/* Letter Post: its own look (a soft sage desk, a cream postcard, Posty the mailbox), with Spell's letter tiles:
   red vowels, blue consonants, the ABeeZee font. Calm by design: soft colors, slow smooth motion (0.4 to 0.8 s,
   ease in and out), one thing moving at a time, nothing loops or flashes. */
@font-face {
  font-family: 'ABeeZee';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../spell/abeezee.woff2) format('woff2');
}

:root {
  --desk: #eef4ea;
  --desk-2: #e1ecdb;
  --card: #fffdf7;
  --ink: #3b2a1a;
  --soft: #6d6250;
  --blue: #3f7fc4;
  --blue-d: #1f5fa8;
  --red: #d65a55;
  --red-d: #ad3f3b;
  --green: #3fa34d;
  --green-d: #2a7a36;
  --sun: #f4c55a;
  --wood: #d9a066;
  --wood-d: #a8713a;
  --tile: clamp(80px, min(26vw, 13dvh), 112px);
  --radius: 20px;
  color-scheme: light;
}
/* Evening: dimmer and warmer (rule 4). */
body.evening {
  --desk: #e6dcc8;
  --desk-2: #dacdb4;
  --card: #f6eedc;
  --blue: #3a6fa6;
  --red: #b85a50;
  --green: #3d8a47;
}
/* The dim goes on the page, not body: a filter on body would pin the Child lock's check and the voice note to the
   page instead of the screen. */
body.evening main, body.evening .top { filter: brightness(.9); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: radial-gradient(circle at 15% 10%, #f6faf3 0 16%, transparent 17%), radial-gradient(circle at 90% 35%, var(--desk-2) 0 12%, transparent 13%), var(--desk);
  color: var(--ink);
  font: 500 18px/1.45 'Fredoka', system-ui, sans-serif;
  overscroll-behavior: none;
  overflow-x: hidden;
}
h1, h2 { font-family: 'Fredoka', system-ui, sans-serif; font-weight: 700; line-height: 1.1; margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--blue-d); }

/* top bar */
.top { display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 16px 6px; min-height: 64px; }
.grow { flex: 1; }
.brand { display: inline-flex; gap: 3px; }
.brand .t { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; color: #fff; font: 400 20px/1 'ABeeZee', sans-serif; background: var(--blue); box-shadow: inset 0 -3px 0 #0003; }
.back, .round {
  min-height: 48px; min-width: 48px; border: 3px solid var(--ink); border-radius: 16px; background: var(--card);
  box-shadow: 0 4px 0 var(--ink); font-weight: 700; padding: 6px; display: inline-flex; align-items: center; justify-content: center;
}
.back:active, .round:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
#sound .mute { display: none; }
#sound[aria-pressed='false'] .mute { display: inline; }
#sound[aria-pressed='false'] .waves { display: none; }

main { max-width: 1600px; margin: 0 auto; padding: 0 16px calc(28px + env(safe-area-inset-bottom)); }
.screen { display: grid; gap: 18px; }

/* letter tiles, like Spell's */
.tile {
  display: grid; place-items: center; width: var(--tile); height: var(--tile); border-radius: 16px; color: #fff;
  font: 400 calc(var(--tile) * .6)/1 'ABeeZee', 'Comic Sans MS', sans-serif; padding-bottom: calc(var(--tile) * .06);
  background: var(--blue); box-shadow: inset 0 -6px 0 var(--blue-d), 0 4px 0 #0002; border: 0; touch-action: none; position: relative;
}
.tile.v { background: var(--red); box-shadow: inset 0 -6px 0 var(--red-d), 0 4px 0 #0002; }
.tile::after { content: ''; position: absolute; inset: 5px 6px auto; height: 26%; border-radius: 10px 10px 30px 30px; background: #ffffff26; pointer-events: none; }

/* home */
.hero { text-align: center; display: grid; gap: 8px; padding-top: 4px; }
.hero h1 { font-size: clamp(34px, 10vw, 54px); }
.lede { margin: 0; font-size: 20px; color: var(--soft); }
.demo { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 6px; --tile: 54px; }
.card-mini { display: grid; place-items: center; width: 70px; height: 54px; background: var(--card); border: 3px solid var(--ink); border-radius: 10px; font: 400 34px/1 'ABeeZee', sans-serif; color: var(--blue); }
.box-mini { display: block; width: 64px; }

.big {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 76px;
  border: 3px solid var(--ink); border-radius: 24px; font-size: 30px; font-weight: 700; box-shadow: 0 7px 0 var(--ink); padding: 10px 20px;
}
.big:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--ink); }
.big.go { background: var(--green); color: #fff; text-shadow: 0 2px 0 #0003; }
.big.plain { background: var(--card); font-size: 24px; min-height: 64px; }

.pick { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; min-width: 0; }
.pick legend { font-weight: 700; font-size: 18px; margin-bottom: 8px; padding: 0; }
.pick button {
  border: 3px solid var(--ink); border-radius: 18px; background: var(--card); box-shadow: 0 4px 0 var(--ink); padding: 10px 4px;
  display: grid; justify-items: center; align-content: start; gap: 4px; font-weight: 700; font-size: 18px; line-height: 1.15; min-height: 96px;
}
.pick button small { font-size: 14px; font-weight: 500; color: var(--soft); }
.pick button[aria-pressed='true'] { background: #dff3e1; border-color: var(--green-d); box-shadow: 0 4px 0 var(--green-d); outline: 3px solid var(--green); outline-offset: 1px; }
.pick button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.mini { display: flex; align-items: center; gap: 3px; --tile: 28px; margin-bottom: 2px; }
.mini .tile { border-radius: 7px; box-shadow: inset 0 -2px 0 #0003; }
.mini .tile::after { display: none; }
.mini .pc { display: grid; place-items: center; width: 30px; height: 28px; background: #fff; border: 2px solid var(--ink); border-radius: 6px; font: 400 20px/1 'ABeeZee', sans-serif; color: var(--blue); font-style: normal; }
.mini img.pc { padding: 2px; object-fit: contain; }
.mini .ar { font-style: normal; color: var(--soft); font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips legend { width: 100%; }
.chips button { display: inline-flex; min-height: 48px; padding: 6px 14px; font-size: 18px; align-items: center; }

.grownups, .about { background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 5px 0 #3b2a1a33; }
.grownups summary { font-weight: 700; cursor: pointer; min-height: 32px; }
.grownups p, .about p { margin: 10px 0 0; }
.about h2 { font-size: 22px; margin-top: 14px; }
.about h2:first-child { margin-top: 0; }
.about h3 { font-size: 18px; margin: 12px 0 0; }
.about ul { padding-left: 22px; display: grid; gap: 6px; }
.small { font-size: 14px; color: var(--soft); }

/* play */
/* The tiles sit in the space under the box, toward the thumb. */
#play-screen { gap: 12px; min-height: calc(100dvh - 120px); grid-template-rows: auto auto auto 1fr; }
#play-screen .tiles { align-self: center; }
.dots { list-style: none; display: flex; justify-content: center; gap: 6px; margin: 0; padding: 0; }
.dots li { width: 16px; height: 16px; border-radius: 50%; background: #d6e3cf; border: 2px solid #a9bd9f; }
.dots li.now { background: var(--sun); border-color: var(--ink); }
.dots li.done { background: var(--green); border-color: var(--green-d); }
.desk { display: grid; justify-items: center; gap: 10px; }

.postcard {
  position: relative; display: grid; place-items: center; width: min(78vw, 300px, 30dvh * 1.4); aspect-ratio: 7 / 5;
  background: var(--card); border: 4px solid var(--ink); border-radius: 18px; box-shadow: 0 6px 0 var(--ink); padding: 10px;
}
.postcard:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--ink); }
.postcard .face { display: grid; place-items: center; width: 100%; height: 100%; }
.postcard .big-letter { font: 400 clamp(72px, 15dvh, 130px)/1 'ABeeZee', sans-serif; color: var(--blue); padding-bottom: 6px; }
.postcard .big-letter.v { color: var(--red); }
.postcard img { width: auto; height: 100%; max-height: 100%; aspect-ratio: 1; object-fit: contain; }
.postcard .stamp { position: absolute; top: 10px; right: 10px; width: 34px; height: 40px; border-radius: 4px; background: #f6d9a8; border: 2px dashed var(--wood-d); }
.postcard .hear { position: absolute; right: -12px; bottom: -12px; width: 46px; height: 46px; border-radius: 50%; background: var(--sun); border: 3px solid var(--ink); display: grid; place-items: center; }
.postcard.arrive { animation: arrive .6s ease-in-out both; }
@keyframes arrive { from { opacity: 0; transform: translateY(-24px); } to { opacity: 1; transform: none; } }

/* Posty the mailbox (../art/posty.js and posty.css, shared with Mail Truck): the letters go into its mouth. */
.postbox { position: relative; width: min(48vw, 260px, 27dvh * .9); }

.said { margin: 0; text-align: center; min-height: 32px; font-size: 22px; font-weight: 700; color: var(--green-d); }
.tiles { display: flex; justify-content: center; gap: clamp(12px, 5vw, 26px); min-height: calc(var(--tile) + 8px); }
.tiles .tile { cursor: grab; }
.tile.dragging { z-index: 20; cursor: grabbing; box-shadow: inset 0 -6px 0 #0003, 0 14px 16px #0003; }
/* The hint: the screen dims around it (spotlight.js, Doug's standing rule Oct 6: no circles). */
.tile.gone { visibility: hidden; }

/* finish */
#finish { text-align: center; padding-top: 10px; }
.cheer { font-size: clamp(32px, 9vw, 46px); }
.sent { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; --tile: clamp(48px, 10.5vw, 72px); animation: arrive .6s ease-in-out both; }
.talk { margin: 0; background: #f6fbf2; border: 2px dashed var(--green-d); border-radius: 16px; padding: 12px 14px; text-align: left; font-size: 18px; }

/* Phones held sideways: the card and the box side by side, the tiles under them. */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --tile: clamp(80px, 20dvh, 88px); }
  .top { min-height: 52px; padding-top: max(6px, env(safe-area-inset-top)); }
  #play-screen { gap: 8px; min-height: 0; grid-template-rows: none; }
  .desk { grid-template-columns: auto auto; align-items: end; gap: 28px; justify-content: center; }
  .postcard { width: min(40vw, 32dvh * 1.4); }
  .postcard .big-letter { font-size: clamp(60px, 22dvh, 110px); }
  .postbox { width: min(24vw, 46dvh * .9); }
  .said { min-height: 26px; font-size: 20px; }
}
