/* ═══════════ Just Right — cozy pixel cottage ═══════════ */

:root {
  --font-px: 'Pixelify Sans', 'Courier New', monospace;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Day (default) */
  --sky1: #86cdf7; --sky2: #dff3ff;
  --bg: #f7ead2; --gingham: rgba(214, 92, 74, .10);
  --panel: #fffaf0; --panel2: #fbeed6; --ink: #3b2416; --muted: #8a6a52; --line: #e5cfaa;
  --wood: #c98b4f; --wood-d: #8f5c30; --wood-l: #e6b57f; --sign-ink: #fff4dc;
  --honey: #f2a93b; --honey-d: #c97f17; --good: #5aa864; --good-d: #3f8a4f; --cold: #5b9bd5; --hot: #e0603f;
  --wall: #f4dcbd; --wall2: #edd0a8; --floor: #b97a45; --floor2: #a6693a;
  --px-outline: #3b2416; --shadow: rgba(59, 36, 22, .9); --soft-shadow: rgba(59, 36, 22, .18);
  --glass: rgba(255, 255, 255, .55);
}
:root[data-tod="morning"] {
  --sky1: #ffc999; --sky2: #cfe9ff; --bg: #f9ebd6; --wall: #f7e0c6; --wall2: #f0d3b0; --gingham: rgba(232, 128, 92, .10);
}
:root[data-tod="evening"] {
  --sky1: #ff9466; --sky2: #8a64b4; --bg: #f2dfcc; --wall: #efcfb3; --wall2: #e6c09f; --gingham: rgba(170, 82, 120, .10);
  --panel: #fff6ec; --panel2: #f8e6d3;
}
:root[data-tod="night"] {
  --sky1: #0e1330; --sky2: #2c3870;
  --bg: #1c1a2b; --gingham: rgba(140, 130, 220, .07);
  --panel: #2a2640; --panel2: #332e4d; --ink: #f6ead6; --muted: #b8a993; --line: #463f63;
  --wood: #8a5a36; --wood-d: #5c3a20; --wood-l: #a87148; --sign-ink: #fff0d2;
  --wall: #3b3354; --wall2: #352d4c; --floor: #5a4036; --floor2: #4d362e;
  --px-outline: #1a0f0a; --shadow: rgba(0, 0, 0, .7); --soft-shadow: rgba(0, 0, 0, .35); --glass: rgba(255, 255, 255, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { overflow-x: hidden; }
body {
  font-variant-ligatures: none;
  min-height: 100vh;
  font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(90deg, var(--gingham) 50%, transparent 50%),
    linear-gradient(var(--gingham) 50%, transparent 50%);
  background-size: 40px 40px;
  transition: background-color .6s, color .6s;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.px { image-rendering: pixelated; display: block; }

.app { max-width: 1200px; margin: 0 auto; padding: 0 16px 56px; }

/* ── Header ── */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0 10px; flex-wrap: wrap; }
@media (max-width: 560px) {
  .tools { width: 100%; justify-content: space-between; }
  .tbtn { flex: 1; min-width: 0; padding: 0 4px; }
  .wordmark { font-size: 26px; }
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand .px { width: 40px; height: auto; animation: bob 2.4s steps(2) infinite; }
.wordmark { font-family: var(--font-px); font-weight: 700; font-size: 30px; line-height: 1; letter-spacing: .5px; white-space: nowrap;
  text-shadow: 3px 3px 0 var(--honey); }
.wordmark i { font-style: normal; color: var(--honey-d); text-shadow: 3px 3px 0 var(--ink); }
.tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.tbtn {
  height: 40px; min-width: 40px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--panel); border: 3px solid var(--ink); border-radius: 8px; box-shadow: 0 3px 0 var(--shadow);
  font-family: var(--font-px); font-size: 15px; transition: transform .08s, box-shadow .08s;
}
.tbtn:hover { background: var(--panel2); }
.tbtn:active, .tbtn.on { transform: translateY(3px); box-shadow: 0 0 0 var(--shadow); }
.tbtn.on { background: var(--honey); color: #3b2416; }
.tbtn .lbl { display: none; }
@media (min-width: 760px) { .tbtn .lbl { display: inline; } }
.tbtn.admin { background: var(--ink); color: var(--panel); }

/* ── Layout with docked notebook ── */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 1000px) {
  body.pad-open .layout { grid-template-columns: minmax(0, 1fr) 380px; }
}
main { min-width: 0; max-width: 820px; width: 100%; margin: 0 auto; }

/* ── Day header ── */
.dayhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 14px; flex-wrap: wrap; }
.daylabel { font-family: var(--font-px); font-size: 15px; color: var(--muted); }
.daylabel b { color: var(--ink); font-size: 20px; }
.rooms { display: flex; gap: 8px; flex-wrap: wrap; }
.rtab {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 10px;
  background: var(--panel); border: 3px solid var(--line); font-weight: 800; font-size: 14px; color: var(--muted);
}
.rtab .em { font-size: 20px; line-height: 1; }
.rtab .sc { font-family: var(--font-px); font-size: 16px; color: var(--ink); min-width: 22px; text-align: right; }
.rtab.on { border-color: var(--ink); color: var(--ink); box-shadow: 0 3px 0 var(--shadow); }
.rtab.done .sc { color: var(--good-d); }
:root[data-tod="night"] .rtab.done .sc { color: var(--good); }
.rtab:disabled { cursor: not-allowed; opacity: .55; }
.jarbox { display: flex; align-items: center; gap: 8px; font-family: var(--font-px); }
.jarbox .px { width: 34px; height: auto; }
.jarbox b { font-size: 22px; }
.jarbox span { color: var(--muted); font-size: 14px; }

/* ── Cards ── */
.card {
  background: var(--panel); border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 0 6px 0 var(--shadow), 0 18px 40px -20px var(--soft-shadow);
  padding: 18px; position: relative;
}
.card + .card { margin-top: 18px; }
.kicker { font-family: var(--font-px); font-size: 14px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.kicker b { color: var(--ink); }

/* ── Room scene ── */
.scene {
  position: relative; overflow: hidden; border: 3px solid var(--ink); border-radius: 10px; margin-top: 10px;
  width: 100%; aspect-ratio: 16 / 8.2; min-height: 190px;
  background: repeating-linear-gradient(90deg, var(--wall) 0 22px, var(--wall2) 22px 44px);
}
.scene.beds { background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--wall) 82%, #8fb3d9) 0 22px, color-mix(in srgb, var(--wall2) 82%, #8fb3d9) 22px 44px); }
.scene.chairs { background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--wall) 85%, #9fc79a) 0 18px, color-mix(in srgb, var(--wall2) 85%, #9fc79a) 18px 36px); }
.scene .floor {
  position: absolute; left: 0; right: 0; bottom: 0; height: 24%;
  background: repeating-linear-gradient(90deg, var(--floor) 0 46px, var(--floor2) 46px 48px);
  border-top: 3px solid var(--ink);
}
.scene .window {
  position: absolute; top: 9%; left: 50%; transform: translateX(-50%); width: 22%; aspect-ratio: 1.25;
  background: linear-gradient(var(--sky1), var(--sky2)); border: 4px solid var(--wood-d); border-radius: 4px; overflow: hidden;
  box-shadow: inset 0 0 0 3px var(--wood-l);
}
.scene .window::before, .scene .window::after { content: ''; position: absolute; background: var(--wood-d); }
.scene .window::before { left: 50%; top: 0; bottom: 0; width: 4px; transform: translateX(-50%); }
.scene .window::after { top: 50%; left: 0; right: 0; height: 4px; transform: translateY(-50%); }
.scene .window .px { position: absolute; width: 34%; height: auto; }
.scene .window .sunpos { top: 14%; left: 54%; }
:root[data-tod="evening"] .scene .window .sunpos { top: 52%; }
.scene .window .moonpos { top: 14%; left: 58%; width: 26%; }
.scene .window .starpos { width: 9%; }
.scene .shelf { position: absolute; top: 20%; left: 6%; width: 14%; height: 4%; background: var(--wood); border: 3px solid var(--ink); border-radius: 2px; }
.scene .shelf .px { position: absolute; bottom: 100%; width: 34%; height: auto; }
.scene .lamp { position: absolute; top: -2%; right: 10%; width: 4%; height: 22%; border-left: 3px solid var(--ink); }

.obj { position: absolute; bottom: 21%; display: flex; flex-direction: column; align-items: center; }
.obj .px { width: 100%; height: auto; }
.obj.small { left: 10%; }
.obj.big { right: 5%; }
.porridge .obj.small { width: 8%; } .porridge .obj.big { width: 25%; }
.chairs .obj.small { width: 5.5%; } .chairs .obj.big { width: 17%; }
.beds .obj.small { width: 9%; } .beds .obj.big { width: 30%; }
.obj .tag { margin-top: 4px; font-family: var(--font-px); font-size: 12px; background: var(--ink); color: var(--panel); padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.table { position: absolute; left: 4%; right: 4%; bottom: 21%; height: 6%; background: var(--wood); border: 3px solid var(--ink); border-radius: 3px; }
.table::before, .table::after { content: ''; position: absolute; top: 100%; width: 3%; height: 260%; background: var(--wood-d); border: 3px solid var(--ink); border-top: 0; }
.table::before { left: 6%; } .table::after { right: 6%; }
.porridge .obj { bottom: calc(21% + 6%); }
.rug { position: absolute; left: 18%; right: 18%; bottom: 8%; height: 12%; border-radius: 50%; background: repeating-radial-gradient(ellipse, #d96b5a 0 6px, #f0a35e 6px 12px); border: 3px solid var(--ink); }

.steam { position: absolute; bottom: 100%; left: 50%; width: 30px; height: 30px; transform: translateX(-50%); pointer-events: none; }
.steam i { position: absolute; bottom: 0; width: 4px; height: 8px; background: rgba(255, 255, 255, .85); border-radius: 1px; animation: steam 2.4s steps(6) infinite; }
:root[data-tod="night"] .steam i { background: rgba(255, 255, 255, .45); }
.steam i:nth-child(1) { left: 4px; } .steam i:nth-child(2) { left: 13px; animation-delay: .8s; } .steam i:nth-child(3) { left: 22px; animation-delay: 1.6s; }
@keyframes steam { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(3px, -24px); opacity: 0; } }

.host { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; z-index: 2; }
.host { width: 15%; }
.host .bear { width: 100%; height: auto; animation: bob 2.4s steps(2) infinite; }
.host .bubble { margin-bottom: 4px; animation: pulse 1.6s steps(2) infinite; }
.host .bubble { width: 30%; }
.host .bubble .px { width: 100%; height: auto; }
.host .middle-obj { width: 100%; display: flex; justify-content: center; margin-bottom: 2px; }
.porridge .host .middle-obj .px { width: 95%; } .chairs .host .middle-obj .px { width: 62%; } .beds .host .middle-obj .px { width: 120%; max-width: none; }
.host.react .bear { animation: hop .6s steps(3) 1; }
.host.toppled .bear { animation: wobble .7s steps(4) 2; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes pulse { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes hop { 0% { transform: translateY(0); } 40% { transform: translateY(-16px); } 100% { transform: translateY(0); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }

/* ── Wooden signs ── */
.signs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.sign {
  position: relative; padding: 10px 14px 12px; border-radius: 6px; min-width: 0;
  background: repeating-linear-gradient(180deg, var(--wood) 0 9px, color-mix(in srgb, var(--wood) 88%, #000) 9px 11px);
  border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--shadow); color: var(--sign-ink);
  transform: rotate(-1deg); transition: transform .3s;
}
.sign.big { transform: rotate(1deg); text-align: right; }
.sign:hover { transform: rotate(0); }
.sign::before, .sign::after { content: ''; position: absolute; top: 7px; width: 6px; height: 6px; background: var(--ink); border-radius: 1px; opacity: .7; }
.sign::before { left: 7px; } .sign::after { right: 7px; }
.sign small { display: block; font-family: var(--font-px); font-size: 13px; letter-spacing: 1px; opacity: .9; }
.sign b { display: block; font-size: 18px; line-height: 1.25; text-shadow: 2px 2px 0 rgba(0, 0, 0, .35); overflow-wrap: anywhere; }
.sign .val { font-family: var(--font-px); font-size: 15px; margin-top: 2px; }

.prompt { font-family: var(--font-px); font-weight: 700; font-size: clamp(22px, 4.6vw, 30px); line-height: 1.15; margin: 18px 0 4px; }
.prompt .prop { background: var(--honey); color: #3b2416; padding: 0 8px; border-radius: 6px; box-shadow: 0 3px 0 var(--honey-d); white-space: nowrap; }
.sub { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

/* ── Guess form ── */
.guess { display: flex; gap: 10px; margin-top: 16px; }
.guess input {
  flex: 1; min-width: 0; height: 56px; padding: 0 16px; font-size: 18px; font-weight: 700;
  background: var(--panel2); border: 3px solid var(--ink); border-radius: 10px; box-shadow: inset 0 3px 0 var(--soft-shadow);
}
.guess input:focus { outline: 4px solid color-mix(in srgb, var(--honey) 55%, transparent); outline-offset: 1px; }
.btn {
  height: 56px; padding: 0 20px; border-radius: 10px; border: 3px solid var(--ink);
  background: var(--honey); color: #3b2416; font-family: var(--font-px); font-weight: 700; font-size: 19px; white-space: nowrap;
  box-shadow: 0 5px 0 var(--shadow); transition: transform .08s, box-shadow .08s, background .2s;
}
.btn:hover { background: #ffbd55; }
.btn:active { transform: translateY(5px); box-shadow: 0 0 0 var(--shadow); }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }
.btn.alt { background: var(--panel); color: var(--ink); }
.btn.alt:hover { background: var(--panel2); }
.btn.green { background: var(--good); color: #fff; }
.btn.sm { height: 42px; font-size: 16px; padding: 0 14px; box-shadow: 0 4px 0 var(--shadow); }
.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }
.link:hover { color: var(--ink); }
@media (max-width: 520px) { .guess { flex-direction: column; } .btn.full-sm { width: 100%; } }

.pips { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.pip { width: 22px; height: 22px; border: 3px solid var(--line); border-radius: 5px; display: grid; place-items: center; font-weight: 900; font-size: 12px; color: var(--hot); background: var(--panel2); }
.pip.used { border-color: var(--hot); }

.msg:empty { display: none; }
.msg { margin-top: 12px; }
.note { padding: 12px 14px; border-radius: 10px; border: 3px solid var(--ink); background: var(--panel2); font-weight: 700; animation: popin .25s steps(3); }
.note.bad { background: color-mix(in srgb, var(--hot) 16%, var(--panel)); }
.note.warn { background: color-mix(in srgb, var(--honey) 22%, var(--panel)); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { border: 3px solid var(--ink); background: var(--panel); border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: 14px; box-shadow: 0 3px 0 var(--shadow); }
.chip:hover { background: var(--honey); color: #3b2416; }
@keyframes popin { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.shake { animation: shake .35s steps(4); }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

/* ── First-guess card ── */
.gcard { margin-top: 16px; display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 14px; border: 3px dashed var(--ink); border-radius: 12px; background: var(--panel2); }
.gcard .bigscore { font-family: var(--font-px); font-size: 52px; line-height: 1; min-width: 74px; text-align: center; }
.gcard .bigscore small { display: block; font-size: 13px; color: var(--muted); }
.gcard .said { font-size: 14px; color: var(--muted); }
.gcard .judged { font-weight: 800; font-size: 17px; line-height: 1.3; }
.gcard .judged .val { font-family: var(--font-px); color: var(--honey-d); white-space: nowrap; }
:root[data-tod="night"] .gcard .judged .val { color: var(--honey); }
.gcard.compact .bigscore { font-size: 34px; min-width: 56px; }
.choices { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.choices .btn { flex: 1 1 200px; }
.btn .hint { display: block; font-family: var(--font); font-weight: 700; font-size: 12px; opacity: .8; margin-top: -2px; }
.btn.two { height: 64px; line-height: 1.1; }
.deduce { margin-top: 12px; font-size: 14px; color: var(--muted); }

/* ── Reveal ── */
.verdict { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.verdict .score { font-family: var(--font-px); font-size: 72px; line-height: .9; }
.verdict .score small { font-size: 16px; color: var(--muted); display: block; }
.verdict h3 { font-family: var(--font-px); font-size: 28px; margin: 0; line-height: 1.1; }
.verdict p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.thermo { margin: 26px 0 10px; padding: 0 6px; }
.thermo .bar { position: relative; height: 30px; border: 3px solid var(--ink); border-radius: 16px; background: linear-gradient(90deg, var(--cold), #b8d9ee 35%, #f4c99a 65%, var(--hot)); }
.thermo .band { position: absolute; inset: 0; border-radius: 13px; }
.thermo .bulb { position: absolute; left: -16px; top: 50%; width: 38px; height: 38px; transform: translateY(-50%); border-radius: 50%; background: var(--cold); border: 3px solid var(--ink); }
.thermo .cap { position: absolute; right: -10px; top: 50%; width: 24px; height: 24px; transform: translateY(-50%); border-radius: 50%; background: var(--hot); border: 3px solid var(--ink); }
.thermo .ticks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(59, 36, 22, .35) calc(10% - 2px) 10%); border-radius: 13px; }
.thermo .center { position: absolute; left: 50%; top: -12px; bottom: -12px; width: 4px; background: var(--good-d); transform: translateX(-50%); border-radius: 2px; }
.thermo .marker { position: absolute; top: 50%; transform: translate(-50%, -50%); transition: left 1.3s cubic-bezier(.3, 1.4, .5, 1); z-index: 2; }
.thermo .marker .px { height: 38px; width: auto; filter: drop-shadow(0 3px 0 var(--shadow)); }
.thermo .marker.ghost { opacity: .5; z-index: 1; }
.thermo .marker.ghost .px { height: 26px; filter: grayscale(.6); }
.thermo .legend { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); font-weight: 700; }
.thermo .legend .mid { text-align: center; color: var(--good-d); }
:root[data-tod="night"] .thermo .legend .mid { color: var(--good); }
.thermo .legend b { display: block; font-family: var(--font-px); font-size: 15px; color: var(--ink); }
.thermo .legend .r { text-align: right; }

.facts { display: grid; gap: 8px; margin-top: 14px; }
.fact { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--panel2); border: 2px solid var(--line); }
.fact .n { font-family: var(--font-px); font-size: 13px; color: var(--muted); }
.fact .w { min-width: 0; overflow-wrap: anywhere; }
.fact .w small { color: var(--muted); display: block; font-size: 13px; }
.fact .s { font-family: var(--font-px); font-size: 22px; }
.fact.final { border-color: var(--ink); }

.section-title { font-family: var(--font-px); font-size: 18px; margin: 22px 0 8px; display: flex; align-items: center; gap: 8px; }
.crowd { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .crowd { grid-template-columns: 1fr 1fr; } }
.histo { display: flex; align-items: flex-end; gap: 3px; height: 74px; padding: 6px; border: 2px solid var(--line); border-radius: 10px; background: var(--panel2); }
.histo i { flex: 1; background: var(--wood-l); border: 2px solid var(--ink); border-bottom: 0; border-radius: 3px 3px 0 0; min-height: 3px; }
.histo i.me { background: var(--honey); }
.histo-l { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 2px 6px 0; font-family: var(--font-px); }
.beat { font-size: 15px; }
.beat b { font-family: var(--font-px); font-size: 26px; color: var(--honey-d); }
:root[data-tod="night"] .beat b { color: var(--honey); }
.toplist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.toplist li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--panel2); border: 2px solid var(--line); }
.toplist li .rk { font-family: var(--font-px); color: var(--muted); }
.toplist li .nm { min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.toplist li .nm small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.toplist li .sc { font-family: var(--font-px); font-size: 18px; }
.toplist li.best { border-color: var(--honey-d); background: color-mix(in srgb, var(--honey) 18%, var(--panel)); }
.empty { color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }

/* ── Day summary ── */
.summary { text-align: center; }
.summary .jarbig .px { width: 110px; height: auto; margin: 6px auto 0; }
.summary .total { font-family: var(--font-px); font-size: 64px; line-height: 1; margin-top: 8px; }
.summary .total small { font-size: 22px; color: var(--muted); }
.summary .mini { display: flex; justify-content: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.summary .mini span { padding: 6px 12px; border-radius: 8px; background: var(--panel2); border: 2px solid var(--line); font-weight: 800; }
.summary .mini b { font-family: var(--font-px); }
.countdown { margin-top: 14px; color: var(--muted); font-size: 14px; }
.countdown b { font-family: var(--font-px); color: var(--ink); font-size: 18px; }
.tip { display: inline-block; margin-top: 12px; font-size: 14px; color: var(--muted); }

/* ── Modals ── */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(28, 18, 10, .55); }
.modal-card { position: relative; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; padding: 22px; background: var(--panel); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 8px 0 var(--shadow); animation: popin .2s steps(3); }
.modal-card h2 { font-family: var(--font-px); font-size: 26px; margin: 0 0 12px; }
.modal-card .x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; display: grid; place-items: center; background: var(--panel2); border: 3px solid var(--ink); border-radius: 8px; }
.comic { display: grid; gap: 12px; }
.panel { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; padding: 12px; background: var(--panel2); border: 3px solid var(--ink); border-radius: 10px; }
.panel .art { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 70px; }
.panel .art .px { height: auto; }
.panel p { margin: 0; font-size: 15px; }
.panel b.n { font-family: var(--font-px); display: block; font-size: 16px; }
.statgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; }
.statgrid b { display: block; font-family: var(--font-px); font-size: 28px; line-height: 1.1; }
.statgrid span { font-size: 11px; color: var(--muted); font-weight: 700; }
.bars { margin-top: 16px; }
.bars .bar { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: center; font-size: 12px; font-family: var(--font-px); margin-bottom: 5px; }
.bars .bar i { display: block; height: 20px; border: 2px solid var(--ink); border-radius: 4px; background: var(--honey); font-style: normal; text-align: right; padding-right: 6px; min-width: 24px; line-height: 16px; color: #3b2416; }
textarea.box, input.box, select.box { width: 100%; padding: 10px 12px; border: 3px solid var(--ink); border-radius: 10px; background: var(--panel2); }
textarea.box { min-height: 90px; resize: vertical; }

/* ── Archive ── */
.archive { display: grid; gap: 8px; }
.aday { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 10px; background: var(--panel2); border: 3px solid var(--line); text-decoration: none; }
.aday:hover { border-color: var(--ink); }
.aday .num { font-family: var(--font-px); font-size: 20px; }
.aday .d { color: var(--muted); font-size: 14px; }
.aday .s { font-family: var(--font-px); display: flex; gap: 8px; }
.aday .s span { min-width: 34px; text-align: center; }
.aday .s .sq { padding: 2px 4px; border: 2px solid var(--ink); border-radius: 5px; color: #2a1810; }
.aday .s .sq.green { background: #78c46b; } .aday .s .sq.yellow { background: #f5d547; }
.aday .s .sq.orange { background: #f39a3c; } .aday .s .sq.red { background: #e5604f; color: #fff; }
.badge { display: inline-block; font-family: var(--font-px); font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--ink); color: var(--panel); vertical-align: middle; }

/* ── Toast, confetti ── */
#toast { position: fixed; left: 50%; bottom: 24px; z-index: 90; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; transition: .25s;
  background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: 10px; font-weight: 800; max-width: calc(100% - 32px); box-shadow: 0 4px 0 var(--shadow); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; top: -16px; width: 10px; height: 10px; z-index: 80; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); } }

.loading { padding: 60px 0; text-align: center; font-family: var(--font-px); color: var(--muted); }
.loading .px { margin: 0 auto 10px; height: 70px; width: auto; animation: bob 1s steps(2) infinite; }

/* ═══════════ Field notebook (scratchpad) ═══════════ */
.pad { display: none; }
body.pad-open .pad { display: flex; }
.pad {
  flex-direction: column; background: #fffdf6; color: #3b2416; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 6px 0 var(--shadow);
  background-image: repeating-linear-gradient(180deg, transparent 0 27px, rgba(91, 155, 213, .25) 27px 28px);
  overflow: hidden;
}
:root[data-tod="night"] .pad { background-color: #f3ead6; }
@media (min-width: 1000px) {
  .pad { position: sticky; top: 12px; max-height: calc(100vh - 24px); }
}
@media (max-width: 999px) {
  .pad { position: fixed; left: 8px; right: 8px; bottom: 0; height: 56vh; z-index: 40; border-radius: 14px 14px 0 0; border-bottom: 0; }
  body.pad-open main { padding-bottom: 56vh; }
}
.pad-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 3px solid #3b2416; background: #fbe7bf; }
.pad-head h3 { margin: 0; font-family: var(--font-px); font-size: 20px; }
.pad-head .x { width: 34px; height: 34px; display: grid; place-items: center; border: 3px solid #3b2416; background: #fff; border-radius: 8px; color: #3b2416; }
.pad-sum { font-size: 13px; padding: 6px 12px; background: #fff3d6; border-bottom: 2px dashed #d9b98a; overflow-wrap: anywhere; }
.pad-sum b { font-family: var(--font-px); }
.pad-tabs { display: flex; gap: 4px; padding: 8px 10px 0; }
.pad-tabs button { flex: 1; padding: 6px 4px; font-family: var(--font-px); font-size: 14px; border: 3px solid #3b2416; border-bottom: 0; border-radius: 8px 8px 0 0; background: #f1dcb4; color: #3b2416; }
.pad-tabs button.on { background: #fffdf6; }
.pad-body { flex: 1; overflow: auto; padding: 12px; border-top: 3px solid #3b2416; margin-top: -3px; }
.pad-body h4 { font-family: var(--font-px); font-size: 16px; margin: 0 0 6px; }
.pad-body p.help { font-size: 13px; margin: 0 0 10px; color: #6e5440; }
.pad-body .formula { font-family: var(--font-px); background: #fff3d6; border: 2px dashed #c9a46e; padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.prow { display: grid; grid-template-columns: 1fr 104px; gap: 6px; margin-bottom: 8px; align-items: end; }
.prow label { font-size: 12px; font-weight: 800; color: #6e5440; display: block; margin-bottom: 2px; }
.pin, .psel { width: 100%; height: 40px; border: 3px solid #3b2416; border-radius: 8px; background: #fff; padding: 0 10px; font-weight: 700; color: #3b2416; }
.psel { padding: 0 4px; font-size: 14px; }
.pres { margin-top: 10px; padding: 12px; border: 3px solid #3b2416; border-radius: 10px; background: #fbe7bf; }
.pres .big { font-family: var(--font-px); font-size: 26px; line-height: 1.1; overflow-wrap: anywhere; }
.pres .also { font-size: 12px; color: #6e5440; margin-top: 4px; }
.pres.err { background: #f8d6cf; font-weight: 700; font-size: 14px; }
.pbtn { height: 36px; padding: 0 12px; border: 3px solid #3b2416; border-radius: 8px; background: #fff; color: #3b2416; font-weight: 800; font-size: 14px; box-shadow: 0 3px 0 #3b2416; }
.pbtn:active { transform: translateY(3px); box-shadow: none; }
.pbtn.go { background: #f2a93b; }
.notes { display: grid; gap: 6px; margin-top: 8px; }
.nrow { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; padding: 6px 8px; background: #fff; border: 2px solid #3b2416; border-radius: 8px; }
.nrow b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.nrow span { font-family: var(--font-px); font-size: 13px; color: #6e5440; }
.nrow .acts { display: flex; gap: 4px; }
.nrow .acts button { height: 28px; padding: 0 8px; border: 2px solid #3b2416; border-radius: 6px; background: #fbe7bf; font-size: 12px; font-weight: 800; color: #3b2416; }
.addform { display: grid; gap: 6px; padding: 10px; margin-top: 8px; border: 3px dashed #c9a46e; border-radius: 10px; background: #fff8e6; }
.addform .two { display: grid; grid-template-columns: 1fr 104px; gap: 6px; }
.calc-in { width: 100%; height: 44px; border: 3px solid #3b2416; border-radius: 8px; font-family: var(--font-px); font-size: 18px; padding: 0 10px; background: #fff; color: #3b2416; }
.calc-prev { font-family: var(--font-px); min-height: 22px; font-size: 14px; color: #6e5440; padding: 4px 2px; }
.calc-prev.bad { color: #b8433a; }
.keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.keys button { height: 38px; border: 2px solid #3b2416; border-radius: 6px; background: #fff; font-family: var(--font-px); font-size: 16px; color: #3b2416; }
.keys button.op { background: #fbe7bf; }
.keys button.eq { background: #f2a93b; grid-column: span 2; }
.hist { margin-top: 10px; font-family: var(--font-px); font-size: 14px; border: 2px solid #3b2416; border-radius: 8px; background: #fff; max-height: 150px; overflow: auto; }
.hist div { padding: 4px 8px; border-bottom: 1px solid #ead9bb; cursor: pointer; overflow-wrap: anywhere; }
.hist div:last-child { border-bottom: 0; }

/* ═══════════ Admin ═══════════ */
.atabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 16px; }
.tbl { overflow-x: auto; border: 3px solid var(--ink); border-radius: 10px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 2px solid var(--line); text-align: left; vertical-align: top; }
th { font-family: var(--font-px); font-weight: 600; background: var(--panel2); white-space: nowrap; }
td input, td select { max-width: 180px; height: 32px; border: 2px solid var(--ink); border-radius: 6px; background: var(--panel2); padding: 0 6px; }
tr.today td { background: color-mix(in srgb, var(--honey) 16%, var(--panel)); }
.st { font-family: var(--font-px); font-size: 12px; padding: 1px 8px; border-radius: 6px; border: 2px solid var(--ink); white-space: nowrap; }
.st.approved { background: var(--good); color: #fff; } .st.auto { background: var(--honey); color: #3b2416; }
.st.draft { background: var(--panel2); } .st.rejected { background: var(--hot); color: #fff; } .st.empty { border-style: dashed; color: var(--muted); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 12px; font-weight: 800; color: var(--muted); min-width: 0; }
.form .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form { grid-template-columns: 1fr; } }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kpi { padding: 12px; border: 3px solid var(--ink); border-radius: 10px; background: var(--panel2); }
.kpi b { display: block; font-family: var(--font-px); font-size: 30px; line-height: 1.1; }
.kpi span { font-size: 12px; font-weight: 800; color: var(--muted); }
.mini-btn { height: 30px; padding: 0 10px; font-size: 13px; font-weight: 800; border: 2px solid var(--ink); border-radius: 6px; background: var(--panel); box-shadow: 0 2px 0 var(--shadow); }
.mini-btn.danger { color: var(--hot); }
.mini-btn.ok { background: var(--good); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Numbers use Silkscreen: Pixelify's 5 reads like an S. */
:root { --font-num: 'Silkscreen', 'Courier New', monospace; }
.verdict .score, .gcard .bigscore, .fact .s, .toplist li .sc, .rtab .sc, .jarbox b, .summary .total, .statgrid b, .kpi b,
.thermo .legend b, .sign .val, .gcard .judged .val, .aday .num, .aday .s, .countdown b, .pres .big, .beat b, .histo-l,
.summary .mini b, .daylabel b, .bars .bar, .calc-in, .calc-prev, .hist, .nrow span { font-family: var(--font-num); letter-spacing: 0; }
.verdict .score { font-size: 60px; }
.gcard .bigscore { font-size: 44px; }
.summary .total { font-size: 54px; }
