/* ==========================================================================
   Shanghai Rummy — shanghairummy.io
   1. Tokens          5. Game board      9. Guides
   2. Base            6. Cards          10. CTA / Footer
   3. Header / drawer 7. Trust          11. Modals
   4. Hero            8. How / Rules    12. Responsive
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --navy:        #16233c;
  --navy-soft:   #1f3050;
  --navy-line:   #2c3f61;
  --cream:       #f2efe8;
  --cream-2:     #e9e5db;
  --paper:       #faf8f3;
  --felt:        #21634a;
  --felt-mid:    #1b5540;
  --felt-dark:   #123a2b;
  --wood:        #7a4f2c;
  --wood-dark:   #4f3018;
  --wood-light:  #9c6a3f;
  --red:         #a11f2e;
  --red-dark:    #7d1723;
  --green:       #1d5334;
  --green-light: #2a7047;
  --gold:        #c9a961;
  --ink:         #16233c;
  --muted:       #6b7280;
  --muted-light: #9aa3b0;

  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;

  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 24px; --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(22,35,60,.08), 0 1px 3px rgba(22,35,60,.06);
  --shadow-md: 0 4px 12px rgba(22,35,60,.10), 0 2px 4px rgba(22,35,60,.06);
  --shadow-lg: 0 18px 40px rgba(22,35,60,.16);
  --ring: 0 0 0 3px rgba(201,169,97,.55);
  --t: 200ms cubic-bezier(.4,0,.2,1);
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
/* An author `display` beats the UA's [hidden] rule, so any component that sets
   display (.modal, .btn) would stay visible while hidden. Enforce it globally. */
[hidden] { display: none !important; }
/* Scroll lock for the drawer and full-screen board — set by JS as a class so no
   styling is ever written inline. */
.no-scroll { overflow: hidden; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.sprite { display: none; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--space-5); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
.skip-link {
  position: absolute; left: var(--space-4); top: -60px; z-index: 200;
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: var(--r-sm);
  transition: top var(--t);
}
.skip-link:focus { top: var(--space-4); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-5);
  border-radius: var(--r-md); font-weight: 600; font-size: 15px;
  cursor: pointer; transition: background-color var(--t), border-color var(--t), transform var(--t), box-shadow var(--t);
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:not(:disabled):active { transform: translateY(1px); }
.btn-primary { background: var(--red); color: #fff; box-shadow: var(--shadow-md); }
.btn-primary:not(:disabled):hover { background: var(--red-dark); }
.btn-outline { border: 1px solid var(--navy-line); color: inherit; background: transparent; }
.btn-outline:not(:disabled):hover { background: rgba(22,35,60,.06); }
.btn-lg { min-height: 52px; padding: 0 var(--space-6); font-size: 16px; }
.btn-block { width: 100%; }

/* 3. Header / drawer ------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--navy); color: #fff; }
.header-inner { display: flex; align-items: center; gap: var(--space-5); height: 68px; }

.logo { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.logo-mark { width: 34px; height: 34px; }
.logo-text {
  display: flex; flex-direction: column; font-family: var(--font-display);
  font-weight: 700; font-size: 17px; line-height: 1.02; letter-spacing: .01em;
}
.logo-text span:first-child { color: var(--gold); }
.site-header .logo-text span:last-child,
.site-footer .logo-text span:last-child { color: #fff; }

.main-nav { margin-left: auto; }
.main-nav ul { display: flex; gap: var(--space-5); }
.main-nav a {
  display: block; padding: 8px 2px; font-size: 15px; font-weight: 500;
  color: rgba(255,255,255,.86); border-bottom: 2px solid transparent; transition: color var(--t), border-color var(--t);
}
.main-nav a:hover { color: #fff; border-bottom-color: var(--gold); }

.header-actions { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.main-nav + .header-actions { margin-left: 0; }
.btn-challenge { color: #fff; border-color: rgba(255,255,255,.28); height: 42px; min-height: 42px; font-size: 14px; }
.btn-challenge:hover { background: rgba(255,255,255,.1); }
.nav-toggle { display: none; width: 44px; height: 44px; place-items: center; border-radius: var(--r-sm); color: #fff; }
.nav-toggle:hover { background: rgba(255,255,255,.1); }

.drawer-backdrop { position: fixed; inset: 0; z-index: 110; background: rgba(11,18,32,.55); }
.drawer {
  position: fixed; z-index: 120; top: var(--space-3); left: var(--space-3); right: var(--space-3);
  background: var(--paper); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-lg);
  animation: drawerIn 220ms cubic-bezier(.4,0,.2,1);
}
@keyframes drawerIn { from { opacity: 0; transform: translateY(-10px); } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-4) var(--space-5); background: var(--navy); color: #fff;
}
.drawer-close { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-sm); color: #fff; }
.drawer-close:hover { background: rgba(255,255,255,.12); }
.drawer-nav { padding: var(--space-2) 0 var(--space-4); }
.drawer-nav > ul > li + li { border-top: 1px solid var(--cream-2); }
.drawer-nav a {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-4) var(--space-5); font-weight: 600; font-size: 17px; min-height: 56px;
}
.drawer-nav a:hover { background: var(--cream); }
.drawer-nav a > svg:first-child { color: var(--navy); }
.drawer-nav .chev { margin-left: auto; color: var(--muted-light); width: 18px; height: 18px; }
.drawer-nav .btn { margin: var(--space-4) var(--space-5) 0; width: calc(100% - var(--space-5) * 2); }

/* 4. Hero ------------------------------------------------------------------ */
.hero {
  position: relative; padding: var(--space-7) 0 var(--space-6);
  background:
    radial-gradient(120% 70% at 50% 0%, #fbf9f4 0%, var(--cream) 58%, var(--cream-2) 100%);
  overflow: hidden;
}
.hero::before, .hero::after {
  content: ""; position: absolute; top: 0; width: 190px; height: 240px; opacity: .5; pointer-events: none;
}
.hero::before { left: 0; background: radial-gradient(70% 60% at 10% 20%, rgba(45,90,60,.28), transparent 70%); }
.hero::after  { right: 0; background: radial-gradient(70% 60% at 90% 20%, rgba(122,79,44,.26), transparent 70%); }
.hero .container { position: relative; z-index: 1; }

.eyebrow {
  display: flex; align-items: center; justify-content: center; gap: var(--space-4);
  margin-bottom: var(--space-3);
  font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
}
.eyebrow::before, .eyebrow::after { content: ""; width: 46px; height: 1px; background: currentColor; opacity: .45; }
.hero h1 { text-align: center; font-size: clamp(30px, 5.4vw, 52px); font-weight: 800; color: var(--navy); }
.lede { text-align: center; margin-top: var(--space-3); font-size: clamp(15px, 2vw, 19px); color: #46536b; }

/* 5. Game board ------------------------------------------------------------ */
.board-frame {
  position: relative; margin-top: var(--space-6); padding: 14px;
  border-radius: var(--r-xl);
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.05) 0 2px, transparent 2px 7px),
    linear-gradient(150deg, var(--wood-light) 0%, var(--wood) 42%, var(--wood-dark) 100%);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.22), inset 0 -2px 6px rgba(0,0,0,.35);
}
.board-felt {
  position: relative; padding: var(--space-5) var(--space-4) var(--space-5);
  border-radius: 14px;
  background: radial-gradient(120% 90% at 50% 30%, var(--felt) 0%, var(--felt-mid) 55%, var(--felt-dark) 100%);
  box-shadow: inset 0 0 60px rgba(0,0,0,.45), inset 0 2px 3px rgba(0,0,0,.4);
  color: #fff;
}
/* Full screen — native API, plus a pinned fallback for iOS Safari, which has
   no element fullscreen. Both share the same inner layout. */
.board-frame:fullscreen,
.board-frame:-webkit-full-screen,
body.is-immersive .board-frame {
  display: flex;
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 0;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
           max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}
body.is-immersive { overflow: hidden; }
body.is-immersive .board-frame { position: fixed; inset: 0; z-index: 300; }

.board-frame:fullscreen .board-felt,
.board-frame:-webkit-full-screen .board-felt,
body.is-immersive .board-felt {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-2);
}
/* Give the table more room once the page chrome is gone */
body.is-fullscreen .opponents { margin: var(--space-3) 0; }
body.is-fullscreen .melds { margin: var(--space-3) 0; }

.board-topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 34px; padding: 0 var(--space-4);
  border: 1px solid rgba(255,255,255,.22); border-radius: var(--r-pill);
  background: rgba(10,26,20,.5); color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  white-space: nowrap;
}
.pill-btn { min-height: 36px; cursor: pointer; transition: background-color var(--t); }
.pill-btn:hover { background: rgba(10,26,20,.8); }
.pill-btn svg { width: 15px; height: 15px; }

.opponents { display: flex; justify-content: space-around; gap: var(--space-3); margin: var(--space-5) 0 var(--space-4); }
.opponent { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.opponent.is-turn .avatar { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,169,97,.3); }
.avatar {
  display: grid; place-items: center; width: 42px; height: 42px; flex: none;
  border: 1.5px solid rgba(255,255,255,.4); border-radius: 50%;
  background: rgba(255,255,255,.08);
  font-family: var(--font-display); font-size: 17px; font-weight: 700;
  transition: box-shadow var(--t), border-color var(--t);
}
.opp-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.opp-meta strong { font-size: 14px; font-weight: 600; }
.opp-meta span { font-size: 13px; color: rgba(255,255,255,.82); }
.opp-down { font-size: 11px; color: var(--gold); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

.piles { display: flex; justify-content: center; gap: var(--space-6); margin: var(--space-4) 0; }
.pile { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.pile-label { font-size: 13px; color: rgba(255,255,255,.75); }

.melds { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--space-5); min-height: 8px; margin: var(--space-4) 0; }
.melds:empty { margin: 0; min-height: 0; }
.meld { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.meld-cards { display: flex; gap: 3px; }
.meld-label { font-size: 12px; color: rgba(255,255,255,.82); letter-spacing: .05em; }
.meld.is-target .meld-cards { outline: 2px dashed var(--gold); outline-offset: 4px; border-radius: var(--r-sm); }
.meld-owner { font-size: 11px; color: var(--gold); text-transform: uppercase; letter-spacing: .06em; }

.you-row { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-5); }
.avatar-you { border-color: var(--gold); }
.you-meta { display: flex; flex-direction: column; line-height: 1.25; }
.you-meta strong { font-size: 14px; }
.you-meta span { font-size: 13px; color: rgba(255,255,255,.82); }

.hand { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px; margin-top: var(--space-3); min-height: 84px; }

.board-status {
  margin-top: var(--space-4); text-align: center; font-size: 14px; min-height: 22px;
  color: rgba(255,255,255,.9);
}
.board-status.is-warn { color: #ffc9a0; }

.board-actions { display: flex; justify-content: center; gap: var(--space-3); margin-top: var(--space-4); }
.board-actions .btn { min-width: 168px; border: 1px solid rgba(255,255,255,.16); }
.btn-draw { background: linear-gradient(180deg, var(--green-light), var(--green)); color: #fff; }
.btn-draw:not(:disabled):hover { background: linear-gradient(180deg, #318052, #205c3a); }
.btn-discard { background: linear-gradient(180deg, #b5293a, var(--red-dark)); color: #fff; }
.btn-discard:not(:disabled):hover { background: linear-gradient(180deg, #c22e40, #8d1b28); }
.btn-meld { background: linear-gradient(180deg, #d0ad63, #a8853f); color: #241a06; }
.btn-meld:not(:disabled):hover { background: linear-gradient(180deg, #dcbb72, #b8944a); }

.board-utils { display: flex; justify-content: center; gap: var(--space-3); margin-top: var(--space-3); flex-wrap: wrap; }
.util {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 40px; padding: 0 var(--space-4);
  border: 1px solid rgba(255,255,255,.16); border-radius: var(--r-md);
  background: rgba(13,30,23,.58); color: #fff; font-size: 14px; font-weight: 500;
  transition: background-color var(--t);
}
.util:hover { background: rgba(13,30,23,.85); }
.util svg { width: 17px; height: 17px; }
.util[aria-pressed="false"] { opacity: .6; }

/* 6. Cards ----------------------------------------------------------------- */
.card {
  position: relative; width: 52px; height: 74px; flex: none;
  border-radius: var(--r-sm); background: var(--paper);
  border: 1px solid rgba(0,0,0,.16);
  box-shadow: 0 2px 4px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.9);
  color: var(--ink); cursor: default;
  transition: transform var(--t), box-shadow var(--t);
}
.card-rank {
  position: absolute; top: 4px; left: 5px;
  font-family: var(--font-body); font-size: 15px; font-weight: 700; line-height: 1;
}
.card-pip { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-42%); text-align: center; font-size: 24px; line-height: 1; }
.card.is-red .card-rank, .card.is-red .card-pip { color: #c0293b; }
.card.is-black .card-rank, .card.is-black .card-pip { color: var(--ink); }

.card-joker { background: linear-gradient(170deg, #fbf8f1, #efe8d8); }
.card-joker .card-rank { font-size: 9px; letter-spacing: .05em; color: var(--red); }
.card-joker .card-pip { font-size: 22px; color: var(--red); }

.card-back {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.09) 0 3px, transparent 3px 6px),
    linear-gradient(160deg, #33507f, #22375c 60%, #1a2b48);
  border: 2px solid var(--paper);
}
.card-empty { background: rgba(255,255,255,.07); border: 2px dashed rgba(255,255,255,.3); box-shadow: none; }

button.card { cursor: pointer; }
button.card:hover { transform: translateY(-4px); box-shadow: 0 8px 14px rgba(0,0,0,.4); }
.hand .card { cursor: pointer; }
.hand .card.is-selected {
  transform: translateY(-12px);
  box-shadow: 0 10px 18px rgba(0,0,0,.45), 0 0 0 2px var(--gold);
}
.card-stack { display: flex; }
.card-stack .card-mini { width: 20px; height: 28px; margin-left: -12px; border-radius: 3px; }
.card-stack .card-mini:first-child { margin-left: 0; }
.meld-cards .card { width: 40px; height: 56px; }
.meld-cards .card-rank { font-size: 12px; }
.meld-cards .card-pip { font-size: 17px; }

/* 7. Trust ----------------------------------------------------------------- */
.trust { background: var(--paper); border-top: 1px solid var(--cream-2); border-bottom: 1px solid var(--cream-2); }
.trust-inner { display: flex; justify-content: center; gap: clamp(20px, 6vw, 76px); flex-wrap: wrap; padding: var(--space-5) var(--space-5); }
.trust-item { display: flex; align-items: center; gap: var(--space-3); font-weight: 600; font-size: 15px; }
.trust-icon {
  display: grid; place-items: center; width: 42px; height: 42px; flex: none;
  border-radius: 50%; background: linear-gradient(160deg, #3d3223, #241d13); color: var(--gold);
}
.trust-icon svg { width: 19px; height: 19px; }

/* 8. How / Rules ----------------------------------------------------------- */
.how, .rules, .guides { padding: var(--space-8) 0; }
.how h2, .rules h2, .guides h2 { font-size: clamp(24px, 3.6vw, 34px); font-weight: 700; color: var(--navy); }
.section-lede { margin-top: var(--space-3); max-width: 62ch; color: #4b5768; font-size: 16px; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); margin-top: var(--space-6); }
.steps li { padding: var(--space-5); background: var(--paper); border: 1px solid var(--cream-2); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.step-n {
  display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: var(--space-3);
  border-radius: 50%; background: var(--navy); color: var(--gold);
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
}
.steps h3 { font-size: 18px; font-weight: 700; color: var(--navy); }
.steps p { margin-top: var(--space-2); font-size: 15px; color: #4b5768; }

.rules { background: var(--paper); border-top: 1px solid var(--cream-2); }
.rules-inner { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-8); }
.contract-list { margin-top: var(--space-5); counter-reset: c; }
.contract-list li {
  counter-increment: c;
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) 0; border-bottom: 1px solid var(--cream-2);
  font-size: 16px;
}
.contract-list li::before {
  content: "Round " counter(c);
  flex: none; width: 88px; font-size: 12px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.contract-list strong { font-weight: 600; color: var(--navy); }

.score-table { width: 100%; margin-top: var(--space-5); border-collapse: collapse; }
.score-table th, .score-table td { padding: var(--space-3) var(--space-2); text-align: left; border-bottom: 1px solid var(--cream-2); font-size: 15px; }
.score-table th { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.score-table td:last-child { text-align: right; font-weight: 600; color: var(--navy); }
.rules-note { margin-top: var(--space-4); font-size: 14px; color: var(--muted); }

/* 9. Guides ---------------------------------------------------------------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); }
.view-all { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--red); }
.view-all svg { width: 16px; height: 16px; }
.view-all:hover { text-decoration: underline; }

.guides-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); margin-top: var(--space-6); }
.guide-feature > a { display: flex; flex-direction: column; height: 100%; background: var(--paper); border: 1px solid var(--cream-2); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow var(--t), transform var(--t); }
.guide-list { display: flex; flex-direction: column; gap: var(--space-4); }
.guide-row > a { display: grid; grid-template-columns: 132px 1fr auto; align-items: center; gap: var(--space-4); background: var(--paper); border: 1px solid var(--cream-2); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow var(--t), transform var(--t); }
.guide-feature > a:hover, .guide-row > a:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.guide-body { display: block; padding: var(--space-5); }
.guide-row .guide-body { padding: var(--space-4) 0; }
.kicker { display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--red); }
.guides h3 { margin-top: 6px; font-size: 19px; font-weight: 700; color: var(--navy); }
.guide-feature h3 { font-size: 23px; }
.guide-body p { margin-top: var(--space-2); font-size: 14.5px; color: #4b5768; }
.meta { display: inline-flex; align-items: center; gap: 6px; margin-top: var(--space-3); font-size: 13px; color: var(--muted); }
.meta svg { width: 15px; height: 15px; }
.guide-chev { width: 20px; height: 20px; margin-right: var(--space-4); color: var(--muted-light); flex: none; }
.guide-feature .guide-chev { display: none; }

.thumb { display: block; position: relative; overflow: hidden; background: linear-gradient(150deg, #6b4a2c, #3a2916); }
.thumb-fan {
  height: 210px;
  background: linear-gradient(160deg, #2c5c46 0%, #24483a 40%, #5a3a20 100%);
}
.thumb-fan::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 150px; height: 96px; transform: translate(-50%,-50%);
  background:
    linear-gradient(#faf8f3,#faf8f3) 0 14px/44px 66px no-repeat,
    linear-gradient(#faf8f3,#faf8f3) 34px 7px/44px 66px no-repeat,
    linear-gradient(#faf8f3,#faf8f3) 68px 2px/44px 66px no-repeat,
    linear-gradient(#faf8f3,#faf8f3) 102px 8px/44px 66px no-repeat;
  border-radius: 4px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.4));
}
.guide-row .thumb { height: 100%; min-height: 104px; }
.thumb-book { background: linear-gradient(150deg, #1f4a37, #163327); display: grid; place-items: center; }
.thumb-book span { font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-align: center; color: var(--gold); text-transform: uppercase; line-height: 1.5; }
.thumb-note { background: linear-gradient(150deg, #8a6a44, #5c4227); }
.thumb-note::after {
  content: "1. 2 sets 2. 1 set + 1 run 3. 2 runs";
  position: absolute; inset: 14px; padding: 8px 10px; border-radius: 3px;
  background: #f6f1e4; color: #4a3a24; font-size: 9.5px; line-height: 2.1; letter-spacing: .02em;
  box-shadow: 0 4px 8px rgba(0,0,0,.3);
}
.thumb-joker { background: linear-gradient(150deg, #5c4227, #3a2916); display: grid; place-items: center; }
.thumb-joker span {
  width: 52px; height: 74px; display: grid; place-items: center; border-radius: 4px;
  background: var(--paper); color: var(--red);
  font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  box-shadow: 0 5px 10px rgba(0,0,0,.45);
}

/* 10. CTA / Footer --------------------------------------------------------- */
.cta { padding: 0 0 var(--space-8); }
.cta-band {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); flex-wrap: wrap;
  padding: var(--space-6) clamp(20px, 4vw, 48px);
  border-radius: var(--r-lg); background: linear-gradient(120deg, var(--navy) 0%, #1c2c4a 60%, #223458 100%);
  color: #fff; box-shadow: var(--shadow-lg); overflow: hidden; position: relative;
}
.cta-band::after {
  content: "\2663\2660"; position: absolute; right: 28%; top: 50%; transform: translateY(-50%);
  font-size: 92px; color: rgba(255,255,255,.05); pointer-events: none; letter-spacing: -10px;
}
.cta-band h2 { font-size: clamp(21px, 3vw, 30px); font-weight: 700; }
.cta-band p { margin-top: 6px; color: rgba(255,255,255,.75); font-size: 15px; }
.cta-band .btn { position: relative; z-index: 1; }

.site-footer { background: var(--navy); color: #fff; padding: var(--space-7) 0 var(--space-5); }
.footer-inner { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-6); flex-wrap: wrap; }
.footer-nav { display: flex; gap: var(--space-8); }
.footer-nav a { font-size: 14.5px; color: rgba(255,255,255,.76); line-height: 2; }
.footer-nav a:hover { color: #fff; text-decoration: underline; }
.social { display: flex; gap: var(--space-4); }
.social a { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: rgba(255,255,255,.85); transition: background-color var(--t); }
.social a:hover { background: rgba(255,255,255,.12); color: #fff; }
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap;
  margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid var(--navy-line);
  font-size: 13px; color: rgba(255,255,255,.6);
}
.footer-bottom ul { display: flex; gap: var(--space-5); }
.footer-bottom a:hover { color: #fff; text-decoration: underline; }

/* 11. Modals --------------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: var(--space-4); background: rgba(11,18,32,.62); }
.modal-card {
  position: relative; width: 100%; max-width: 440px; max-height: 88vh; overflow-y: auto;
  padding: var(--space-6); border-radius: var(--r-lg); background: var(--paper); box-shadow: var(--shadow-lg);
  animation: modalIn 200ms cubic-bezier(.4,0,.2,1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-card h2 { font-size: 24px; font-weight: 700; color: var(--navy); }
.modal-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-sm); color: var(--muted); }
.modal-close:hover { background: var(--cream); }
.modal-card .btn { margin-top: var(--space-5); }

.scoreboard { margin-top: var(--space-4); }
.score-row { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) 0; border-bottom: 1px solid var(--cream-2); font-size: 15px; }
.score-row:last-child { border-bottom: 0; }
.score-row.is-you strong { color: var(--red); }
.score-row .pts { font-weight: 700; font-variant-numeric: tabular-nums; }
.score-row .delta { font-size: 13px; color: var(--muted); margin-left: auto; margin-right: var(--space-4); }
.score-lead { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--green); }

.switch { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-4); font-size: 15px; cursor: pointer; min-height: 44px; }
.switch input { width: 20px; height: 20px; accent-color: var(--green); cursor: pointer; }

/* 12. Responsive ----------------------------------------------------------- */
@media (max-width: 1024px) {
  .main-nav { display: none; }
  .nav-toggle { display: grid; }
  .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .rules-inner { grid-template-columns: 1fr; gap: var(--space-7); }
  .guides-grid { grid-template-columns: 1fr; }
  .guide-feature .thumb-fan { height: 190px; }
  .board-actions .btn { min-width: 0; flex: 1; }
}
@media (max-width: 720px) {
  html { scroll-padding-top: 74px; }
  .btn-challenge span { display: none; }
  .btn-challenge { padding: 0 12px; }
  .hero { padding-top: var(--space-6); }
  .board-frame { padding: 9px; border-radius: var(--r-lg); }
  .board-felt { padding: var(--space-4) var(--space-3); }
  .opponents { gap: var(--space-2); }
  .opponent { flex-direction: column; gap: 4px; text-align: center; }
  .opp-meta { align-items: center; }
  .avatar { width: 36px; height: 36px; font-size: 15px; }
  .card { width: 42px; height: 60px; }
  .card-rank { font-size: 13px; }
  .card-pip { font-size: 19px; }
  .meld-cards .card { width: 32px; height: 45px; }
  .meld-cards .card-rank { font-size: 10px; }
  .meld-cards .card-pip { font-size: 13px; }
  .hand { gap: 3px; min-height: 68px; }
  .board-actions { flex-wrap: wrap; }
  .pill { font-size: 10.5px; padding: 0 12px; min-height: 30px; }
  .guide-row > a { grid-template-columns: 104px 1fr auto; }
  .footer-inner { flex-direction: column; gap: var(--space-5); }
  .footer-nav { gap: var(--space-7); }
  .cta-band { flex-direction: column; align-items: flex-start; }
  .cta-band .btn { width: 100%; }
  .cta-band::after { display: none; }
}
@media (max-width: 420px) {
  .trust-inner { gap: var(--space-3); flex-wrap: nowrap; padding-left: var(--space-3); padding-right: var(--space-3); }
  .trust-item { flex-direction: column; gap: 6px; text-align: center; font-size: 12.5px; }
  .trust-icon { width: 36px; height: 36px; }
  /* (c) keep round / contract / full screen on one line */
  .pill { font-size: 8.5px; padding: 0 8px; min-height: 27px; letter-spacing: .03em; }
  .pill-btn svg { width: 12px; height: 12px; }
  .board-topbar { gap: 5px; flex-wrap: nowrap; }
  .board-utils { gap: 5px; flex-wrap: nowrap; }
  .util { font-size: 11.5px; padding: 0 9px; min-height: 38px; gap: 5px; white-space: nowrap; }
  .util svg { width: 14px; height: 14px; }
  .card { width: 36px; height: 52px; }
  .card-rank { font-size: 11px; }
  .card-pip { font-size: 16px; }
  .steps { grid-template-columns: 1fr; }
  .board-actions .btn span { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media print { .site-header, .drawer, .board-frame, .cta, .site-footer { display: none; } }
