/* Nocturia — kompletní responzivita V18 */

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

main, section, .container,
.navbar-inner, .footer-grid,
.content-layout, .content-stack,
.mode-grid, .team-grid, .rules-grid,
.punishment-grid, .vote-sites-grid,
.reward-podium, .latest-votes-list,
.voting-shell, .team-groups, .team-group {
  min-width: 0;
}

img, video, iframe, svg {
  max-width: 100%;
}

/* Tablet */
@media (max-width: 1000px) {
  .container {
    width: min(100% - 34px, 1180px);
  }

  .section {
    padding: 74px 0;
  }

  .page-hero {
    padding: 128px 0 48px;
  }

  .page-title {
    max-width: 760px;
  }

  .content-layout {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 20px;
    padding: 16px 0 76px;
  }

  .content-layout > *,
  .content-stack,
  .content-card {
    min-width: 0;
    max-width: 100%;
  }

  /* Oznámení: poslední čtyři jako vodorovně posuvné karty. */
  .announcements-page .latest-news-sidebar {
    position: static;
    width: 100%;
    max-width: 100%;
    display: block !important;
    overflow: hidden !important;
    padding: 16px;
  }

  .announcements-page .latest-news-list {
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: none !important;
    grid-auto-flow: column;
    grid-auto-columns: minmax(205px, 36vw);
    gap: 8px;
    overflow-x: auto !important;
    overflow-y: hidden;
    padding: 2px 2px 8px;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .announcements-page .latest-news-link {
    width: auto;
    min-width: 0 !important;
    scroll-snap-align: start;
  }

  .footer-grid {
    grid-template-columns: 1.15fr .85fr .85fr;
    gap: 32px 24px;
  }

  .footer-brand {
    grid-column: 1 / -1;
    max-width: 680px;
  }
}

/* Mobil a menší tablety */
@media (max-width: 850px) {
  :root {
    --mobile-page-gap: 14px;
  }

  body {
    line-height: 1.55;
  }

  .container {
    width: calc(100% - 28px);
  }

  /* Navigace */
  .navbar,
  .navbar.scrolled {
    top: 10px;
    width: calc(100% - 20px);
    border: 1px solid rgba(40,117,228,.14);
    border-radius: 16px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 10px 32px rgba(31,70,117,.13);
    backdrop-filter: blur(18px);
  }

  .navbar-inner,
  .navbar.scrolled .navbar-inner {
    min-height: 62px;
    padding: 0 9px 0 11px;
    border-bottom: 0;
  }

  .brand {
    min-width: 0;
    gap: 8px;
  }

  .brand img {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }

  .brand strong {
    max-width: 122px;
    overflow: hidden;
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-actions {
    gap: 7px;
  }

  .nav-login,
  .nav-login.is-player-logged {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0 7px;
    border-radius: 11px;
  }

  .nav-login .nav-login-label,
  .nav-login.is-player-logged .nav-login-label,
  .nav-login .nav-account-chevron {
    display: none !important;
  }

  .nav-login .nav-player-head {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    border-radius: 7px;
  }

  .menu-button {
    width: 42px;
    height: 42px;
    display: block;
    flex: 0 0 42px;
  }

  .nav-links,
  .navbar.scrolled .nav-links {
    position: fixed;
    top: 82px;
    right: 10px;
    left: 10px;
    z-index: 1002;
    max-height: calc(100dvh - 94px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid rgba(40,117,228,.15);
    border-radius: 16px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 18px 55px rgba(20,54,95,.2);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px) scale(.985);
    transform-origin: top;
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
  }

  .nav-links.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }

  .nav-links a {
    min-height: 46px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 11px;
    font-size: 13px;
  }

  .nav-links a.active {
    color: var(--blue-dark);
    background: var(--soft);
  }

  .profile-dropdown {
    position: fixed;
    top: 82px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: calc(100dvh - 94px);
    overflow-y: auto;
    border-radius: 16px;
  }

  /* Hlavičky stránek */
  .page-hero {
    padding: 112px 0 42px;
  }

  .breadcrumb {
    flex-wrap: wrap;
    margin-bottom: 14px;
  }

  .page-title h1 {
    max-width: 100%;
    font-size: clamp(38px, 11vw, 50px);
    line-height: .98;
    letter-spacing: -.055em;
    overflow-wrap: anywhere;
  }

  .page-title p {
    margin-top: 16px;
    font-size: 14px;
    line-height: 1.65;
  }

  .page-title > .eyebrow {
    font-size: 13px;
  }

  .section {
    padding: 58px 0;
  }

  .section-title h2 {
    font-size: clamp(31px, 9vw, 42px);
  }

  .section-title p {
    margin-top: 12px;
    font-size: 14px;
  }

  /* Karty a společné gridy */
  .mode-grid,
  .team-grid,
  .rules-grid,
  .punishment-grid,
  .vote-grid,
  .vote-sites-grid,
  .reward-podium,
  .latest-votes-list {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .content-card,
  .rule-card,
  .punishment-card,
  .team-card,
  .mode-card,
  .vote-site-card,
  .latest-votes-panel {
    width: 100%;
    max-width: 100%;
  }

  .content-card {
    padding: 21px 19px;
    border-radius: 17px;
  }

  .content-card h2 {
    font-size: 23px;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .news-meta {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  /* Oznámení */
  .announcements-page .latest-news-sidebar {
    padding: 14px;
  }

  .announcements-page .latest-news-list {
    grid-auto-columns: minmax(210px, 82vw);
  }

  .announcements-page .latest-news-label {
    width: auto;
    margin-bottom: 9px;
  }

  .news-detail-modal {
    padding: 10px;
  }

  .news-detail-dialog {
    width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 23px 18px;
    border-radius: 18px;
  }

  .news-detail-head {
    padding-right: 44px;
  }

  .news-detail-head h2 {
    font-size: 27px;
  }

  /* Tým */
  .team-groups {
    gap: 36px;
  }

  .team-group-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 14px;
  }

  .team-group-head p {
    max-width: none;
    text-align: left;
  }

  .team-group .team-grid {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .team-card {
    min-height: 0;
    padding: 22px 18px;
  }

  .team-card p {
    min-height: 0;
  }

  /* Pravidla a tresty */
  .rule-card {
    gap: 13px;
    padding: 18px;
  }

  .rule-number {
    flex-basis: 35px;
    width: 35px;
    height: 35px;
  }

  .punishment-card {
    padding: 20px;
  }

  /* Hlasování */
  .voting-hero {
    min-height: 0 !important;
    padding: 112px 0 52px !important;
  }

  .voting-hero .page-title {
    max-width: 100%;
  }

  .voting-hero .page-title h1 {
    margin-top: 14px;
    font-size: clamp(37px, 10.7vw, 47px) !important;
    line-height: .98;
  }

  .voting-hero-stats {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-top: 24px;
  }

  .voting-hero-stats > div {
    min-width: 0 !important;
    padding: 11px 5px;
    border-radius: 12px;
  }

  .voting-hero-stats strong {
    font-size: 15px;
  }

  .voting-hero-stats span {
    font-size: 8px;
    line-height: 1.2;
  }

  .vote-rain {
    display: none;
  }

  .voting-section {
    padding: 50px 0 62px !important;
  }

  .voting-shell {
    gap: 54px !important;
  }

  .voting-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
  }

  .voting-heading h2 {
    font-size: clamp(27px, 8vw, 35px);
  }

  .voting-heading > p {
    max-width: none;
    text-align: left;
  }

  .vote-lock-state {
    align-self: flex-start;
    max-width: 100%;
  }

  .vote-site-card {
    min-height: 0;
    padding: 21px 18px 18px;
    border-radius: 18px;
  }

  .vote-site-card:hover {
    transform: none;
  }

  .vote-site-top {
    width: 100%;
  }

  .vote-site-logo,
  .minecraftservery .vote-site-logo {
    width: fit-content;
    min-width: 0 !important;
    max-width: 100%;
    height: 54px;
    padding: 7px 11px 7px 8px;
  }

  .vote-site-logo img {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .vote-site-logo span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .vote-site-name {
    margin-top: 18px;
  }

  .vote-site-name span {
    font-size: 20px;
    overflow-wrap: anywhere;
  }

  .vote-site-card > p {
    margin-top: 12px;
    font-size: 12px;
  }

  .vote-site-reward {
    margin-top: 18px;
  }

  .vote-site-button {
    width: 100%;
    min-height: 48px;
  }

  /* TOP 3 jako kompaktní mobilní karty. */
  .reward-podium {
    align-items: stretch;
    gap: 12px;
    padding-top: 0;
  }

  .podium-card,
  .podium-first,
  .podium-second,
  .podium-third {
    min-height: 0 !important;
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) 44px;
    grid-template-rows: auto auto auto auto;
    column-gap: 12px;
    align-items: center;
    padding: 18px 0 18px 15px;
    border-radius: 17px;
    text-align: left;
  }

  .podium-first { order: -1; }
  .podium-second { order: 0; }
  .podium-third { order: 1; }

  .podium-crown {
    top: 0;
    left: 14px;
    padding: 4px 9px;
    border-radius: 0 0 8px 8px;
    font-size: 7px;
  }

  .trophy {
    grid-column: 1;
    grid-row: 1 / 5;
    width: 70px;
    height: 70px;
    margin: 0;
  }

  .trophy img {
    width: 68px;
    height: 68px;
    filter: drop-shadow(3px 4px 0 rgba(28,38,51,.2));
  }

  .podium-place {
    grid-column: 2;
    grid-row: 1;
  }

  .podium-card h3 {
    grid-column: 2;
    grid-row: 2;
    margin-top: 2px;
    font-size: 18px;
  }

  .podium-card > strong {
    grid-column: 2;
    grid-row: 3;
    margin-top: 6px;
    line-height: 1.35;
  }

  .podium-card > p {
    grid-column: 2;
    grid-row: 4;
    margin-top: 2px;
    line-height: 1.4;
  }

  .podium-step,
  .podium-first .podium-step,
  .podium-second .podium-step,
  .podium-third .podium-step {
    grid-column: 3;
    grid-row: 1 / 5;
    align-self: stretch;
    width: 44px;
    min-height: 100% !important;
    margin: -18px 0 -18px auto;
    border-radius: 0 16px 16px 0;
    font-size: 25px;
  }

  .latest-votes-panel {
    padding: 20px 15px;
    border-radius: 18px;
  }

  .latest-votes-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 15px;
  }

  .latest-votes-head h2 {
    font-size: 27px;
  }

  .latest-votes-list {
    gap: 8px;
    margin-top: 14px;
  }

  .latest-vote {
    min-width: 0;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    padding: 11px;
  }

  .latest-vote img {
    width: 40px;
    height: 40px;
  }

  .latest-vote > div {
    min-width: 0;
  }

  .latest-vote strong {
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .latest-vote strong .vote-month-count {
    display: inline;
    margin-left: 2px;
    white-space: normal;
  }

  .latest-vote time {
    grid-column: 2;
    white-space: normal;
  }

  /* Modály */
  .modal {
    align-items: center;
    padding: 10px;
  }

  .modal-box,
  .vote-login-modal .modal-box {
    width: 100%;
    max-width: 460px;
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    padding: 25px 19px 21px;
    border-radius: 18px;
  }

  .modal-box h2 {
    padding-right: 42px;
    font-size: 27px;
    line-height: 1.1;
  }

  .modal-close {
    top: 12px;
    right: 12px;
  }

  .login-form {
    gap: 12px;
    margin-top: 19px;
  }

  .login-form input {
    width: 100%;
    height: 48px;
  }

  .vote-modal-session {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 11px;
  }

  .vote-modal-session img {
    width: 52px;
    height: 52px;
  }

  .vote-modal-session button {
    grid-column: 1 / -1;
    width: 100%;
  }

  /* Vstupní brána */
  .site-access-gate {
    padding: 10px;
  }

  .site-access-card {
    width: 100%;
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    padding: 27px 20px;
    border-radius: 19px;
  }

  /* Footer — kratší a přehlednější na mobilu. */
  .footer {
    padding: 48px 0 22px;
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 28px 18px;
  }

  .footer-brand,
  .footer-server {
    grid-column: 1 / -1;
  }

  .footer-brand {
    max-width: none;
  }

  .footer-brand p {
    max-width: 520px;
  }

  .footer-links {
    gap: 8px;
    margin-top: 12px;
  }

  .footer-server {
    padding: 15px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    margin-top: 32px;
    padding-top: 18px;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    text-align: center;
  }
}

/* Malé telefony */
@media (max-width: 430px) {
  .container {
    width: calc(100% - 22px);
  }

  .brand strong {
    display: none;
  }

  .page-title h1 {
    font-size: clamp(35px, 11.5vw, 44px);
  }

  .home-hero-centered {
    min-height: 690px;
    padding: 108px 0 54px;
  }

  .hero-center {
    padding-inline: 4px;
  }

  .hero-server-name {
    font-size: clamp(42px, 13vw, 54px);
  }

  .hero-ip {
    width: 100%;
    padding: 15px 14px;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-actions .btn-primary,
  .hero-actions .btn-secondary {
    width: 100%;
  }

  .mode-card {
    border-radius: 17px;
  }

  .mode-image {
    height: 178px;
  }

  .voting-hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .podium-card,
  .podium-first,
  .podium-second,
  .podium-third {
    grid-template-columns: 62px minmax(0, 1fr) 38px;
    column-gap: 9px;
    padding-left: 11px;
  }

  .trophy {
    width: 58px;
    height: 58px;
  }

  .trophy img {
    width: 56px;
    height: 56px;
  }

  .podium-card h3 {
    font-size: 16px;
  }

  .podium-card > strong {
    font-size: 10px;
  }

  .podium-card > p {
    font-size: 9px;
  }

  .podium-step,
  .podium-first .podium-step,
  .podium-second .podium-step,
  .podium-third .podium-step {
    width: 38px;
  }
}

@media (max-width: 360px) {
  .navbar,
  .navbar.scrolled {
    width: calc(100% - 12px);
  }

  .nav-links,
  .navbar.scrolled .nav-links,
  .profile-dropdown {
    right: 6px;
    left: 6px;
  }

  .voting-hero-stats {
    grid-template-columns: 1fr 1fr;
  }

  .voting-hero-stats > div:last-child {
    grid-column: 1 / -1;
  }

  .footer-grid {
    grid-template-columns: 1fr !important;
  }

  .footer-brand,
  .footer-server {
    grid-column: 1;
  }
}
