/* Daily Brain Puzzles: public site styles (portal pages around the puzzle embeds). */
:root {
  --bg: #0e1016;
  --bg2: #131620;
  --panel: #181c27;
  --panel2: #1f2432;
  --line: #2a3042;
  --text: #eef0f6;
  --muted: #9ba3b7;
  --faint: #6c748a;
  --accent: #8d9bff;
  --accent-ink: #0d1020;
  --coral: #ff7b6b;
  --mint: #5fd4a8;
  --gold: #ffc861;
  --radius: 16px;
  --wrap: 1180px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: radial-gradient(1200px 600px at 70% -200px, #1b2140 0%, transparent 70%), var(--bg);
  color: var(--text); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(28px, 4.2vw, 46px); font-weight: 850; }
h2 { font-size: clamp(21px, 2.4vw, 27px); font-weight: 800; }
h3 { font-size: 17px; font-weight: 750; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- header / footer ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(14, 16, 22, 0.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 14px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 850; font-size: 18px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.top .wrap { position: relative; }
.top .grow { flex: 1; }
.gmenu summary { list-style: none; user-select: none; }
.gmenu summary::-webkit-details-marker { display: none; }
.gmenu .caret { font-size: 11px; transition: transform 0.15s; }
.gmenu[open] .caret { transform: rotate(180deg); }
.gmenu[open] summary { border-color: #3b4560; background: #252b3c; }
.gpanel { position: absolute; top: 58px; left: 16px; width: min(660px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 12px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55); z-index: 30; animation: pop 0.15s ease; }
.ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px; max-height: min(70vh, 520px); overflow: auto; }
.gitem { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; color: var(--text); }
.gitem:hover, .gitem[aria-current] { background: var(--panel2); text-decoration: none; }
.gitem img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; flex: none; }
.gitem b { display: block; font-size: 14.5px; line-height: 1.25; }
.gitem small { color: var(--muted); font-size: 12.5px; }
.gall { display: block; text-align: right; padding: 8px 8px 2px; font-weight: 700; font-size: 14px; }
.streak { display: none; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; font-size: 14px; white-space: nowrap; }
.streak.on { display: flex; }
.foot { margin-top: auto; border-top: 1px solid var(--line); padding: 28px 0 36px; color: var(--faint); font-size: 14px; }
.foot .wrap { display: grid; grid-template-columns: minmax(220px, 1fr) 2fr; gap: 18px 40px; align-items: start; }
.foot-brand p { margin: 8px 0 0; }
.foot-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 20px; }
.foot a { color: var(--muted); }

/* ---------- buttons / chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font: 700 15px/1 system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: #3b4560; background: #252b3c; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.07); background: var(--accent); }
.btn.big { padding: 15px 24px; font-size: 17px; border-radius: 14px; }
.btn.small { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line);
  color: var(--muted); font-size: 14px; font-weight: 650; }
a.chip:hover { color: var(--text); text-decoration: none; border-color: #3b4560; }
.chip[aria-current] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chip[aria-current] .muted { color: inherit; opacity: 0.7; }
.lvl { font-size: 12px; font-weight: 750; padding: 2px 8px; border-radius: 999px; text-transform: capitalize; }
.lvl.easy { background: rgba(95, 212, 168, 0.15); color: var(--mint); }
.lvl.medium { background: rgba(255, 200, 97, 0.15); color: var(--gold); }
.lvl.hard { background: rgba(255, 123, 107, 0.15); color: var(--coral); }

/* ---------- home ---------- */
.hero-bg { border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, var(--bg) 0%, rgba(14, 16, 22, 0.92) 38%, rgba(14, 16, 22, 0.6) 70%, rgba(14, 16, 22, 0.8) 100%),
    url('img/hero-wide.webp') right center / cover no-repeat, var(--bg); }
.hero { padding: 46px 16px 40px; display: grid; grid-template-columns: 1fr minmax(0, 470px); gap: 40px; align-items: center; }
.hero p.lead { font-size: clamp(17px, 1.6vw, 19px); color: var(--muted); max-width: 560px; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 14px; }
.eyebrow { display: inline-block; font-size: 13px; font-weight: 750; letter-spacing: 0.02em; color: var(--accent); background: rgba(141, 155, 255, 0.12);
  border: 1px solid rgba(141, 155, 255, 0.3); padding: 5px 12px; border-radius: 999px; margin-bottom: 16px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 22px; color: var(--muted); font-size: 14px; }
.hero-stats b { color: var(--text); font-size: 20px; margin-right: 4px; }
.daily-panel { background: rgba(24, 28, 39, 0.9); backdrop-filter: blur(12px); border: 1px solid #343c55; border-radius: 22px; padding: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5); }
.dhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dhead h2 { margin: 0 0 2px; font-size: 21px; }
.dtimer { font-size: 12.5px; font-weight: 700; color: var(--gold); background: rgba(255, 200, 97, 0.12); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.dbar { height: 8px; background: var(--panel2); border-radius: 999px; overflow: hidden; margin: 14px 0 6px; }
.dbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--mint), var(--accent)); border-radius: 999px; transition: width 0.4s ease; }
.dcount { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.dcount b { color: var(--text); }
.dlist { display: flex; flex-direction: column; gap: 6px; max-height: 620px; overflow: auto; }
.drow { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 14px;
  color: var(--text); background: rgba(255, 255, 255, 0.025); border: 1px solid transparent; }
.drow:hover { text-decoration: none; border-color: #3b4560; background: var(--panel2); }
.dicon { width: 44px; height: 44px; border-radius: 11px; object-fit: cover; }
.dtext { min-width: 0; }
.dtext b { display: block; font-size: 14.5px; }
.dtext span { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dgo::after { content: "Play →"; color: var(--accent); font-weight: 750; font-size: 13.5px; white-space: nowrap; }
.drow.done { opacity: 0.72; }
.drow.skel { pointer-events: none; }
.drow.skel .dicon, .drow.skel b, .drow.skel .dtext span { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--panel2) 25%, #2a3044 50%, var(--panel2) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.drow.skel b { width: 40%; height: 14px; margin-bottom: 6px; }
.drow.skel .dtext span { width: 70%; height: 11px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.drow.done .dgo::after { content: "✓ Solved"; color: var(--mint); }
section { padding: 26px 0; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.sec-head h2 { margin: 0; }
.progress { display: none; gap: 12px; flex-wrap: wrap; }
.progress.on { display: flex; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; min-width: 130px; }
.stat b { display: block; font-size: 24px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.grid.types { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { position: relative; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; color: var(--text); transition: transform 0.12s, border-color 0.12s; }
.card:hover { transform: translateY(-2px); border-color: #3b4560; text-decoration: none; }
.card .thumb { aspect-ratio: 5 / 6; background: var(--bg2); overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.types .card .thumb { aspect-ratio: 3 / 2; }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.card .kicker { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 650; }
.card .title { font-weight: 750; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .desc { color: var(--muted); font-size: 14px; }
.card.done::after { content: "✓ Solved"; position: absolute; top: 10px; right: 10px; background: var(--mint); color: #062218; font-size: 12px; font-weight: 800;
  padding: 3px 9px; border-radius: 999px; }
.card .badge { position: absolute; top: 10px; left: 10px; background: rgba(14, 16, 22, 0.85); color: var(--gold); font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.card.game .thumb { display: block; }
.card.game .title a { color: var(--text); }
.card.game .kicker a { color: var(--muted); text-transform: capitalize; }
.card.game .kicker a:hover { color: var(--text); }
.plays { margin-left: auto; font-size: 12px; color: var(--faint); }
.page-head.game-head { position: relative; margin-top: 22px; padding: 30px 26px 26px; border-radius: 22px; border: 1px solid var(--line); overflow: hidden;
  background: linear-gradient(90deg, rgba(14, 16, 22, 0.97) 30%, rgba(14, 16, 22, 0.72) 60%, rgba(14, 16, 22, 0.35)), var(--cover, none) right center / cover no-repeat, var(--panel); }
.page-head.game-head p { max-width: 620px; }

/* ---------- type page ---------- */
.page-head { padding: 34px 0 6px; }
.page-head p { color: var(--muted); max-width: 760px; font-size: 17px; }
.crumbs { font-size: 14px; color: var(--faint); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 14px 0 18px; }
.pager { display: flex; gap: 8px; justify-content: center; margin: 26px 0 6px; flex-wrap: wrap; }
.howto { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
.howto ol { margin: 0; padding-left: 20px; color: var(--muted); }
.howto li { margin: 4px 0; }

/* ---------- puzzle page ---------- */
.play { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 28px; padding: 24px 0 10px; align-items: start; }
.frame { width: 100%; background: #0f1115; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45); }
.frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.side h1 { font-size: clamp(24px, 3vw, 34px); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; color: var(--muted); font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.dstrip { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; margin: 2px 0 16px; }
.dstrip-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.dstrip-head span { color: var(--muted); font-size: 13.5px; }
.dstrip-icons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.di { position: relative; width: 42px; height: 42px; border-radius: 11px; overflow: hidden; border: 2px solid transparent; transition: transform 0.12s; }
.di:hover { transform: translateY(-2px); }
.di img { width: 100%; height: 100%; object-fit: cover; }
.di.done img { filter: grayscale(0.5) brightness(0.45); }
.di i { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; color: var(--mint); font-style: normal; font-weight: 900; font-size: 20px; }
.di.done i { display: flex; }
.di.cur { border-color: var(--accent); }
.dall { color: var(--mint); font-weight: 700; font-size: 14.5px; }
.result { display: none; background: linear-gradient(135deg, rgba(95, 212, 168, 0.16), rgba(141, 155, 255, 0.12)); border: 1px solid rgba(95, 212, 168, 0.45);
  border-radius: var(--radius); padding: 16px 18px; margin: 4px 0 16px; }
.result.on { display: block; animation: pop 0.35s ease; }
.result b.big { font-size: 20px; display: block; margin-bottom: 4px; }
.result .actions { margin: 12px 0 0; }
@keyframes pop { from { transform: scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
.prose { color: var(--muted); }
.prose h2 { color: var(--text); font-size: 20px; margin-top: 18px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--mint); color: #062218; font-weight: 800;
  padding: 10px 18px; border-radius: 999px; opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 50; }
.toast.on { opacity: 1; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 28px; gap: 26px; }
  .hero-bg { background: linear-gradient(180deg, rgba(14, 16, 22, 0.55) 0%, var(--bg) 340px), url('img/hero-wide.webp') 70% top / auto 340px no-repeat, var(--bg); }
  .gpanel { position: fixed; top: 64px; left: 8px; right: 8px; width: auto; }
  .play { grid-template-columns: 1fr; padding-top: 12px; gap: 18px; }
  /* Phones: give the puzzle (nearly) the whole screen, like the full-screen share view. */
  .frame { border-radius: 14px; aspect-ratio: auto !important; max-width: none !important; height: calc(100svh - 82px); min-height: 460px; }
  .foot .wrap { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .top .wrap { gap: 8px; }
  .brand span { display: none; }
  .drow { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .drow .lvl { display: none; }
  .page-head.game-head { padding: 22px 18px; }
  .grid, .grid.types { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card .body { padding: 10px; }
  .card .desc { display: none; }
  .btn.big { width: 100%; }
}
