/* Game-rules chrome. Widescreen from 768px; phone layout below that. */
@font-face {
  font-family: Cinzel;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/cinzel-700-latin.woff2") format("woff2");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/inter-600-latin.woff2") format("woff2");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/inter-700-latin.woff2") format("woff2");
}

.games-scene,
.rules-wide-header,
.rules-wide-play {
  display: none;
}

@media (min-width: 768px) {
  .rules-phone-banner { display: none !important; }

  .games-scene {
    --scene-fade-start: 52%;
    --scene-fade-end: 82%;
    display: block;
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-color: transparent;
    background-image: url("images/universal-page-background-3840x2160.jpg");
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    -webkit-mask-image: linear-gradient(to bottom, #fff 0%, #fff var(--scene-fade-start), transparent var(--scene-fade-end), transparent 100%);
    mask-image: linear-gradient(to bottom, #fff 0%, #fff var(--scene-fade-start), transparent var(--scene-fade-end), transparent 100%);
  }
  .games-scene::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #0A1630;
    opacity: 0.68;
    pointer-events: none;
  }

  .rules-wide-header,
  .game-rules-page-title,
  .game-rules-content {
    position: relative;
    z-index: 1;
  }

  .rules-wide-header {
    display: grid;
    width: 100%;
    flex-shrink: 0;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 12px;
    margin: 0;
    box-sizing: border-box;
    padding: 16px 0 0 18px;
    background: none;
    border: none;
    box-shadow: none;
    color: #FFFFFF;
  }
  .rules-wide-header .home-brand-slot,
  .rules-wide-header .home-home-slot {
    min-width: 0;
    display: flex;
    align-items: center;
  }
  .rules-wide-header .home-brand-slot { justify-content: flex-start; }
  .rules-wide-header .home-home-slot {
    justify-self: end;
    justify-content: flex-end;
  }
  .rules-wide-header .home-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    min-width: 0;
  }
  .rules-wide-header .home-all-games {
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    color: #1A8CFF;
    text-decoration: none;
  }
  .rules-wide-header .home-all-games:focus-visible {
    outline: 2px solid #1A8CFF;
    outline-offset: 3px;
    border-radius: 4px;
  }
  .rules-wide-header .home-mgfh {
    margin: 0;
    color: #FFFFFF;
    font-family: Montserrat, "Segoe UI", Arial, sans-serif;
    font-weight: 800;
    font-size: round(calc(1.5 * clamp(1.45rem, 3.2vw, 2rem)), 1px);
    line-height: 1;
    letter-spacing: round(-0.06em, 1px);
    white-space: nowrap;
    text-decoration: none;
  }
  .rules-wide-header .mgfh-g {
    display: inline-block;
    width: 0.72em;
    height: 0.72em;
    margin: 0 1px;
    vertical-align: baseline;
  }
  .home-wordmark a.banner-game-id,
  .site-banner a.banner-game-id,
  .rules-wide-header a.banner-game-id,
  .rules-phone-banner a.banner-game-id {
    display: none !important;
  }
  .rules-wide-header .banner-title {
    width: 100%;
    margin: 1px 0 0;
    padding: 0;
    font-family: Montserrat, "Segoe UI", Arial, sans-serif;
    font-weight: 800;
    font-size: round(calc((11 / 32) * clamp(1.45rem, 3.2vw, 2rem)), 1px);
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
    text-align: left;
    color: #FFFFFF;
    text-shadow: none;
  }
  .rules-wide-header a.banner-home-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 10px;
    border-radius: 16px;
    background: #1C9BB8;
    border: none;
    box-shadow:
      0 0 16px 4px rgba(28, 155, 184, 0.7),
      0 0 32px 10px rgba(28, 155, 184, 0.4);
    color: #F4FBFD;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
  }
  .rules-wide-header a.banner-home-btn:hover,
  .rules-wide-header a.banner-home-btn:focus-visible {
    box-shadow:
      0 0 20px 6px rgba(28, 155, 184, 0.85),
      0 0 40px 12px rgba(28, 155, 184, 0.45);
    color: #F4FBFD;
    outline: none;
  }

  .game-rules-page-title {
    --hero-size: clamp(1.15rem, 4.2vw, 2.75rem);
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    margin: clamp(2.75rem, 6.5vh, 4.25rem) auto 0;
    padding: 0 18px;
    box-sizing: border-box;
    font-family: Cinzel, "Times New Roman", serif;
    font-weight: 700;
    font-size: var(--hero-size);
    line-height: 0.95;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-align: center;
    background: none;
    filter: none;
  }
  .game-rules-page-title,
  .game-rules-page-title strong {
    font-weight: 700;
    background: linear-gradient(180deg, #E8F4FF 0%, #8EC8F8 42%, #4FA0E8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: #8EC8F8;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 14px rgba(61, 155, 255, 0.55));
  }
  .game-rules-page-title:has(.home-hero-line) {
    flex-direction: column;
    align-items: center;
    background: none;
    color: #8EC8F8;
    -webkit-text-fill-color: currentcolor;
    filter: none;
  }
  .game-rules-page-title .home-hero-line {
    display: block;
    width: max-content;
    max-width: 100%;
    white-space: nowrap;
    background: linear-gradient(180deg, #E8F4FF 0%, #8EC8F8 42%, #4FA0E8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: #8EC8F8;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 14px rgba(61, 155, 255, 0.55));
  }
  .game-rules-page-title .home-hero-line2 {
    margin-top: 0.12em;
    font-size: calc(1em - 0.5rem);
    letter-spacing: 0.18em;
  }

  .game-rules-content {
    margin-top: 0;
    padding-top: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    color: #F4F7FB;
  }
  .legal-page-main .game-rules-page-title,
  .contact-page-main .game-rules-page-title {
    margin-bottom: clamp(2.75rem, 6.5vh, 4.25rem);
  }
  .legal-page-inner > .rules-note:first-child,
  .contact-page-inner > .contact-body:first-child {
    margin-top: 0;
  }
  .legal-page-inner > .rules-note + p {
    margin-bottom: 0;
  }

  .game-rules-toc {
    margin-top: clamp(2.75rem, 6.5vh, 4.25rem);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(18, 26, 42, 0.28) 22%, rgba(10, 18, 34, 0.42) 100%);
    border: 1px solid rgba(186, 214, 255, 0.34);
    border-radius: 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(18px) saturate(1.35);
    -webkit-backdrop-filter: blur(18px) saturate(1.35);
    color: #F4F7FB;
  }
  .game-rules-content h2,
  .game-rules-content h3,
  .game-rules-toc .toc-title,
  .game-rules-content p,
  .game-rules-content li,
  .game-rules-content .rules-note {
    color: #F4F7FB;
  }
  .game-rules-toc a,
  .game-rules-content a:not(.banner-play-btn),
  .game-rules-bottom-back a,
  .game-rules-bottom-back a strong {
    color: #5B9FFF;
    -webkit-text-fill-color: #5B9FFF;
  }
  .game-rules-toc a:hover,
  .game-rules-toc a:focus-visible,
  .game-rules-content a:not(.banner-play-btn):hover,
  .game-rules-content a:not(.banner-play-btn):focus-visible,
  .game-rules-bottom-back a:hover,
  .game-rules-bottom-back a:focus-visible {
    color: #7CB4FF;
    -webkit-text-fill-color: #7CB4FF;
    text-decoration: underline;
    outline: none;
  }
  .game-rules-bottom-back a:hover strong,
  .game-rules-bottom-back a:focus-visible strong {
    color: #7CB4FF;
    -webkit-text-fill-color: #7CB4FF;
  }
  .game-rules-content a.banner-play-btn,
  .rules-wide-play a.banner-play-btn {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: #FFFFFF;
    background: linear-gradient(180deg, #3D8EF5 0%, #0E6AE8 38%, #0E6AE8 100%);
    border: none;
    border-radius: 15px;
    box-shadow:
      inset 0 0 0 2px rgba(214, 240, 255, 1),
      inset 0 0 14px 3px rgba(190, 230, 255, 1),
      inset 0 1px 0 rgba(255, 255, 255, 0.75),
      0 0 0 1px rgba(110, 200, 255, 0.95),
      0 0 8px 1px rgba(70, 185, 255, 0.95),
      0 0 18px 2px rgba(61, 155, 255, 0.7);
  }
  .game-rules-content a.banner-play-btn:hover,
  .game-rules-content a.banner-play-btn:focus-visible,
  .rules-wide-play a.banner-play-btn:hover,
  .rules-wide-play a.banner-play-btn:focus-visible {
    filter: brightness(1.08);
    color: #FFFFFF;
    background: linear-gradient(180deg, #3D8EF5 0%, #0E6AE8 38%, #0E6AE8 100%);
    text-decoration: none;
    outline: none;
  }
  .rules-wide-play {
    display: block;
    position: relative;
    z-index: 1;
    width: min(640px, 100%);
    max-width: 640px;
    margin: clamp(2.75rem, 6.5vh, 4.25rem) auto;
    padding: 0 16px;
    box-sizing: border-box;
    text-align: center;
  }
  .rules-wide-play + .game-rules-content {
    margin-top: 0;
    padding-top: 0;
  }
  .rules-wide-play + .game-rules-content > .game-rules-toc:first-child {
    margin-top: 0;
  }
  .rules-wide-play a.banner-play-btn {
    width: 25%;
    padding: 12px 16px;
    text-align: center;
    box-sizing: border-box;
  }
  .rules-wide-play-pair {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
  }
  .rules-wide-play-pair a.banner-play-btn {
    width: auto;
    padding: 12px 16px;
  }
}

@media (max-width: 767px) {
  .rules-phone-banner { display: none !important; }

  .games-scene {
    --scene-fade-start: 52%;
    --scene-fade-end: 82%;
    display: block;
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-color: transparent;
    background-image: url("images/universal-page-background-3840x2160.jpg");
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    -webkit-mask-image: linear-gradient(to bottom, #fff 0%, #fff var(--scene-fade-start), transparent var(--scene-fade-end), transparent 100%);
    mask-image: linear-gradient(to bottom, #fff 0%, #fff var(--scene-fade-start), transparent var(--scene-fade-end), transparent 100%);
  }
  .games-scene::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #0A1630;
    opacity: 0.68;
    pointer-events: none;
  }
  .rules-wide-header,
  .game-rules-page-title,
  .game-rules-content,
  .rules-wide-play {
    position: relative;
    z-index: 1;
  }

  html, body {
    overflow-x: hidden;
    max-width: 100%;
    scrollbar-width: none;
  }
  html::-webkit-scrollbar,
  body::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }

  .rules-wide-header {
    display: grid;
    width: 100%;
    box-sizing: border-box;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
    margin: 0;
    padding: max(8px, env(safe-area-inset-top, 0px)) 12px 0;
    background: none;
    border: none;
    box-shadow: none;
    color: #FFFFFF;
    position: relative;
    z-index: 1;
  }
  .rules-wide-header .home-brand-slot,
  .rules-wide-header .home-home-slot {
    min-width: 0;
    display: flex;
    align-items: center;
  }
  .rules-wide-header .home-brand-slot { justify-content: flex-start; }
  .rules-wide-header .home-home-slot {
    justify-self: end;
    justify-content: flex-end;
  }
  .rules-wide-header .home-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
  }
  .rules-wide-header .banner-title { display: none !important; }
  .rules-wide-header .home-mgfh {
    margin: 0;
    color: #FFFFFF;
    font-family: Montserrat, "Segoe UI", Arial, sans-serif;
    font-weight: 800;
    font-size: 1.35rem;
    line-height: 1;
    letter-spacing: -0.06em;
    white-space: nowrap;
    text-decoration: none;
  }
  .rules-wide-header .mgfh-g {
    display: inline-block;
    width: 0.72em;
    height: 0.72em;
    margin: 0 1px;
    vertical-align: baseline;
  }
  .rules-wide-header .home-all-games {
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    align-self: center;
    margin: 0;
    color: #1A8CFF;
    text-decoration: none;
  }
  .rules-wide-header a.banner-home-btn {
    gap: 0;
    padding: 6px;
  }
  .rules-wide-header a.banner-home-btn .banner-home-label { display: none; }

  .game-rules-page-title {
    width: 100%;
    max-width: 100%;
    margin-top: 0.85rem;
    padding: 0 12px;
    box-sizing: border-box;
    font-size: clamp(0.92rem, 4.2vw, 1.05rem);
    line-height: 1.25;
  }
  .game-rules-page-title .home-hero-line {
    display: block;
    white-space: normal;
  }
  .game-rules-content {
    width: calc(100% - 24px);
    max-width: calc(100% - 24px);
    margin: 0.75rem 12px 0;
    padding: 14px 12px 24px;
    box-sizing: border-box;
    overflow-wrap: break-word;
    background: #121A2A;
    border: 1px solid #1E3A5F;
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
  .game-rules-toc {
    margin: 0 0 1rem;
    padding: 0.7rem 0.8rem;
    box-sizing: border-box;
    background: #121A2A;
    border: 1px solid #1E3A5F;
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
  .game-rules-toc .toc-title { font-size: 0.95rem; }
  .game-rules-toc li,
  .game-rules-toc a { font-size: 0.88rem; }
  .game-rules-content h2 { font-size: 1.02rem; }
  .game-rules-content h3 { font-size: 0.95rem; }
  .game-rules-content p,
  .game-rules-content li,
  .game-rules-content .rules-note { font-size: 0.9rem; }
  .game-rules-content table.rules-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    font-size: 0.78rem;
  }
  .game-rules-content table.rules-table th,
  .game-rules-content table.rules-table td {
    padding: 6px;
    overflow-wrap: anywhere;
  }
  .hand-example-cards {
    flex-wrap: wrap;
    max-width: 100%;
  }
  .rules-wide-play {
    display: block;
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100%;
    margin: 0.85rem auto;
    padding: 0 12px;
    box-sizing: border-box;
    text-align: center;
  }
  .rules-wide-play + .game-rules-content {
    margin-top: 0;
    padding-top: 0;
  }
  .rules-wide-play + .game-rules-content > .game-rules-toc:first-child {
    margin-top: 0;
  }
  .rules-wide-play a.banner-play-btn {
    width: 25%;
    padding: 12px 16px;
    text-align: center;
    box-sizing: border-box;
  }
  .rules-wide-play-pair {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
  }
  .rules-wide-play-pair a.banner-play-btn {
    width: auto;
    padding: 12px 12px;
  }

  .legal-page-main .game-rules-page-title,
  .contact-page-main .game-rules-page-title {
    margin-bottom: 0;
  }
  .legal-page-inner.game-rules-content,
  .contact-page-inner.game-rules-content {
    margin-top: 1rem;
    padding-top: 0;
  }
  .legal-page-inner > .rules-note:first-child,
  .contact-page-inner > .contact-body:first-child {
    margin-top: 0;
  }
  .legal-page-inner > .rules-note + p {
    margin-bottom: 0;
  }
  .legal-page-inner > .game-rules-toc {
    margin-top: calc(1rem + 1px);
  }
}

/* Phone landscape rules, legal, and contact pages: the page still scrolls, with no scrollbar. Portrait is unchanged. */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1000px),
       (orientation: landscape) and (min-width: 1001px) and (max-width: 1279px) and (max-height: 699px),
       (orientation: landscape) and (min-width: 1280px) and (max-width: 1919px) and (max-height: 500px) {
  html:has(body.game-rules-page),
  body.game-rules-page,
  html:has(body.legal-page),
  body.legal-page,
  html:has(body.contact-page),
  body.contact-page {
    height: auto;
    min-height: 100dvh;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
  }
  html:has(body.game-rules-page)::-webkit-scrollbar,
  body.game-rules-page::-webkit-scrollbar,
  html:has(body.legal-page)::-webkit-scrollbar,
  body.legal-page::-webkit-scrollbar,
  html:has(body.contact-page)::-webkit-scrollbar,
  body.contact-page::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
  body.game-rules-page .themed-scroll,
  body.legal-page .themed-scroll,
  body.contact-page .themed-scroll {
    display: none !important;
  }
  body.contact-page .contact-page-main {
    flex: none;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }
}

/* 6.1–6.7" phone landscape. Pull the Home button in from the screen edge. */
@media (orientation: landscape) and (min-width: 800px) and (max-width: 1020px) and (min-height: 380px) and (max-height: 480px) {
  body.legal-page .rules-wide-header,
  body.contact-page .rules-wide-header,
  body.game-rules-page .rules-wide-header {
    padding-right: 16px;
  }
}

/* Phone under 6.1" landscape. Word mark only, Home is the icon, and the Home inset stays 16px. */
@media (orientation: landscape) and (max-height: 379px) and (max-width: 1000px),
       (orientation: landscape) and (max-height: 379px) and (min-width: 1001px) and (max-width: 1919px) {
  body.legal-page .rules-wide-header,
  body.contact-page .rules-wide-header,
  body.game-rules-page .rules-wide-header {
    padding-right: 16px;
  }
  .rules-wide-header .banner-title,
  .rules-phone-banner .banner-title {
    display: none !important;
  }
  .rules-wide-header a.banner-home-btn .banner-home-label,
  .rules-phone-banner a.banner-home-btn .banner-home-label {
    display: none !important;
  }
  .rules-wide-header a.banner-home-btn,
  .rules-phone-banner a.banner-home-btn {
    gap: 0;
    padding: 6px;
  }
}

/* iPad portrait. Same rules, legal, and contact pages as 6.7" phone portrait, sized to the iPad. The site name stays under MGFH, and Home keeps its words. No scrollbar. */
@media (orientation: portrait) and (min-width: 744px) and (max-width: 1100px),
       (orientation: portrait) and (min-width: 1101px) and (max-width: 1919px) {
  html, body { scrollbar-width: none; }
  html::-webkit-scrollbar,
  body::-webkit-scrollbar { width: 0; height: 0; display: none; }
  .themed-scroll,
  #themed-scroll { display: none !important; }
  .rules-phone-banner { display: none !important; }
  .rules-wide-header .home-brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .rules-wide-header .home-mgfh { font-size: clamp(1.85rem, 3.2vw, 2.5rem); }
  .rules-wide-header .banner-title { display: block !important; }
  .rules-wide-header .home-dock-grid { width: 42px; height: 42px; }
  .rules-wide-header a.banner-home-btn .banner-home-label { display: inline !important; }
  .rules-wide-header a.banner-home-btn {
    gap: 10px;
    padding: 8px 16px 8px 12px;
    font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  }
  .rules-wide-header .banner-home-icon { width: 42px !important; height: 42px !important; }
  .game-rules-page-title {
    margin-top: 1.25rem;
    padding: 0 28px;
    font-size: clamp(1.2rem, 2.6vw, 1.75rem);
  }
  .game-rules-content {
    width: min(52rem, calc(100% - 56px));
    max-width: min(52rem, calc(100% - 56px));
    margin: 1rem auto 0;
    padding: 22px 24px 32px;
    background: #121A2A;
    border: 1px solid #1E3A5F;
    border-radius: 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
  .game-rules-toc { margin: 0 0 1.15rem; padding: 0.9rem 1rem; }
  .game-rules-toc .toc-title { font-size: 1.15rem; }
  .game-rules-toc li,
  .game-rules-toc a { font-size: 1.05rem; }
  .game-rules-content h2 { font-size: 1.3rem; }
  .game-rules-content h3 { font-size: 1.15rem; }
  .game-rules-content p,
  .game-rules-content li,
  .game-rules-content .rules-note { font-size: 1.05rem; }
  .rules-wide-play { margin: 1.1rem auto; padding: 0 28px; }
  .rules-wide-play a.banner-play-btn { width: min(16rem, 40%); padding: 14px 18px; }
}

/* iPad landscape. Rules, legal, and contact pages scroll with no scrollbar. */
@media (orientation: landscape) and (min-width: 1000px) and (max-width: 1260px) and (min-height: 700px) and (max-height: 900px),
       (orientation: landscape) and (min-width: 1300px) and (max-width: 1400px) and (min-height: 960px) and (max-height: 1100px),
       (orientation: landscape) and (min-width: 1000px) and (max-width: 1279px) and (min-height: 901px),
       (orientation: landscape) and (min-width: 1261px) and (max-width: 1279px) and (min-height: 700px) {
  html:has(body.game-rules-page),
  body.game-rules-page,
  html:has(body.legal-page),
  body.legal-page,
  html:has(body.contact-page),
  body.contact-page {
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
  }
  html:has(body.game-rules-page)::-webkit-scrollbar,
  body.game-rules-page::-webkit-scrollbar,
  html:has(body.legal-page)::-webkit-scrollbar,
  body.legal-page::-webkit-scrollbar,
  html:has(body.contact-page)::-webkit-scrollbar,
  body.contact-page::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
  body.game-rules-page .themed-scroll,
  body.legal-page .themed-scroll,
  body.contact-page .themed-scroll,
  #themed-scroll { display: none !important; }
}
