@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;600;700;800&display=swap');
:root{color-scheme:light;--paper:#f6f1e7;--card:#fffdf8;--ink:#2a2f3a;--muted:#736c7c;--line:#e2dccd;--plum:#5b3f8f;--amber:#c27f22;--teal:#1f6f78;--gold:#d9a531;--danger:#c23b4c}
*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font-family:'DM Sans',system-ui,sans-serif}
button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;cursor:pointer;touch-action:manipulation;border:0;color:inherit}button:disabled{cursor:default}
button:focus-visible,a:focus-visible{outline:3px solid var(--plum);outline-offset:3px}a{color:inherit;text-decoration:none}[hidden]{display:none!important}
.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.shell{max-width:1220px;margin:auto;padding:24px 38px 44px}
header{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);padding-bottom:18px}
.brand{font:800 16px 'Manrope',sans-serif;letter-spacing:2px}.brand span{color:var(--amber)}
.utilities{display:flex;gap:8px}.utilities button{padding:9px 13px;border:1px solid var(--line);border-radius:8px;background:transparent;font-size:12px;font-weight:700}.utilities button:disabled{opacity:.45}
.heading{display:flex;align-items:flex-end;justify-content:space-between;margin:34px 0 25px}
.eyebrow{font-size:10px;font-weight:800;letter-spacing:1.8px;margin:0 0 12px;color:var(--plum)}
h1{font:800 clamp(38px,5vw,62px)/1.05 'Manrope',sans-serif;letter-spacing:-3px;margin:0}h1 em{font-style:normal;color:var(--plum)}
.tagline{color:var(--muted);font-size:14px;line-height:1.7;margin:0 0 4px;text-align:right}
.layout{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:30px}
.brew{border:1px solid var(--line);border-radius:20px;padding:20px;background:var(--card);box-shadow:0 12px 40px #3a2f1a08}
.hud{display:grid;grid-template-columns:1fr 1.35fr .8fr 1.05fr;padding-bottom:15px;border-bottom:1px solid var(--line)}
.hud>div{padding-left:15px;border-left:1px solid var(--line);min-width:0}.hud>div:first-child{padding-left:0;border:0}
.hud small{display:block;color:var(--muted);font-size:9px;letter-spacing:1px;font-weight:700}
.hud strong{display:flex;align-items:center;gap:6px;font:800 23px 'Manrope',sans-serif;margin-top:6px;white-space:nowrap;min-height:30px}
.hud-material span:last-child{font-size:15px;overflow:hidden;text-overflow:ellipsis}.hud .icon{width:28px;height:28px}
.goal{font-size:15px!important;overflow:hidden;text-overflow:ellipsis}
.stars{display:block;font-size:11px;letter-spacing:1px;color:var(--gold);margin-top:2px}
.opening{display:flex;align-items:center;gap:14px;background:#efe8f6;padding:18px;border-radius:12px;margin:16px 0}
.sun{font-size:38px;color:var(--plum)}.opening h2{font:800 18px 'Manrope',sans-serif;margin:0 0 6px}.opening p{font-size:12px;line-height:1.5;margin:0;color:#56506a}
.opening-condition{margin-top:8px!important}.opening-ai-note{margin-top:8px!important;color:var(--plum)!important;font-weight:600}.opening-actions{display:flex;gap:8px;margin-left:auto}
.primary,.secondary{padding:12px 15px;font-size:12px;font-weight:800;border-radius:9px;transition:transform .12s}
.primary{background:var(--plum);color:#fff}.secondary{background:#efe8f6;color:var(--plum);border:1px solid #dccfee}
.primary:active,.secondary:active{transform:translateY(2px)}.primary:disabled,.secondary:disabled{opacity:.55}
.text-button{background:none;color:var(--plum);padding:7px;font-size:11px;font-weight:700}.text-button:disabled{opacity:.45}
.day-line{display:flex;justify-content:space-between;gap:10px;font-size:10px;color:var(--muted);padding:12px 0 6px}.day-line span:first-child{color:var(--plum);font-weight:700}
.rule-impact{font-size:11px;color:var(--muted);margin:0 0 12px}.small{font-size:11px;color:var(--muted)}
.icon{display:inline-block;width:40px;height:40px;background:center/contain no-repeat;flex:none}
.stage{display:flex;justify-content:center}
/* The board: 16 cells underneath, tiles positioned by --r/--c from the engine state. */
.board{--gap:10px;position:relative;width:min(100%,480px);aspect-ratio:1;padding:var(--gap);border-radius:18px;background:linear-gradient(#4a3b2e,#2f2419);box-shadow:inset 0 3px 0 #ffffff1c,0 14px 30px #2a1f1a33;touch-action:none;user-select:none;-webkit-user-select:none;cursor:grab}
.board:focus-visible{outline:3px solid var(--plum);outline-offset:3px}
.cells,.tiles{position:absolute;inset:var(--gap)}
.cells{display:grid;grid-template-columns:repeat(4,1fr);grid-template-rows:repeat(4,1fr);gap:var(--gap)}
.cells span{border-radius:12px;background:#ffffff14;box-shadow:inset 0 2px 6px #0004}
.tile{position:absolute;left:0;top:0;width:calc((100% - 3 * var(--gap)) / 4);height:calc((100% - 3 * var(--gap)) / 4);transform:translate(calc(var(--c,0) * (100% + var(--gap))),calc(var(--r,0) * (100% + var(--gap))));transition:transform .12s ease-out;will-change:transform}
.tile.leaving{z-index:0}.tile:not(.leaving){z-index:1}
.tile-face{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;border-radius:12px;box-shadow:inset 0 -3px 0 #0002,0 2px 4px #0003;overflow:hidden}
.tile-icon{width:62%;aspect-ratio:1;background:center/contain no-repeat;flex:none}
.tile-name{font:800 11px/1 'Manrope',sans-serif;color:#2a2f3a;max-width:94%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tile-value{position:absolute;top:5px;left:7px;font:800 10px/1 'Manrope',sans-serif;color:#2a2f3acc}
.tile[data-level="10"] .tile-face{box-shadow:inset 0 -3px 0 #0002,0 0 0 2px var(--gold),0 0 14px #d9a53199}
.tile.spawned .tile-face{animation:appear .16s ease-out .08s backwards}
.tile.merged .tile-face{animation:merge .2s ease-out}
@keyframes appear{from{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}
@keyframes merge{0%{transform:scale(.85)}55%{transform:scale(1.12)}100%{transform:scale(1)}}
.paused-note{display:none;position:absolute;inset:0;margin:0;align-items:center;justify-content:center;font:800 22px 'Manrope',sans-serif;color:#fff;background:#2a1f3a99;border-radius:18px;letter-spacing:2px}
body[data-phase=paused] .paused-note{display:flex}
body[data-phase=won] .tiles,body[data-phase=failed] .tiles{opacity:.82}
.ladder{display:grid;grid-template-columns:repeat(11,minmax(0,1fr));gap:4px;list-style:none;padding:0;margin:14px 0 0}
.ladder li{display:flex;flex-direction:column;align-items:center;gap:2px;padding:5px 1px;border-radius:9px;background:#f6f2fa;opacity:.55;min-width:0}
.ladder li.known{opacity:.85}.ladder li.made{opacity:1;background:#efe6fa}.ladder li.top{box-shadow:inset 0 0 0 2px var(--plum)}
.ladder .icon{width:30px;height:30px}.ladder small{font-size:8px;font-weight:700;color:var(--muted);text-align:center;line-height:1.15;white-space:nowrap}
.notice{font-size:12px;line-height:1.5;color:var(--plum);min-height:36px;margin:11px 0}
.board-actions{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:10px}.board-actions .text-button{white-space:nowrap}.controls{font-size:9px;line-height:1.6;color:var(--muted);margin:0}
.story-card,.result{background:#f1ecf7;border:1px solid #e0d6ee;padding:22px;border-radius:14px}
.story-card h2,.result h2{font:800 25px/1.25 'Manrope',sans-serif;letter-spacing:-.8px;margin:0 0 12px}
.story-card>p:not(.eyebrow),.result>p{font-size:12px;line-height:1.75;color:#5c566a}
.rule-note{padding:11px;border-left:2px solid #b9a6d8;background:#fff8;font-size:11px;line-height:1.6;color:var(--plum);margin:15px 0}
.story-card .secondary{width:100%;background:var(--plum);color:#fff}.story-card .small{font-size:9px!important;margin-bottom:0}
.result{margin-top:16px;background:#f6ecdc;border-color:#eadbc3}.reflection{padding:12px;border:1px dashed #d6bc98;border-radius:9px}
.reflection small{font-size:8px;letter-spacing:1px;color:#a27950;font-weight:800}.reflection p{font-size:12px;line-height:1.7;margin:7px 0 0}
.result-actions{display:grid;gap:8px;margin-top:16px}
.field-guide{margin:25px 0 20px;padding:0 6px}.field-guide h3{font:800 15px 'Manrope',sans-serif;margin:0 0 12px}.field-guide p{font-size:11px;color:var(--muted);line-height:1.7;margin:8px 0}.field-guide b{color:var(--ink)}
.game-help-links{display:flex;flex-wrap:wrap;align-items:center;gap:6px 16px;margin:14px 0}
.game-help-links a,.game-help-links button{display:inline-flex;align-items:center;min-height:44px;padding:0 8px;touch-action:manipulation;background:transparent}
.game-help-links .play-guide-link{color:var(--plum);font-size:14px;text-decoration:underline;text-underline-offset:3px}.catalog{font-size:11px;font-weight:700}
#help-panel{width:min(560px,calc(100vw - 24px));max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);padding:0;border:1px solid var(--line);border-radius:16px;background:var(--paper);color:var(--ink);overflow:hidden;box-shadow:0 18px 70px #2a2f3a33}
#help-panel::backdrop{background:#2a2f3a80}
.lab-help{display:flex;flex-direction:column;max-height:calc(100dvh - 24px)}
.help-body{min-height:0;overflow:auto;overscroll-behavior:contain;padding:22px;line-height:1.65;overflow-wrap:anywhere}
.help-body h2{font:800 24px/1.25 'Manrope',sans-serif;margin:0 0 14px}.help-body p,.help-steps{font-size:14px}
.help-state{padding:12px;border-radius:9px;background:#efe8f6;color:var(--plum)}
.help-steps{padding-left:22px}.help-steps li{padding-left:4px;margin:12px 0}.help-body .help-keys{font-size:12px;color:var(--muted)}
.help-full-guide{display:inline-flex;align-items:center;min-height:44px;color:var(--plum);text-decoration:underline;text-underline-offset:3px}
.help-actions{flex:0 0 auto;border-top:1px solid var(--line);padding:14px 22px;background:var(--paper)}.help-actions button{width:100%;min-height:44px;font-size:14px;white-space:normal}
body[data-phase=paused] .brew{border-color:#cdbfe2}body[data-phase=paused] .day-line span:first-child:before{content:'PAUSED · '}
@media(max-width:900px){.shell{padding:18px 22px 30px}.layout{grid-template-columns:minmax(0,1fr) 250px;gap:18px}.brew{padding:15px}.opening{flex-wrap:wrap}.opening-actions{width:100%;margin-left:0}.opening-actions button{flex:1}.tagline{display:none}}
/* Keep the HUD clear of the mobile sticky header when a board starts or practice begins. */
.brew,.result{scroll-margin-top:76px}
@media(max-width:700px){.shell{padding:12px 12px 24px}header{position:sticky;top:0;z-index:3;background:var(--paper);padding:6px 0 12px}.brand{font-size:13px;letter-spacing:1.2px}.utilities button{padding:8px 10px;font-size:10px;min-height:44px}.heading{margin:21px 5px 18px}.eyebrow{font-size:9px;letter-spacing:1.3px}h1{font-size:38px;letter-spacing:-2px}.layout{display:block}.brew{padding:12px;border-radius:15px}.hud{grid-template-columns:.95fr 1.3fr .75fr 1fr}.hud>div{padding-left:8px}.hud small{font-size:9px;letter-spacing:.4px}.hud strong{font-size:19px;gap:4px}#score{font-size:17px}.goal{font-size:12px!important}.hud-material span:last-child{font-size:12px}.hud .icon{width:24px;height:24px}.opening{margin:12px 0;padding:13px}.opening .sun{display:none}.opening h2{font-size:16px}.opening p{font-size:12px}.day-line{padding:10px 0 4px}.rule-impact{margin-bottom:10px}.board{--gap:7px;border-radius:14px}.cells span,.tile-face{border-radius:9px}.tile-name{font-size:9px}.tile-value{font-size:9px;top:4px;left:5px}.ladder{gap:2px}.ladder li{padding:4px 0}.ladder .icon{width:24px;height:24px}.ladder small{font-size:6.5px;letter-spacing:-.3px}.notice{font-size:12px}.controls{font-size:10px}aside{margin-top:18px}.help-body{padding:16px}.help-actions{padding:12px 16px}.help-body h2{font-size:22px}button{min-height:44px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{transition:none!important;animation:none!important}}
/* Reviewed goal choices sit with the start controls, including the compact feed. */
.opening-copy{min-width:0;flex:1}.opening-goals{min-width:0;margin:14px 0 0;padding:0;border:0}.opening-goals legend{font-size:12px;font-weight:800;margin:0 0 8px}.goal-options{display:flex;flex-wrap:wrap;gap:6px}.goal-choice{min-height:44px;padding:9px 11px;border:1px solid #b7c8c4;border-radius:8px;background:#fff9;color:var(--ink);font-size:11px;font-weight:700;line-height:1.35;text-align:left;white-space:normal}.goal-choice[aria-pressed=true]{background:var(--teal,var(--green));color:#fff;border-color:currentColor}.goal-choice:disabled{opacity:.6}.opening-goals p{margin:8px 0 0;font-size:11px;line-height:1.5;color:var(--muted)}.goal-choice:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
@media(max-width:700px){.goal-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}.goal-choice{font-size:10px;padding:8px 6px}.opening-goals{margin-top:10px}}
.cc-embed .opening-goals{margin-top:10px}.cc-embed .opening-goals p{font-size:10px}.cc-embed .opening .opening-ai-note{font-size:10px}

.ai-choice{display:flex;align-items:center;flex-wrap:wrap;gap:4px 12px;margin-top:10px}.ai-choice button{min-height:44px;border:1px solid var(--line);border-radius:8px;background:#fff8;padding:9px 12px;font-size:12px}.ai-choice button:disabled{cursor:default;opacity:.65}.preview-date{font-size:10px;color:var(--muted)}.ai-choice p{flex:0 0 100%;margin:0;font-size:11px;line-height:1.5}.cc-embed .ai-choice p{font-size:10px}

/* Inside the /play/ feed (html.cc-embed, set by play-bridge.js): no site chrome, and the
   opening, HUD and board share one screen. The opening sits over the board. */
.cc-embed .brand,.cc-embed .heading,.cc-embed .story-card,.cc-embed .field-guide,.cc-embed .controls,.cc-embed .catalog{display:none}
.cc-embed .shell{position:relative;display:flex;flex-direction:column;height:100vh;height:100dvh;max-width:1220px;padding:8px 12px 10px}
.cc-embed header{position:static;justify-content:flex-end;border:0;padding:0 0 6px;background:none;z-index:auto}
.cc-embed .game-help-links{position:absolute;top:8px;left:12px;margin:0;z-index:3}
.cc-embed .game-help-links .play-guide-link{min-height:44px;padding:0 4px;font-size:0}
.cc-embed .game-help-links .play-guide-link::before{content:'How to play';font-size:12px;font-weight:700}
.cc-embed .layout{flex:1;min-height:0;grid-template-columns:minmax(0,1fr) auto;gap:16px}
.cc-embed aside{min-height:0;overflow:auto}
.cc-embed .brew{display:grid;min-height:0;padding:12px;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto auto auto minmax(0,1fr) auto auto auto;grid-template-areas:"hud" "line" "status" "impact" "stage" "ladder" "notice" "actions"}
.cc-embed .hud{grid-area:hud;padding-bottom:10px}.cc-embed .day-line{grid-area:line;padding:8px 0 2px}.cc-embed #progress-status{grid-area:status;margin:0}
.cc-embed .rule-impact{grid-area:impact;margin:0 0 8px}.cc-embed .ladder{grid-area:ladder;margin-top:8px}.cc-embed .notice{grid-area:notice;margin:6px 0 0;min-height:36px}
.cc-embed .board-actions{grid-area:actions;justify-content:flex-end;margin-top:0}
.cc-embed .stage{grid-area:stage;min-height:0;align-items:center;container-type:size}
.cc-embed .board{width:min(100%,100cqh,480px)}
.cc-embed .opening{max-height:calc(100dvh - 150px);overflow:auto;overscroll-behavior:contain;grid-area:stage;z-index:2;align-self:center;justify-self:center;flex-wrap:wrap;max-width:520px;margin:0 6px;box-shadow:0 10px 34px #1d16288c}
.cc-embed .opening-actions{width:100%;margin-left:0}.cc-embed .opening-actions button{flex:1}
.cc-embed .result{display:flex;flex-direction:column;width:280px;margin-top:0}.cc-embed .result>*{margin-top:0}
.cc-embed .result-actions{order:1;margin:0 0 14px}.cc-embed .reflection{order:2}
@media(max-width:700px){
  .cc-embed .shell{padding:6px 8px 8px}.cc-embed .game-help-links{top:10px;left:8px}
  .cc-embed .layout{display:flex;flex-direction:column}.cc-embed .brew{flex:1;min-height:420px;padding:10px}.cc-embed aside{flex:none;margin:0;overflow:visible}
  .cc-embed .ladder .icon{width:24px;height:24px}
  .cc-embed .result{width:auto;margin-top:10px}
  .cc-embed body:is([data-phase=won],[data-phase=failed]) .result{position:fixed;left:8px;right:8px;bottom:8px;z-index:5;max-height:calc(100dvh - 16px);overflow:auto;margin:0;box-shadow:0 -10px 40px #2a1f3a59}
}
