@font-face { font-family: Recursive; src: local("Recursive"); font-display: swap; }
:root { --pl-bg:#F3EEE1; --pl-ink:#18343D; --pl-accent:#6651A5; --pl-card:#FBF4DF; --pl-border:#18343D; --pl-button:#F0B544; --pl-topbar-bg:#FBF4DF; --pl-topbar-text:#1B6267; --pl-control-text:#18343D; --pl-control-bg:#FBF4DF; --pl-control-border:#AAC9C0; --pl-focus:#6651A5; --pl-overlay:rgb(17 51 57 / .64); --pl-card-bg:#FBF4DF; --pl-card-text:#18343D; --pl-card-muted:#456267; --pl-card-border:#A7C9BD; --pl-primary:#1B7374; --pl-primary-text:#FFF9E9; --pl-shadow:rgb(24 52 61 / .28); }
body { background-color:#F3EEE1; background-image:linear-gradient(rgba(24,52,61,.055) 1px,transparent 1px),linear-gradient(90deg,rgba(24,52,61,.055) 1px,transparent 1px); background-size:20px 20px; color:#18343D; font-family:Recursive, ui-rounded, system-ui, sans-serif; }
.shell { max-width:520px; }
.level-name { font-family:ui-rounded,system-ui,sans-serif; letter-spacing:.05em; text-transform:uppercase; }
.progress-line { margin:4px 3px 7px; color:#456267; font-size:13px; font-weight:700; line-height:1.3; font-variant-numeric:tabular-nums; }
.board-shell { border:0; box-shadow:none; background:transparent; }
#board { border-radius:18px; box-shadow:0 8px 24px rgba(24,52,61,.15); touch-action:none; }
button { border:1.5px solid #18343D; border-radius:13px; box-shadow:2px 2px 0 #18343D; background:#FBF4DF; font-weight:700; }
button:active { transform:translate(2px,2px); box-shadow:none; }
.primary-button { background:#F0B544; color:#18343D; border-color:#18343D; }
.result-card { background:#FBF4DF; border:2px solid #18343D; box-shadow:5px 5px 0 #18343D; }
.atlas { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin:24px 0 48px; }
.atlas-title { grid-column:1/-1; margin:0 2px 2px; font-size:15px; line-height:1.35; color:#18343D; }
.atlas-page canvas { display:block; width:28px; height:28px; }
.atlas-page span { font-size:12px; line-height:1.3; color:#18343D; padding-top:5px; overflow-wrap:anywhere; }
.atlas:not([hidden]) { display:grid; }
.atlas-page { min-height:76px; padding:7px; background:#FBF6E6; border:1px solid #1E2328; border-radius:10px; }
.atlas-page b { color:#7B3FA0; font-size:20px; }
.atlas-page span { display:block; border-top:2px dotted #bdb9ac; margin-top:6px; min-height:22px; }
.story-plate { position:fixed; inset:0; z-index:30; display:grid; place-content:center; gap:18px; padding:24px; background:rgba(242,241,236,.92); }
.story-plate[hidden] { display:none; }
.plate-paper { display:flex; gap:8px; width:min(360px,90vw); padding:14px; border:2px solid #1E2328; background:#FBF6E6; box-shadow:6px 6px 0 #7B3FA0; }
.plate-paper i { position:relative; flex:1; aspect-ratio:1; border:1.5px solid #1E2328; background:linear-gradient(135deg,transparent 45%,#F2B33D 46% 55%,transparent 56%); }
.plate-paper i:nth-child(2)::after { content:""; position:absolute; width:28%; height:28%; border:3px solid #7B3FA0; border-radius:50%; left:35%; top:28%; }
.plate-paper i:nth-child(3) { background:radial-gradient(circle at 50% 46%,#F2B33D 0 18%,transparent 19%),#E8D9A0; }
@media (max-width:360px) {
  .progress-line { margin-top:2px; margin-bottom:4px; font-size:11px; white-space:nowrap; }
  .atlas { grid-template-columns:repeat(3,1fr); }
}

#map-screen { padding-top:64px; }
.plc-cabinet { margin-top:12px; }
.plc-cabinet__head { background:#D8E8E2; color:#18343D; }
.plc-cabinet__group { border-color:#A7C9BD; box-shadow:3px 4px 0 rgba(24,52,61,.14); }
.plc-level { min-height:58px; padding:5px; border-color:#A7C9BD; background:#FBF4DF; color:#18343D; font-size:12px; line-height:1.15; }
.plc-cabinet__preview { background:#426D70; }
.plc-cabinet__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.plc-level { min-height: 64px; padding: 4px 6px; line-height: 1.15; }
.map-preview { display:grid; grid-template-columns:24px 1fr 24px 1fr 24px; gap:8px; align-items:center; width:min(290px,100%); color:#F2B544; }
.map-preview span { display:grid; width:24px; height:24px; place-items:center; border:1px solid #F2B544; border-radius:50%; background:#9BD4BD; color:#18343D; font-size:10px; }
.map-preview i { height:1px; background:#F2B544; }
.map-preview p { grid-column:1/-1; margin:4px 0 0; color:#FFF9E9; font-size:12px; line-height:1.25; }
.lesson-loop { background:#F3EEE1; }
.hand-demo.running.drag { animation:hand-drag 2.2s ease-in-out infinite; }
@keyframes hand-drag { 0% { transform:translate(0,0) scale(.85); opacity:0; } 12% { transform:translate(0,0) scale(1); opacity:1; } 70% { transform:translate(var(--dx),var(--dy)) scale(1); opacity:1; } 88%,100% { transform:translate(var(--dx),var(--dy)) scale(.85); opacity:0; } }
.reduced-motion .hand-demo.running.drag { animation:none; opacity:1; }
/* Brand button (house rule 22): the logo keeps its size, the title gives way first on a 320 px phone. */
[data-pl="back"][data-brand] { min-width: 0; flex: 0 1 auto; overflow: hidden; }
[data-pl="back"][data-brand] svg { flex: none; width: 24px; height: 24px; }
[data-pl="back"][data-brand] .pl-brand-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The first minute lives beside the saved level board and uses the same dish renderer. */
.first-minute[hidden] { display:none; }
body.first-minute-active #play-screen,
body.first-minute-active #map-screen { display:none; }
.first-minute { padding-top:8px; }
.fm-heading { display:flex; align-items:center; justify-content:space-between; min-height:44px; color:#18343D; font-size:18px; font-weight:800; letter-spacing:.03em; }
#fm-skip { min-height:44px; min-width:44px; padding:3px 12px; border:0; box-shadow:none; background:transparent; color:#18343D; font-size:18px; font-weight:700; text-decoration:underline; }
.fm-line { display:grid; place-items:center; min-height:2.9em; margin:3px 0 7px; color:#18343D; font-size:22px; font-weight:850; line-height:1.3; text-align:center; }
.fm-board-wrap { position:relative; width:min(100%, calc((100dvh - 255px) * var(--fm-ratio, .8372))); margin:0 auto; }
#fm-board { display:block; width:100%; height:auto; border-radius:18px; box-shadow:0 8px 24px rgba(24,52,61,.15); touch-action:none; }
.fm-cue { position:absolute; z-index:2; display:grid; place-items:center; width:38px; height:38px; border:2px solid #F0B544; border-radius:50%; background:rgba(255,249,233,.92); box-shadow:0 0 0 6px rgba(240,181,68,.18); color:#1B6267; font-size:23px; transform:translate(-50%,-50%); pointer-events:none; animation:fm-pulse 1.5s ease-in-out infinite; }
.fm-cue[hidden] { display:none; }
@keyframes fm-pulse { 50% { box-shadow:0 0 0 13px rgba(240,181,68,.05); transform:translate(-50%,-50%) scale(1.08); } }
.fm-meter { display:flex; flex-wrap:wrap; justify-content:center; gap:6px; margin:9px auto 0; min-height:20px; }
.fm-meter[hidden] { display:none; }
/* a drop of dish life: filled while left, hollow and dashed once spent */
.fm-meter .fm-drop { flex:none; width:16px; height:16px; border:2px solid #18343D; border-radius:50% 50% 50% 0; transform:rotate(-45deg); background:#5FB7C6; }
.fm-meter .fm-drop.spent { background:transparent; border-style:dashed; opacity:.7; }
.fm-status { min-height:1.5em; margin:7px 0 3px; color:#18343D; font-size:20px; font-weight:750; text-align:center; }
.fm-actions { display:flex; justify-content:center; min-height:44px; }
.fm-actions button[hidden] { display:none; }
@media (max-width:360px) {
  .first-minute { padding-top:0; }
  .fm-line { min-height:36px; margin:1px 0 4px; font-size:15px; }
  .fm-meter { margin-top:5px; }
  .fm-status { margin:4px 0 1px; font-size:12px; }
  .fm-actions button { min-height:40px; padding:5px 12px; }
}
.reduced-motion .fm-cue { animation:none; }
#fm-replay { display:block; width:100%; margin-top:11px; border:0; box-shadow:none; background:transparent; color:#1B6267; font-size:13px; text-decoration:underline; }
#fm-replay[hidden] { display:none; }

/* P2NF17: one slot under the level name says who you are and what to do; a game message takes it, and it comes back on the next move. */
#play-screen .message { height:calc(2 * 1.3em); min-height:0; overflow:hidden; margin:4px 3px 6px; text-wrap:balance; color:#18343D; font-size:16px; font-weight:700; line-height:1.3; }
#play-screen .message.idle { color:#456267; font-weight:500; }
#play-screen .message.refused { color:#9b3b31; }

/* P2NF17: the whole title in the top bar. How to play is the "?" button on phones; the title gives up the logo before it is cut. */
@media (max-width:430px) {
  [data-pl="howto"] .pl-howto-word { display:none; }
  [data-pl="howto"] .pl-howto-question { display:inline; }
  [data-pl="howto"] { width:44px; }
  .pl-topbar__inner { padding:0 10px; gap:8px; }
  .pl-topbar__actions { gap:3px; }
  .pl-topbar__actions [data-pl="levels"] { padding:6px 2px; }
  [data-pl="back"][data-brand] { padding:4px 2px; gap:5px; }
  [data-pl="back"][data-brand] svg { width:20px; height:20px; }
  [data-pl="back"][data-brand] .pl-brand-title { font-size:17px; letter-spacing:-.01em; overflow:visible; text-overflow:clip; }
}
/* Too narrow for logo and title: the logo goes, the title stays whole (two lines in zh never needed; EN wraps if it must). */
@media (max-width:379px) {
  [data-pl="back"][data-brand] svg { display:none; }
}
@media (max-width:379px) {
  [data-pl="back"][data-brand] .pl-brand-title { white-space:normal; line-height:1.08; text-align:left; }
}
/* One phone screen (2026-11-20): name + Reset, one HUD line, a two-line message, then the board, which takes what is left. */
#play-screen { padding-top:0; }
.shell { padding-bottom:calc(8px + env(safe-area-inset-bottom)); }
.level-row { min-height:44px; margin-top:0; align-items:center; }
.level-name { flex:1 1 auto; min-width:0; font-size:17px; line-height:1.15; letter-spacing:.03em; }
.reset-chip { flex:none; min-height:44px; padding:4px 12px; font-size:15px; }
.hud-row { display:flex; justify-content:space-between; align-items:baseline; gap:10px; margin:2px 3px 0; }
.hud-row .progress-line, .hud-row .move-count { margin:0; font-size:14px; font-weight:700; color:#456267; white-space:nowrap; }
.dish-notes { position:absolute; left:0; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); clip-path:inset(50%); white-space:normal; margin:0; padding:0; border:0; }
