/* Tyler's AAC styles. Themes: light (Cosy), dark (Cosy night), calm (low-stim), contrast (high contrast). */
:root, [data-theme="light"] {
  --bg: #fbf4e8; --panel: #fffaf1; --text: #3a2d27; --muted: #6f5d52;
  --cell: #fffdf8; --cell-text: #3a2d27; --border: #e2d1ba; --edge: #d3bfa3; --accent: #a94f38; --accent-text: #fff;
  --sentence: #fffdf8; --focus: #1f6fb2; --danger: #a3261e; --scale: 1; --radius: 20px;
}
[data-theme="dark"] {
  --bg: #231c19; --panel: #2d2420; --text: #f6ebdd; --muted: #c4b3a2;
  --cell: #362b26; --cell-text: #f6ebdd; --border: #55443a; --edge: #1a1412; --accent: #f0a37f; --accent-text: #2a160d;
  --sentence: #2d2420; --focus: #8fd0ff; --danger: #ff8d80;
}
[data-theme="calm"] {
  --bg: #1d1f21; --panel: #24272a; --text: #cfd3d6; --muted: #8d949a;
  --cell: #2a2d31; --cell-text: #cfd3d6; --border: #34383d; --edge: #34383d; --accent: #6f8f86; --accent-text: #101213;
  --sentence: #24272a; --focus: #b9a26b; --danger: #c98b84;
}
[data-theme="contrast"] {
  --bg: #000; --panel: #000; --text: #fff; --muted: #fff;
  --cell: #000; --cell-text: #fff; --border: #fff; --edge: #fff; --accent: #ffff00; --accent-text: #000;
  --sentence: #000; --focus: #00ffff; --danger: #ff6060; --radius: 10px;
}
[data-theme="calm"] *, [data-theme="contrast"] * { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Nunito", "Quicksand", "Segoe UI", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent; }
body { font-size: calc(16px * var(--scale)); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; }

#app { display: flex; flex-direction: column; height: 100dvh; max-width: 1400px; margin: 0 auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 6px; padding: 8px 8px 6px; }
.title { font-size: 1.05em; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 800; }
.top-actions { display: flex; gap: 5px; }
@media (max-width: 520px) { .topbar { flex-wrap: wrap; padding-top: 4px; } .title { flex-basis: 100%; font-size: .95em; padding-left: 4px; } .top-actions { width: 100%; } .top-btn { flex: 1; } }
.top-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 50px; min-height: 50px;
  padding: 3px 5px; border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 16px; background: var(--panel); font-size: .72em; font-weight: 700; }
.top-btn span[aria-hidden] { font-size: 1.5em; line-height: 1.1; }
.top-btn.status { border-color: var(--accent); }
.top-btn[aria-pressed="true"], .top-btn.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* Sentence bar */
.sentence { display: flex; flex-direction: column; gap: 6px; padding: 0 8px 6px; }
.sentence-text { min-height: 52px; max-height: 110px; overflow: auto; background: var(--sentence);
  border: 2px solid var(--border); border-radius: var(--radius); padding: 10px 14px; font-size: 1.3em; line-height: 1.3; word-break: break-word; font-weight: 600; }
.sentence-text:empty::before { content: "Tap buttons to build a message"; color: var(--muted); font-size: .8em; font-weight: 500; }
.sentence-tr { font-size: .78em; color: var(--muted); margin-top: 2px; font-weight: 600; }
.sentence-actions { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 5px; }
.s-btn { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px;
  border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 16px; background: var(--panel); font-size: 1.15em; padding: 2px 4px; font-weight: 700; }
.s-btn span { font-size: .68em; }
.s-btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
@media (max-width: 420px) { .s-btn { flex-direction: column; gap: 0; } .s-btn span { font-size: .55em; } }
@media (min-width: 900px) { .sentence { flex-direction: row; } .sentence-text { flex: 1; } .sentence-actions { width: 460px; } }

.edit-banner { margin: 0 8px 6px; padding: 8px 12px; border-radius: 14px; background: var(--accent); color: var(--accent-text); font-size: .9em; }

/* Board */
.board { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 0 8px 8px; min-height: 0; }
.grid { display: grid; gap: 7px; }
.core-grid { grid-template-columns: repeat(4, 1fr); grid-auto-rows: minmax(58px, 1fr); flex: 2; padding-bottom: 8px; border-bottom: 3px dotted var(--edge); }
.fringe-grid { grid-template-columns: repeat(4, 1fr); grid-auto-rows: minmax(58px, 1fr); flex: 4; min-height: 0; }
@media (min-width: 700px) {
  .core-grid { grid-template-columns: repeat(8, 1fr); flex: 1; }
  .fringe-grid { grid-template-columns: repeat(8, 1fr); flex: 2; }
}

.crumbs { display: flex; gap: 6px; align-items: center; min-height: 40px; }
.crumb-btn { min-height: 40px; padding: 4px 14px; border-radius: 14px; border: 2px solid var(--border); border-bottom-width: 4px; background: var(--panel); font-weight: 700; }
.crumb-here { font-weight: 800; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }


.cell { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 0; min-height: 0; padding: 4px; border-radius: var(--radius); background: var(--cell); color: var(--cell-text);
  border: 3px solid var(--border); box-shadow: 0 3px 0 var(--edge); overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.cell:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.cell .pic { font-size: 2.1em; line-height: 1; }
.cell img.pic { width: 62%; max-height: 62%; object-fit: contain; border-radius: 10px; }
.cell .lbl { font-size: .9em; font-weight: 700; text-align: center; line-height: 1.1; max-width: 100%;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }



.cell.attention .lbl::before { content: "📣 "; font-size: .8em; }
.cell.empty { border-style: dashed; opacity: .3; background: transparent; box-shadow: none; }
.cell.simple-hidden { visibility: hidden; }
.cell .audio-dot { position: absolute; bottom: 3px; right: 6px; font-size: .7em; }
.no-labels .cell .lbl { display: none; }
body.editing .cell.empty { opacity: .85; visibility: visible; }
body.editing .cell.empty::before { content: "+"; font-size: 2em; }
[data-theme="contrast"] .cell { border-width: 4px; box-shadow: none; }
[data-theme="calm"] .cell { box-shadow: none; }

.pager { display: flex; justify-content: center; gap: 10px; align-items: center; }
.pager button { min-height: 44px; min-width: 80px; border-radius: 14px; border: 2px solid var(--border); background: var(--panel); font-weight: 700; }

/* Overlays */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(40,25,15,.55); display: flex; align-items: center; justify-content: center; padding: 12px; }
.sheet { background: var(--panel); color: var(--text); border-radius: 24px; width: min(640px, 100%); max-height: 92dvh; overflow: auto; padding: 18px; border: 2px solid var(--border); }
.sheet h2 { margin: 0 0 10px; font-size: 1.35em; }
.sheet h3 { margin: 18px 0 6px; font-size: 1.05em; border-top: 2px dotted var(--border); padding-top: 12px; }
.sheet label { display: block; margin: 10px 0 4px; font-weight: 700; }
.sheet .hint { color: var(--muted); font-size: .85em; margin: 2px 0 6px; font-weight: 500; }
.sheet p { line-height: 1.45; }
.sheet input[type=text], .sheet input[type=email], .sheet textarea, .sheet select {
  width: 100%; font: inherit; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--border); background: var(--bg); color: var(--text); }
.sheet textarea { min-height: 90px; }
.sheet input[type=range] { width: 100%; accent-color: var(--accent); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { min-height: 46px; padding: 8px 16px; border-radius: 16px; border: 2px solid var(--border); border-bottom-width: 4px; background: var(--bg); font-weight: 700; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
a.btn { display: inline-flex; align-items: center; text-decoration: none; color: inherit; }
a.btn.primary { color: var(--accent-text); }
.sheet-actions { position: sticky; bottom: -18px; background: var(--panel); padding: 12px 0 6px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-weight: 700; }
.check input { width: 26px; height: 26px; accent-color: var(--accent); flex: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 42px; height: 42px; border-radius: 14px; border: 3px solid var(--border); }
.swatch[aria-pressed="true"] { outline: 4px solid var(--focus); }
.sym-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; margin-top: 8px; }
.sym-results button { background: #fff; border: 2px solid var(--border); border-radius: 14px; padding: 4px; aspect-ratio: 1; }
.sym-results img { width: 100%; height: 100%; object-fit: contain; }
.preview-cell { width: 116px; height: 116px; margin: 6px auto; }
.emoji-quick { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.emoji-quick button { font-size: 1.5em; background: none; border: 1px solid var(--border); border-radius: 12px; width: 44px; height: 44px; }
.lang-list { display: grid; gap: 8px; }
.lang-list .btn { display: flex; align-items: center; gap: 12px; font-size: 1.15em; min-height: 60px; text-align: left; }
.lang-list .code { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 34px; border-radius: 10px; border: 2px solid currentColor; font-size: .8em; }

/* Big show screen */
.bigshow { position: fixed; inset: 0; z-index: 60; background: #1b1411; color: #ffe9a8; display: flex; flex-direction: column; }
.bigshow.light { background: #fffdf8; color: #1b1411; }
.bigshow .pane { flex: 1; position: relative; overflow: hidden; min-height: 0; }
.bigshow .pane.me { display: none; border-top: 4px dashed currentColor; }
.bigshow.two .pane.me { display: block; }
.bigshow .wrap { position: absolute; left: 50%; top: 50%; padding: 2vmin; }
.bigshow .bt { display: block; width: 100%; text-align: center; font-weight: 800; line-height: 1.1; white-space: pre-line; }
.bigshow .bigbar { display: flex; gap: 5px; padding: 8px 6px; justify-content: center; }
.bigshow .bigbar button { min-height: 52px; min-width: 0; flex: 1 1 0; max-width: 150px; padding: 4px 4px; font-size: .85em; border-radius: 16px; border: 2px solid currentColor; background: transparent; color: inherit; font-weight: 700; }
.bigshow .bigbar button.on { background: currentColor; }
.bigshow .bigbar button.on span { filter: invert(1); }
.bigshow .yn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 10px; }
.bigshow .yn button { min-height: 14vh; font-size: 7vmin; font-weight: 800; border-radius: 24px; border: 5px solid currentColor; background: transparent; color: inherit; }

.toast { position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top)); transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 16px; z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; font-weight: 600; }
.toast.show { opacity: 1; }
.attrib { font-size: .8em; color: var(--muted); }

/* Favourite people row */
.favrow { display: flex; gap: 6px; padding: 0 8px 6px; overflow-x: auto; scrollbar-width: none; }
.favrow::-webkit-scrollbar { display: none; }
.chip { flex: none; display: flex; align-items: center; gap: 6px; min-height: 46px; padding: 3px 14px 3px 5px; border-radius: 999px;
  border: 2px solid var(--border); border-bottom-width: 4px; background: var(--panel); font-weight: 700; font-size: .92em; touch-action: manipulation; }
.chip .pic { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35em; background: var(--bg); object-fit: cover; }
.chip.add { padding-left: 14px; border-style: dashed; color: var(--muted); }
.sentence-tr small { font-weight: 500; opacity: .85; }
/* Small screens: keep buttons a usable size even when the message is long (the board scrolls instead of squashing). */
.board { overflow-y: auto; }
@media (max-width: 699px) { .sentence-text { max-height: 84px; } .core-grid { min-height: 130px; flex-shrink: 0; } .fringe-grid { min-height: 270px; flex-shrink: 0; } }

/* ---- v3: more themes, fonts, shapes, button size, language tools ---- */
[data-theme="midnight"] { --bg:#17132b; --panel:#201a3a; --text:#ece8fb; --muted:#a9a2c9; --cell:#272046; --cell-text:#ece8fb; --border:#3d3466; --edge:#0d0a1c; --accent:#7fe0c3; --accent-text:#0f2a22; --sentence:#201a3a; --focus:#ffd166; --danger:#ff8fa3; }
[data-theme="storm"] { --bg:#16191d; --panel:#1e2329; --text:#e6ebf0; --muted:#9aa7b4; --cell:#252b33; --cell-text:#e6ebf0; --border:#3a4350; --edge:#0b0d10; --accent:#4da3ff; --accent-text:#04182e; --sentence:#1e2329; --focus:#ffd166; --danger:#ff8a80; }
[data-theme="dusk"] { --bg:#141a33; --panel:#1b2242; --text:#eef0ff; --muted:#a6add6; --cell:#222a50; --cell-text:#eef0ff; --border:#39437a; --edge:#0a0e20; --accent:#f4a6c8; --accent-text:#3a0f24; --sentence:#1b2242; --focus:#9be7ff; --danger:#ff9aa8; }
[data-theme="custom"] { --focus:#ffd166; --danger:#ff8a80; }
html[data-font="system"], html[data-font="system"] body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
html[data-font="easy"], html[data-font="easy"] body { font-family: "OpenDyslexic", "Lexend", "Atkinson Hyperlegible", "Comic Neue", "Comic Sans MS", Verdana, sans-serif; letter-spacing: .04em; word-spacing: .12em; }
html[data-font="mono"], html[data-font="mono"] body { font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace; }
html[data-shape="square"] { --radius: 6px; }
html[data-shape="square"] .top-btn, html[data-shape="square"] .s-btn, html[data-shape="square"] .btn, html[data-shape="square"] .chip, html[data-shape="square"] .crumb-btn, html[data-shape="square"] .sheet { border-radius: 6px; }
html[data-shape="pill"] { --radius: 30px; }
body.bold-text { font-weight: 700; } body.bold-text .cell .lbl, body.bold-text .sentence-text { font-weight: 900; }
.core-grid, .fringe-grid { grid-template-columns: repeat(var(--cols, 4), 1fr); }
@media (min-width: 700px) { .core-grid, .fringe-grid { grid-template-columns: repeat(calc(var(--cols, 4) * 2), 1fr); } }
.sheet details { border-top: 2px dotted var(--border); }
.sheet summary { font-weight: 800; font-size: 1.05em; min-height: 50px; display: flex; align-items: center; cursor: pointer; list-style: none; }
.sheet summary::before { content: "▸"; margin-right: 10px; } .sheet details[open] > summary::before { content: "▾"; }
.sheet summary::-webkit-details-marker { display: none; }
.sheet details[open] { padding-bottom: 12px; }
.sheet input[type=color] { width: 64px; height: 46px; padding: 2px; border-radius: 12px; border: 2px solid var(--border); background: var(--bg); }
.tr-row { margin: 12px 0; } .tr-row label { font-weight: 600; font-size: .92em; margin: 0 0 3px; white-space: pre-line; }
.lang-list .row .btn small { font-weight: 500; opacity: .8; margin-left: 6px; }
/* Core strip keeps a fixed row height; category area fills the rest and never squashes (the board scrolls if needed). */
.core-grid { flex: none; min-height: 0; grid-auto-rows: 68px; }
.fringe-grid { flex: 1 0 auto; min-height: 0; grid-auto-rows: minmax(76px, 1fr); }
@media (min-width: 700px) { .core-grid { flex: none; grid-auto-rows: 92px; } .fringe-grid { flex: 1 0 auto; grid-auto-rows: minmax(92px, 1fr); } }
@media (max-width: 699px) { .core-grid, .fringe-grid { min-height: 0; } }

/* ---- v4: big Speak / Show buttons, mascot, helper sheets ---- */
.sentence-actions { grid-template-columns: repeat(10, 1fr); }
.s-btn { grid-column: span 2; flex-direction: column; gap: 0; } .s-btn span { font-size: .58em; }
.s-btn.big { grid-column: span 5; flex-direction: row; gap: 10px; min-height: 60px; font-size: 1.5em; } .s-btn.big span { font-size: .72em; }
.s-btn.show { background: var(--text); color: var(--bg); border-color: var(--text); }
.s-btn[aria-pressed="true"] { border-color: var(--accent); border-style: dashed; }
.mascot { vertical-align: middle; flex: none; }
.title { display: flex; align-items: center; gap: 8px; }
.tour { text-align: center; } .tour h2 { font-size: 1.5em; } .tour p { font-size: 1.1em; min-height: 6.5em; }
.tour .dots { color: var(--muted); font-weight: 700; }
.att-list { display: grid; gap: 8px; }
.att-list .btn { min-height: 58px; font-size: 1.1em; text-align: left; justify-content: flex-start; }
.send-preview { font-size: 1.3em; font-weight: 700; padding: 12px 14px; border: 2px solid var(--border); border-radius: 16px; background: var(--bg); white-space: pre-line; }

/* ---- v5: out loud / quiet switch, ask banner, questionnaire, Meet card ---- */
.seg { grid-column: span 4; display: flex; border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 16px; overflow: hidden; background: var(--panel); min-height: 48px; }
.seg button { flex: 1; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 1.1em; font-weight: 800; }
.seg button span { font-size: .58em; }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-text); }
.seg button[aria-checked="true"] span::before { content: "✓ "; }
.ask { display: flex; gap: 8px; align-items: center; margin: 0 8px 6px; padding: 8px 10px; border-radius: 16px; border: 2px solid var(--accent); background: var(--panel); }
.ask-q { flex: 1; font-weight: 800; font-size: 1.1em; }
.pp-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 0; border-bottom: 1px dotted var(--border); }
.pp-row select, .pp-row input[type=text] { flex: 1 1 150px; width: auto !important; }
.pp-row .check { margin: 0; font-size: .9em; }
.meetcard .meet-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.meetcard .meet-inner { max-width: 760px; margin: 0 auto; padding: 4vmin 5vmin; text-align: center; }
.meetcard.flipped .meet-inner { transform: rotate(180deg); }
.meet-hello { font-size: clamp(2rem, 9vw, 4.4rem); margin: 6px 0 10px; line-height: 1.05; }
.meet-note { font-size: clamp(1.25rem, 5vw, 2.1rem); font-weight: 700; line-height: 1.25; margin: 0 0 18px; }
.meet-about { text-align: left; border: 2px dashed currentColor; border-radius: 18px; padding: 10px 16px; margin: 0 auto 16px; font-size: 1.1em; }
.meet-about p { margin: 4px 0 0; }
.meet-sub { font-weight: 700; opacity: .85; }
.meet-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.meet-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; border-radius: 18px; border: 2px solid currentColor; background: transparent; color: inherit; }
.meet-tile small { opacity: .75; word-break: break-all; font-size: .75em; }
.qr { display: block; width: 100%; max-width: 160px; aspect-ratio: 1; background: #fff; border-radius: 10px; padding: 4px; }
.qr svg, .qr img { width: 100%; height: 100%; display: block; object-fit: contain; }
.qr-big .qr { max-width: min(80vw, 420px); margin: 0 auto; }
.meet-greet { font-size: clamp(1.6rem, 7vw, 3rem); font-weight: 800; margin: 18px 0; }
.meet-event { opacity: .8; font-weight: 700; }
.met-list { display: grid; gap: 8px; } .met-item { padding: 10px 12px; border: 2px solid var(--border); border-radius: 14px; }
.met-item a { color: var(--accent); }

/* ---- v6: full-screen pages (Settings, welcome, favourites) ---- */
.overlay.full { padding: 0; align-items: stretch; background: var(--bg); }
.spage { background: var(--panel); color: var(--text); width: 100%; max-width: 680px; margin: 0 auto; height: 100dvh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.sp-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; min-height: 62px; border-bottom: 2px dotted var(--border); }
.sp-head h2 { flex: 1; margin: 0; font-size: 1.3em; text-align: center; }
.sp-head .btn { min-width: 84px; }
.sp-body { flex: 1; min-height: 0; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.sp-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 12px; border-top: 2px dotted var(--border); }
.spage .hint { color: var(--muted); font-size: .9em; margin: 0; }
.spage input[type=text], .spage input[type=email], .spage input[type=tel], .spage textarea { width: 100%; font: inherit; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--border); background: var(--bg); color: var(--text); }
.spage textarea { resize: none; }
.tiles { display: grid; gap: 10px; flex: 1; grid-auto-rows: 1fr; }
.tiles-3 { grid-template-columns: repeat(3, 1fr); } .tiles-2 { grid-template-columns: repeat(2, 1fr); }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 92px; padding: 8px;
  border: 2px solid var(--border); border-bottom-width: 5px; border-radius: 20px; background: var(--bg); font-weight: 800; text-align: center; line-height: 1.15; cursor: pointer; }
.tile .ti { font-size: 2.2em; line-height: 1; }
.tile small { font-weight: 600; color: var(--muted); font-size: .78em; }
.tile.wide { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 60px; width: 100%; text-align: left; }
.tile.wide .ti { font-size: 1.6em; } .tile.wide small { margin-left: auto; }
.tile[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.tile[aria-pressed="true"] small { color: inherit; }
.tile.danger { color: var(--danger); border-color: var(--danger); }
.opt-label { font-weight: 800; margin: 0 0 6px; display: block; }
.choices { display: flex; gap: 6px; }
.choices button { flex: 1; min-height: 50px; padding: 4px 6px; border-radius: 14px; border: 2px solid var(--border); border-bottom-width: 4px; background: var(--bg); font-weight: 800; font-size: .92em; line-height: 1.1; }
.choices button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.choices button:disabled { opacity: .45; }
.themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.theme-sw { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border-radius: 14px; border: 2px solid var(--border); background: var(--bg); font-weight: 800; font-size: .85em; }
.theme-sw i { display: block; width: 100%; height: 42px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); }
.theme-sw[aria-pressed="true"] { outline: 4px solid var(--accent); outline-offset: 1px; }
.colpick { display: flex; align-items: center; gap: 8px; font-weight: 700; flex: 1; }
.colpick input { width: 56px; height: 44px; padding: 2px; border-radius: 12px; border: 2px solid var(--border); background: var(--bg); }
.vlist { display: grid; gap: 6px; }
.vbtn { min-height: 50px; text-align: left; padding: 6px 14px; border-radius: 14px; border: 2px solid var(--border); background: var(--bg); font-weight: 700; }
.vbtn small { color: var(--muted); font-weight: 500; }
.vbtn[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.vbtn[aria-pressed="true"] small { color: inherit; }
.lrow { display: flex; gap: 6px; align-items: center; }
.lrow input { flex: 1; min-width: 0; } .lrow img { width: 48px; height: 48px; object-fit: contain; background: #fff; border-radius: 8px; }
/* welcome */
.wel .sp-head { display: none; }
.wel .sp-body { align-items: center; justify-content: center; text-align: center; }
.wel h2 { font-size: 1.9em; margin: 4px 0; }
.wel .sp-body > p { font-size: 1.35em; line-height: 1.35; margin: 0; max-width: 26ch; }
.wel .big-emoji { font-size: 6em; line-height: 1; }
.wel .tiles { width: 100%; max-height: 260px; }
.wel .tile { font-size: 1.15em; } .wel .tile small { font-size: .7em; }
.wel .dots { color: var(--muted); font-weight: 700; font-size: .95em !important; }
.big-next { min-width: 130px; min-height: 54px; font-size: 1.1em; }
/* favourites picker */
.pick-q { font-weight: 800; font-size: 1.15em; margin: 0; text-align: center; }
.picks { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pick { position: relative; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 2px;
  border-radius: 14px; border: 2px solid var(--border); background: var(--bg); font-weight: 700; font-size: .72em; line-height: 1.05; text-align: center; }
.pick .pe { font-size: 2.1em; line-height: 1; }
.pick[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.pick[aria-pressed="true"]::after { content: "✓"; position: absolute; top: 2px; right: 6px; font-weight: 900; font-size: 1.2em; }
.pick.add { border-style: dashed; }
.pick-count { margin-right: auto; color: var(--muted); font-weight: 700; }
@media (min-width: 700px) { .picks { grid-template-columns: repeat(6, 1fr); } .pick { font-size: .85em; } }
body:has(.overlay.full) .toast { top: auto; bottom: calc(92px + env(safe-area-inset-bottom)); }

/* ---- v7: delete badge + undo, Few/All, pictures only, Event card ---- */
body:not(.editing) .cell.empty { visibility: hidden; }
.cell.few-dim { opacity: .38; }
.del-badge { position: absolute; top: 3px; right: 3px; width: 32px; height: 32px; border-radius: 50%; background: var(--danger); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 17px; z-index: 3; box-shadow: 0 2px 0 rgba(0,0,0,.35); }
body.editing .cell.folder::after { display: none; }
.chip { position: relative; } .chip .del-badge { top: -6px; right: -6px; width: 26px; height: 26px; font-size: 14px; }
.confirm { text-align: center; max-width: 420px; } .confirm p { font-size: 1.1em; }
.confirm-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.undo-bar { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translate(-50%, 160%); z-index: 90; display: flex; gap: 12px; align-items: center;
  background: var(--text); color: var(--bg); padding: 8px 8px 8px 16px; border-radius: 18px; font-weight: 700; max-width: 92vw; transition: transform .2s; }
.undo-bar.show { transform: translate(-50%, 0); }
.no-labels .cell .pic { font-size: 3em; } .no-labels .cell img.pic { width: 80%; max-height: 80%; }
/* Event card */
.meet-greet small { display: block; font-size: .55em; font-weight: 700; opacity: .85; margin-top: 4px; }
.ev-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 6px 0 16px; }
@media (min-width: 900px) { .ev-choices { grid-template-columns: repeat(4, 1fr); } }
.ev-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 120px; padding: 10px; border-radius: 22px;
  border: 3px solid currentColor; background: transparent; color: inherit; font-weight: 800; font-size: clamp(1.05rem, 4.2vw, 1.5rem); line-height: 1.15; }
.ev-btn span { font-size: 2.2em; line-height: 1; }
.ev-h { font-size: clamp(1.6rem, 6.5vw, 2.6rem); margin: 8px 0 14px; line-height: 1.15; }
.ev-input { display: block; width: 100%; font: inherit; font-size: clamp(1.3rem, 5vw, 1.8rem); padding: 14px 16px; border-radius: 18px; border: 3px solid currentColor; background: rgba(255,255,255,.06); color: inherit; margin-bottom: 14px; }
.bigshow.light .ev-input { background: #fff; }
.ev-next { min-height: 60px; min-width: 180px; padding: 8px 24px; border-radius: 18px; border: 0; background: #ffe9a8; color: #1b1411; font-weight: 900; font-size: 1.25em; margin-top: 4px; }
.bigshow.light .ev-next { background: #1b1411; color: #ffe9a8; }
.ev-topics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
@media (min-width: 700px) { .ev-topics { grid-template-columns: repeat(6, 1fr); } }
.ev-topics .pick { color: inherit; background: transparent; border-color: currentColor; font-size: .9em; }
.ev-topics .pick[aria-pressed="true"] { background: #ffe9a8; color: #1b1411; }
.ev-starters { display: grid; gap: 8px; margin-bottom: 14px; }
@media (min-width: 700px) { .ev-starters { grid-template-columns: 1fr 1fr; } }
.ev-start { min-height: 64px; padding: 10px 16px; border-radius: 18px; border: 3px solid currentColor; background: transparent; color: inherit; font-weight: 800; font-size: clamp(1.05rem, 4.2vw, 1.35rem); text-align: left; }
.ev-said { font-size: clamp(2rem, 10vw, 5rem); font-weight: 900; line-height: 1.1; margin: 8vh 0; word-break: break-word; }
.ev-photo img { max-width: 100%; max-height: 58vh; border-radius: 18px; display: block; margin: 0 auto; }
.ev-cap { font-size: clamp(1.2rem, 5vw, 1.8rem); font-weight: 800; margin: 12px 0 4px; }
.ev-nav { display: flex; justify-content: center; align-items: center; gap: 22px; font-weight: 800; font-size: 1.2em; }
.ev-nav button { width: 64px; height: 64px; border-radius: 50%; border: 3px solid currentColor; background: transparent; color: inherit; font-size: 1.8em; font-weight: 900; }
.ev-card { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: center; text-align: left; border: 3px solid currentColor; border-radius: 22px; padding: 16px; margin-bottom: 16px; }
.ev-card h2 { margin: 0 0 4px; font-size: clamp(1.6rem, 6vw, 2.4rem); } .ev-card p { margin: 4px 0; font-size: 1.1em; font-weight: 700; }
.ev-card .meet-tile { max-width: 200px; }

/* ---- v8: calm board (word buttons = plain cards; category buttons = filled stacked tiles with ›) ---- */
/* ==== v8: CALM BOARD ====
   One rule: a plain flat card SAYS something. A filled, stacked card with a › OPENS more choices.
   Category colour lives only on "open" tiles; word cards are quiet. No corner marks, no border patterns. */

/* -- quieter chrome -- */
.topbar { padding: 6px 8px 4px; }
.top-btn { border: 0; border-bottom-width: 0; background: transparent; color: var(--muted); min-height: 52px; min-width: 52px; border-radius: 14px; }
.top-btn span[aria-hidden] { font-size: 1.35em; }
.top-btn.status { border: 2px solid var(--border); color: var(--text); background: var(--panel); }
@media (max-width: 520px) {
  .topbar { flex-wrap: nowrap; padding: 4px 6px 2px; }
  .title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .top-actions { width: 100%; gap: 2px; }
}
.sentence-text { border-width: 2px; }
.s-btn, .seg, .chip, .crumb-btn { border-bottom-width: 2px; }
.s-btn:not(.big) { background: transparent; }
.seg { background: transparent; }
.chip { background: transparent; min-height: 48px; }
.favrow { padding-bottom: 4px; }

/* -- board spacing: space instead of lines -- */
.board { gap: 10px; }
.grid { gap: 8px; }
.core-grid { border-bottom: 0; padding-bottom: 0; }
/* Home needs no breadcrumb row (Support stays in Settings > Support). Inside a category it is a clear "‹ Home" back bar. */
.crumbs:not(:has(.crumb-btn)) { display: none; }
.crumbs { min-height: 48px; gap: 10px; margin-top: 2px; }
.crumb-btn { min-height: 48px; padding: 4px 16px; background: var(--panel); }
.crumb-btn[data-nav="home"]::before { content: "‹ "; font-size: 1.3em; line-height: 0; }
.crumb-here { font-size: 1.15em; }
.support-link { display: none; }   /* only shown on Home, which no longer has a crumb row */

/* -- WORD buttons: plain, quiet, flat cards -- */
.cell { border: 2px solid var(--border) !important; background: var(--cell); box-shadow: none; gap: 4px; }
.cell:active { transform: scale(.97); box-shadow: none; }
.cell .mark { display: none; }     /* legacy shape marks */
.cell .lbl { font-weight: 700; }

/* -- CATEGORY buttons: filled colour tile + stacked cards behind + › badge -- */
.cell.folder {
  --fill: var(--c, var(--muted));
  background: color-mix(in srgb, var(--fill) 28%, var(--cell));
  border-color: color-mix(in srgb, var(--fill) 75%, var(--cell)) !important;
  overflow: visible;
  margin: 5px 5px 0 0;               /* room for the second card peeking out top-right */
  box-shadow: 5px -5px 0 -2px var(--bg), 5px -5px 0 0 color-mix(in srgb, var(--fill) 55%, var(--cell));
}
.cell.folder:active { transform: translate(3px, -3px); box-shadow: 2px -2px 0 -2px var(--bg), 2px -2px 0 0 color-mix(in srgb, var(--fill) 55%, var(--cell)); }
.cell.folder::after {                  /* the › badge (replaces the dark corner triangle) */
  content: "›"; position: absolute; right: 4px; top: 4px; bottom: auto;
  width: 1.4em; height: 1.4em; border: 0; border-radius: 50%; opacity: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05em; font-weight: 900; line-height: 1; padding-bottom: .12em; padding-left: .08em;
  background: var(--cell-text); color: var(--cell);
}
.cell.folder .lbl::after { content: none; }   /* no " ›" after the words */
.cell.folder .lbl { font-weight: 800; }
.no-labels .cell.folder::after { font-size: 1.25em; }
@media (max-width: 699px) { .cell.folder .pic { font-size: 1.85em; } body:not(.no-labels) .cell.folder .pic { margin-right: .35em; } .no-labels .cell.folder .pic { font-size: 2.5em; margin: 0; } }

/* Pictures only: a bit more picture, same rule */
.no-labels .cell .pic { font-size: 2.8em; }

/* Few: hidden buttons stay in place as clean empty space (no outline, no ghost). */
.cell.simple-hidden { visibility: hidden; }

/* Editing: show the stack less so the delete badge stays clear */
body.editing .cell.folder::after { display: none; }

/* -- themes -- */
[data-theme="light"] .cell.folder { background: color-mix(in srgb, var(--fill) 30%, var(--cell)); }
[data-theme="calm"] .cell.folder { background: color-mix(in srgb, var(--fill) 20%, var(--cell)); border-color: color-mix(in srgb, var(--fill) 45%, var(--cell)) !important; }
[data-theme="contrast"] .cell { border: 3px solid var(--border) !important; }
[data-theme="contrast"] .cell.folder { background: var(--text); color: var(--bg); border-color: var(--text) !important;
  box-shadow: 5px -5px 0 -2px var(--bg), 5px -5px 0 0 var(--text); }
[data-theme="contrast"] .cell.folder::after { background: var(--bg); color: var(--text); }
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .cell.folder { background: var(--panel); border-color: var(--c, var(--text)) !important; border-width: 3px !important;
    box-shadow: 5px -5px 0 -2px var(--bg), 5px -5px 0 0 var(--c, var(--text)); }
}

/* -- phone: fit the whole board without scrolling -- */
@media (max-width: 699px) {
  .core-grid { grid-auto-rows: 64px; }
  .fringe-grid { grid-auto-rows: minmax(70px, 1fr); }
  .board { gap: 8px; }
  .sentence { gap: 5px; padding-bottom: 5px; }
  .sentence-text { min-height: 48px; padding: 8px 12px; }
  .s-btn.big { min-height: 54px; }
  .s-btn, .seg { min-height: 46px; }
}
@media (min-width: 700px) {
  .cell.folder::after { font-size: 1.35em; right: 7px; top: 7px; }
  .fringe-grid .cell .pic { font-size: 2.6em; }
  .no-labels .fringe-grid .cell .pic { font-size: 3.4em; }
}
@media (max-width: 699px) { .core-grid .cell { gap: 1px; padding: 3px; } .core-grid .cell .pic { font-size: 1.85em; } .no-labels .core-grid .cell .pic { font-size: 2.6em; } }
/* ==== end v8 ==== */
/* Short phones (e.g. 360x740): tighter rows so the whole board fits without scrolling */
@media (max-height: 780px) and (max-width: 699px) {
  .core-grid { grid-auto-rows: 56px; }
  .fringe-grid { grid-auto-rows: minmax(58px, 1fr); }
  .sentence-text { min-height: 44px; padding: 6px 12px; }
  .s-btn.big { min-height: 48px; }
  .seg, .s-btn { min-height: 44px; }
  .chip { min-height: 40px; }
  .grid, .board { gap: 5px; }
}
@media (max-width: 380px) { .cell .lbl { font-size: .82em; } }

/* ---- v9: call steps, voice input on the Event card ---- */
.call .call-q { font-size: 1.4em; font-weight: 800; text-align: center; margin: 10px 0; }
.att-list .btn small, .att-list a.btn small { display: block; font-weight: 500; font-size: .78em; opacity: .8; }
.att-list a.btn { flex-direction: column; align-items: flex-start; justify-content: center; }
.ev-mic { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 110px; margin: 6px 0 10px; border-radius: 26px; border: 0;
  background: #ffe9a8; color: #1b1411; font: inherit; font-weight: 900; font-size: clamp(1.3rem, 5.5vw, 2rem); }
.ev-mic.small { min-height: 64px; font-size: 1.2em; }
.bigshow.light .ev-mic { background: #1b1411; color: #ffe9a8; }
.ev-heard { font-size: clamp(2rem, 9vw, 4rem); font-weight: 900; margin: 6px 0; word-break: break-word; }
.ev-spell { font-size: 1.15em; letter-spacing: .04em; }
.bigshow .bigbar button.on { background: #ffe9a8; color: #1b1411; }

/* ==== v10: PEACEFUL ====
   Fewer lines and boxes, softer colour, more breathing room. Same rule: plain card = says it, filled stacked tile with › = opens more. */
[data-theme="midnight"] { --bg:#14112a; --panel:#1d1936; --cell:#221e3e; --border:#2e2852; --edge:#0e0b1f; --text:#ecE9f8; --muted:#a39ec2; --accent:#8fe3ca; --accent-text:#10302a; --sentence:#1d1936; }
html, body { background: var(--bg); }
.overlay { background: rgba(10, 8, 24, .6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

/* top bar: quiet icons; "Can't talk" is a soft tinted pill */
.top-btn { font-weight: 600; }
.top-btn.status { border: 0 !important; background: color-mix(in srgb, var(--accent) 16%, var(--panel)); color: var(--text); }
.top-btn:not(.status):active { background: var(--panel); }

/* message bar + controls: no outlines, soft surfaces */
.sentence-text { border: 0 !important; background: var(--panel); border-radius: 22px; font-weight: 600; }
.s-btn, .seg, .chip, .crumb-btn, .pager button { border: 0 !important; background: var(--panel) !important; }
.s-btn.big { border-radius: 22px; }
.s-btn.big.primary { background: var(--accent) !important; color: var(--accent-text); }
.s-btn.big.show { background: var(--text) !important; color: var(--bg); }
.seg { border-radius: 18px; padding: 3px; gap: 3px; }
.seg button { border-radius: 15px; color: var(--muted); }
.seg button[aria-checked="true"] { color: var(--accent-text); }
.chip { font-weight: 650; }
.chip .pic { background: var(--cell); }

/* word buttons: calm flat cards */
.cell { border: 1px solid color-mix(in srgb, var(--text) 7%, transparent) !important; border-radius: 22px; }
.cell .lbl { font-weight: 650; letter-spacing: .005em; }
/* category buttons: softer fill, gentler stack, smaller badge */
.cell.folder { background: color-mix(in srgb, var(--fill) 20%, var(--cell));
  border: 1.5px solid color-mix(in srgb, var(--fill) 42%, var(--cell)) !important;
  box-shadow: 5px -5px 0 -2px var(--bg), 5px -5px 0 0 color-mix(in srgb, var(--fill) 30%, var(--cell)); }
.cell.folder::after { background: color-mix(in srgb, var(--cell-text) 88%, transparent); width: 1.3em; height: 1.3em; font-size: .95em; }
.cell.folder .lbl { font-weight: 750; }
[data-theme="contrast"] .cell { border: 3px solid var(--border) !important; }
[data-theme="contrast"] .cell.folder { background: var(--text); border-color: var(--text) !important; }
.crumb-here { font-weight: 750; color: var(--muted); }
.pager { gap: 8px; } .pager button { min-height: 38px; border-radius: 14px; font-size: .9em; } .pager span { color: var(--muted); font-size: .9em; }

/* full-screen pages (Settings, welcome, favourites): soft cards, no rules */
.spage { background: var(--bg); }
.sp-head, .sp-foot { border: 0 !important; }
.sp-head h2 { font-weight: 750; }
.tile, .theme-sw, .vbtn, .pick, .choices button, .btn { border: 0 !important; background: var(--panel); }
.tile { border-radius: 24px; font-weight: 700; }
.tile .ti { font-size: 2em; }
.choices button { border-radius: 16px; font-weight: 700; }
.btn.danger, .tile.danger { box-shadow: inset 0 0 0 2px var(--danger); }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.spage input[type=text], .spage input[type=email], .spage input[type=tel], .spage textarea, .sheet input[type=tel], .sheet input[type=text], .sheet input[type=email], .sheet textarea, .sheet select {
  border: 1.5px solid color-mix(in srgb, var(--text) 12%, transparent); background: var(--panel); border-radius: 16px; }
.sheet { border: 0; border-radius: 28px; background: var(--panel); }
.sheet .btn { background: var(--cell); }
.sheet .btn.primary { background: var(--accent); }
.sheet h3 { border-top: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wel .tile[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.tile[aria-pressed="true"], .choices button[aria-pressed="true"], .pick[aria-pressed="true"], .vbtn[aria-pressed="true"] { background: var(--accent) !important; color: var(--accent-text); }
.undo-bar, .toast { border-radius: 18px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
/* ==== end v10 ==== */
.crumbs:not(:has(.crumb-btn)):not(:has(.crumb-pager)) { display: none; }
.crumbs:has(.crumb-pager) { display: flex; }
.crumb-pager { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 700; }
.crumb-pager .crumb-btn { min-width: 48px; padding: 4px 10px; font-size: 1.3em; }
.crumb-pager .crumb-btn:disabled { opacity: .35; }
.crumb-pager .crumb-btn::before { content: none !important; }

/* ---- v11: feelings wheel ---- */
.wheelpage .sp-body { align-items: center; }
.wheel { width: min(100%, 420px); height: auto; display: block; margin: 0 auto; }
.wseg { cursor: pointer; outline: none; }
.wseg path { stroke: var(--bg); stroke-width: 3; transition: transform .12s; transform-origin: 180px 180px; }
.wseg:hover path, .wseg:focus path { transform: scale(1.03); }
.wseg:focus-visible path, .wseg:focus-visible circle { stroke: var(--focus); stroke-width: 5; }
.wseg .wlbl { font: 800 15px ui-rounded, "SF Pro Rounded", Nunito, system-ui, sans-serif; fill: #1b1630; }
.wmid circle { fill: var(--panel); stroke: var(--bg); stroke-width: 3; } .wmid .wlbl { fill: var(--text); }
[data-theme="contrast"] .wseg path { stroke: #fff; }
.wwords { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.wword { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; min-height: 72px; padding: 8px 12px; border-radius: 18px; border: 0;
  background: color-mix(in srgb, var(--c) 22%, var(--panel)); color: var(--text); font: inherit; }
.wword .we { grid-row: 1 / 3; font-size: 1.9em; } .wword b { font-size: 1.1em; } .wword small { color: var(--muted); font-size: .8em; line-height: 1.15; }
.wheelpage .tile.wide { background: color-mix(in srgb, var(--c) 18%, var(--panel)); }
.save-mode { background: var(--panel); border-radius: 16px; padding: 10px 14px; margin: 0; }
.consent { font-weight: 600; font-size: .9em; } .consent a { color: var(--accent); }
@media (max-height: 780px) and (max-width: 699px) {
  .crumbs { min-height: 40px; margin-top: 0; }
  .crumb-btn { min-height: 40px; padding: 2px 12px; }
  .favrow { padding-bottom: 2px; }
  .chip { min-height: 38px; }
}
/* long single words (Overwhelmed, Comfortable) shrink a little instead of spilling out */
.cell .lbl.long { font-size: .76em; letter-spacing: -.02em; }
@media (max-height: 780px) and (max-width: 699px) {
  .fringe-grid { grid-auto-rows: minmax(0, 1fr); }
  .fringe-grid .cell { min-height: 0; overflow: hidden; }
  .fringe-grid .cell .lbl { line-height: 1.05; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
@media (max-height: 780px) and (max-width: 699px) { .fringe-grid { flex: 1 1 0; } }
.cell .lbl.longer { font-size: .68em; letter-spacing: -.02em; }

/* ---- v12: follow-up questions ---- */
.askpage .sp-body, .peoplepage .sp-body, .limitspage .sp-body, .badgeset .sp-body { gap: 10px; }
.ask-sofar { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 18px; padding: 8px 8px 8px 14px; }
.ask-sofar p { flex: 1; margin: 0; font-weight: 700; line-height: 1.25; }
.ask-step { color: var(--muted); font-weight: 600; font-size: .8em; white-space: nowrap; }
.ask-grid, .pp-roles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
@media (min-width: 700px) { .ask-grid, .pp-roles { grid-template-columns: repeat(6, 1fr); } }
.ask-grid .pick, .pp-roles .pick { min-height: 70px; padding: 6px 4px; font-size: .86em; line-height: 1.1; position: relative; }
.ask-grid .pick .pe, .pp-roles .pick .pe { font-size: 1.7em; display: block; margin-bottom: 3px; }
.ask-grid .pick.mine { outline: 2px dashed var(--accent); outline-offset: -2px; }
.ask-add { display: flex; gap: 8px; } .ask-add input { flex: 1; }
.ask-scale { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; }
.ask-scale button { border: 0; border-radius: 14px; min-height: 96px; background: var(--c); color: #12101f; font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 2px; }
.ask-scale b { font-size: 1.35em; } .ask-scale span { font-size: 1.2em; min-height: 1.2em; }
@media (max-width: 520px) { .ask-scale { grid-template-columns: repeat(6, 1fr); } .ask-scale button { min-height: 72px; } }
.ask-scale-lbl { display: flex; justify-content: space-between; color: var(--muted); font-weight: 700; font-size: .85em; }
.ask-final { flex: 1; display: flex; align-items: center; justify-content: center; }
.ask-big { font-size: clamp(1.4em, 6vw, 2.4em); font-weight: 800; text-align: center; line-height: 1.2; margin: 0; }
.askpage .sp-foot, .peoplepage .sp-foot { flex-wrap: wrap; }

/* ---- v12: what it can and can't do ---- */
.limits-mini { list-style: none; padding: 0; margin: 0 auto; max-width: 30em; text-align: left; display: grid; gap: 8px; }
.limits-mini li, .limits-list li { display: grid; grid-template-columns: 1.8em 1fr; gap: 8px; align-items: start; }
.limits-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; font-size: .95em; line-height: 1.3; }
.seg-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg-tabs button { min-height: 46px; border: 0; border-radius: 14px; background: var(--panel); color: var(--text); font: inherit; font-weight: 700; }
.seg-tabs button[aria-selected="true"] { background: var(--accent); color: var(--bg); }
.cmp { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: .82em; line-height: 1.25; }
.cmp th, .cmp td { text-align: left; vertical-align: top; padding: 6px 7px; background: var(--panel); }
.cmp thead th { background: none; color: var(--muted); padding-top: 0; }
.cmp tbody th { border-radius: 12px 0 0 12px; width: 22%; } .cmp td:last-child { border-radius: 0 12px 12px 0; }
.cmp-best { margin: 0; font-size: .9em; }

/* ---- v12: My people ---- */
.pp-hello { text-align: center; }
.pp-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pp-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; border-radius: 18px; background: var(--panel); color: var(--text); font: inherit; padding: 8px 4px; min-height: 92px; }
.pp-chip img, .pp-face img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; } .pp-chip span { font-size: 1.8em; line-height: 1.1; }
.pp-chip b { font-size: .95em; } .pp-chip small { color: var(--muted); font-size: .75em; }
.pp-face { text-align: center; font-size: 3.2em; line-height: 1; } .pp-face img { width: 84px; height: 84px; }

/* ---- v12: event badge (looks nothing like the board, so people across the room know it's for them) ---- */
.bigshow.badgeview { background: radial-gradient(circle at 30% 0%, #2f2766, #120f24 72%); color: #fff; }
.badgeview .meet-scroll { display: flex; }
.badgeview .meet-inner { max-width: 640px; width: 100%; padding: 10px 10px 0; text-align: left; display: flex; }
.badge { background: #fff; color: #1f1a33; border-radius: 28px; overflow: hidden; display: flex; flex-direction: column; flex: 1; box-shadow: 0 12px 40px #0009; }
.badge-band { background: linear-gradient(115deg, #13a88a, #5b4ee0 75%); color: #fff; padding: 22px 18px 16px; display: flex; gap: 12px; align-items: center; position: relative; }
.badge-band::before { content: ""; position: absolute; top: 8px; left: 50%; width: 60px; height: 8px; margin-left: -30px; border-radius: 6px; background: #ffffff66; }
.bs-icon { font-size: 2.6em; line-height: 1; }
.bs-big { margin: 0; font-weight: 900; font-size: clamp(1.55em, 7.2vw, 2.9em); line-height: 1.04; letter-spacing: -.01em; }
.bs-sub { margin: 5px 0 0; font-weight: 700; font-size: clamp(1em, 4.2vw, 1.4em); line-height: 1.2; }
.badge-main { padding: 14px 16px; display: flex; flex-direction: column; gap: 11px; flex: 1; min-height: 0; }
.badge-id { display: flex; gap: 12px; align-items: center; }
.badge-av { width: 62px; height: 62px; border-radius: 50%; object-fit: cover; flex: none; background: #ebe8ff; color: #5b4ee0; display: grid; place-items: center; font-weight: 900; font-size: 1.45em; }
.badge-id h2 { margin: 0; font-size: clamp(1.45em, 6.4vw, 2.3em); line-height: 1.05; color: #1f1a33; }
.badge-id p { margin: 3px 0 0; color: #5c5677; font-weight: 700; }
.badge-photo { position: relative; border: 0; padding: 0; border-radius: 18px; overflow: hidden; flex: 1 1 110px; min-height: 90px; max-height: 260px; background: #eee; display: block; width: 100%; }
.badge-photo img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; transition: opacity .3s; }
.badge-photo span { position: absolute; left: 8px; bottom: 8px; background: #000b; color: #fff; padding: 4px 10px; border-radius: 12px; font-weight: 700; font-size: .85em; }
.badge-about { margin: 0; color: #2a2540; line-height: 1.3; }
.badge-event { margin: 0; color: #5c5677; font-weight: 700; font-size: .9em; }
.badge-connect { display: flex; gap: 12px; align-items: center; background: #f2f0ff; border-radius: 18px; padding: 10px; }
.badge-connect b { display: block; font-size: 1.1em; } .badge-connect small { color: #5c5677; font-weight: 700; }
.badge-qr { width: 108px; height: 108px; flex: none; border: 0; background: #fff; border-radius: 12px; padding: 5px; }
.badge-qr svg, .badge-qr img { width: 100%; height: 100%; display: block; object-fit: contain; }
.cn-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.cn-chips button { border: 0; border-radius: 999px; padding: 6px 11px; background: #fff; color: #2a2540; font: inherit; font-weight: 700; font-size: .85em; min-height: 36px; }
.badge-cta { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; padding: 0 16px 16px; }
.badge-cta button { min-height: 62px; border: 0; border-radius: 20px; font: inherit; font-weight: 800; font-size: 1.12em; background: #5b4ee0; color: #fff; }
.badge-cta button + button { background: #ebe8ff; color: #3b2fb0; }
.badgeview .bigbar button { border-color: #ffffff88; color: #fff; }
.badgeview.flipped .meet-inner { transform: rotate(180deg); }
@media (max-height: 760px) { .badge-band { padding: 18px 14px 12px; } .badge-qr { width: 88px; height: 88px; } .badge-photo { max-height: 150px; } .badge-main { gap: 8px; padding: 10px 14px; } .badge-cta button { min-height: 54px; } }
@media (min-width: 900px) and (orientation: landscape) {
  .badgeview .meet-inner { max-width: 1100px; }
  .badge-main { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: min-content; align-content: start; }
  .badge-photo { grid-row: span 3; max-height: none; min-height: 260px; }
}
/* badge set-up */
.bs-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bs-ph { position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: var(--panel); }
.bs-ph img { width: 100%; height: 100%; object-fit: cover; }
.bs-ph.add { display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; cursor: pointer; } .bs-ph.add span { font-size: 2em; }
.bs-ph .del-badge { position: absolute; top: 6px; right: 6px; }
.bs-cn { display: grid; gap: 6px; }
.bs-cnrow { display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 14px; padding: 4px 6px; }
.bs-cnrow span { flex: 1; font-weight: 700; }
.bs-star { border: 0; background: none; font-size: 1.5em; min-width: 44px; min-height: 44px; color: var(--accent); }
.badgeset .tiles-1 { display: grid; grid-template-columns: 1fr; gap: 8px; } .badgeset .tiles-1 .tile { flex-direction: row; justify-content: flex-start; gap: 10px; min-height: 58px; text-align: left; }

/* ---- event mode: the board itself changes too ---- */
.event-bar { display: flex; gap: 6px; padding: 6px 8px 0; }
.event-bar[hidden] { display: none; }
.ev-show { flex: 1; min-height: 48px; border: 0; border-radius: 16px; background: linear-gradient(115deg, #13a88a, #5b4ee0 75%); color: #fff; font: inherit; font-weight: 700; }
.ev-off { min-height: 48px; padding: 0 14px; border: 0; border-radius: 16px; background: var(--panel); color: var(--text); font: inherit; font-weight: 700; }
body.event-on .topbar { box-shadow: inset 0 -3px 0 #5b4ee0; }
.badge-empty { flex: 1; min-height: 120px; border: 2px dashed #c9c3f2; border-radius: 18px; background: #f7f6ff; color: #5b4ee0; font: inherit; font-weight: 700; padding: 14px; }

.badge-cta .cta-later { grid-column: 1 / -1; min-height: 52px; background: #fff4d6; color: #5a3d00; font-weight: 600; font-size: .95em; border: 2px dashed #e7b84a; }
.badge-cta .cta-later b { font-weight: 900; }
.later-done { text-align: center; } .met-later { font-size: .8em; background: var(--accent); color: var(--bg); border-radius: 999px; padding: 2px 8px; }
@media (max-height: 760px) { .badge-cta .cta-later { min-height: 46px; font-size: .88em; } }

/* ---- badge v3: a quarter for my contact, a quarter for "leave yours" ---- */
.badge-main { gap: 9px; }
.pron { display: inline-block; vertical-align: middle; font-size: .45em; font-weight: 800; background: #ebe8ff; color: #3b2fb0; border-radius: 999px; padding: 4px 10px; margin-left: 4px; }
.badge-likes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.badge-likes b { color: #5c5677; font-size: .9em; margin-right: 2px; }
.badge-likes button { border: 0; border-radius: 999px; padding: 5px 12px; background: #e6f8f3; color: #0b6b57; font: inherit; font-weight: 800; font-size: .9em; min-height: 34px; }
.badge-photo { flex: 1 1 0; min-height: 0; max-height: none; }
.badge-spacer { flex: 1 1 0; }
.badge-contact { flex: 0 0 21vh; min-height: 21vh; box-sizing: border-box; }
.badge-connect.badge-contact .badge-qr { width: min(17vh, 150px); height: min(17vh, 150px); }
.cn-web { margin: 4px 0 0; font-weight: 900; font-size: clamp(1.1em, 5vw, 1.6em); color: #1f1a33; word-break: break-all; }
.cn-handles { background: #f2f0ff; border-radius: 18px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.cn-title { font-size: 1.05em; }
.cn-handle { display: grid; grid-template-columns: 1.6em auto 1fr; align-items: center; gap: 8px; border: 0; background: #fff; border-radius: 12px; padding: 4px 10px; font: inherit; text-align: left; flex: 1 1 0; min-height: 0; color: #1f1a33; }
.cn-handle .cn-net { color: #5c5677; font-weight: 700; font-size: .85em; } .cn-handle b { font-size: clamp(1em, 4.6vw, 1.35em); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-later { flex: 0 0 21vh; min-height: 21vh; border: 3px dashed #e7b84a; border-radius: 22px; background: #fff4d6; color: #4a3200; font: inherit; display: flex; align-items: center; gap: 14px; padding: 10px 16px; text-align: left; }
.badge-later .bl-ico { font-size: 3em; line-height: 1; } .badge-later b { display: block; font-size: clamp(1.25em, 5.6vw, 1.8em); font-weight: 900; margin-bottom: 2px; }
.badge-later span:last-child { font-weight: 700; font-size: clamp(.95em, 4vw, 1.15em); line-height: 1.25; }
.badge-cta { grid-template-columns: 1fr 1fr; } .badge-cta button { min-height: 52px; font-size: 1em; }
@media (max-height: 760px) { .badge-contact, .badge-later { flex-basis: 20vh; min-height: 20vh; } .badge-later .bl-ico { font-size: 2.3em; } .badge-cta button { min-height: 46px; } .badge-id h2 { font-size: 1.5em; } .badge-av { width: 50px; height: 50px; } }
@media (min-width: 900px) and (orientation: landscape) {
  .badge-main { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto 1fr 1fr; }
  .badge-id, .badge-likes { grid-column: 1; } .badge-photo, .badge-spacer { grid-column: 1; grid-row: 3 / 5; min-height: 200px; }
  .badge-contact { grid-column: 2; grid-row: 1 / 3; min-height: 0; } .badge-later { grid-column: 2; grid-row: 3 / 5; min-height: 0; }
}
.pron-pick button[aria-pressed="true"] { background: var(--accent); color: var(--bg); }
@media (min-width: 900px) and (orientation: landscape) {
  .badge-main { grid-template-rows: auto auto 1fr 1fr; }
  .badge-contact { grid-row: 1 / 4; } .badge-later { grid-row: 4 / 5; }
  .badge-id { grid-row: 1; } .badge-likes { grid-row: 2; } .badge-photo, .badge-spacer { grid-row: 3 / 5; }
}
@media (min-width: 900px) and (orientation: landscape) {
  .badge-main { grid-template-rows: repeat(4, minmax(0, 1fr)); }
  .badge-contact { grid-row: 1 / 3; } .badge-later { grid-row: 3 / 5; }
  .badge-id, .badge-likes { align-self: center; }
}

/* ---- mixed contact list on the badge ---- */
.cn-mix { display: flex; gap: 10px; align-items: stretch; background: #f2f0ff; border-radius: 18px; padding: 8px; }
.cn-mix .badge-qr { width: auto; height: auto; aspect-ratio: auto; flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; max-width: 42%; }
.cn-mix .badge-qr svg, .cn-mix .badge-qr img { width: min(15vh, 140px); height: min(15vh, 140px); }
.cn-mix .badge-qr small { font-weight: 800; color: #3b2fb0; font-size: .75em; }
.cn-rows { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.cn-row { display: grid; grid-template-columns: 1.5em 1fr; align-items: center; gap: 6px; border: 0; background: #fff; border-radius: 12px; padding: 3px 9px; font: inherit; text-align: left; flex: 1 1 0; min-height: 0; max-height: 52px; color: #1f1a33; }
.cn-row b { font-size: clamp(.9em, 3.9vw, 1.2em); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cn-mix.noqr .cn-row b { font-size: clamp(1em, 4.6vw, 1.35em); }
.bs-cnrow small { color: var(--muted); font-weight: 600; }
.cn-add .tile { min-height: 74px; } .cn-add .ti { font-weight: 900; }

.badgeset .bs-cn { gap: 4px; } .badgeset .bs-cnrow { padding: 0 4px; min-height: 42px; }
.badgeset .bs-cnrow span { font-size: .92em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badgeset .bs-cnrow .btn.danger { min-height: 36px; min-width: 36px; padding: 0; }
.badgeset .bs-star { min-height: 38px; min-width: 38px; font-size: 1.25em; }
.badgeset .cn-add .tile { min-height: 58px; padding: 4px; font-size: .9em; } .badgeset .cn-add .ti { font-size: 1.4em; }
.badgeset .choices button { min-height: 40px; }
@media (max-height: 760px) { .badgeset h2 { font-size: 1.2em; margin: 0; } .badgeset .bs-cnrow { min-height: 38px; } .badgeset .cn-add .tile { min-height: 50px; } .badgeset .dots { display: none; } }

/* one clean page for contact options */
.cn-form { display: grid; gap: 6px; }
.cn-field { display: grid; grid-template-columns: 1.6em 6.4em 1fr; align-items: center; gap: 8px; background: var(--panel); border-radius: 14px; padding: 4px 6px 4px 10px; }
.cn-field .cn-ic { font-size: 1.2em; } .cn-field .cn-lb { font-weight: 700; font-size: .92em; }
.spage .cn-field input[type=text] { min-height: 40px; padding: 6px 10px; background: var(--bg); border-radius: 10px; }
.cn-qrpic { min-height: 52px; flex-direction: row; gap: 10px; justify-content: flex-start; font-size: .92em; }
.cn-main button[aria-pressed="true"] { background: var(--accent); color: var(--bg); }
@media (max-height: 760px) { .cn-form { gap: 4px; } .spage .cn-field input[type=text] { min-height: 36px; } }
.badgeset .dots { display: none; }
.badgeset .sp-body > h2 { margin: 0; }
.cn-form { gap: 4px; } .cn-field { padding: 2px 4px 2px 10px; }
.spage .cn-field input[type=text] { min-height: 38px; }
.cn-main { gap: 5px; } .cn-main button { min-height: 38px; padding: 4px 10px; font-size: .88em; }
.cn-qrpic { min-height: 46px; }

.att-sheet .att-big { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 8px; }
.att-sheet .tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 96px; border: 0; border-radius: 20px; background: var(--cell); color: var(--text); font: inherit; font-weight: 700; }
.att-sheet .tile .ti { font-size: 1.8em; }
.att-sheet .tile.wide { flex-direction: row; width: 100%; min-height: 70px; gap: 12px; justify-content: flex-start; padding: 8px 16px; text-align: left; }
.att-sheet .tile.wide small { display: block; color: var(--muted); font-weight: 600; margin-left: auto; text-align: right; max-width: 45%; }
.cn-main { display: flex; flex-wrap: wrap; } .cn-main button { flex: 0 0 auto; display: inline-flex; flex-direction: row; gap: 4px; align-items: center; }
@media (max-height: 760px) { .spage .cn-field input[type=text] { min-height: 32px; padding: 4px 8px; } .cn-field { padding: 1px 4px 1px 8px; } .cn-qrpic { min-height: 40px; } .cn-main button { min-height: 34px; } .badgeset .sp-body > .hint { display: none; } }
/* Sound sheet: five level tiles */
.tiles-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.tiles-5 .slim-tile { min-height: 64px; font-size: .78rem; padding: 6px 2px; }

/* ---- Phone held sideways: two columns, so many more buttons fit. Message and Speak on the left, buttons on the right. ---- */
@media (orientation: landscape) and (max-height: 540px) {
  #app { display: grid; grid-template-columns: minmax(230px, 34%) 1fr; grid-template-rows: auto auto auto auto 1fr; max-width: none; }
  .topbar { grid-column: 1 / -1; grid-row: 1; padding: 2px 6px; min-height: 0; flex-wrap: nowrap; }
  .topbar .title { display: none; }
  .top-actions { width: 100%; justify-content: space-between; gap: 2px; }
  .top-btn { flex-direction: row; gap: 4px; padding: 3px 8px; min-height: 34px; font-size: .78em; }
  .top-btn .tl { display: none; }
  #askBanner, #eventBar, #editBanner { grid-column: 1 / -1; grid-row: 2; }
  .sentence { grid-column: 1; grid-row: 3; padding: 0 6px 4px; gap: 4px; }
  .sentence-text { max-height: 54px; min-height: 40px; font-size: .95em; }
  .sentence-actions { grid-template-columns: repeat(6, 1fr); gap: 4px; }
  .s-btn.big { grid-column: span 3; min-height: 44px; font-size: 1.1em; gap: 6px; }
  .seg { grid-column: span 3; }
  .s-btn { grid-column: span 1; min-height: 40px; padding: 2px; }
  .favrow { grid-column: 1; grid-row: 4; flex-wrap: wrap; overflow: visible; padding: 0 6px 4px; gap: 4px; }
  .favrow > * { font-size: .82em; padding-top: 2px; padding-bottom: 2px; min-height: 36px; }
  .board { grid-column: 2; grid-row: 3 / 6; padding: 0 6px 6px 0; overflow-y: auto; min-height: 0; gap: 4px; }
  .core-grid { grid-template-columns: repeat(8, 1fr) !important; grid-auto-rows: 62px !important; gap: 4px; padding-bottom: 4px; }
  .fringe-grid { grid-template-columns: repeat(5, 1fr) !important; grid-auto-rows: 64px !important; gap: 4px; flex: none; }
  .cell { padding: 2px; gap: 0; }
  .cell .pic { font-size: 1.5em !important; margin: 0 !important; }
  .cell .lbl { font-size: .74em; line-height: 1.1; }
  .crumbs { margin: 0; min-height: 0; padding: 2px 0; font-size: .85em; }
  .ms-escape { display: none !important; }
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet-head h2 { margin: 0; } .help-btn { min-height: 44px; padding: 6px 14px; }
.wide-btn { width: 100%; margin: 10px 0 6px; min-height: 60px; font-size: 1.2em; }
.sound-steps { padding-left: 1.3em; display: grid; gap: 8px; line-height: 1.35; }

/* ---- Nothing cut off: buttons may grow a little to fit their picture and words, instead of cropping them ---- */
.cell .pic, .cell .lbl { flex-shrink: 0; }
.cell .lbl { overflow-wrap: break-word; word-break: normal; -webkit-hyphens: manual; hyphens: manual; }
.cell .lbl.many { -webkit-line-clamp: 3; }
.core-grid { grid-auto-rows: minmax(56px, auto) !important; }
.fringe-grid { grid-auto-rows: minmax(58px, auto); }
@media (max-width: 699px) { .fringe-grid { grid-auto-rows: minmax(70px, auto); } }
@media (max-height: 780px) and (max-width: 699px) {
  .core-grid { grid-auto-rows: minmax(56px, auto) !important; } .fringe-grid { grid-auto-rows: minmax(60px, auto); }
  .cell .pic { font-size: 1.65em; } .core-grid .cell .pic { font-size: 1.55em; }
  .cell .lbl { font-size: .84em; } .cell .lbl.long { font-size: .74em; } .cell .lbl.longer { font-size: .66em; }
}
@media (min-width: 700px) { .core-grid { grid-auto-rows: minmax(92px, auto) !important; } .fringe-grid { grid-auto-rows: minmax(92px, auto); } }
@media (orientation: landscape) and (max-height: 540px) { .core-grid { grid-auto-rows: minmax(62px, auto) !important; } .fringe-grid { grid-auto-rows: minmax(64px, auto) !important; } }
#askBanner .btn { min-height: 36px; padding: 4px 12px; margin: 4px 4px 0 0; }
.grid .cell { min-height: min-content; }   /* a button is never shorter than its picture and words */
/* Long words shrink to fit the button's own width (cqi = 1% of the button), so a word never runs off the edge. */
.grid .cell { container-type: inline-size; }
.cell .lbl.w6 { font-size: min(.9em, 25cqi); } .cell .lbl.w7 { font-size: min(.9em, 22cqi); } .cell .lbl.w8 { font-size: min(.9em, 19.5cqi); }
.cell .lbl.w9 { font-size: min(.86em, 17.5cqi); } .cell .lbl.w10 { font-size: min(.8em, 15.8cqi); } .cell .lbl.w11 { font-size: min(.74em, 14.4cqi); }
.cell .lbl.w12 { font-size: min(.7em, 13.2cqi); } .cell .lbl.w13 { font-size: min(.68em, 12.2cqi); } .cell .lbl.w14 { font-size: min(.66em, 11.3cqi); }
/* Short phones (every iPhone in Safari counts, because of the toolbars): never squeeze buttons smaller than their contents. If everything doesn't fit, the board scrolls a little instead. */
@media (max-height: 780px) and (max-width: 699px) {
  .fringe-grid { flex: none !important; grid-auto-rows: minmax(60px, auto) !important; }
  .fringe-grid .cell { min-height: min-content !important; }
}
@media (max-height: 780px) and (max-width: 699px) { .fringe-grid .cell .lbl { line-height: 1.15; } }
.cell .lbl { line-height: 1.15; padding-bottom: 1px; }

/* ===== v14 ===== */
/* Core words: Modified Fitzgerald Key colours (people yellow, actions green, describing blue, no/not red, where pink, questions purple). */
.cell.pos { border-color: color-mix(in srgb, var(--p) 80%, var(--cell)) !important; background: color-mix(in srgb, var(--p) 18%, var(--cell)); }
.cell.morph { border-style: dashed !important; }
.cell.morph .lbl { font-weight: 900; }
body.editing .cell.age-dim::before { content: "hidden for this age"; position: absolute; top: 3px; left: 4px; right: 4px; font-size: .6em; font-weight: 700; color: var(--muted); text-align: center; }
.top-btn.holding { outline: 4px solid var(--focus); animation: holdfill 2s linear forwards; }
@keyframes holdfill { from { box-shadow: inset 0 0 0 0 var(--accent); } to { box-shadow: inset 0 -60px 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font: inherit; cursor: pointer; }

/* Scanning */
.scan-row { outline: 5px solid var(--focus) !important; outline-offset: 2px; }
.scan-on { outline: 8px solid var(--focus) !important; outline-offset: 3px; box-shadow: 0 0 0 14px color-mix(in srgb, var(--focus) 35%, transparent) !important; position: relative; z-index: 3; transform: scale(1.04); }
.wseg.scan-row path, .wseg.scan-on path, .wseg.scan-on circle { stroke: var(--focus); stroke-width: 6; }
.scan-catch { position: fixed; left: 0; right: 0; bottom: 0; top: 0; z-index: 900; background: transparent; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.scan-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 950; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 2px solid var(--border); }
.scan-bar .scan-hint { flex: 1; font-weight: 800; min-width: 160px; }
.scan-bar .btn { min-height: 52px; }
body.scanning #app { padding-bottom: 80px; }
body.scanning .overlay.full .sp-foot, body.scanning .overlay.full .sp-body { padding-bottom: 84px; }

/* Keyboard */
.kbd .sp-body { gap: 10px; }
.kbd-out { min-height: 2.6em; font-size: 1.6em; font-weight: 700; padding: 10px 14px; border-radius: 16px; background: var(--bg); border: 2px solid var(--border); word-break: break-word; }
.kbd-caret { color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.kbd-pred { display: flex; gap: 6px; flex-wrap: wrap; min-height: 52px; }
.kbd-pred .btn { flex: 1 1 22%; min-height: 50px; font-size: 1.1em; font-weight: 800; }
.kbd-keys { display: flex; flex-direction: column; gap: 6px; }
.kbd-row { display: flex; gap: 6px; }
.kbd-key { flex: 1; min-height: 58px; border-radius: 14px; border: 2px solid var(--border); border-bottom-width: 4px; background: var(--cell); color: var(--cell-text); font: inherit; font-size: 1.45em; font-weight: 800; text-transform: none; }
.kbd-key.wide { flex: 3; font-size: 1em; }
.kbd-key.act { font-size: 1em; }
.kbd-key:active { transform: translateY(2px); }

/* Backup page and guides */
.bk-status { padding: 12px 14px; border-radius: 16px; border: 2px solid var(--border); margin: 0 0 6px; }
.bk-status.ok { border-color: #6FCF97; background: color-mix(in srgb, #6FCF97 14%, var(--panel)); }
.bk-status.warn { border-color: #F2994A; background: color-mix(in srgb, #F2994A 16%, var(--panel)); }
.bk-file { font-size: 1.1em; }
.guide .sp-body h3 { margin: 14px 0 4px; }
.guide .sp-body p, .guide .sp-body li { line-height: 1.45; }
.big-signal { font-size: 1.5em; font-weight: 900; text-align: center; padding: 10px; border-radius: 16px; border: 3px solid var(--accent); }

/* Paper board preview + print */
.paper-ov { overflow: auto; display: block !important; background: #fff; color: #111; }
.paper { max-width: 900px; margin: 0 auto; padding: 16px 16px 90px; font-family: Arial, Helvetica, sans-serif; }
.paper-bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; justify-content: center; padding: 10px; background: #f3f0f7; border-top: 2px solid #ccc; }
.pp { page-break-after: always; break-after: page; padding: 8px 0 18px; }
.pp h2 { font-size: 22px; margin: 0 0 8px; color: #111; }
.pp-grid { display: flex; flex-direction: column; gap: 6px; }
.pr { display: grid; grid-template-columns: 34px repeat(var(--pc, 4), 1fr); gap: 6px; align-items: stretch; }
.rn { display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 18px; color: #555; border: 2px solid #999; border-radius: 50%; width: 30px; height: 30px; align-self: center; }
.pc { border: 2px solid #333; border-radius: 10px; padding: 6px 4px; min-height: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 2px; background: #fff; color: #111; }
.pc.empty { border: 2px dashed #ddd; }
.pc .pe { font-size: 34px; line-height: 1; }
.pc img { width: 54px; height: 54px; object-fit: contain; }
.pc b { font-size: 15px; } .pc small { font-size: 10px; color: #666; }
.pc.letter { min-height: 64px; } .pc.letter b { font-size: 28px; }
.pp-yn { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 10px 0; }
.pp-yn div { border: 4px solid #111; border-radius: 18px; font-size: 64px; font-weight: 900; text-align: center; padding: 30px 0; }
.pp-yn div:first-child { background: #d8f5e3; } .pp-yn div:last-child { background: #fde0e0; }
.pp-sig { font-size: 22px; font-weight: 900; text-align: center; }
.pp-help { font-size: 14px; color: #333; border-top: 1px solid #ccc; padding-top: 8px; }
@media print {
  body.printing #app, body.printing .toast, body.printing .scan-bar, body.printing .scan-catch, body.printing #undoBar { display: none !important; }
  body.printing #overlayRoot > :not(.print-me) { display: none !important; }
  body.printing .print-me { position: static !important; background: #fff !important; color: #111 !important; padding: 0 !important; display: block !important; }
  body.printing .print-me .sp-head, body.printing .print-me .sp-foot, body.printing .print-me .paper-bar { display: none !important; }
  body.printing .print-me .spage { height: auto !important; max-width: none; background: #fff; color: #111; }
  body.printing .print-me .sp-body { overflow: visible !important; height: auto !important; color: #111; }
  body.printing .print-me .paper { padding: 0; }
  body.printing { background: #fff !important; }
}
/* Picture guides */
svg.mini { width: 100%; max-width: 390px; height: auto; display: block; margin: 0 auto; }
.gstep { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px; align-items: center; padding: 12px 0; border-bottom: 2px solid var(--border); break-inside: avoid; }
@media (max-width: 560px) { .gstep { grid-template-columns: 1fr; } }
.gstep h3 { margin: 0 0 6px; display: flex; gap: 8px; align-items: center; }
.gnum { display: inline-flex; align-items: center; justify-content: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 900; flex: none; }
.mycards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mycard { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border-radius: 20px; border: 3px solid var(--border); background: var(--cell); color: var(--cell-text); font: inherit; }
.mc-pics { font-size: 2.6em; line-height: 1.1; } .mc-arrow { font-size: .5em; color: var(--muted); vertical-align: middle; }
.mc-txt { font-size: 1.15em; font-weight: 800; text-align: center; }
@media print { body.printing .print-me .gstep { border-color: #ccc; } body.printing .print-me svg.mini { --bg: #fff; --cell: #f3f3f3; --border: #888; --text: #111; --panel: #fff; --sentence: #fff; --muted: #777; } body.printing .print-me .mycard { background: #fff; color: #111; border-color: #888; } }
/* v14: one more button (⌨️ Type) in the message bar: 12 columns keep everything on two rows */
.sentence-actions { grid-template-columns: repeat(12, 1fr); }
.s-btn.big { grid-column: span 6; }
.overlay.full.paper-ov { background: #fff; color: #111; }
.paper-bar .btn { color: #111; background: #fff; border-color: #888; }
.paper-bar .btn.primary { background: #7fe0c3; }
/* Mankoski pain levels: one row each, colour from green to red, readable on any width */
.mank { display: flex; flex-direction: column; gap: 6px; }
.mank-row { display: grid; grid-template-columns: 2.2em 2em minmax(0, 1fr); align-items: center; gap: 8px; text-align: left; padding: 8px 10px; border-radius: 14px;
  border: 2px solid color-mix(in srgb, var(--c) 70%, var(--border)); border-left-width: 10px; background: color-mix(in srgb, var(--c) 16%, var(--cell)); color: var(--cell-text); font: inherit; min-height: 54px; }
.mank-n { font-size: 1.5em; font-weight: 900; text-align: center; }
.mank-face { font-size: 1.6em; line-height: 1; }
.mank-txt { display: flex; flex-direction: column; min-width: 0; } .mank-txt b { font-size: 1.05em; } .mank-txt small { color: var(--muted); font-size: .85em; line-height: 1.25; overflow-wrap: anywhere; }
.mank-credit { margin-top: 6px; font-size: .78em; }
/* Word guesses: one thin row that scrolls sideways inside itself (never the page) */
.guess-row { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 2px 0; }
.guess-row[hidden] { display: none; }
.guess-tag { flex: none; font-size: .78em; font-weight: 800; color: var(--muted); }
.guess-list { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; padding: 2px; }
.guess-list::-webkit-scrollbar { display: none; }
.guess { flex: none; min-height: 40px; padding: 4px 14px; border-radius: 999px; border: 2px dashed var(--accent); background: transparent; color: var(--text); font: inherit; font-weight: 800; white-space: nowrap; }
.guess.often { border-style: solid; }
/* Words used report */
.ubars { display: flex; flex-direction: column; gap: 4px; }
.ubar { display: grid; grid-template-columns: minmax(0, 7em) minmax(0, 1fr) 2.6em; gap: 8px; align-items: center; }
.ub-w { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ub-track { height: 14px; border-radius: 7px; background: var(--cell); overflow: hidden; } .ub-fill { display: block; height: 100%; background: var(--accent); border-radius: 7px; }
.ub-n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
/* AAC pictures (ARASAAC) on buttons: white tile so the drawing reads on dark themes */
.cell img.pic.aac { background: #fff; border-radius: 10px; padding: 3px; width: auto; height: 58%; max-width: 78%; object-fit: contain; }
.ps-bar { height: 12px; border-radius: 6px; background: var(--cell); overflow: hidden; } .ps-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.pr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pr-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 14px; border: 2px solid var(--accent); background: var(--cell); color: var(--cell-text); font: inherit; min-width: 0; }
.pr-card img { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 8px; }
.pr-card b { font-size: .8em; text-align: center; overflow-wrap: anywhere; }
.pr-em { position: absolute; top: 4px; right: 6px; font-size: 1.1em; }
.pr-card.off { border-color: var(--border); border-style: dashed; } .pr-card.off img { opacity: .25; filter: grayscale(1); }
.pr-card.off::after { content: "✕"; position: absolute; top: 26px; font-size: 2em; font-weight: 900; color: var(--danger); }
.helper-tag { font-size: .75em; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-text); white-space: nowrap; }
.pp-pain { display: flex; flex-direction: column; gap: 4px; }
.pp-pl { display: grid; grid-template-columns: 34px 34px 1fr; gap: 8px; align-items: center; border: 2px solid #999; border-left-width: 12px; border-radius: 10px; padding: 6px 8px; font-size: 14px; }
.pp-pl > b { font-size: 22px; text-align: center; } .pp-pl > span { font-size: 24px; }

/* ===== v15 layout: clear sections on every screen ===== */
/* "Always here" core strip sits in its own tinted tray, so it reads as different from the category pages below it. */
#coreGrid { padding: 6px; border-radius: 18px; background: color-mix(in srgb, var(--accent) 7%, var(--panel)); border: 2px solid color-mix(in srgb, var(--accent) 28%, var(--border)); }
.crumbs { border-radius: 14px; }
/* Rows that scroll sideways fade at the right edge, so it's clear there is more */
.guess-list, .favrow { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); padding-right: 28px; }
.guess-row { padding: 0 8px; }

/* Phone held sideways (short and wide): two columns. Left: message, guesses, people. Right: core strip and a 2-row page of buttons
   (the same 16 buttons per page as in portrait, laid out 8 across), so nothing needs scrolling and buttons stay big. */
@media (orientation: landscape) and (max-height: 540px) {
  #app { grid-template-rows: auto auto auto auto auto 1fr; }
  #guessRow { grid-column: 1; grid-row: 4; padding: 0 6px 4px; }
  .favrow { grid-row: 5; align-content: flex-start; -webkit-mask-image: none; mask-image: none; padding-right: 6px; }
  .board { grid-row: 3 / -1; }
  .sentence-actions { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .s-btn.big { grid-column: span 3; }
  .seg { grid-column: span 2; }
  .s-btn { grid-column: span 1; }
  .s-btn span { font-size: .6em; }
  .core-grid { grid-template-columns: repeat(calc(var(--cols, 4) * 2), minmax(0, 1fr)) !important; grid-auto-rows: minmax(52px, auto) !important; padding: 4px; }
  .fringe-grid { grid-template-columns: repeat(calc(var(--cols, 4) * 2), minmax(0, 1fr)) !important; grid-auto-rows: minmax(58px, 1fr) !important; flex: 1 1 auto !important; }
  .crumbs { min-height: 36px; } .crumb-btn { min-height: 34px; padding: 2px 10px; }
  .scan-bar { padding: 4px 8px; } .scan-bar .btn { min-height: 40px; }
  body.scanning #app { padding-bottom: 54px; }
}
/* Very short screens (phone sideways with toolbars): the keyboard uses wider rows and smaller keys */
@media (max-height: 540px) {
  .kbd-out { min-height: 1.5em; font-size: 1.15em; padding: 4px 10px; }
  .kbd-pred { min-height: 0; } .kbd-pred .btn { min-height: 34px; flex-basis: 15%; }
  .kbd-key { min-height: 36px; font-size: 1.15em; border-bottom-width: 3px; }
  .kbd .sp-body { gap: 6px; }
  .spage .sp-head { padding-top: 4px; padding-bottom: 4px; }
}
/* Status card buttons wrap their words instead of overflowing on small phones */
.bigbar button { min-width: 0; overflow-wrap: anywhere; }
.bigbar button span { white-space: normal; }
@media (orientation: landscape) and (max-height: 540px) {
  .topbar { min-height: 38px; }
  .ask { margin: 2px 6px 4px; padding: 4px 8px; font-size: .82em; gap: 6px; }
  #askBanner .btn { min-height: 32px; margin: 0; padding: 2px 10px; }
}
svg.mini { flex: none; min-height: 60px; }

/* ===== v16: Shelby, Make it mine, shells, parent hub ===== */
#boardTitle { cursor: pointer; }
.primary-tile { border-color: var(--accent) !important; background: color-mix(in srgb, var(--accent) 22%, var(--cell)) !important; }
.hello .hello-top { display: flex; gap: 12px; align-items: center; }
.hello .hello-top h2 { margin: 0 0 4px; }
.hello-joke, .sh-bubble { position: relative; background: var(--bg); border: 2px solid var(--accent); border-radius: 18px; padding: 10px 14px; font-weight: 700; line-height: 1.35; margin: 8px 0; }
.hello .tiles { grid-auto-rows: minmax(92px, auto); }
@media (max-width: 420px) { .hello .tiles-3 { grid-template-columns: 1fr; } .hello .tiles .tile { min-height: 64px; flex-direction: row; gap: 10px; } .hello .tiles .tile small { display: none; } }
.mk-bar { display: flex; gap: 4px; margin-bottom: 6px; } .mk-bar span { flex: 1; height: 6px; border-radius: 3px; background: var(--border); } .mk-bar span.on { background: var(--accent); }
.mk-hero { display: flex; gap: 10px; align-items: center; } .mk-hero .sh-bubble { flex: 1; min-width: 0; }
.mk-q { font-size: 1.25em; font-weight: 800; margin: 10px 0 6px; }
.mk-input { width: 100%; font: inherit; font-size: 1.3em; padding: 12px 14px; border-radius: 16px; border: 2px solid var(--border); background: var(--bg); color: var(--text); margin-bottom: 8px; }
.mk-preview { font-size: 1.05em; } .mk-preview b { color: var(--accent); }
.mk-tiles { flex: 0 0 auto; grid-auto-rows: minmax(96px, auto); }
.mk-tiles .tile small { font-size: .78em; }
.mk-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.mk-sw { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 16px; border: 3px solid var(--border); background: var(--cell); color: var(--cell-text); font: inherit; font-weight: 700; cursor: pointer; position: relative; }
.mk-sw i { width: 54px; height: 54px; border-radius: 50%; display: block; border: 2px solid rgba(255,255,255,.4); }
.mk-sw[aria-pressed="true"] { border-color: var(--accent); outline: 3px solid var(--focus); }
.mk-own input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.mk-done { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mk-done h2 { margin: 4px 0; }
.shell-pop { position: fixed; left: 50%; top: 12px; transform: translate(-50%, -140%); z-index: 2000; display: flex; gap: 10px; align-items: center; max-width: calc(100vw - 24px);
  background: var(--panel); color: var(--text); border: 3px solid var(--accent); border-radius: 20px; padding: 10px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.35); transition: transform .35s cubic-bezier(.2,1.4,.4,1); }
.shell-pop.show { transform: translate(-50%, 0); }
.shell-pop .sp-ic { font-size: 2em; animation: wiggle 1s ease 2; } .shell-pop small { display: block; color: var(--muted); font-size: .8em; }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
.sh-top { display: flex; gap: 10px; align-items: center; } .sh-top .sh-bubble { flex: 1; min-width: 0; }
.sh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.sh-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 10px 6px; border-radius: 16px; border: 2px dashed var(--border); background: var(--bg); opacity: .65; min-width: 0; }
.sh-card.got { border-style: solid; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--cell)); opacity: 1; }
.sh-ic { font-size: 2em; } .sh-card b { font-size: .88em; overflow-wrap: anywhere; } .sh-card small { font-size: .72em; color: var(--muted); overflow-wrap: anywhere; }
.pair-qr { max-width: 240px; margin: 8px auto; } .pair-qr svg { width: 100%; height: auto; display: block; }
.pair-code { font-size: 2.2em; font-weight: 900; letter-spacing: .12em; text-align: center; margin: 4px 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.hub-code { display: flex; gap: 8px; } .hub-code[hidden] { display: none; } .hub-code .mk-input { margin: 0; } #hbCode, #rcCode { text-transform: uppercase; letter-spacing: .1em; }
.hub-email summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.hub-tools { flex: 0 0 auto; grid-auto-rows: minmax(84px, auto); }
@media (max-width: 380px) { .hub-tools { grid-template-columns: repeat(2, 1fr); } }
.shell-pop { pointer-events: none; }
/* Phones hide the title bar to save room, so the board's name lives in the empty message bar instead */
@media (max-width: 520px), (orientation: landscape) and (max-height: 540px) {
  .sentence-text:empty::before { content: attr(data-ph); }
}
@media (orientation: landscape) and (max-height: 360px) {
  .topbar { min-height: 32px; padding: 1px 6px; } .top-btn { min-height: 30px !important; padding: 1px 8px; }
  .sentence-text { min-height: 34px; max-height: 46px; }
  .s-btn.big { min-height: 38px; } .s-btn { min-height: 36px; }
  #app { height: 100dvh; overflow: hidden; }
}
.shell-pop { left: 12px; right: 12px; margin: 0 auto; width: fit-content; transform: translateY(-140%); }
.shell-pop.show { transform: translateY(0); }
/* No accidental pull-to-refresh while tapping and swiping on the board */
html, body { overscroll-behavior: none; }
.hello-back { margin: 8px 0 0; min-height: 48px; font-size: 1em; }
.sh-total { font-size: 1.1em; margin: 6px 0; } .sh-total b { font-size: 1.4em; color: var(--accent); }
.sh-set h3 { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; } .sh-set h3 small { color: var(--muted); font-weight: 600; font-size: .72em; }
.sh-meter { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; margin-bottom: 8px; } .sh-meter span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
/* Dress up the crab */
.crab-stage { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: center; }
.crab-stage .mascot { flex: none; max-width: 46vw; height: auto; }
.crab-info { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.crab-name { font-size: 1.5em; } .crab-lvl { margin: 4px 0 0; font-weight: 800; color: var(--accent); }
.mascot .paintable { cursor: pointer; } .mascot .paintable:hover { opacity: .85; }
.crab-pal { display: flex; flex-wrap: wrap; gap: 8px; }
.crab-dot { width: 44px; height: 44px; border-radius: 50%; background: var(--dot); border: 3px solid var(--border); flex: none; }
.crab-dot[aria-pressed="true"] { outline: 4px solid var(--focus); outline-offset: 2px; }
.crab-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.crab-opt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; border: 2px solid var(--border); background: var(--cell); color: var(--cell-text); font: inherit; font-weight: 700; font-size: .9em; min-width: 0; }
.crab-opt span { font-size: 1.6em; } .crab-opt small { font-size: .72em; color: var(--muted); }
.crab-opt[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, var(--cell)); }
.crab-opt.locked { opacity: .55; border-style: dashed; }
.level-pop .mascot { flex: none; }
.acc-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 2px solid var(--border); border-radius: 14px; background: var(--cell); }
.acc-ic { font-size: 1.5em; } .acc-t { flex: 1; min-width: 0; display: flex; flex-direction: column; } .acc-t small { color: var(--muted); }
.acc-row .btn { flex: none; }
.crab-opt[aria-pressed="true"] { border-color: var(--accent); }
/* Daily hello from the crab */
.daily { position: fixed; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 520px; z-index: 1500; display: flex; gap: 10px; align-items: flex-start;
  background: var(--panel); color: var(--text); border: 3px solid var(--accent); border-radius: 22px; padding: 12px 14px; box-shadow: 0 12px 36px rgba(0,0,0,.4); transform: translateY(140%); transition: transform .45s cubic-bezier(.2,1.3,.4,1); }
.daily.show { transform: translateY(0); }
.daily .mascot { flex: none; animation: wiggle 1.2s ease 1; }
.daily-t { flex: 1; min-width: 0; } .daily-t p { margin: 4px 0; line-height: 1.35; } .daily-w { color: var(--muted); } .daily-w b { color: var(--accent); font-size: 1.15em; }
.daily-b { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; } .daily-b .btn { min-height: 44px; }
.cell.wotd-glow { outline: 6px solid var(--accent) !important; outline-offset: 2px; animation: wiggle .8s ease 3; }

/* Picture guide: which device */
.dev-picks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 4px 0 10px; }
.dev-pick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; border: 2px solid var(--border); background: var(--cell); color: var(--cell-text, var(--text)); font: inherit; font-weight: 700; font-size: .85em; min-height: 70px; }
.dev-pick span { font-size: 1.7em; line-height: 1; }
.dev-pick[aria-pressed="true"] { border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus) inset; }
@media (max-width: 380px) { .dev-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lead-q { font-size: 1.2em; font-weight: 800; text-align: center; margin: 8px 0 12px; }
/* What's new */
.wn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 8px 0; }
.wn-card { display: flex; flex-direction: column; gap: 3px; padding: 10px; border-radius: 14px; background: var(--cell); border: 2px solid var(--border); }
.wn-card .wn-ic { font-size: 1.9em; line-height: 1.1; }
.wn-card small { opacity: .85; line-height: 1.3; }

/* Word shop and Show or hide pages */
.eb-tools { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.eb-tools .btn { min-height: 40px; padding: 6px 12px; font-size: .95em; background: var(--bg); color: var(--text); border: 2px solid var(--bg); opacity: 1; }
.shop-tabs { flex-shrink: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 4px 0 12px; }
.shop-tab { flex: 0 0 auto; border: 2px solid var(--border); background: var(--panel); color: inherit; border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 700; min-height: 44px; }
.shop-tab[aria-selected="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.shop-grid, .hide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.shop-card, .hide-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 12px 8px; min-height: 140px;
  border: 2px solid var(--border); border-radius: 24px; background: var(--panel); color: var(--text); font: inherit; }
.shop-card b, .hide-card b { font-size: 1.05em; line-height: 1.2; overflow-wrap: anywhere; }
.shop-card small { opacity: .75; }
.shop-ic { font-size: 2.4em; line-height: 1; }
.shop-tag { margin-top: 4px; padding: 3px 10px; border-radius: 999px; background: var(--border); font-size: .8em; font-weight: 800; }
.shop-card.on { border-color: var(--accent); } .shop-card.on .shop-tag { background: var(--accent); color: var(--accent-text); }
.hide-card.off { opacity: .5; border-style: dashed; }
.shop-acts { justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.shop-msg { text-align: center; font-weight: 800; padding: 8px 12px; border-radius: 14px; border: 2px solid var(--accent); }
.shop-words { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.shop-word { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; min-height: 96px; border: 2px solid var(--border); border-radius: 18px; background: var(--panel); color: inherit; font: inherit; text-align: center; }
.shop-word span { font-size: 1.8em; line-height: 1; } .shop-word b { font-size: .9em; line-height: 1.2; overflow-wrap: anywhere; }

/* Seven ages */
.age-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; grid-auto-rows: auto; flex: 0 0 auto; }
.age-tiles .tile { min-height: 86px; } .age-tiles .tile small { opacity: .75; }
.age-choices { flex-wrap: wrap; } .age-choices button { flex: 1 1 30%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.age-choices button small { font-weight: 600; opacity: .75; font-size: .78em; }
.ver-line { text-align: center; margin-top: 10px; }
/* Avatars: drawn people and pets */
svg.avatar { display: block; width: 100%; height: 100%; }
.pic.av { display: inline-block; width: 1.25em; height: 1.25em; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.cell .pic.av { width: 1.3em; height: 1.3em; }
.chip .pic.av { width: 34px; height: 34px; padding: 0; background: none; }
.pp-roles .pick .pe svg.avatar, .pp-face svg.avatar { margin: 0 auto; }
.pp-roles .pick .pe { width: 1.5em; height: 1.5em; margin: 0 auto 3px; }
.pp-roles .pick[data-n="2"]::after { content: "×2"; }
.pp-sec { grid-column: 1 / -1; margin: 10px 0 0; font-size: 1em; text-align: center; }
.pp-chip svg.avatar { width: 42px; height: 42px; }
.pp-face svg.avatar { width: 84px; height: 84px; }
.pk-grid .pe svg.avatar, .pe svg.avatar { width: 1.6em; height: 1.6em; }
/* Avatar closet */
.cl-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.cl-who { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px; border: 2px solid var(--border); border-radius: 20px; background: var(--panel); color: var(--text); font: inherit; text-align: center; }
.cl-who svg.avatar, .cl-who img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.cl-who b { overflow-wrap: anywhere; line-height: 1.15; } .cl-who small { color: var(--muted); font-size: .75em; }
.cl-hero { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 6px; }
.cl-hero svg.avatar.big { width: 150px; height: 150px; }
.cl-pearls { margin: 0; font-weight: 800; }
.cl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; margin-bottom: 8px; }
.cl-opt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; border: 2px solid var(--border); border-radius: 18px; background: var(--panel); color: var(--text); font: inherit; font-size: .82em; font-weight: 700; text-align: center; }
.cl-opt svg.avatar { width: 56px; height: 56px; }
.cl-opt.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.cl-opt.locked svg.avatar { opacity: .5; }
.cl-opt small { position: absolute; top: 4px; right: 4px; padding: 1px 6px; border-radius: 999px; background: var(--bg); font-size: .85em; }
.age-tiles .tile { flex-direction: column; text-align: center; gap: 2px; }
.hello .tiles.age-tiles { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); grid-auto-rows: auto; }
.hello .tiles.age-tiles .tile { flex-direction: column; gap: 2px; min-height: 84px; padding: 6px 4px; font-size: .95em; line-height: 1.1; }
.hello .tiles.age-tiles .tile small { display: block; }
@media (max-width: 420px) { .hello .tiles.age-tiles { grid-template-columns: repeat(3, 1fr); } }
/* the clear way into the Avatar closet */
.chip.dress-chip { border: 2px dashed var(--accent); }
.hello-dress { margin-top: 8px; }
/* New shells and levels: a big card that stays until tapped (or a few seconds, if chosen) */
.ach-card { position: fixed; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); margin: 0 auto; max-width: 520px; z-index: 1500;
  background: var(--panel); color: var(--text); border: 3px solid var(--accent); border-radius: 22px; padding: 14px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.35);
  transform: translateY(160%); transition: transform .3s ease; }
/* at the bottom, so the message and Speak stay free to use */
body.scanning .ach-card { bottom: 90px; }
.ach-card.show { transform: translateY(0); }
.ach-card.quick { pointer-events: none; }
.ach-top { display: flex; gap: 12px; align-items: center; }
.ach-ic { font-size: 2.8em; line-height: 1; flex-shrink: 0; } .ach-ic svg { width: 56px; height: 56px; }
.ach-txt b { display: block; font-size: 1.2em; line-height: 1.2; } .ach-txt small { display: block; color: var(--muted); margin-top: 3px; font-size: .95em; }
.ach-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; } .ach-btns .btn { min-height: 46px; }
.ach-q { text-align: center; font-weight: 800; margin: 12px 0 0; }
@media (prefers-reduced-motion: reduce) { .ach-card { transition: none; } }
/* Scanning: what's lit is obvious, everything else is dimmed */
body.scanning.scan-lit #app .cell:not(.scan-row):not(.scan-on), body.scanning.scan-lit #app .chip:not(.scan-row):not(.scan-on),
body.scanning.scan-lit #app .sentence-actions button:not(.scan-row):not(.scan-on), body.scanning.scan-lit #app #crumbs button:not(.scan-row):not(.scan-on),
body.scanning.scan-lit .overlay:last-child button:not(.scan-row):not(.scan-on) { opacity: .4; transition: opacity .15s; }
.scan-bar .scan-hint { font-size: 1.05em; } .scan-where { display: block; font-weight: 700; color: var(--muted); font-size: .85em; margin-top: 2px; }
.note-box { padding: 10px 12px; border-radius: 14px; border: 2px solid var(--accent); background: var(--panel); line-height: 1.4; }
/* Printing: nothing cut off. Pop-up boxes print in full, the page is allowed to grow, and rows never split in half. */
@media print {
  html, body { height: auto !important; overflow: visible !important; }
  body.printing .print-me, body.printing .print-me .sheet { max-height: none !important; height: auto !important; overflow: visible !important; box-shadow: none !important; transform: none !important; position: static !important; }
  body.printing .print-me .sheet-actions, body.printing .print-me [data-x], body.printing .print-me [data-pr] { display: none !important; }
  body.printing .print-me .pr, body.printing .print-me .pc, body.printing .print-me .gstep, body.printing .print-me .pp-pl, body.printing .print-me .mycard, body.printing .print-me li { break-inside: avoid; }
  body.printing.print-big .print-me .pp { break-before: page; } body.printing.print-big .print-me .pp:first-child { break-before: auto; }
}
.pr-tiles { flex: 0 0 auto; } .pr-tiles .tile { min-height: 84px; }
.ach-card .btn:not(.primary) { border: 2px solid var(--border); background: var(--bg); }
.pairpage .big-emoji { font-size: 3.2em; text-align: center; margin-top: 10px; } .pair-msg-t { text-align: center; margin: 6px 0; }
.pairpage .row { justify-content: center; }
.pp-roles .pick[data-n="3"]::after { content: "×3"; } .pp-roles .pick[data-n="4"]::after { content: "×4"; } .pp-roles .pick[data-n="5"]::after { content: "×5"; }
