/* Atom Kitchen: one-screen iPad bench in landscape — atom shelf left, mixing bowl centre, result card right,
   journal strip along the bottom. Stacks and scrolls on narrow or portrait screens. Colours follow style.css. */
:root {
  --bg: #f5f8f4; --panel: #ffffff; --ink: #192c28; --muted: #50635e; --line: #dce4df;
  --accent: #dcff85; --accent-ink: #192c28; --good: #1f7a4f; --hint: #a24a17;
  --bowl: #e4efdc; --atom-edge: #192c28; --soft: #eef3ee;
  --display: ui-rounded, "Avenir Next", Avenir, system-ui, sans-serif;
  --body: ui-rounded, "Avenir Next", Avenir, system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { background: var(--bg); color: var(--ink); font: 17px/1.45 var(--body);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 12px; margin: 0;
  display: grid; grid-template-rows: auto 1fr auto; gap: 12px;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button { touch-action: manipulation; font: inherit; color: inherit; }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; margin: 0; text-wrap: balance; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.1rem; }
p { margin: 0; }
.label { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }

header { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.home { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 10px; background: var(--panel); color: var(--ink); font-weight: 700; text-decoration: none; }
.home img { width: 24px; height: 24px; }
header p { color: var(--muted); font-size: .95rem; }

.bench { display: grid; grid-template-columns: 1fr; gap: 12px; min-height: 0; }
.panel { background: var(--panel); border: 2px solid var(--ink); border-radius: 10px; padding: 14px; display: grid; gap: 10px; min-width: 0; min-height: 0; }

/* iPad landscape: everything on one screen, no page scroll */
@media (orientation: landscape) and (min-width: 900px) and (min-height: 560px) {
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  .bench { grid-template-columns: 196px minmax(0, 1fr) minmax(300px, 360px); }
  .shelf-panel { grid-template-rows: auto 1fr; }
  .bowl-panel { grid-template-rows: auto 1fr auto; }
  .result { overflow-y: auto; }
}

.shelf { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-content: start; min-height: 0; overflow-y: auto; }
.atom-btn { display: grid; justify-items: center; gap: 0; padding: 4px 2px; border: 2px solid var(--line); border-radius: 12px; line-height: 1.2;
  background: var(--soft); cursor: grab; touch-action: none; font-size: .85rem; font-weight: 700; transition: transform .1s; }
.atom-btn:active { transform: scale(.94); border-color: var(--accent); }
.atom-btn small { color: var(--muted); font-size: .72rem; font-weight: 400; }
.atom-btn.wide { grid-column: 1 / -1; grid-template-columns: auto auto; column-gap: 8px; align-items: center; }
.atom-btn.wide small { grid-column: 2; }
.atom-btn.wide svg { grid-row: span 2; }

.bowl { background: var(--bowl); border-radius: 0 0 50% 50% / 0 0 40% 40%; min-height: 200px; padding: 18px 24px 34px;
  display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; align-content: center; transition: box-shadow .15s; }
.bowl.over { box-shadow: inset 0 0 0 4px var(--accent); }
.bowl .empty { color: var(--muted); text-align: center; }
.bowl button { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%; }
.bowl button.pop { animation: pop .3s ease-out; }
.bowl.shake button { animation: jiggle .45s ease-in-out 2; }
@keyframes pop { from { transform: scale(.3) } 70% { transform: scale(1.12) } to { transform: scale(1) } }
@keyframes jiggle { 0%,100% { transform: translate(0,0) } 25% { transform: translate(-4px,3px) rotate(-6deg) } 75% { transform: translate(4px,-3px) rotate(6deg) } }
.ghost { position: fixed; pointer-events: none; z-index: 20; transform: translate(-50%, -50%) scale(1.15); filter: drop-shadow(0 6px 8px rgba(0,0,0,.25)); }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn { font: 600 1.15rem var(--display); min-height: 54px; padding: 0 26px; border-radius: 999px; border: 2px solid var(--ink); background: var(--panel); cursor: pointer; transition: transform .1s; }
.btn:active { transform: scale(.95); }
.btn.go { background: var(--accent); color: var(--accent-ink); box-shadow: 3px 3px 0 var(--ink); min-width: 140px; }

.result { align-content: start; }
.result-top { display: grid; gap: 4px; }
.verdict { font-family: var(--display); font-size: 1.45rem; font-weight: 600; line-height: 1.15; }
.verdict.good { color: var(--good); } .verdict.hint { color: var(--hint); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { font-size: .75rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); }
.made { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: center; }
.made .icon { width: 84px; height: 84px; border-radius: 20px; background: var(--soft); border: 2px solid var(--good); display: grid; place-items: center; }
.made .icon.new { animation: pop .5s ease-out; }
.made .icon svg { width: 62px; height: 62px; }
.made .mol svg { width: 100%; max-height: 110px; }
.learn { display: grid; gap: 8px; align-content: start; min-height: 0; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--soft); border-radius: 12px; padding: 4px; }
.tabs button { border: 0; background: none; border-radius: 9px; min-height: 40px; font-size: .82rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.tabtext { font-size: .98rem; }
.tabtext b { font-family: var(--display); font-weight: 600; }

.journal { padding: 10px 14px; }
.journal-head { display: flex; justify-content: space-between; align-items: baseline; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.card { border: 2px dashed var(--line); border-radius: 12px; padding: 6px 4px; display: grid; justify-items: center; gap: 2px; text-align: center;
  background: var(--soft); font-size: .78rem; font-weight: 700; min-height: 78px; align-content: center; }
.card.found { border-style: solid; border-color: var(--good); background: var(--panel); cursor: pointer; }
.card svg { width: 36px; height: 36px; }
.card .q { font: 600 1.5rem var(--display); color: var(--muted); opacity: .5; }
@media (orientation: landscape) and (min-width: 900px) { .cards { grid-template-columns: repeat(8, 1fr); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Game layer: rank, challenges, hints, celebration ---------- */
[hidden] { display: none !important; }
.dim { color: var(--muted); }
header h1 { margin-right: auto; }
.rank { display: grid; grid-template-columns: auto 140px auto; gap: 4px 10px; align-items: center; font-weight: 700; font-size: .9rem; }
.rank-track { height: 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--panel); overflow: hidden; }
.rank-bar { display: block; height: 100%; width: 0; background: var(--accent); transition: width .6s ease-out; }
.rank-points { color: var(--muted); font-variant-numeric: tabular-nums; }
.sound { min-height: 44px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 10px; background: var(--panel); font-weight: 700; cursor: pointer; }
.sound[aria-pressed="false"] { color: var(--muted); border-color: var(--line); }

.challenge { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; background: #fff6cf; border: 2px solid var(--ink); min-height: 58px; }
.ch-num { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; font: 800 1.05rem var(--display); }
.ch-text { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.ch-text .label { font-size: .68rem; }
.ch-clue { color: var(--hint); font-size: .9rem; }
.ch-btn { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--ink); background: var(--panel); font-weight: 700; cursor: pointer; }
.challenge.flash { animation: flash .8s ease-out; }
@keyframes flash { 0% { background: var(--accent); transform: scale(1.03); } 100% { background: #fff6cf; transform: scale(1); } }

.bowl button.lonely { border-radius: 50%; box-shadow: 0 0 0 4px var(--hint); animation: lonely 1s ease-in-out 3; }
@keyframes lonely { 50% { box-shadow: 0 0 0 9px rgba(162, 74, 23, .25); } }
.cooked { display: grid; justify-items: center; gap: 4px; animation: cook .55s cubic-bezier(.3, 1.5, .5, 1); }
.cooked svg { width: min(320px, 100%); height: auto; }
.cooked b { font: 800 1.3rem var(--display); color: var(--good); }
@keyframes cook { from { transform: scale(.4) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
.btn:disabled { opacity: .6; }
.made .icon.plain { border-color: var(--line); }
.table-link { justify-self: start; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 2px solid var(--ink); background: var(--soft); color: var(--ink); font-weight: 700; text-decoration: none; }

.celebrate { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(25, 44, 40, .55); }
.celebrate-card { position: relative; z-index: 1; display: grid; justify-items: center; gap: 8px; width: min(420px, 100%); padding: 26px 24px; text-align: center;
  background: var(--panel); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 6px 6px 0 var(--ink); animation: cook .5s cubic-bezier(.3, 1.5, .5, 1); }
.celebrate-card h2 { font-size: 2rem; color: var(--good); }
.big-icon { width: 140px; height: 140px; display: grid; place-items: center; border-radius: 28px; background: var(--soft); border: 3px solid var(--good); animation: wobble 1.2s ease-in-out .4s; }
.big-icon.star { font-size: 4.5rem; color: #e0a100; }
@keyframes wobble { 25% { transform: rotate(-8deg) scale(1.06); } 50% { transform: rotate(6deg); } 75% { transform: rotate(-3deg); } }
.formula-big { font: 800 1.4rem var(--display); color: var(--muted); }
.stamp { padding: 6px 12px; border-radius: 10px; background: #fff6cf; border: 2px dashed var(--ink); font-weight: 700; transform: rotate(-1.5deg); }
.rank-up { font-size: 1.1rem; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall 2.2s ease-in forwards; }
@keyframes fall { to { transform: translate(var(--drift), 110vh) rotate(720deg); } }
@media (max-width: 700px) { .rank { grid-template-columns: auto 90px; } .rank-points { display: none; } }

/* ---------- Never stuck: mystery cards, Show me, Fix it for me ---------- */
button.card { font: inherit; font-size: .78rem; font-weight: 700; color: var(--ink); cursor: pointer; transition: transform .1s, border-color .1s; }
button.card:not(.found):hover, button.card:not(.found):focus-visible { border-color: var(--ink); background: #fff6cf; }
button.card:active { transform: scale(.95); }
.mini-atoms { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; max-width: 90px; }
.mini-atoms i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--atom-edge); font: 700 .58rem var(--body); font-style: normal; }
.ch-btn.show { background: var(--accent); }
.btn.fix { justify-self: start; display: inline-flex; align-items: center; gap: 10px; font-size: 1rem; min-height: 50px; padding: 0 18px; background: #fff6cf; }
.btn.fix .mini-atoms { max-width: none; flex-wrap: nowrap; }
.btn.go.nudge { animation: nudge 1s ease-in-out 3; }
@keyframes nudge { 50% { transform: scale(1.08); box-shadow: 3px 3px 0 var(--ink), 0 0 0 8px rgba(220, 255, 133, .7); } }
.celebrate-card .row { margin-top: 4px; }
