/* ============================================================================
   Clubhouse (bowlsy.news player-facing home).
   Layout: fixed dark sidebar + parchment main (topbar, stats, achievements
   strip, today's games, bottom columns). Achievements cards use Technique 5
   (torn paper + 3D push pin + hex badge).
   ============================================================================ */

:root {
  --page-bg: #efe9da;
  --panel-bg: #f3ecd9;
  --paper: #faf5e8;
  --paper-dark: #e4dcc6;
  --ink: #2b2620;
  --ink-soft: #4a443b;
  --ink-faint: #7a7468;
  --accent-red: #8c2b1f;
  --accent-green: #1f4a33;
  --accent-blue: #1f3a5f;
  --accent-gold: #9a6b15;

  --side-bg: #11281d;
  --side-bg2: #0c1f16;
  --side-text: #c2d4c6;
  --side-muted: #7f9a86;
  --orange: #e3893d;

  --card: #fffdf7;
  --card-border: #e6ddc6;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--page-bg);
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--ink);
}

a { color: inherit; }

/* Flash toast — bottom-right, slides in on save. */
.ch-flash { position: fixed; right: 22px; bottom: 22px; z-index: 9000; max-width: 360px; padding: 13px 18px; border-radius: 11px;
  background: linear-gradient(180deg, #2f7a42, #246335); color: #fff; font: 600 13.5px system-ui, sans-serif;
  box-shadow: 0 10px 28px rgba(20,40,20,.32), inset 0 1px 0 rgba(255,255,255,.2);
  opacity: 0; transform: translateY(12px); transition: opacity .25s, transform .25s; pointer-events: none; }
.ch-flash.show { opacity: 1; transform: translateY(0); }
.ch-flash.is-error { background: linear-gradient(180deg, #b4402f, #8c2b1f); box-shadow: 0 10px 28px rgba(60,20,15,.32), inset 0 1px 0 rgba(255,255,255,.18); }

/* ── Shell ──────────────────────────────────────────────────────────────── */
.ch-shell { display: flex; min-height: 100vh; align-items: stretch; }

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.ch-sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: var(--side-bg);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px 16px;
}

.side-logo { padding: 0 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.logo-word { font-family: 'Times New Roman', Georgia, serif; font-size: 28px; font-weight: 700; letter-spacing: .5px; color: #fff; line-height: 1; }
.logo-word span { color: var(--orange); font-style: italic; font-size: 17px; }
.logo-sub { margin-top: 6px; font-size: 11px; letter-spacing: 3px; color: var(--side-muted); }

.side-nav { flex: 1; overflow-y: auto; padding: 14px 0 8px; display: flex; flex-direction: column; gap: 2px; }
.side-nav::-webkit-scrollbar { width: 6px; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  font-family: -apple-system, system-ui, 'Segoe UI', sans-serif;
  font-size: 14.5px;
  color: var(--side-text);
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: #fbf7ec; color: #1d2b22; font-weight: 700; }
.nav-logout { font-family: inherit; }

.nav-ic { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; color: var(--side-muted); flex: 0 0 26px; }
.nav-item:hover .nav-ic, .nav-item.active .nav-ic { color: inherit; }
.nav-ic.sq { width: 30px; height: 30px; flex-basis: 30px; border-radius: 9px; color: #fff !important; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }

/* Indented child link (e.g. Match History under Play Bowls) */
.nav-subitem { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 12px 7px 26px; margin: 1px 0; border-radius: 9px;
  font-family: -apple-system, system-ui, 'Segoe UI', sans-serif; font-size: 13px; color: var(--side-muted); text-decoration: none; }
.nav-subitem:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-subitem.active { background: #fbf7ec; color: #1d2b22; font-weight: 700; }
.nav-subdot { width: 6px; height: 6px; flex: none; margin-left: 14px; border-radius: 50%; background: currentColor; opacity: .55; }

.nav-divider { flex: none; height: 1px; background: rgba(255,255,255,.20); margin: 10px 12px; }

.side-points { background: var(--side-bg2); border-radius: 12px; padding: 14px 16px; text-align: center; margin-top: 8px; }
.sp-label { font-family: -apple-system, system-ui, sans-serif; font-size: 11px; letter-spacing: 1.5px; color: var(--side-muted); }
.sp-value { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 26px; font-weight: 700; color: #fff; margin: 4px 0 2px; }
.sp-value svg { color: var(--orange); }
.sp-sub { font-size: 11.5px; color: var(--orange); font-style: italic; }

/* Mobile drawer chrome — hidden on desktop; activated in the ≤900px query. */
.ch-mobilebar, .ch-backdrop { display: none; }

/* ── Main ───────────────────────────────────────────────────────────────── */
.ch-main { flex: 1; min-width: 0; position: relative; background: var(--page-bg); }
.ch-main::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.42 0 0 0 0 0.35 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}
.ch-content { position: relative; z-index: 1; padding: 16px 30px 60px; }

/* ── Top bar ────────────────────────────────────────────────────────────── */
.ch-topbar { position: relative; z-index: 30; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 26px 30px 8px; }
/* Bare top bar (no greeting, e.g. game lobbies): float just the user chrome at
   top-right and let the page content rise onto the same line as it. */
.ch-topbar-bare { position: absolute; top: 0; right: 0; padding: 18px 30px 0; z-index: 30; }
.tb-greet { margin: 0; font-size: 34px; font-weight: 700; color: var(--accent-green); letter-spacing: .3px; }
.tb-sub { margin: 4px 0 0; font-size: 14px; color: var(--ink-soft); }

.tb-right { display: flex; align-items: center; gap: 22px; flex-shrink: 0; }
.tb-bell { position: relative; background: none; border: 0; cursor: pointer; color: var(--ink-soft); padding: 4px; }
.bell-badge { position: absolute; top: -2px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent-red); color: #fff; font-family: system-ui, sans-serif; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.tb-user { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; color: var(--ink); }
.tb-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.tb-avatar-fallback { display: inline-flex; align-items: center; justify-content: center; background: var(--accent-green); color: #fff; font-family: system-ui, sans-serif; font-weight: 700; font-size: 17px; }
.tb-userinfo { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.tb-name { font-family: system-ui, sans-serif; font-weight: 700; font-size: 14.5px; }
.tb-since { font-family: system-ui, sans-serif; font-size: 12px; color: var(--ink-faint); }

/* Account dropdown (top-right member chip). */
.tb-user-dd { position: relative; }
.tb-user { border-radius: 10px; padding: 4px 8px 4px 5px; transition: background .12s; }
.tb-user:hover { background: rgba(60,50,30,.06); }
.tb-user > svg { color: var(--ink-faint); transition: transform .15s ease; }
.tb-user-dd.open .tb-user > svg { transform: rotate(180deg); }
.tb-user-panel { position: absolute; top: calc(100% + 10px); right: 0; min-width: 234px; background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; box-shadow: 0 12px 32px rgba(60,50,30,.18); padding: 6px; opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .14s ease, transform .14s ease, visibility .14s; z-index: 50; }
.tb-user-dd.open .tb-user-panel { opacity: 1; visibility: visible; transform: translateY(0); }
.tb-user-panel form { margin: 0; }
.tb-dd-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 11px; margin-bottom: 5px; border-bottom: 1px solid var(--card-border); }
.tb-dd-head-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: 0 0 38px; font-size: 15px; }
.tb-dd-head-info { display: flex; flex-direction: column; min-width: 0; }
.tb-dd-head-name { font-family: system-ui, sans-serif; font-weight: 700; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-dd-head-sub { font-family: system-ui, sans-serif; font-size: 11.5px; color: var(--ink-faint); }
.tb-dd-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 11px; border-radius: 8px; font-family: system-ui, sans-serif; font-size: 13.5px; font-weight: 500; color: var(--ink-soft); text-decoration: none; background: none; border: 0; cursor: pointer; text-align: left; }
.tb-dd-item svg { color: var(--ink-faint); flex: 0 0 auto; }
.tb-dd-item:hover { background: rgba(60,50,30,.06); color: var(--ink); }
.tb-dd-item:hover svg { color: var(--ink); }
.tb-dd-sep { height: 1px; background: var(--card-border); margin: 5px 6px; }
.tb-dd-logout, .tb-dd-logout svg { color: var(--accent-red); }
.tb-dd-logout:hover { background: rgba(140,43,31,.08); color: var(--accent-red); }
.tb-dd-logout:hover svg { color: var(--accent-red); }

/* ── Stats strip ────────────────────────────────────────────────────────── */
.stat-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; background: linear-gradient(180deg, #fffdf8, #f7f0df); border: 1px solid #e0d4b6; border-radius: 14px; padding: 18px 10px; margin-bottom: 22px; box-shadow: inset 0 1px 0 #fff, 0 2px 8px rgba(60,50,30,.1); }
.stat-tile { display: flex; align-items: center; gap: 13px; padding: 4px 18px; }
.stat-tile + .stat-tile { border-left: 1px solid #e6d9b8; }
.stat-ic { width: 46px; height: 46px; border-radius: 50%; flex: 0 0 46px; display: inline-flex; align-items: center; justify-content: center; color: #fff; box-shadow: inset 0 2px 2px rgba(255,255,255,.5), inset 0 -4px 5px rgba(0,0,0,.22), 0 0 0 3px #fffdf8, 0 2px 5px rgba(40,30,15,.26); }
.stat-label { font-family: system-ui, sans-serif; font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: var(--ink-faint); }
.stat-value { font-size: 26px; font-weight: 700; color: var(--ink); line-height: 1.15; }
.stat-value-sm { font-size: 18px; }
.stat-sub { font-family: system-ui, sans-serif; font-size: 12px; color: var(--ink-faint); }

/* ── Bowlsy Achievements panel ──────────────────────────────────────────── */
.gazette { background: var(--panel-bg); border: 1px solid #d8cdb2; border-radius: 10px; padding: 18px 22px 26px; box-shadow: inset 0 0 0 1px #fff7e8, 0 1px 2px rgba(60,50,30,.08); margin-bottom: 24px; }
.gazette-head { display: flex; align-items: baseline; gap: 12px; border-bottom: 1px solid #cbbf9f; padding-bottom: 10px; margin-bottom: 20px; }
.gazette-head h1 { margin: 0; font-size: 21px; letter-spacing: 2px; font-weight: 700; white-space: nowrap; }
.gazette-head p { margin: 0; font-style: italic; color: var(--ink-soft); font-size: 14px; flex: 1; }
.gazette-head a { font-style: normal; font-size: 13px; letter-spacing: .5px; color: var(--accent-red); text-decoration: none; white-space: nowrap; }
.gazette-head a:hover { text-decoration: underline; }
.card-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 20px 18px; }

/* Achievement card — Technique 5 (torn paper + 3D push pin) */
.gaz-card { position: relative; isolation: isolate; padding: 16px 20px 14px; margin: 8px 6px 4px; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "badge main" "time time"; column-gap: 15px; min-height: 116px; transform: rotate(-1.2deg); }
.gaz-card:nth-child(2n) { transform: rotate(1deg); }
.gaz-card:nth-child(3n) { transform: rotate(-0.5deg); }
.gaz-card:nth-child(4n) { transform: rotate(1.6deg); }
.gaz-card::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--paper); filter: url(#torn-paper); }

.pin { --pin: #c0392b; position: absolute; top: -9px; left: 50%; width: 18px; height: 28px; margin-left: -9px; z-index: 2; filter: drop-shadow(3px 4px 2px rgba(40,30,15,.35)); }
.pin::before { content: ""; position: absolute; top: 0; left: 0; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--pin), white 50%) 0%, var(--pin) 50%, color-mix(in srgb, var(--pin), black 55%) 100%); }
.pin::after { content: ""; position: absolute; top: 16px; left: 8px; width: 2px; height: 11px; background: linear-gradient(180deg, #c6c6c6, #5e5e5e); transform: rotate(7deg); transform-origin: top center; }

.gaz-badge { grid-area: badge; width: 66px; height: 66px; object-fit: contain; margin-top: 2px; filter: drop-shadow(0 2px 2px rgba(60,50,30,.28)); }
.gaz-main { grid-area: main; }

.kicker { font-size: 10.5px; letter-spacing: 1.5px; font-weight: 700; text-transform: uppercase; color: var(--accent-red); margin-bottom: 5px; }
.kicker.green { color: var(--accent-green); }
.kicker.blue { color: var(--accent-blue); }
.kicker.gold { color: var(--accent-gold); }
.card-title { margin: 0 0 6px; font-size: 19px; font-weight: 700; line-height: 1.15; color: var(--accent-red); }
.card-body { margin: 0 0 9px; font-size: 13.5px; color: var(--ink-soft); line-height: 1.4; }
.points { margin: 0; font-size: 15px; font-weight: 700; color: var(--accent-red); }
.timestamp { grid-area: time; margin: 12px 0 0; font-size: 12px; font-style: italic; color: var(--ink-faint); }

/* ── Section heads (shared) ─────────────────────────────────────────────── */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 20px; letter-spacing: .5px; color: var(--ink); }
.games-timer { display: inline-flex; align-items: center; gap: 6px; font-family: system-ui, sans-serif; font-size: 13px; color: var(--ink-faint); }

/* ── Today's Games ──────────────────────────────────────────────────────── */
.games { margin-bottom: 26px; }
.games-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.game-card { background: linear-gradient(165deg, color-mix(in srgb, var(--g), #fff 16%) 0%, var(--g) 52%, color-mix(in srgb, var(--g), #000 12%) 100%); border-radius: 14px; padding: 16px 16px 14px; display: flex; flex-direction: column; min-height: 230px; color: #fff; text-decoration: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.3), inset 0 0 0 1px rgba(255,255,255,.1), 0 4px 12px rgba(40,30,15,.24); transition: transform .12s ease, box-shadow .12s ease; }
.game-card:hover { transform: translateY(-3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.32), inset 0 0 0 1px rgba(255,255,255,.12), 0 10px 22px rgba(40,30,15,.3); }
.game-top { text-align: center; }
.game-name { font-size: 19px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; text-shadow: 0 1px 2px rgba(20,12,4,.28); }
.game-tag { font-family: system-ui, sans-serif; font-size: 12.5px; opacity: .9; margin-top: 2px; }
.game-illo { flex: 1; display: flex; align-items: center; justify-content: center; padding: 10px 0; }
.game-illo img { max-width: 88px; max-height: 88px; object-fit: contain; filter: drop-shadow(0 3px 5px rgba(0,0,0,.3)); }
.game-illo svg { opacity: .9; }
.play-btn { display: block; text-align: center; background: linear-gradient(180deg, #fffefa, #f4ecd9); color: var(--g); font-family: system-ui, sans-serif; font-weight: 700; font-size: 13px; letter-spacing: .5px; text-transform: uppercase; padding: 9px; border-radius: 8px; box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(20,12,4,.22); }

/* ── Bottom columns ─────────────────────────────────────────────────────── */
.ch-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.panel { background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 2px rgba(60,50,30,.05); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.panel-head h3 { margin: 0; font-size: 16px; letter-spacing: .3px; }
.panel-head a { font-family: system-ui, sans-serif; font-size: 12.5px; color: var(--accent-red); text-decoration: none; }
.panel-head a:hover { text-decoration: underline; }

/* Recent activity */
.activity-item { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid #f0e8d4; }
.activity-item:first-of-type { border-top: 0; }
.activity-ic { width: 34px; height: 34px; object-fit: contain; flex: 0 0 34px; }
.activity-main { flex: 1; min-width: 0; }
.activity-title { font-family: system-ui, sans-serif; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.activity-sub { font-family: system-ui, sans-serif; font-size: 12px; color: var(--ink-faint); }
.activity-meta { text-align: right; flex-shrink: 0; }
.activity-empty { padding: 18px 4px; font-family: system-ui, sans-serif; font-size: 13px; color: var(--ink-faint); text-align: center; }
.activity-pts { font-family: system-ui, sans-serif; font-weight: 700; font-size: 13.5px; color: var(--accent-green); }
.activity-when { font-family: system-ui, sans-serif; font-size: 11.5px; color: var(--ink-faint); }

/* Challenge progress */
.challenge-head { display: flex; align-items: baseline; justify-content: space-between; }
.challenge-title { font-family: system-ui, sans-serif; font-size: 12px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--ink-soft); }
.challenge-left { font-family: system-ui, sans-serif; font-size: 12px; color: var(--ink-faint); }
.challenge-blurb { margin: 6px 0 12px; font-size: 13px; color: var(--ink-soft); }
.challenge-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.challenge-task { display: flex; align-items: center; gap: 9px; font-family: system-ui, sans-serif; font-size: 13px; color: var(--ink); }
.task-check { display: inline-flex; color: #c4bca6; flex: 0 0 auto; }
.challenge-task.done .task-check { color: #1f7a4d; }
.task-label { flex: 1; }
.challenge-task.done .task-label { color: var(--ink-soft); }
.task-progress { font-size: 12px; color: var(--ink-faint); }
.task-pts { font-weight: 700; font-size: 12.5px; color: var(--accent-green); }

/* Club news */
.news-item { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid #f0e8d4; }
.news-item:first-of-type { border-top: 0; }
.news-thumb { width: 62px; height: 50px; flex: 0 0 62px; border-radius: 7px; background: linear-gradient(135deg, #d7cdb2, #c2b694); }
.news-main { flex: 1; min-width: 0; }
.news-title { font-family: system-ui, sans-serif; font-size: 13.5px; font-weight: 700; color: var(--ink); }
.news-body { font-family: system-ui, sans-serif; font-size: 12.5px; color: var(--ink-soft); line-height: 1.35; margin: 2px 0 3px; }
.news-when { font-family: system-ui, sans-serif; font-size: 11.5px; color: var(--ink-faint); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
/* Tablets + phones: the sidebar collapses to a hamburger drawer. Mouse-driven
   desktops keep the menu pinned down to 1200px. Touch devices (pointer:coarse)
   collapse it up to 1400px too, so an iPad Pro 12.9" in landscape (1366px) gets
   the drawer while a 1366px laptop — which has a fine pointer — keeps the menu. */
@media (max-width: 1200px), (max-width: 1400px) and (pointer: coarse) {
  /* Fixed top bar with the hamburger + logo. */
  .ch-mobilebar { display: flex; position: fixed; top: 0; left: 0; right: 0; height: 54px; align-items: center; gap: 14px; padding: 0 14px; background: var(--side-bg); z-index: 40; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
  .ch-burger { display: inline-flex; flex-direction: column; justify-content: center; gap: 4px; width: 38px; height: 38px; padding: 8px; background: none; border: 0; cursor: pointer; }
  .ch-burger span { display: block; height: 2px; border-radius: 2px; background: #e7efe8; }
  .ch-mobilebar-logo { font-family: 'Times New Roman', Georgia, serif; font-size: 20px; font-weight: 700; color: #fff; }
  .ch-mobilebar-logo span { color: var(--orange); font-style: italic; font-size: 13px; }

  /* Sidebar → off-canvas drawer. */
  .ch-sidebar { position: fixed; top: 0; left: 0; height: 100vh; width: 270px; transform: translateX(-100%); transition: transform .25s ease; z-index: 60; box-shadow: 4px 0 18px rgba(0,0,0,.35); }
  .ch-sidebar.open { transform: translateX(0); }

  /* Backdrop. */
  .ch-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .25s ease; }
  .ch-backdrop.show { opacity: 1; pointer-events: auto; }

  /* Hide the desktop top bar; clear the fixed mobile bar. */
  .ch-topbar { display: none; }
  .ch-main { padding-top: 54px; }
}

@media (max-width: 1180px) {
  .games-row { grid-template-columns: repeat(3, 1fr); }
  .ch-columns { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); gap: 10px 0; }
}

/* ── Phones ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .ch-content { padding: 16px 14px 50px; }
  .games-row { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================================
   Sudoku lobby (gamesy, on the clubhouse parchment shell)
   ============================================================================ */
.sd-flash { background: rgba(140,43,31,.08); border: 1px solid #d9b9b2; color: var(--accent-red); border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-family: system-ui, sans-serif; font-size: 14px; }

.sd-banner { display: block; margin: 2px 0 22px; }
/* Source is pre-trimmed to the banner band (~3.8:1), so show it at natural
   height — the whole banner is visible, nothing cropped. */
.sd-banner img { display: block; width: 100%; height: auto; border-radius: 12px; }

/* ── Clubhouse lobby header — gazette text hero (left) + today's puzzle art
   (right). Reused across games; per-game title colour via --hero. Mirrors the
   original Sudoku banner: big high-contrast serif title, italic serif kicker
   in green, a gold diamond rule, then a sans tagline. */
.lobby-hero { display: grid; grid-template-columns: 1fr minmax(240px, 380px); gap: 34px; align-items: center; margin: 6px 0 26px; }
/* Full-width text hero (no "today" art column yet) — used until a game has a
   right-hand panel to show. */
.lobby-hero--solo { grid-template-columns: 1fr; }
.lobby-hero-text { display: flex; align-items: center; gap: 22px; min-width: 0; }
.lobby-hero-badge { flex: 0 0 auto; width: clamp(76px, 11vw, 150px); height: auto; filter: drop-shadow(0 3px 4px rgba(60,50,30,.28)); }
/* Icon badge — used when a game has no bespoke hex badge yet (e.g. Drills):
   the nav icon in a rounded square tinted with the game accent. */
.lobby-hero-badge--icon { display: grid; place-items: center; aspect-ratio: 1; height: auto; border-radius: 24%; background: var(--hero, #0B646B); color: #fff; filter: none; box-shadow: 0 3px 6px rgba(60,50,30,.26); }
.lobby-hero-badge--icon svg { width: 56%; height: 56%; }
.lobby-hero-copy { min-width: 0; }
.lobby-hero-title { margin: 0; font-family: 'Alfa Slab One', Georgia, 'Times New Roman', serif; font-weight: 400; font-size: clamp(38px, 5vw, 72px); line-height: 1; letter-spacing: 2.5px; color: var(--hero, #2F6EA3); text-transform: uppercase; text-shadow: 2px 3px 3px rgba(40,30,15,.16); }
.lobby-hero-kicker { margin-top: 14px; font-family: 'Playfair Display', Georgia, serif; font-weight: 600; font-style: italic; font-size: clamp(26px, 4.2vw, 52px); color: #234b34; line-height: 1.02; }
.lobby-hero-rule { display: flex; align-items: center; gap: 14px; max-width: 540px; margin: 16px 0 14px; }
.lobby-hero-rule::before, .lobby-hero-rule::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, #c79a3a 30%, #c79a3a 70%, transparent); }
.lobby-hero-rule span { flex: 0 0 auto; width: 10px; height: 10px; background: #c79a3a; transform: rotate(45deg); box-shadow: inset 0 0 0 1px rgba(255,255,255,.45); }
.lobby-hero-tag { margin: 0; font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: clamp(15px, 2vw, 20px); color: #2b2620; }
.lobby-hero-today { margin: 0; background: #fffdf7; border: 1px solid #e6ddc6; border-radius: 14px; padding: 12px; box-shadow: 0 2px 6px rgba(60,50,30,.07); }
.lobby-hero-eyebrow { font-family: system-ui, sans-serif; text-transform: uppercase; letter-spacing: .14em; font-size: 10.5px; font-weight: 700; color: #7a7468; text-align: center; margin-bottom: 9px; }
.lobby-hero-today img { display: block; width: 100%; aspect-ratio: 7 / 4; object-fit: cover; border-radius: 9px; }
/* Word Cube's "today" art — a 3×3 letter cube; centre tile in the game accent. */
.lobby-hero-cube { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 290px; aspect-ratio: 1; margin: 0 auto; }
.lobby-hero-cube span { display: grid; place-items: center; background: #f3ecd9; border: 1px solid #e0d6bd; border-radius: 10px; font-family: Georgia, 'Times New Roman', serif; font-weight: 700; font-size: clamp(22px, 4.4vw, 34px); color: #2b2620; text-transform: uppercase; box-shadow: 0 1px 2px rgba(60,50,30,.08); }
.lobby-hero-cube span.ctr { background: var(--hero, #8B3345); border-color: var(--hero, #8B3345); color: #fff; }
/* Today's cube on the velvet frame — raised tiles, dark frame in the gaps. */
.lobby-hero-board .lobby-hero-cube { max-width: none; width: 100%; gap: 7px; }
.lobby-hero-board .lobby-hero-cube span { border: 0; background: linear-gradient(180deg, #fdfaf0, #f0e9d5); box-shadow: inset 0 1px 0 #fff, inset 0 -2px 3px rgba(90,70,35,.2), 0 1px 2px rgba(0,0,0,.22); }
.lobby-hero-board .lobby-hero-cube span.ctr { background: var(--hero, #8B3345); box-shadow: 0 1px 2px rgba(0,0,0,.28); }
/* Sudoku's "today" art — a 9×9 grid of today's medium givens, with 3×3 box rules. */
.lobby-hero-board { width: clamp(230px, 24vw, 290px); margin: 0 auto; padding: 10px; border-radius: 16px; background: linear-gradient(160deg, #3d342a, #241e16); box-shadow: 0 10px 24px rgba(40,30,15,.3), inset 0 0 0 1.5px #b08a35; }
.lobby-hero-sudoku { display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr); width: 100%; max-width: 250px; aspect-ratio: 1; margin: 0 auto; background: #fffdf7; border: 2px solid #2b2620; border-radius: 6px; overflow: hidden; }
.lobby-hero-board .lobby-hero-sudoku { border: 0; border-radius: 8px; max-width: none; background: #fdf9ee; }
/* Today's crossword board — cream cells + black squares on the velvet frame
   (the dark frame shows through the gaps as the grid lines). */
.lobby-hero-board .lobby-hero-crossword { display: grid; grid-template-columns: repeat(var(--n, 7), 1fr); grid-template-rows: repeat(var(--n, 7), 1fr); gap: 3px; width: 100%; aspect-ratio: 1; }
.lobby-hero-crossword span { position: relative; display: grid; place-items: center; background: #fdf9ee; border-radius: 3px; }
.lobby-hero-crossword span.blk { background: #241e16; }
.lobby-hero-crossword b { font-family: Georgia, 'Times New Roman', serif; font-weight: 700; font-size: clamp(12px, 1.8vw, 18px); color: #2b2620; line-height: 1; }
.lobby-hero-crossword .cw-num { position: absolute; top: 1px; left: 2px; font-style: normal; font-family: system-ui, sans-serif; font-size: clamp(6px, .85vw, 8px); color: #9a8f78; line-height: 1; }
/* Today's jigsaw photo on the velvet frame. */
.lobby-hero-board img { display: block; width: 100%; aspect-ratio: 7 / 4; object-fit: cover; border-radius: 8px; }
/* Let the sudoku card hug its (smaller) grid instead of stretching the column. */
/* Velvet-board hero (sudoku / crossword): drop the white card — the board is
   its own frame; centre the eyebrow + board + caption on the parchment. */
.lobby-hero-today:has(.lobby-hero-board) { width: fit-content; max-width: 100%; margin: 0 auto; background: none; border: 0; box-shadow: none; padding: 0; }
.lobby-hero-sudoku span { display: grid; place-items: center; border-right: 1px solid #e6dcc4; border-bottom: 1px solid #e6dcc4; font-family: Georgia, 'Times New Roman', serif; font-weight: 600; font-size: clamp(9px, 1.7vw, 13px); color: #2b2620; }
.lobby-hero-sudoku span[data-c="2"], .lobby-hero-sudoku span[data-c="5"] { border-right: 1.5px solid #9b917a; }
.lobby-hero-sudoku span[data-c="8"] { border-right: none; }
.lobby-hero-sudoku span[data-r="2"], .lobby-hero-sudoku span[data-r="5"] { border-bottom: 1.5px solid #9b917a; }
.lobby-hero-sudoku span[data-r="8"] { border-bottom: none; }
.lobby-hero-caption { margin-top: 9px; font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-size: 14px; color: #4a443b; text-align: center; line-height: 1.35; }
@media (max-width: 760px) {
  .lobby-hero { grid-template-columns: 1fr; gap: 20px; }
  .lobby-hero-today { max-width: 420px; }
}
/* Stacked but still wide (landscape phones, e.g. 740px): centre the hero so the
   capped today's-puzzle card doesn't sit left with a big blank gap beside it.
   Portrait phones (≤480px) keep their left-aligned layout. */
@media (min-width: 481px) and (max-width: 760px) {
  .lobby-hero { justify-items: center; }
  .lobby-hero-text { justify-content: center; max-width: 560px; }
  .lobby-hero-today { margin-left: auto; margin-right: auto; }
}

/* One card; short (not full-height) vertical separators between segments. */
.sd-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 26px; background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 16px 8px; box-shadow: 0 1px 2px rgba(60,50,30,.05); }
.sd-stat { position: relative; padding: 4px 18px; text-align: center; }
.sd-stat + .sd-stat::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 1px; height: 58px; background: var(--card-border); }
.sd-stat-ic { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; margin-bottom: 8px; }
.sd-stat-label { font-family: system-ui, sans-serif; font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: var(--ink-faint); }
.sd-stat-value { font-size: 28px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.sd-stat-value small { font-size: 14px; font-weight: 400; color: var(--ink-faint); }
.sd-stat-sub { font-family: system-ui, sans-serif; font-size: 12px; color: var(--ink-faint); }

.sd-section { margin-bottom: 26px; }
.sd-h2 { margin: 0 0 14px; font-size: 20px; color: var(--ink); }
.sd-viewall { font-family: system-ui, sans-serif; font-size: 13px; color: var(--accent-red); text-decoration: none; }
.sd-viewall:hover { text-decoration: underline; }

.sd-difficulties { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
/* Crossword lobby variants — 2 modes + a decorative crossword preview. */
.sd-difficulties--two { grid-template-columns: repeat(2, 1fr); }
.cr-mini { width: 96px; height: 96px; margin: 18px auto 12px; display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); grid-template-rows: repeat(var(--n, 5), 1fr); border: 2px solid var(--ink); background: var(--paper); overflow: hidden; }
.cr-mini span { border-right: 1px solid var(--card-border); border-bottom: 1px solid var(--card-border); }
.cr-mini span.blk { background: var(--ink); }
.sd-resume-badge { width: 54px; height: 54px; flex: 0 0 54px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(60,50,30,.22)); }
/* Crossword card: graphic (left half) | 2x2 stats (right half), centred. */
.cr-diff .cr-body { display: flex; flex-direction: column; gap: 14px; margin: 20px 18px 16px; flex: 1; }
.cr-diff .cr-body-left { display: flex; flex-direction: column; align-items: center; gap: 12px; }
/* Velvet board for the crossword difficulty cards — matches the sudoku tiles. */
.cr-diff .cr-mini { margin: 0 auto; width: 174px; height: 174px; gap: 2px; padding: 8px; border: 0; border-radius: 14px; overflow: visible; background: linear-gradient(160deg, #3b3328, #231d15); box-shadow: 0 6px 14px rgba(40,30,15,.26), inset 0 0 0 1.5px #b08a35; }
.cr-diff .cr-mini span { border: 0; border-radius: 2px; background: linear-gradient(180deg, #fdfaf0, #f0e9d5); box-shadow: inset 0 1px 0 #fff, 0 1px 1px rgba(0,0,0,.16); }
.cr-diff .cr-mini span.blk { background: #241e16; box-shadow: none; }
/* Dimensional "velvet" board — dark gold-edged frame, raised cream tiles. */
.cr-diff .sd-diff-mini { margin: 0 auto; width: 100%; max-width: 174px; aspect-ratio: 1; height: auto; gap: 5px; padding: 8px; border: 0; border-radius: 14px; background: linear-gradient(160deg, #3b3328, #231d15); box-shadow: 0 6px 14px rgba(40,30,15,.26), inset 0 0 0 1.5px #b08a35; }
.cr-diff .sd-diff-mini span { border: 0; border-radius: 6px; background: linear-gradient(180deg, #fdfaf0, #f0e9d5); box-shadow: inset 0 1px 0 #fff, inset 0 -2px 3px rgba(90,70,35,.2), 0 1px 2px rgba(0,0,0,.22); font-size: clamp(17px, 2vw, 27px); color: #2b2620; }
.cr-diff .sd-diff-mini span.filled { color: var(--c); }
.cr-diff .sd-diff-mini span.cand i { font-size: 10px; color: #8a8270; }
/* Candidate (pencil-mark) cells — Hard/Expert previews render a 3×3 of tiny
   numbers so the grids read like a real mid-solve. */
.sd-diff-mini span.cand { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 3px; }
.sd-diff-mini span.cand i { display: grid; place-items: center; font-family: system-ui, sans-serif; font-style: normal; font-weight: 600; font-size: 9px; line-height: 1; color: #8a8270; }
.cr-diff .sd-diff-blurb { margin: 0; }
.cr-diff .cr-stats { margin: 0; padding-top: 16px; border-top: 1px solid var(--card-border); gap: 16px 10px; }
@media (max-width: 560px) { .cr-diff .cr-body { grid-template-columns: 1fr; } }

/* Word Cube preview — 3×3 letter cube; powerplay shows each tile's 2nd letter. */
.wc-mini { width: 116px; height: 116px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 4px; }
/* Velvet board for the word-cube difficulty cards — matches the other games. */
.cr-diff .wc-mini { width: 174px; height: 174px; margin: 0 auto; gap: 6px; padding: 8px; border-radius: 14px; background: linear-gradient(160deg, #3b3328, #231d15); box-shadow: 0 6px 14px rgba(40,30,15,.26), inset 0 0 0 1.5px #b08a35; }
.cr-diff .wc-mini span { border: 0; border-radius: 6px; background: linear-gradient(180deg, #fdfaf0, #f0e9d5); box-shadow: inset 0 1px 0 #fff, inset 0 -2px 3px rgba(90,70,35,.2), 0 1px 2px rgba(0,0,0,.22); font-size: 27px; }
.cr-diff .wc-mini span.ctr { background: var(--c); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.cr-diff .wc-mini span.ctr i { color: rgba(255,255,255,.8); }
.wc-mini span { position: relative; display: grid; place-items: center; background: #fffdf7; border: 1px solid var(--card-border); border-radius: 7px; font-family: Georgia, serif; font-weight: 700; font-size: 23px; color: var(--ink); }
.wc-mini span.ctr { background: var(--c); color: #fff; border-color: var(--c); }
.wc-mini span i { position: absolute; top: 1px; right: 3px; font-style: normal; font-weight: 600; font-size: 8px; color: var(--ink-faint); }
.wc-mini span.ctr i { color: rgba(255,255,255,.78); }

/* Jigsaw preview — the real daily image with a grid overlay whose density (--g)
   reflects the piece count (25 coarse → 200 fine). */
.jig-mini { position: relative; width: 116px; height: 116px; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
.cr-diff .jig-mini { width: 150px; height: 150px; }
/* "Option B" cut-piece preview — the photo, cut into pieces (JS-generated SVG),
   sat in the velvet gold-edged frame to match the other games. */
.cr-diff .jig-cut { width: 100%; max-width: 280px; margin: 0 auto; padding: 9px; border-radius: 14px; background: linear-gradient(160deg, #3b3328, #231d15); box-shadow: 0 6px 14px rgba(40,30,15,.26), inset 0 0 0 1.5px #b08a35; }
.jig-piece-preview { display: block; line-height: 0; }
.jig-piece-preview svg { display: block; width: 100%; }
.jig-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.jig-grid { position: absolute; inset: 0; background-image: linear-gradient(to right, rgba(35,25,12,.4) 1px, transparent 1px), linear-gradient(to bottom, rgba(35,25,12,.4) 1px, transparent 1px); background-size: calc(100% / var(--g, 5)) calc(100% / var(--g, 5)); }
.jig-mini-sm { width: 64px; height: 64px; flex: 0 0 64px; }
.sd-diff { background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 0 0 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(60,50,30,.05); display: flex; flex-direction: column; }
.sd-diff-head { background: linear-gradient(180deg, color-mix(in srgb, var(--c), #fff 16%), var(--c)); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; }
.sd-diff-name { font-family: system-ui, sans-serif; font-weight: 700; font-size: 15px; letter-spacing: 1.5px; }
.sd-diff-pips { display: inline-flex; gap: 7px; flex: 0 0 auto; }
.sd-diff-pips i { width: 9px; height: 9px; transform: rotate(45deg); background: rgba(255,255,255,.32); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.sd-diff-pips i.on { background: #ffd97a; }
.sd-diff-mini { width: 92px; height: 92px; margin: 18px auto 12px; display: grid; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(3,1fr); border: 2px solid var(--ink); background: var(--paper); }
.sd-diff-mini span { display: grid; place-items: center; border-right: 1px solid var(--card-border); border-bottom: 1px solid var(--card-border); font-family: Georgia, serif; font-size: 16px; font-weight: 700; color: #2b2620; }
.sd-diff-mini span.filled { color: var(--c); }
.sd-diff-blurb { margin: 0 16px 12px; text-align: center; font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-size: 14.5px; color: var(--c); }
.sd-diff-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 10px; margin: auto 16px 14px; padding-top: 14px; border-top: 1px solid var(--card-border); }
.sd-ds { display: flex; flex-direction: column; align-items: center; text-align: center; }
.sd-ds-top { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 7px; }
.sd-ds-ic { display: inline-flex; }
.sd-ds-ic svg { width: 18px; height: 18px; }
.sd-ds-v { font-family: Georgia, serif; font-weight: 700; font-size: 26px; color: var(--ink); line-height: 1; }
.sd-ds-l { font-family: system-ui, sans-serif; font-size: 12.5px; letter-spacing: .5px; text-transform: uppercase; color: var(--ink-faint); margin-top: 5px; }
.sd-play { display: block; width: 90%; margin: 0 auto; text-align: center; background: linear-gradient(180deg, color-mix(in srgb, var(--c), #fff 14%), var(--c)); color: #fff; border: 0; border-radius: 10px; padding: 14px; font-family: system-ui, sans-serif; font-weight: 700; font-size: 14.5px; letter-spacing: .6px; text-transform: uppercase; cursor: pointer; text-decoration: none; box-shadow: 0 3px 8px rgba(40,30,15,.2); }
.sd-play:hover { filter: brightness(1.08); }
.sd-play.done { background: #e4dcc6; color: var(--ink-soft); cursor: default; }

/* In-progress footer — resume details (started + progress) sit beside the
   Resume button, so each mode card carries its own "continue playing" state. */
.sd-foot { display: flex; align-items: center; gap: 14px; margin: 4px 16px 0; }
.sd-foot .sd-play { width: auto; margin: 0; flex: 0 0 auto; padding: 11px 22px; }
/* Revealed-solution state — muted "View" button (re-opens the grid read-only). */
.sd-play.sd-play--ghost { background: #efe8d6; color: #6b6357; box-shadow: none; }
.sd-play.sd-play--ghost:hover { background: #e6ddc6; filter: none; }
.sd-foot form { margin: 0; flex: 0 0 auto; }
.sd-resume-inline { flex: 1; min-width: 0; }
.sd-resume-inline .sd-resume-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-resume-prog { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.sd-resume-prog .sd-resume-bar { flex: 1; margin: 0; max-width: none; }
.sd-resume-pct { flex: 0 0 auto; font-family: system-ui, sans-serif; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
@media (max-width: 480px) { .sd-foot { flex-direction: column; align-items: stretch; } .sd-foot .sd-play, .sd-foot form { width: 100%; } .sd-foot .sd-play { display: block; } }

.sd-resume-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }
.sd-resume { display: flex; align-items: center; gap: 18px; background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 2px rgba(60,50,30,.05); }
.sd-resume-mini { width: 64px; height: 64px; flex: 0 0 64px; display: grid; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(3,1fr); border: 2px solid var(--ink); background: var(--paper); }
.sd-resume-mini span { display: grid; place-items: center; border-right: 1px solid var(--card-border); border-bottom: 1px solid var(--card-border); font-family: Georgia, serif; font-size: 11px; color: var(--ink-soft); }
.sd-resume-main { flex: 1; min-width: 0; }
.sd-resume-title { font-family: system-ui, sans-serif; font-weight: 700; font-size: 15px; color: var(--ink); }
.sd-resume-meta { font-family: system-ui, sans-serif; font-size: 12px; color: var(--ink-faint); }
.sd-resume-bar { height: 6px; background: #e7ddc4; border-radius: 4px; margin: 7px 0 4px; overflow: hidden; max-width: 320px; }
.sd-resume-bar span { display: block; height: 100%; background: var(--c, #4e7d3a); }
.sd-continue { flex: 0 0 auto; background: var(--accent-green); color: #fff; border-radius: 8px; padding: 11px 22px; font-family: system-ui, sans-serif; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; text-decoration: none; }
.sd-continue:hover { filter: brightness(1.08); }

/* Split: main content (~80%) + vertical torn-paper achievements column. */
.sd-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 24px; align-items: start; }
.sd-main { min-width: 0; }

/* Nudge the column down so its heading clears the floating top-bar user chrome. */
.sd-ach-col { margin-top: 80px; }
.sd-ach-col-title { margin: 0 0 14px; font-size: 18px; color: var(--ink); }
.sd-ach-stack { display: flex; flex-direction: column; gap: 16px; }
.sd-ach-viewall { display: inline-block; margin-top: 14px; font-family: system-ui, sans-serif; font-size: 12.5px; color: var(--accent-red); text-decoration: none; }
.sd-ach-viewall:hover { text-decoration: underline; }

/* Torn-paper card (Technique 5) — same #torn-paper filter + pin as the home
   Bowlsy Achievements strip, sized for the narrow column. */
.sd-ach-card { position: relative; isolation: isolate; padding: 28px 16px 20px; margin: 6px 4px; text-align: center; transform: rotate(-0.8deg); transition: transform .18s ease; }
.sd-ach-card:hover { transform: rotate(0deg) scale(1.02); }
.sd-ach-card:nth-child(2n) { transform: rotate(0.8deg); }
.sd-ach-card:nth-child(3n) { transform: rotate(-0.4deg); }
.sd-ach-card:nth-child(4n) { transform: rotate(1.1deg); }
.sd-ach-card::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--paper); filter: url(#torn-paper); }
.sd-ach-card-badge { width: 94px; height: 94px; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(60,50,30,.28)); }
.sd-ach-card-name { font-family: Georgia, serif; font-weight: 700; font-size: 18px; color: var(--ink); margin-top: 10px; line-height: 1.2; }
.sd-ach-card-desc { font-family: system-ui, sans-serif; font-size: 14px; color: var(--ink-soft); line-height: 1.45; margin-top: 6px; }

@media (max-width: 1180px) {
  .sd-stats { grid-template-columns: repeat(2, 1fr); gap: 14px 0; }
  /* In 2-col, only the right-column items keep a left separator. */
  .sd-stat:nth-child(odd)::before { display: none; }
  .sd-difficulties { grid-template-columns: repeat(2, 1fr); }
}
/* Stack the achievements column under the main content when it gets tight,
   reflowing the torn-paper cards into a responsive grid. Kicks in at 1100px so
   iPad Pro portrait (1024px) drops the column below the game modes too. */
@media (max-width: 1100px) {
  .sd-layout { grid-template-columns: 1fr; }
  .sd-ach-stack { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px 14px; }
  /* Back to in-flow so the floated user chrome can't overlap stacked content. */
  .ch-topbar-bare { position: static; padding: 18px 30px 0; }
  .sd-ach-col { margin-top: 0; }
}
@media (max-width: 700px) {
  .sd-difficulties { grid-template-columns: 1fr; }
  .sd-resume { flex-wrap: wrap; }
}

/* ---- Play pages, phone landscape: the board gets the whole screen ----
   The fixed BOWLSY.news mobile bar eats ~15% of an iPhone's landscape height
   before Safari takes its own share. On play pages (body.ch-play) we collapse
   it to a small floating burger — the drawer still opens — and drop the main
   padding so the game reclaims the full viewport. */
/* viewport-fit=cover on play pages: keep game content out of the notch /
   Dynamic Island in landscape (env() is 0 on plain screens). */
.ch-play .ch-main { padding-left: env(safe-area-inset-left, 0); padding-right: env(safe-area-inset-right, 0); }

@media (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  .ch-play .ch-mobilebar {
    left: env(safe-area-inset-left, 0); right: auto; top: 8px; margin-left: 8px;
    height: 38px; width: 38px; padding: 0; justify-content: center;
    border-radius: 50%; background: rgba(18, 39, 30, .55);
    box-shadow: none; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  }
  .ch-play .ch-mobilebar-logo { display: none; }
  .ch-play .ch-burger { width: 34px; height: 34px; gap: 3px; padding: 9px; }
  .ch-play .ch-main { padding-top: 0; }
}

/* Phone: the gazette masthead can't fit on one nowrap line — let it wrap
   (headline on its own line, tagline + link sharing the next). */
@media (max-width: 640px) {
  .gazette-head { flex-wrap: wrap; gap: 4px 12px; }
  .gazette-head h1 { font-size: 17px; letter-spacing: 1.5px; width: 100%; }
}
