:root {
  /* Palette from https://www.frostzero.ca (styles/style.css; same file as
     sea/public/blog content/static/styles/style.css). Light theme only. */
  --fz-blue: #0f17ba;        /* body text + h2 */
  --fz-blue-h1: #0f17ca;     /* h1 */
  --fz-blue-h3: #0f17aa;     /* h3 */
  --fz-header-ink: #191b2c;  /* header text */
  --fz-link: #0f172a;        /* a:link / a:visited */
  --fz-hover: #124599;       /* .menu_link a:hover */
  --fz-cyan: #00bbcc;        /* .article / .link_box box-shadow */
  --fz-teal: #009999;        /* text-shadow glow */
  --fz-code-bg: #bcfcfb;     /* pre.src background */
  --fz-surface: #ffffff;     /* .content background */
  --fz-modal: #fefefe;       /* .basic_modal_content background */
  --fz-zebra: #f6f5fa;       /* tr:nth-child(even) */
  --fz-nav: #555555;         /* .nav a */
  --fz-border: #888888;      /* modal border */
  --fz-rule: #eeeeee;        /* header border-bottom */
  --fz-page: #e0fefe;        /* mean colour of /images/background-light.webp (body background-image) */
  /* Derived (the blog has no green; its only red is the #FF0000aa hover glow). */
  --ok: #00775a;             /* darkened Okabe-Ito bluish green: 5.2:1 on page */
  --ok-bg: #e3f4ee;
  --bad: #cc0000;            /* blog red #ff0000 darkened to pass AA: 5.5:1 on page */
  --bad-bg: #fde8e8;

  /* Roles used below */
  --bg: var(--fz-page);
  --ink: var(--fz-blue);
  --heading: var(--fz-header-ink);
  --muted: var(--fz-nav);
  --brand: var(--fz-blue);
  --brand-active: var(--fz-hover);
  --pile: var(--fz-surface);
  --pile-edge: var(--fz-teal);
  --over: var(--fz-hover);
  --over-bg: var(--fz-code-bg);
  --card: var(--fz-modal);
  --card-glow: var(--fz-cyan);
  --stack: var(--fz-code-bg);
  --purpose-bg: var(--fz-code-bg);
  --purpose-ink: var(--fz-link);
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.bar {
  background: var(--brand);
  color: var(--fz-surface);
  padding: 8px 12px calc(8px) 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.bar h1 { font-size: 16px; margin: 0; white-space: nowrap; }
.stats { display: flex; gap: 8px; font-size: 12px; }
.stats span { white-space: nowrap; }
.stats b { font-size: 16px; }

main { flex: 1; display: flex; flex-direction: column; padding: 10px; gap: 8px; max-width: 520px; width: 100%; margin: 0 auto; }

.piles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pile {
  appearance: none;
  font: inherit;
  color: inherit;
  min-height: 124px;
  border: 3px dashed var(--pile-edge);
  border-radius: var(--radius);
  background: var(--pile);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  cursor: pointer;
  transition: border-color .12s, background-color .12s;
}
.pile-label { font-weight: 700; font-size: 16px; line-height: 1.15; color: var(--heading); }
.pile-count { font-size: 13px; color: var(--muted); }
.pile.over { border-color: var(--over); border-style: solid; background: var(--over-bg); }
.pile.ok { border-color: var(--ok); border-style: solid; background: var(--ok-bg); }
.pile.bad { border-color: var(--bad); border-style: solid; background: var(--bad-bg); animation: shake .3s; }
.pile.hint { border-color: var(--ok); border-style: double; border-width: 5px; background: var(--ok-bg); animation: pulse .6s 2; }
/* Non-colour cues so feedback never relies on hue alone */
.pile.ok::after, .pile.bad::after, .pile.hint::after { font-size: 13px; font-weight: 700; }
.pile.ok::after { content: "\2713  correct"; color: var(--ok); }
.pile.bad::after { content: "\2717  not here"; color: var(--bad); }
.pile.hint::after { content: "\2192  goes here"; color: var(--ok); }

.message { min-height: 2.6em; margin: 2px 0; font-size: 15px; text-align: center; line-height: 1.3; }
.message.ok { color: var(--ok); font-weight: 600; }
.message.bad { color: var(--bad); font-weight: 600; }

.deck-area { margin-top: auto; padding-bottom: env(safe-area-inset-bottom); }
.deck-meta { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 4px; font-size: 15px; color: var(--ink); }
.toggle input { width: 22px; height: 22px; accent-color: var(--brand); }

.deck { position: relative; min-height: 150px; }
.deck::before { /* the stack under the top card */
  content: "";
  position: absolute;
  inset: 6px -4px -6px 4px;
  border-radius: var(--radius);
  background: var(--stack);
  border: 1px solid var(--card-glow);
}
.deck.empty::before { display: none; }
.card {
  position: relative;
  min-height: 150px;
  background: var(--card);
  border: 2px solid var(--card-glow);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  box-shadow: 1px 1px 2px 2px var(--card-glow); /* the blog's .article shadow */
  touch-action: none;
  cursor: grab;
  will-change: transform;
  text-align: center;
}
.card.dragging { cursor: grabbing; box-shadow: 2px 6px 12px 3px var(--card-glow); z-index: 10; transition: none; }
.card.settle { transition: transform .2s ease-out; }
.card.fly { transition: transform .18s ease-in, opacity .18s ease-in; opacity: 0; }
.card.hidden { visibility: hidden; }
.card-name { color: var(--ink); margin: 4px 0 6px; font-size: 24px; line-height: 1.15; overflow-wrap: anywhere; }
.card-ingredients { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.card-ingredients:empty, .card-purpose:empty, .card-section:empty { display: none; }
.card-purpose { margin: 8px 0 0; font-size: 16px; font-style: italic; color: var(--purpose-ink); background: var(--purpose-bg); border-radius: 8px; padding: 6px 8px; }
.card-section { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }

.help { font-size: 12px; color: var(--muted); text-align: center; margin: 8px 0 0; }

.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); /* blog .basic_modal */ display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.overlay[hidden] { display: none; }
.panel { background: var(--fz-modal); border: 1px solid var(--fz-border); color: var(--ink); border-radius: 18px; padding: 20px 18px; width: 100%; max-width: 360px; max-height: 90vh; overflow: auto; text-align: center; }
.panel h2 { margin: 0 0 6px; }
.big { font-size: 22px; margin: 6px 0; }
.big b { font-size: 34px; color: var(--brand); }
.new-best { color: var(--ok); font-weight: 700; margin: 4px 0; }
.r-stats { list-style: none; padding: 0; margin: 10px 0; line-height: 1.6; }
.r-missed { text-align: left; font-size: 14px; margin: 8px 0 14px; }
.r-missed h3 { font-size: 15px; margin: 0 0 4px; }
.r-missed ul { margin: 0; padding-left: 18px; }
.r-missed li { margin: 3px 0; }
.btn { appearance: none; border: 0; border-radius: 12px; background: var(--brand); color: var(--fz-surface); font: inherit; font-size: 18px; font-weight: 700; min-height: 52px; width: 100%; cursor: pointer; }
.btn:active { background: var(--brand-active); }
.btn:focus-visible, .pile:focus-visible, .toggle input:focus-visible { outline: 3px solid var(--fz-cyan); outline-offset: 2px; }

.foot { font-size: 11px; color: var(--muted); text-align: center; padding: 6px 10px 10px; background: rgba(255, 255, 255, .92); border-top: 1px solid rgba(228, 228, 231, .8); /* blog footer */ }

@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes pulse { 50% { transform: scale(1.04); } }

@media (prefers-reduced-motion: reduce) {
  .pile.bad, .pile.hint { animation: none; }
  .card.settle, .card.fly { transition: none; }
}
@media (max-height: 620px) {
  .pile { min-height: 88px; }
  .help, .foot { display: none; }
}
