/* PIDGIN: clay tablets, ink, and warm paper. */

:root {
  --paper: #f3ebdd;
  --paper-2: #eadfcb;
  --panel: #fbf6ec;
  --card: #fffcf5;
  --ink: #2a2320;
  --ink-2: #5a4d44;
  --muted: #6e6052;
  --line: #dccfb8;
  --accent: #c4553a;
  --accent-2: #a9432b;
  --teal: #2f7a71;
  --gold: #d9a12b;
  --good: #3d8a57;
  --bad: #c4553a;
  --soft: #7a4e8c;
  --radius: 18px;
  --press: 0 4px 0 var(--ink);
  --press-sm: 0 3px 0 var(--ink);
  --shadow: 0 1px 0 rgba(42, 35, 32, 0.05), 0 10px 30px -14px rgba(42, 35, 32, 0.35);
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-ui: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  background-color: var(--paper);
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(255, 255, 255, 0.55), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(196, 85, 58, 0.08), transparent 60%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
}
:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}
h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.1;
  margin: 0 0 0.4em;
}
p {
  margin: 0 0 0.6em;
}
b {
  font-weight: 700;
}
.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
.kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.error {
  color: var(--bad);
  font-weight: 500;
  margin: 10px 0 0;
}
.waiting {
  color: var(--ink-2);
  font-style: italic;
}
.count {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin-left: 6px;
}

/* ---------------------------------------------------------------- svg helpers */
.svg {
  display: inline-block;
  line-height: 0;
}
.svg > svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.glyph-wrap {
  width: 1.4em;
  height: 1.4em;
  color: var(--ink);
}
.glyph-row {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 2.5px solid var(--ink);
  background: var(--panel);
  box-shadow: var(--press);
  font-weight: 700;
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease,
    background 0.15s;
  touch-action: manipulation;
  user-select: none;
}
.btn:hover:not(:disabled) {
  background: #fff;
}
.btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}
.btn:disabled {
  opacity: 0.45;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-2);
}
.btn-big {
  min-height: 56px;
  font-size: 1.08rem;
  width: 100%;
}
.btn-ghost {
  box-shadow: none;
  border-color: transparent;
  background: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(42, 35, 32, 0.06);
}
.btn-link {
  background: none;
  border: 0;
  padding: 8px 0;
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  background: var(--panel);
  box-shadow: var(--press-sm);
  font-size: 1.05rem;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  padding: 0;
}
.icon-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}
.icon-btn.is-active {
  background: var(--ink);
  color: var(--panel);
}
.controls {
  display: flex;
  gap: 8px;
}
.ico {
  width: 20px;
  height: 20px;
}
.back-btn {
  min-width: 52px;
  font-size: 1.2rem;
  padding: 8px 12px;
}

/* ---------------------------------------------------------------- panels */
.panel {
  background: var(--panel);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.center-card {
  max-width: 420px;
  margin: 18vh auto 0;
  text-align: center;
}
.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  margin: 6px auto 14px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  color: var(--ink-2);
}
.tag-host {
  background: var(--gold);
  color: var(--ink);
}
.tag-bot {
  background: #dfe6ee;
}

/* ---------------------------------------------------------------- avatars */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--ink);
  color: #fff;
  font-weight: 800;
  font-family: var(--font-display);
  overflow: hidden;
}
.avatar-md {
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
}
.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 0.9rem;
}
.avatar-xs {
  width: 22px;
  height: 22px;
  font-size: 0.7rem;
  border-width: 1.5px;
}
.avatar-pip {
  background: #e7edf3;
}
.avatar-pip .svg {
  width: 118%;
  height: 118%;
  transform: translate(2%, 6%);
}

/* ---------------------------------------------------------------- home */
.home {
  max-width: 1140px;
  margin: 0 auto;
  padding: 14px 18px 40px;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  grid-template-areas:
    'top top'
    'copy demo'
    'entry demo'
    'daily daily'
    'shelf shelf'
    'how how'
    'foot foot';
  gap: 18px 40px;
  align-items: start;
}
.home-top {
  grid-area: top;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}
.hero-copy {
  grid-area: copy;
  padding-top: 18px;
}
.hero-demo {
  grid-area: demo;
  align-self: center;
}
.first-contact {
  padding: 25px;
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: 26px;
  box-shadow: 0 7px 0 var(--ink), var(--shadow);
  text-align: center;
}
.contact-top, .contact-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.contact-top { margin-bottom: 19px; text-align: left; }
.contact-top .kicker { color: var(--teal); letter-spacing: .09em; }
.contact-steps { display: flex; gap: 5px; flex: none; }
.contact-steps i { width: 14px; height: 6px; border-radius: 8px; background: var(--line); }
.contact-steps i.is-done { background: var(--teal); }
.first-contact h2 { font-size: clamp(1.5rem, 3vw, 2rem); min-height: 2.2em; margin: 0; display: grid; align-items: center; }
.contact-instruction { color: var(--ink-2); margin: 8px 0 0; min-height: 3em; font-size: .92rem; }
.contact-scene { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 125px; margin: 8px 0; }
.contact-pip { width: 90px; height: 100px; flex: none; }
.contact-message { display: flex; gap: 5px; padding: 14px; border: 2.5px solid var(--ink); border-radius: 20px 20px 20px 4px; background: var(--card); box-shadow: var(--press-sm); }
.contact-message .glyph-wrap, .contact-message .card-art-wrap { width: 58px; height: 58px; }
.contact-equals { font-size: 1.5rem; font-weight: 900; }
.contact-answer .card-art-wrap { width: 74px; height: 74px; }
.contact-options { display: flex; justify-content: center; gap: 14px; }
.contact-glyph, .contact-choice { display: grid; place-items: center; width: 88px; height: 86px; padding: 12px; border: 2.5px solid var(--ink); border-radius: 18px; background: var(--card); box-shadow: var(--press-sm); transition: transform .15s, background .15s; }
.contact-glyph:hover, .contact-choice:hover { background: #f6e6b7; transform: translateY(-3px); }
.contact-glyph:active, .contact-choice:active { transform: translateY(2px); box-shadow: none; }
.contact-glyph .glyph-wrap, .contact-choice .card-art-wrap { width: 58px; height: 58px; }
.contact-choice.is-wrong { border-color: var(--accent); background: #f9e5d7; }
.contact-note { margin: 15px 0 12px; color: var(--ink-2); font-size: .83rem; min-height: 2.8em; }
.contact-footer { border-top: 1px dashed var(--line); padding-top: 12px; }
.contact-footer .btn-link, .contact-return { font-size: .8rem; color: var(--ink-2); }
.contact-return { display: block; margin: 14px auto 0; }
.contact-finish { display: flex; flex-direction: column; align-items: center; gap: 16px; min-height: 153px; justify-content: center; padding-bottom: 15px; }
.contact-stamp { color: var(--teal); border: 2px solid var(--teal); border-radius: 7px; padding: 5px 12px; transform: rotate(-3deg); font-size: .83rem; font-weight: 700; }
.contact-start { max-width: 100%; }
@media (max-width: 480px) {
  .first-contact { padding: 18px; }
  .contact-pip { width: 64px; height: 79px; }
  .contact-scene { gap: 9px; min-height: 103px; }
  .contact-message { padding: 10px; }
  .contact-message .glyph-wrap { width: 41px; height: 41px; }
  .contact-answer .card-art-wrap { width: 54px; height: 54px; }
  .contact-options { gap: 12px; }
  .contact-glyph, .contact-choice { width: 78px; height: 74px; padding: 8px; }
  .contact-glyph .glyph-wrap, .contact-choice .card-art-wrap { width: 52px; height: 52px; }
}
@keyframes bob {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-5px) rotate(2deg);
  }
}
@keyframes peck {
  50% {
    transform: rotate(-7deg) translateY(3px);
  }
}
.pop-in {
  animation: popIn 0.35s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
@keyframes popIn {
  from {
    transform: scale(0.3);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(3.4rem, 9vw, 5.6rem);
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 0.95;
  color: var(--ink);
  text-shadow: 3px 3px 0 var(--gold);
}
.tagline {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 600;
  color: var(--ink-2);
  margin-top: 12px;
}
.entry {
  grid-area: entry;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.entry-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.btn-pip {
  gap: 4px;
}
.btn-pip .pip-mini {
  width: 36px;
  height: 36px;
  margin: -10px 0 -10px -6px;
}
.pip-hint {
  font-size: 0.85rem;
  color: var(--ink-2);
  margin: -2px 0 0;
}
.invite-note {
  background: #fff4d6;
  border: 2px dashed var(--gold);
  border-radius: 12px;
  padding: 10px 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
  font-size: 0.9rem;
}
input {
  min-height: 50px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2.5px solid var(--ink);
  background: #fff;
  font-size: 1.05rem;
  outline: none;
}
input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(47, 122, 113, 0.18);
}
.or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}
.or::before,
.or::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--line);
}
.join-row {
  display: flex;
  gap: 10px;
}
.code-input {
  flex: 1;
  min-width: 0;
  text-transform: uppercase;
  font-size: 1.3rem;
  text-align: center;
}
.pip-practice,
.add-pip {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 10px 14px;
  border-radius: 14px;
  border: 2px dashed var(--ink-2);
  background: rgba(255, 255, 255, 0.5);
  font-size: 0.92rem;
  color: var(--ink-2);
}
.pip-practice:hover,
.add-pip:hover {
  background: #fff;
  border-style: solid;
}
.pip-mini {
  width: 46px;
  height: 46px;
  flex: none;
}
.how {
  grid-area: how;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.how-step {
  background: rgba(251, 246, 236, 0.7);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.how-step h3 {
  font-size: 1.1rem;
  margin: 12px 0 4px;
}
.how-step p {
  color: var(--ink-2);
  margin: 0;
  font-size: 0.93rem;
}
.how-art {
  height: 96px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.glyph-demo .glyph-wrap {
  width: 54px;
  height: 54px;
  padding: 8px;
  background: #f7f0e2;
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: var(--press-sm);
}
.mini-card {
  width: 90px;
  height: 90px;
  padding: 6px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 14px;
  box-shadow: var(--press-sm);
}
.mini-card .card-art-wrap {
  width: 100%;
  height: 100%;
}
.mini-card.is-glow {
  box-shadow:
    0 0 0 4px var(--gold),
    0 0 26px 4px rgba(217, 161, 43, 0.6);
}
.mini-card.is-pick {
  box-shadow:
    0 0 0 4px var(--teal),
    var(--press-sm);
  transform: translateY(-4px);
}
.home-foot {
  grid-area: foot;
  text-align: center;
  color: var(--ink-2);
}
.home-daily {
  grid-area: daily;
}

/* the animated demo */
.demo {
  position: relative;
  background: var(--panel);
  border: 2.5px solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 6px 0 var(--ink), var(--shadow);
  padding: 16px 16px 12px;
}
.demo-caption {
  min-height: 2.8em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.12rem;
  line-height: 1.3;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeUp 0.4s ease both;
}
.demo-stage {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 92px;
  align-items: end;
  gap: 6px;
  min-height: 172px;
  padding-top: 30px;
}
.demo-bird {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.demo-pigeon {
  width: 88px;
  height: 88px;
}
.demo-pigeon.flip svg {
  transform: scaleX(-1);
}
.demo-pigeon.is-talking {
  animation: peck 0.3s ease 3;
}
.demo-pigeon.is-thinking {
  animation: bob 0.9s ease-in-out infinite;
}
.demo-name {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.demo-bubble {
  position: absolute;
  bottom: calc(100% - 6px);
  left: 38px;
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 14px 14px 14px 4px;
  box-shadow: var(--press-sm);
  z-index: 2;
}
.demo-bubble .glyph-wrap {
  width: 28px;
  height: 28px;
}
.demo-think {
  position: absolute;
  bottom: calc(100% - 4px);
  right: 16px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.7rem;
  animation: pulse 0.9s ease infinite;
}
.demo-cards {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding-bottom: 20px;
}
.demo-card {
  position: relative;
  width: 74px;
  aspect-ratio: 1;
  flex: 0 1 74px;
  padding: 5px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: var(--press-sm);
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}
.demo-card .card-art-wrap {
  width: 100%;
  height: 100%;
}
.demo-card.is-target {
  box-shadow:
    0 0 0 4px var(--gold),
    0 0 22px 4px rgba(217, 161, 43, 0.6);
}
.demo-card.is-picked {
  transform: translateY(-7px);
  box-shadow:
    0 0 0 4px var(--teal),
    var(--press-sm);
}
.demo-card.is-right {
  transform: scale(1.07);
  box-shadow:
    0 0 0 4px var(--good),
    var(--press-sm);
}
.demo-card.is-wrong {
  box-shadow:
    0 0 0 4px var(--bad),
    var(--press-sm);
  animation: shake 0.45s ease;
}
.demo-mark {
  position: absolute;
  top: -10px;
  right: -9px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
  border: 2px solid var(--ink);
  animation: popIn 0.3s ease both;
}
.demo-mark.ok {
  background: var(--good);
}
.demo-mark.bad {
  background: var(--bad);
}
.demo-tablet {
  margin-top: 10px;
  min-height: 116px;
  background: #e9dcc3;
  border-radius: 14px;
  border: 2px solid var(--ink);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.demo-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 252, 245, 0.85);
  border-radius: 8px;
  padding: 3px 10px;
  animation: fadeUp 0.35s ease both;
}
.demo-msg {
  flex: 1;
  display: flex;
  gap: 2px;
}
.demo-msg .glyph-wrap {
  width: 22px;
  height: 22px;
}
.demo-arrow {
  color: var(--muted);
}
.demo-mini {
  width: 28px;
  height: 28px;
}
.demo-mini .card-art-wrap {
  width: 100%;
  height: 100%;
}
.demo-ok {
  font-weight: 800;
  width: 16px;
  text-align: center;
}
.demo-ok.ok {
  color: var(--good);
}
.demo-ok.soft {
  color: var(--soft);
}

/* daily decoder teaser */
.daily-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 2.5px solid var(--ink);
  background: linear-gradient(135deg, #2a2320, #4a3a2f);
  color: var(--panel);
  box-shadow: var(--press);
  transition: transform 0.08s;
}
.daily-card:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}
.daily-glyphs {
  display: grid;
  grid-template-columns: repeat(2, 30px);
  gap: 6px;
  flex: none;
}
.daily-glyphs .glyph-wrap {
  width: 30px;
  height: 30px;
  color: var(--gold);
}
.daily-body {
  flex: 1;
  min-width: 0;
}
.daily-card .kicker {
  color: var(--gold);
}
.daily-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
}
.daily-text {
  opacity: 0.82;
  font-size: 0.92rem;
}
.daily-cta {
  font-weight: 800;
  background: var(--gold);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

/* language picker & settings */
.lang-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 10px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--press-sm);
}
.lang-picker select {
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  padding: 0 2px;
  cursor: pointer;
  max-width: 150px;
}
.lang-picker select:focus-visible {
  outline: none;
}
.topbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}
.settings-wrap {
  position: relative;
}
.settings-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 45;
  min-width: 260px;
  background: var(--panel);
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  box-shadow: var(--press-sm), var(--shadow);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeUp 0.18s ease both;
}
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  font-size: 0.92rem;
}
.set-row select {
  font: inherit;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: #fff;
  max-width: 150px;
}
.switch {
  flex: none;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--line);
  position: relative;
  padding: 0;
}
.switch i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  transition: left 0.15s;
}
.switch.is-on {
  background: var(--teal);
}
.switch.is-on i {
  left: 22px;
}
.inline-glyph {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.22em;
}
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 95;
}

/* ---------------------------------------------------------------- lobby */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
}
.brand-sm {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  text-shadow: 2px 2px 0 var(--gold);
}
.lobby {
  max-width: 1100px;
  margin: 0 auto;
  padding-bottom: 40px;
}
.lobby-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  padding: 0 18px;
}
.invite {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.room-code {
  font-size: clamp(2.6rem, 8vw, 3.8rem);
  font-weight: 800;
  letter-spacing: 0.22em;
  padding-left: 0.22em;
  line-height: 1;
}
.invite-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.invite-url {
  font-size: 0.85rem;
  color: var(--muted);
  word-break: break-all;
}
.qr {
  width: 148px;
  height: 148px;
  padding: 6px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px;
}
.hint {
  color: var(--ink-2);
  font-size: 0.9rem;
  max-width: 360px;
}
.player-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.player-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #fff;
  border: 2px solid var(--line);
  animation: popIn 0.3s ease both;
}
.player-list .pname {
  flex: 1;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-list em {
  font-weight: 400;
  color: var(--muted);
}
.is-away {
  opacity: 0.5;
}
.kick {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
}
.kick:hover {
  color: var(--bad);
  border-color: var(--bad);
}
.rules {
  padding-left: 1.2em;
  margin: 0 0 14px;
}
.rules li {
  margin-bottom: 6px;
}
.inline-glyphs {
  display: inline-flex;
  gap: 3px;
  vertical-align: middle;
}
.inline-glyphs .glyph-wrap {
  width: 1.3em;
  height: 1.3em;
}
.golden-rule {
  background: var(--ink);
  color: var(--panel);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.95rem;
}
.golden-rule b {
  color: var(--gold);
}
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.seg-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 14px;
  border-radius: 14px;
  border: 2.5px solid var(--line);
  background: #fff;
  text-align: left;
}
.seg-btn span {
  font-size: 0.82rem;
  color: var(--muted);
}
.seg-btn.is-on {
  border-color: var(--ink);
  background: #fff4d6;
  box-shadow: var(--press-sm);
}
.seg-btn:disabled {
  cursor: default;
}
.sets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}
.set-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 14px;
  border: 2.5px solid var(--line);
  background: #fff;
}
.set-btn.is-on {
  border-color: var(--ink);
  background: #fff4d6;
  box-shadow: var(--press-sm);
}
.set-btn:disabled {
  cursor: default;
}
.set-art {
  display: flex;
}
.set-art .card-art-wrap {
  width: 32px;
  height: 32px;
  margin: 0 -2px;
}
.tag-season {
  position: absolute;
  top: -11px;
  right: -6px;
  background: #f2a33a;
  color: var(--ink);
  font-size: 0.6rem;
  white-space: nowrap;
}
.h-gap {
  margin-top: 16px;
}
.age-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.93rem;
}
.age-n {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--panel);
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 4px;
}

/* ---------------------------------------------------------------- game layout */
.game {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 310px;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    'head head head'
    'left stage right';
  gap: 14px;
  padding: 12px 14px 14px;
  height: 100vh;
  height: 100dvh;
}
.game-header {
  grid-area: head;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 10px 8px 16px;
  background: var(--panel);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.gh-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.gh-age {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.gh-age b {
  font-family: var(--font-display);
  font-size: 1.2rem;
  white-space: nowrap;
}
.gh-progress {
  display: flex;
  gap: 20px;
  align-items: center;
  margin: 0 auto;
}
.meter {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.meter-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.bricks,
.cracks {
  display: flex;
  gap: 4px;
}
.bricks i {
  width: 22px;
  height: 14px;
  border-radius: 3px;
  border: 2px solid var(--ink);
  background: transparent;
  opacity: 0.35;
  transition: all 0.3s;
}
.bricks i.on {
  background: #e8b36e;
  opacity: 1;
  animation: popIn 0.4s ease both;
}
.cracks i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  opacity: 0.3;
}
.cracks i.on {
  opacity: 1;
  background: var(--bad);
  animation: shake 0.4s ease both;
}
.gh-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tablet-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  background: var(--panel);
  box-shadow: var(--press-sm);
  font-weight: 700;
}
.badge {
  background: var(--ink);
  color: var(--panel);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 0.75rem;
}
.timer {
  position: relative;
  width: 48px;
  height: 48px;
  flex: none;
}
.timer svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.timer-bg {
  fill: #fff;
  stroke: var(--line);
  stroke-width: 5;
}
.timer-fg {
  fill: none;
  stroke: var(--teal);
  stroke-width: 5;
  stroke-linecap: round;
  transition:
    stroke-dashoffset 0.2s linear,
    stroke 0.3s;
}
.timer span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1rem;
}
.timer-urgent .timer-fg {
  stroke: var(--bad);
}
.timer-urgent span {
  color: var(--bad);
  animation: pulse 1s ease infinite;
}
.timer-idle {
  display: none;
}
@keyframes pulse {
  50% {
    transform: scale(1.18);
  }
}

.side-left {
  grid-area: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: auto;
}
.players-live ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.players-live li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 12px;
  background: var(--panel);
  border: 2px solid var(--line);
  transition: all 0.2s;
}
.players-live li .avatar {
  grid-row: span 2;
}
.players-live .pname {
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.players-live .pname em {
  font-style: normal;
  font-weight: 500;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.pstatus {
  grid-column: 2;
  font-size: 0.78rem;
  color: var(--muted);
}
.pscore {
  grid-row: span 2;
  grid-column: 3;
  grid-row-start: 1;
  font-weight: 800;
  font-family: var(--font-display);
  font-size: 1.1rem;
}
.players-live li.is-speaker {
  border-color: var(--ink);
  background: #fff4d6;
  box-shadow: var(--press-sm);
}
.players-live li.is-speaker .pstatus {
  color: var(--ink);
  font-weight: 700;
}
.players-live li.is-good {
  border-color: var(--good);
}
.players-live li.is-good .pstatus {
  color: var(--good);
  font-weight: 700;
}
.players-live li.is-bad .pstatus {
  color: var(--bad);
}
.tower-panel {
  margin-top: auto;
  padding: 10px 4px 0;
  text-align: center;
}
.tower-panel .svg {
  width: 100%;
  max-width: 200px;
}
.tower-caption {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  margin-top: 4px;
}

.stage {
  grid-area: stage;
  position: relative;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.side-right {
  grid-area: right;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- round */
.round {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 4px 30px 12px;
  min-height: 100%;
}
.banner {
  width: 100%;
  max-width: 760px;
  text-align: center;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(251, 246, 236, 0.75);
  border: 2px solid var(--line);
  animation: fadeUp 0.3s ease both;
}
.banner-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  line-height: 1.15;
}
.banner-sub {
  color: var(--ink-2);
  font-size: 0.95rem;
  margin-top: 2px;
}
.banner-speak {
  background: #fff4d6;
  border-color: var(--gold);
}
.banner-act {
  background: #e3f0ec;
  border-color: var(--teal);
}
.banner-good {
  background: #e3f1e6;
  border-color: var(--good);
}
.banner-good .banner-title {
  color: var(--good);
}
.banner-bad {
  background: #f8e3dc;
  border-color: var(--bad);
  animation: shake 0.45s ease both;
}
.banner-bad .banner-title {
  color: var(--bad);
}
.banner-soft {
  background: #efe5f4;
  border-color: var(--soft);
}
.banner-soft .banner-title {
  color: var(--soft);
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes shake {
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(2px);
  }
}

.cards {
  --gap: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gap);
  width: 100%;
  padding: 6px 10px 10px;
}
.cards > .card {
  flex: 0 0 auto;
  width: min(170px, calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)));
}
.cards.n3 {
  --cols: 3;
}
.cards.n4 {
  --cols: 4;
}
.cards.n5 {
  --cols: 5;
}
.card {
  position: relative;
  aspect-ratio: 1;
  padding: 10px;
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--press);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.25s ease,
    filter 0.25s;
  animation: dealIn 0.35s ease both;
}
.cards .card:nth-child(2) {
  animation-delay: 0.04s;
}
.cards .card:nth-child(3) {
  animation-delay: 0.08s;
}
.cards .card:nth-child(4) {
  animation-delay: 0.12s;
}
.cards .card:nth-child(5) {
  animation-delay: 0.16s;
}
@keyframes dealIn {
  from {
    opacity: 0;
    transform: translateY(14px) rotate(-3deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.card .card-art-wrap {
  width: 100%;
  height: 100%;
}
button.card {
  font: inherit;
}
.card-pickable:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 0 var(--ink);
}
.card-pickable:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ink);
}
.card-chosen {
  transform: translateY(-4px);
  box-shadow:
    0 0 0 5px var(--teal),
    0 8px 0 var(--ink);
  background: #eef7f4;
}
.card-target {
  box-shadow:
    0 0 0 5px var(--gold),
    0 0 20px 5px rgba(217, 161, 43, 0.55),
    var(--press);
  animation:
    dealIn 0.35s ease both,
    glow 2s ease-in-out 0.4s infinite;
  z-index: 1;
}
@keyframes glow {
  50% {
    box-shadow:
      0 0 0 5px var(--gold),
      0 0 26px 8px rgba(217, 161, 43, 0.72),
      var(--press);
  }
}
.card-dim {
  opacity: 0.45;
  filter: saturate(0.7);
}
.card-waiting {
  opacity: 0.85;
}
.card-correct {
  box-shadow:
    0 0 0 5px var(--good),
    var(--press);
  transform: scale(1.04);
  z-index: 1;
}
.card-wrong {
  box-shadow:
    0 0 0 5px var(--bad),
    var(--press);
  animation: shake 0.45s ease both;
}
.card-badge {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--gold);
  white-space: nowrap;
}
.card-correct .card-badge {
  background: var(--good);
  color: #fff;
}
.card-guessers {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
}

.message {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  min-height: 84px;
}
.slot {
  width: 74px;
  height: 74px;
  border-radius: 16px;
  border: 2.5px dashed var(--ink-2);
  background: rgba(255, 255, 255, 0.35);
  display: grid;
  place-items: center;
  padding: 10px;
  opacity: 0.7;
}
.slot.filled {
  border-style: solid;
  border-color: var(--ink);
  background: #f7f0e2;
  box-shadow: var(--press-sm);
  opacity: 1;
}
.slot .glyph-wrap {
  width: 100%;
  height: 100%;
}
.message.shown .slot {
  width: 88px;
  height: 88px;
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 4px 0 #000;
}
.message.shown .glyph-wrap {
  color: #f7e9c9;
}
.message-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.message.shown button.slot {
  cursor: pointer;
}
.message.shown button.slot:hover {
  transform: translateY(-2px);
}
.lookup-hint {
  font-size: 0.78rem;
  color: var(--muted);
}
.drop {
  animation: drop 0.45s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}
@keyframes drop {
  from {
    transform: translateY(-40px) scale(0.6);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.writing .slot.stone {
  border-style: solid;
  border-color: var(--ink);
  background: repeating-linear-gradient(45deg, #d9ccb4, #d9ccb4 6px, #cdbf9f 6px, #cdbf9f 12px);
  opacity: 1;
  animation: popIn 0.25s ease both;
}
.writing .slot:not(.stone):first-of-type,
.writing .slot.stone + .slot:not(.stone) {
  animation: blink 1.1s ease infinite;
}
@keyframes blink {
  50% {
    border-color: var(--gold);
    background: #fff4d6;
  }
}

.composer {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.composer .slots {
  display: flex;
  gap: 8px;
}
button.slot {
  cursor: pointer;
}
button.slot:hover {
  border-color: var(--bad);
}
.composer.is-full .slots {
  animation: shake 0.35s ease;
}
.composer-actions {
  display: flex;
  gap: 8px;
}
.send-btn {
  min-width: 110px;
  font-size: 1.05rem;
}
.keyboard {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 72px));
  gap: 10px;
  justify-content: center;
  width: 100%;
}
.key {
  position: relative;
  aspect-ratio: 1;
  border-radius: 16px;
  border: 2.5px solid var(--ink);
  background: linear-gradient(#fbf5ea, #efe4cf);
  box-shadow: var(--press);
  padding: 12px;
  display: grid;
  place-items: center;
  transition:
    transform 0.07s,
    box-shadow 0.07s;
  touch-action: manipulation;
  user-select: none;
}
.key .glyph-wrap {
  width: 100%;
  height: 100%;
}
.key:hover:not(:disabled) {
  background: linear-gradient(#fff, #f3e9d6);
}
.key:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}
.key-hint {
  position: absolute;
  right: 6px;
  bottom: 3px;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
}
.key.is-dead {
  border-style: dashed;
  background: transparent;
  box-shadow: none;
  opacity: 0.3;
}
.key.is-dead::after {
  content: '';
  position: absolute;
  inset: 10%;
  background: linear-gradient(135deg, transparent 46%, var(--bad) 46%, var(--bad) 54%, transparent 54%);
}
.pip-says {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 560px;
  animation: popIn 0.35s ease both;
}
.pip-bubble {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 4px 16px 16px 16px;
  padding: 8px 12px;
  box-shadow: var(--press-sm);
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.pip-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pip-inline .glyph-wrap {
  width: 22px;
  height: 22px;
}
.pip-eq {
  font-weight: 800;
}
.pip-card {
  width: 34px;
  height: 34px;
  display: inline-block;
}
.pip-card .card-art-wrap {
  width: 100%;
  height: 100%;
}
.players-live li.is-busy .avatar {
  animation: bob 1.1s ease-in-out infinite;
}
.reaction-bar {
  margin-top: auto;
  display: flex;
  gap: 6px;
  padding-top: 6px;
}
.reaction-bar button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  font-size: 1.25rem;
  transition: transform 0.1s;
}
.reaction-bar button:hover {
  transform: scale(1.15);
  border-color: var(--ink);
}
.reaction-bar button:active {
  transform: scale(0.9);
}

/* ---------------------------------------------------------------- intro / level done / paused */
.intro-panel,
.level-done {
  margin: auto;
  width: 100%;
  max-width: 680px;
  text-align: center;
  padding: 18px 10px 24px;
  animation: fadeUp 0.4s ease both;
}
.age-title {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 900;
  margin: 6px 0 8px;
}
.age-blurb {
  font-size: 1.15rem;
  color: var(--ink-2);
  max-width: 540px;
  margin: 0 auto 16px;
}
.age-examples {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 12px 0;
}
.age-note {
  color: var(--ink-2);
}
.intro-steps {
  text-align: left;
  max-width: 460px;
  margin: 14px auto 10px;
  padding-left: 1.3em;
}
.intro-steps li {
  margin-bottom: 4px;
}
.intro-panel .golden-rule {
  max-width: 460px;
  margin: 0 auto;
}
.age-facts {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 16px 0;
}
.age-facts li {
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--panel);
  font-size: 0.9rem;
}
.intro-go {
  max-width: 360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.ready-row {
  display: flex;
  gap: 6px;
}
.ready-dot {
  opacity: 0.35;
  transition: opacity 0.2s;
}
.ready-dot.is-ready {
  opacity: 1;
}
.crumble-box {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 8px 0 4px;
}
.crumbled {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--ink-2);
}
.crumbled .glyph-wrap {
  width: 64px;
  height: 64px;
  padding: 8px;
  border: 2.5px dashed var(--bad);
  border-radius: 14px;
  color: var(--bad);
}
.crumbling {
  animation: crumble 2.4s ease-in 0.6s both;
}
@keyframes crumble {
  0% {
    transform: none;
    opacity: 1;
    filter: none;
  }
  20% {
    transform: rotate(-4deg);
  }
  35% {
    transform: rotate(4deg);
  }
  100% {
    transform: translateY(18px) rotate(12deg) scale(0.85);
    opacity: 0.25;
    filter: blur(1.5px);
  }
}
.tower-build .tier {
  animation: tierIn 0.55s cubic-bezier(0.3, 1.4, 0.5, 1) both;
  animation-delay: calc(var(--i) * 0.14s);
  transform-box: fill-box;
  transform-origin: center bottom;
}
@keyframes tierIn {
  from {
    transform: translateY(-34px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.tower-fall .tier {
  animation: tierFall 0.9s cubic-bezier(0.5, 0, 0.8, 0.6) both;
  animation-delay: calc(0.3s + var(--i) * 0.12s);
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes tierFall {
  from {
    transform: translateY(-90px) rotate(-20deg);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.level-done h1 {
  font-size: clamp(2.2rem, 5vw, 3rem);
  font-weight: 900;
}
.ld-tower .svg {
  width: 240px;
  max-width: 70vw;
  animation: popIn 0.6s ease both;
}
.paused {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(243, 235, 221, 0.82);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.paused-card {
  max-width: 400px;
  text-align: center;
  background: var(--panel);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.paused-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ---------------------------------------------------------------- tablet */
.tablet {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  background: #e9dcc3;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.35), transparent 40%),
    repeating-linear-gradient(0deg, rgba(42, 35, 32, 0.025) 0 2px, transparent 2px 6px);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: inset 0 2px 12px rgba(42, 35, 32, 0.15), var(--shadow);
  padding: 14px 12px 8px;
}
.tablet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tablet-head h3 {
  font-size: 1.3rem;
  margin: 0;
}
.tablet-close {
  display: none;
  width: 36px;
  height: 36px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--panel);
  font-size: 1.3rem;
  line-height: 1;
}
.tablet-sub {
  font-size: 0.8rem;
  color: var(--ink-2);
  margin: 2px 0 8px;
}
.tablet-filter {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  margin-bottom: 8px;
}
.tf {
  position: relative;
  aspect-ratio: 1;
  border-radius: 9px;
  border: 1.5px solid rgba(42, 35, 32, 0.35);
  background: rgba(255, 255, 255, 0.45);
  padding: 5px;
  display: grid;
  place-items: center;
}
.tf .glyph-wrap {
  width: 100%;
  height: 100%;
}
.tf:disabled {
  opacity: 0.25;
}
.tf.is-on {
  background: var(--ink);
  border-color: var(--ink);
}
.tf.is-on .glyph-wrap {
  color: var(--gold);
}
.tf.is-dead {
  border-style: dashed;
  border-color: var(--bad);
}
.tf-n {
  position: absolute;
  top: -6px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.tablet-empty {
  color: var(--ink-2);
  font-style: italic;
  font-size: 0.9rem;
  padding: 16px 6px;
  text-align: center;
}
.tablet-list {
  list-style: none;
  padding: 0 2px 6px;
  margin: 0;
  overflow: auto;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.t-age {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 6px 0 0;
}
.t-entry {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border-radius: 10px;
  background: rgba(255, 252, 245, 0.75);
  border: 1.5px solid rgba(42, 35, 32, 0.15);
  animation: fadeUp 0.35s ease both;
}
.t-msg {
  display: flex;
  gap: 2px;
  flex: 1;
}
.t-msg .glyph-wrap {
  width: 25px;
  height: 25px;
}
.t-msg .glyph-wrap.is-hl {
  color: var(--accent);
}
.t-arrow {
  color: var(--muted);
}
.t-card {
  width: 38px;
  height: 38px;
  flex: none;
}
.t-card .card-art-wrap {
  width: 100%;
  height: 100%;
}
.t-mark {
  width: 20px;
  text-align: center;
  font-weight: 800;
}
.t-entry.ok .t-mark {
  color: var(--good);
}
.t-entry.bad .t-mark {
  color: var(--bad);
}
.t-entry.soft .t-mark {
  color: var(--soft);
}
.t-entry.bad {
  background: rgba(248, 227, 220, 0.6);
}

/* ---------------------------------------------------------------- overlays */
.milestone {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 24px));
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  background: var(--ink);
  color: var(--panel);
  border-radius: 20px;
  border: 3px solid var(--gold);
  box-shadow:
    0 20px 50px -10px rgba(0, 0, 0, 0.5),
    0 0 0 6px rgba(217, 161, 43, 0.25);
  animation: msIn 0.5s cubic-bezier(0.3, 1.4, 0.5, 1) both;
  cursor: pointer;
}
@keyframes msIn {
  from {
    transform: translate(-50%, 40px) scale(0.8);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0) scale(1);
    opacity: 1;
  }
}
.ms-icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--gold);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  font-weight: 800;
}
.ms-kicker {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}
.ms-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  line-height: 1.15;
}
.ms-word {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
}
.ms-word .glyph-wrap {
  width: 40px;
  height: 40px;
  padding: 5px;
  color: var(--ink);
  background: #f7e9c9;
  border-radius: 10px;
}
.ms-word .meaning {
  width: 44px;
  height: 44px;
  padding: 3px;
  background: #f7e9c9;
  border-radius: 10px;
}
.ms-eq {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gold);
}
.ms-text {
  font-size: 0.92rem;
  opacity: 0.9;
  margin-top: 4px;
}
.toasts {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(460px, calc(100vw - 24px));
}
.toast {
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--panel);
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: fadeUp 0.25s ease both;
  text-align: center;
}
.toast-good {
  background: var(--good);
}
.toast-bad {
  background: var(--bad);
}
.reaction-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}
.float-reaction {
  position: absolute;
  bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: floatUp 2.6s ease-out forwards;
}
.fr-emoji {
  font-size: 2.4rem;
}
.fr-name {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--ink);
  color: var(--panel);
  padding: 1px 7px;
  border-radius: 999px;
}
@keyframes floatUp {
  0% {
    transform: translateY(20px) scale(0.6);
    opacity: 0;
  }
  15% {
    transform: translateY(0) scale(1.1);
    opacity: 1;
  }
  100% {
    transform: translateY(-55vh) scale(1);
    opacity: 0;
  }
}
.conn-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  text-align: center;
  padding: 8px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  border-bottom: 2px solid var(--ink);
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(42, 35, 32, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fadeUp 0.2s ease both;
}
.modal {
  position: relative;
  width: min(620px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: 22px;
  padding: 26px 24px 20px;
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: var(--panel);
  font-size: 1.4rem;
  line-height: 1;
}
.lead {
  font-size: 1.08rem;
  color: var(--ink-2);
}
.help-steps {
  padding-left: 1.2em;
}
.help-steps li {
  margin-bottom: 8px;
}

/* ---------------------------------------------------------------- results */
.results {
  max-width: 1160px;
  margin: 0 auto;
  padding-bottom: 50px;
}
.results-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 4px 22px 16px;
}
.results-hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  margin: 4px 0;
}
.results-tower {
  width: 150px;
  flex: none;
}
.results-tower.is-fallen {
  transform: rotate(-4deg);
}
.results-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  padding: 0 18px;
  align-items: start;
}
.results-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.lost h3 {
  font-size: 1.25rem;
}
.lost-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-top: 2px dashed var(--line);
  flex-wrap: wrap;
}
.lost-row:first-of-type {
  border-top: 0;
}
.lost-msg .glyph-wrap {
  width: 34px;
  height: 34px;
}
.lost-pair {
  display: flex;
  align-items: center;
  gap: 12px;
}
.lost-pair figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.lost-pair figcaption {
  font-size: 0.78rem;
  color: var(--ink-2);
  font-weight: 600;
  max-width: 130px;
  text-align: center;
}
.lost-card {
  width: 78px;
  height: 78px;
  padding: 5px;
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
}
.lost-card .card-art-wrap {
  width: 100%;
  height: 100%;
}
.lost-card.ok {
  box-shadow: 0 0 0 3px var(--good);
}
.lost-card.bad {
  box-shadow: 0 0 0 3px var(--bad);
  transform: rotate(3deg);
}
.lost-vs {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--bad);
}
.challenge {
  background: #fff4d6 !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.challenge h3 {
  font-size: 1.2rem;
  margin: 0;
}
.challenge-invite {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 26px;
  align-items: center;
  margin: 0 18px 26px;
  padding: 26px;
}
.challenge-copy { min-width: 0; }
.challenge-copy .kicker { color: var(--teal); margin-bottom: 7px; }
.challenge-copy h2 { font-size: clamp(1.45rem, 3vw, 2rem); overflow-wrap: anywhere; }
.challenge-copy p { color: var(--ink-2); }
.challenge-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 11px; margin-top: 18px; }
.challenge-actions .btn { max-width: 100%; white-space: normal; }
.challenge-try { font-size: .85rem; }
.postcard-peek { display: flex; flex-direction: column; gap: 19px; text-align: center; padding: 23px 16px; border: 2px solid var(--ink); border-radius: 4px; background: var(--card); box-shadow: 4px 5px 0 var(--paper-2); transform: rotate(3deg); }
.postcard-peek > div { display: flex; justify-content: center; align-items: center; gap: 9px; }
.postcard-peek .glyph-row { flex-wrap: wrap; justify-content: center; }
.postcard-peek .glyph-wrap { width: 32px; height: 32px; }
.postcard-peek b { font-family: var(--font-display); font-size: 2rem; color: var(--accent); }
.postcard-brand { border-top: 1px dashed var(--line); padding-top: 10px; font-size: .67rem; color: var(--ink-2); letter-spacing: .1em; }
@media (max-width: 760px) {
  .challenge-invite { grid-template-columns: 1fr; padding: 21px; gap: 18px; }
  .postcard-peek { padding: 14px; gap: 9px; max-width: 330px; width: 100%; justify-self: center; transform: rotate(1.5deg); }
  .postcard-brand { display: none; }
  .challenge-actions { align-items: stretch; flex-direction: column; }
  .challenge-try { text-align: center; padding: 7px; }
}
.lang-card {
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: 26px;
  padding: 28px;
  box-shadow: 0 6px 0 var(--ink), var(--shadow);
}
.lc-top {
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 2px dashed var(--line);
  margin-bottom: 14px;
}
.lc-name {
  font-size: clamp(3rem, 8vw, 4.8rem);
  font-weight: 900;
  margin: 2px 0;
  letter-spacing: -0.02em;
  text-shadow: 3px 3px 0 var(--gold);
}
.lc-sub {
  color: var(--ink-2);
}
.lc-h {
  font-family: var(--font-ui);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 10px;
}
.lc-words {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.word {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  background: #fff;
  border: 2px solid var(--line);
  animation: popIn 0.35s ease both;
}
.w-glyph {
  width: 48px;
  height: 48px;
  flex: none;
}
.w-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}
.w-sound {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-2);
}
.w-mean {
  display: flex;
  align-items: center;
  gap: 5px;
}
.w-mean .meaning {
  width: 26px;
  height: 26px;
}
.w-by {
  font-size: 0.72rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.lc-extinct {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.x-word {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: line-through;
  color: var(--muted);
}
.x-word .glyph-wrap {
  color: var(--muted);
}
.lc-grammar {
  margin: 0;
  padding-left: 1.2em;
  font-family: var(--font-display);
  font-size: 1.15rem;
}
.lc-examples {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.gloss {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 2px solid var(--line);
}
.gl-eq {
  font-weight: 900;
  font-size: 1.4rem;
  color: var(--muted);
}
.gl-card {
  width: 56px;
  height: 56px;
}
.gl-card .card-art-wrap {
  width: 100%;
  height: 100%;
}
.gl-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.gl-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 58px;
}
.gl-cell .glyph-wrap {
  width: 38px;
  height: 38px;
}
.gl-sound {
  font-family: var(--font-display);
  font-style: italic;
}
.gl-mean {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}
.gl-tr {
  font-family: var(--font-display);
  font-style: italic;
  margin-top: 6px;
  color: var(--ink-2);
}
.lc-curve {
  width: 100%;
  height: 110px;
}
.lc-curve-cap {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
}
.results-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.results-side .panel {
  padding: 18px;
}
.results-side h3 {
  font-size: 1.15rem;
}
.actions-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.actions-panel hr {
  width: 100%;
  border: 0;
  border-top: 2px dashed var(--line);
  margin: 4px 0;
}
.award {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.ms-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ms-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--line);
  font-size: 0.82rem;
  font-weight: 600;
}
.ms-badge i {
  font-style: normal;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
}
.scores ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scores li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
}
.scores li .avatar {
  grid-row: span 2;
}
.scores li .pname {
  font-weight: 700;
}
.scores li .muted {
  grid-column: 2;
}
.scores li .pscore {
  grid-row: 1 / span 2;
  grid-column: 3;
}

/* ---------------------------------------------------------------- decoder */
.decoder {
  max-width: 1140px;
  margin: 0 auto;
  padding-bottom: 50px;
}
.brand-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink);
}
.dec-hero {
  padding: 0 18px 14px;
}
.dec-hero h1 {
  font-size: clamp(1.9rem, 5vw, 3.1rem);
  font-weight: 900;
  margin: 4px 0 6px;
}
.dec-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  padding: 0 18px;
  align-items: start;
}
.dec-tablet {
  height: auto;
  max-height: calc(100dvh - 140px);
  position: sticky;
  top: 12px;
}
.dec-examples {
  list-style: none;
  padding: 0 2px 6px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: auto;
  min-height: 0;
}
.t-entry.learned {
  outline: 2px dashed rgba(42, 35, 32, 0.28);
  outline-offset: -2px;
}
.dec-quiz {
  min-height: 440px;
}
.dec-progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 14px;
}
.dec-progress i {
  width: 36px;
  height: 8px;
  border-radius: 99px;
  background: var(--line);
}
.dec-progress i.ok {
  background: var(--good);
}
.dec-progress i.bad {
  background: var(--bad);
}
.dec-progress i.cur {
  background: var(--gold);
}
.dec-q {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  animation: fadeUp 0.3s ease both;
}
.dec-q h2 {
  font-size: 1.6rem;
  margin: 0;
}
.dec-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 130px));
  gap: 12px;
  justify-content: center;
  width: 100%;
  padding: 6px;
}
.dec-options .card {
  width: 100%;
}
.dec-target {
  width: 150px;
  height: 150px;
}
.dec-slots {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.dec-keyboard {
  max-width: 440px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.dec-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.dec-feedback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 2px solid;
  width: 100%;
  max-width: 460px;
  animation: popIn 0.3s ease both;
}
.dec-feedback.ok {
  background: #e3f1e6;
  border-color: var(--good);
  color: var(--good);
}
.dec-feedback.bad {
  background: #f8e3dc;
  border-color: var(--bad);
  color: var(--bad);
}
.dec-answer {
  display: flex;
  gap: 6px;
}
.dec-answer .glyph-wrap {
  width: 38px;
  height: 38px;
  color: var(--ink);
}
.dec-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  animation: fadeUp 0.35s ease both;
}
.dec-score {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 4.6rem;
  line-height: 1;
}
.dec-score span {
  font-size: 2rem;
  color: var(--muted);
}
.dec-rank {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
}
.dec-grid-emoji {
  font-size: 1.8rem;
  letter-spacing: 4px;
}
.dec-streak {
  font-weight: 700;
  margin: 0;
}
.dec-done hr {
  width: 100%;
  border: 0;
  border-top: 2px dashed var(--line);
}
.dec-invent {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
}
.dec-cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------------------------------------------------------------- responsive */
.drawer-backdrop {
  display: none;
}
@media (max-width: 1180px) {
  .game {
    grid-template-columns: 210px minmax(0, 1fr);
    grid-template-areas:
      'head head'
      'left stage';
  }
  .tablet-toggle {
    display: inline-flex;
  }
  .tablet-close {
    display: grid;
    place-items: center;
  }
  .side-right {
    position: fixed;
    z-index: 40;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, 92vw);
    padding: 12px;
    transform: translateX(105%);
    transition: transform 0.25s ease;
  }
  .side-right.is-open {
    transform: none;
  }
  .drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 39;
    background: rgba(42, 35, 32, 0.4);
  }
}
@media (max-width: 860px) {
  .home {
    grid-template-columns: 1fr;
    grid-template-areas: 'top' 'copy' 'demo' 'entry' 'daily' 'shelf' 'how' 'foot';
    gap: 16px;
  }
  .home.is-invite {
    grid-template-areas: 'top' 'copy' 'entry' 'demo' 'daily' 'shelf' 'how' 'foot';
  }
  .hero-copy {
    text-align: center;
    padding-top: 0;
  }
  .lobby-grid,
  .results-grid {
    grid-template-columns: 1fr;
  }
  .results-hero {
    flex-direction: column;
    text-align: center;
  }
  .results-tower {
    width: 120px;
  }
}
@media (max-width: 760px) {
  .game {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 10px 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .game-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'left right'
      'progress controls';
    padding: 6px 8px 7px 12px;
    gap: 4px 8px;
  }
  .gh-left {
    grid-area: left;
  }
  .gh-right {
    grid-area: right;
  }
  .gh-progress {
    grid-area: progress;
  }
  .gh-controls {
    grid-area: controls;
  }
  .gh-age .kicker {
    white-space: nowrap;
  }
  .gh-controls .icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    box-shadow: 0 2px 0 var(--ink);
  }
  .gh-controls .controls {
    gap: 5px;
  }
  .gh-controls .ico {
    width: 17px;
    height: 17px;
  }
  .gh-progress .meter-label {
    display: none;
  }
  .gh-left .brand-sm {
    display: none;
  }
  .gh-age b {
    font-size: 1.02rem;
  }
  .gh-progress {
    gap: 14px;
    margin: 0;
  }
  .meter {
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }
  .bricks i {
    width: 16px;
    height: 11px;
  }
  .cracks i {
    width: 12px;
    height: 12px;
  }
  .gh-right {
    gap: 6px;
  }
  .icon-btn {
    width: 36px;
    height: 36px;
  }
  .tablet-toggle {
    height: 36px;
    padding: 0 10px;
  }
  .timer {
    width: 40px;
    height: 40px;
  }
  .side-left {
    flex: none;
    overflow: visible;
  }
  .tower-panel {
    display: none;
  }
  .players-live ul {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .players-live li {
    flex: none;
    padding: 4px 8px 4px 4px;
    grid-template-columns: auto auto auto;
  }
  .players-live .pname {
    font-size: 0.8rem;
    max-width: 90px;
  }
  .pstatus {
    font-size: 0.7rem;
  }
  .pscore {
    font-size: 0.95rem;
  }
  .stage {
    flex: 1;
  }
  .round {
    gap: 10px;
    padding: 0 2px 6px;
  }
  .banner {
    padding: 8px 10px;
  }
  .banner-sub {
    font-size: 0.85rem;
  }
  .cards {
    --gap: 9px;
    padding: 4px 6px 8px;
  }
  .cards > .card {
    width: min(118px, calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)));
  }
  .card-target {
    box-shadow:
      0 0 0 4px var(--gold),
      0 0 18px 4px rgba(217, 161, 43, 0.55),
      var(--press);
    animation: dealIn 0.35s ease both;
  }
  .cards.n4 {
    --cols: 2;
  }
  .cards.n5 {
    --cols: 3;
  }
  .card {
    padding: 6px;
    border-radius: 14px;
  }
  .message {
    min-height: 60px;
    gap: 7px;
  }
  .slot {
    width: 56px;
    height: 56px;
    padding: 7px;
    border-radius: 13px;
  }
  .message.shown .slot {
    width: 66px;
    height: 66px;
  }
  .composer {
    gap: 8px;
  }
  .keyboard {
    gap: 7px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    max-width: 460px;
  }
  .key {
    padding: 8px;
    border-radius: 12px;
  }
  .key-hint {
    display: none;
  }
  .as-speaker.ph-compose .reaction-bar {
    display: none;
  }
  .reaction-bar button {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }
  .intro-panel {
    padding: 8px 4px 16px;
  }
  .age-blurb {
    font-size: 1rem;
  }
  .age-examples .mini-card {
    width: 76px;
    height: 76px;
  }
  .how {
    grid-template-columns: 1fr;
  }
  .how-step {
    display: grid;
    grid-template-columns: 110px 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    align-items: center;
  }
  .how-art {
    grid-row: span 2;
    height: auto;
  }
  .how-art .mini-card {
    width: 64px;
    height: 64px;
  }
  .how-art .mini-card:first-child:not(:last-child) {
    display: none;
  }
  .glyph-demo .glyph-wrap {
    width: 34px;
    height: 34px;
    padding: 4px;
  }
  .how-step h3 {
    margin: 0;
    font-size: 1rem;
  }
  .panel {
    padding: 18px;
  }
  .lang-card {
    padding: 18px;
  }
  .topbar {
    padding: 10px 12px;
  }
  .lobby-grid,
  .results-grid {
    padding: 0 12px;
  }
}
@media (max-width: 380px) {
  .slot {
    width: 50px;
    height: 50px;
  }
  .gh-progress .meter-label {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 860px) {
  .dec-grid {
    grid-template-columns: 1fr;
    padding: 0 12px;
  }
  .dec-tablet {
    position: static;
    max-height: 36vh;
  }
  .dec-hero {
    padding: 0 12px 10px;
  }
}
@media (max-width: 760px) {
  .demo {
    padding: 12px 10px 10px;
  }
  .demo-caption {
    font-size: 1rem;
  }
  .demo-stage {
    grid-template-columns: 70px minmax(0, 1fr) 70px;
    min-height: 150px;
  }
  .demo-pigeon {
    width: 68px;
    height: 68px;
  }
  .demo-bubble {
    left: 26px;
  }
  .demo-bubble .glyph-wrap {
    width: 22px;
    height: 22px;
  }
  .demo-card {
    flex-basis: 62px;
  }
  .entry-actions {
    grid-template-columns: 1fr;
  }
  .daily-card {
    padding: 14px;
    gap: 12px;
  }
  .daily-glyphs {
    display: none;
  }
  .daily-title {
    font-size: 1.15rem;
  }
  .daily-cta {
    padding: 6px 10px;
  }
  .sets .set-art .card-art-wrap {
    width: 24px;
    height: 24px;
  }
  .lost-card {
    width: 64px;
    height: 64px;
  }
  .dec-options {
    grid-template-columns: repeat(2, minmax(0, 140px));
  }
  .dec-target {
    width: 120px;
    height: 120px;
  }
  .dec-quiz {
    min-height: 0;
  }
  .settings-menu {
    min-width: 240px;
  }
  .pip-says {
    max-width: 100%;
  }
}

@media (max-width: 860px) {
  .home {
    grid-template-columns: minmax(0, 1fr);
    padding: 10px 12px 32px;
  }
}
@media (max-width: 760px) {
  .lang-picker {
    height: 36px;
    padding: 0 8px;
  }
  .lang-picker select {
    max-width: 96px;
  }
  .topbar-right .lang-picker {
    display: none;
  }
  .demo-stage {
    grid-template-columns: 58px minmax(0, 1fr) 58px;
    gap: 4px;
  }
  .demo-pigeon {
    width: 58px;
    height: 58px;
  }
  .demo-bubble {
    left: 18px;
  }
  .demo-cards {
    gap: 6px;
  }
  .demo-card {
    flex-basis: 58px;
    padding: 4px;
  }
  .dec-options {
    grid-template-columns: repeat(2, minmax(0, 118px));
  }
  .dec-tablet {
    max-height: 30vh;
  }
  .dec-hero h1 {
    font-size: 1.8rem;
  }
  .brand-sm {
    font-size: 1.3rem;
  }
}

/* Scripts without capital letters look wrong with wide letter-spacing. */
html:lang(hi) .kicker,
html:lang(hi) .lc-h,
html:lang(hi) .meter-label,
html:lang(hi) .t-age,
html:lang(ja) .kicker,
html:lang(ja) .lc-h,
html:lang(ja) .meter-label,
html:lang(ja) .t-age,
html:lang(zh) .kicker,
html:lang(zh) .lc-h,
html:lang(zh) .meter-label,
html:lang(zh) .t-age {
  letter-spacing: 0.02em;
}

/* A group's real history, kept in the same paper-and-ink world. */
.origin-story { margin: 24px 0; overflow: hidden; }
.story-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.story-heading h2, .language-shelf h2 { margin: 5px 0 12px; font-family: var(--font-display); font-size: clamp(24px, 3vw, 34px); }
.story-scene { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 24px; min-height: 265px; padding: 24px 0; }
.story-round { display: inline-block; padding: 4px 10px; border: 1px solid var(--teal); color: var(--teal); border-radius: 100px; font-size: 12px; font-weight: 700; }
.story-narration h3 { font-family: var(--font-display); font-size: clamp(26px, 4vw, 42px); line-height: 1.14; margin: 12px 0; }
.story-narration p { margin: 0 0 12px; }
.story-narration .glyph-row { flex-wrap: wrap; padding: 10px; background: var(--paper-2); border-radius: 12px; }
.story-narration .glyph-wrap { width: 44px; height: 44px; }
.story-pictures { display: flex; align-items: center; justify-content: center; gap: 12px; }
.story-pictures figure { margin: 0; width: 140px; max-width: 45%; text-align: center; }
.story-pictures figcaption { font-size: 12px; margin-top: 10px; overflow-wrap: anywhere; }
.story-card { aspect-ratio: 1; padding: 10px; background: var(--card); border: 2px solid var(--ink); border-radius: 18px; box-shadow: 4px 5px 0 var(--paper-2); transform: rotate(3deg); }
.story-card .card-art, .story-card svg { width: 100%; height: 100%; }
.story-card.is-misread { transform: rotate(-4deg); border-style: dashed; }
.story-versus { font-size: 28px; color: var(--accent); }
.story-controls { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.story-controls .btn-link { min-height: 44px; }
.story-controls .btn-link:disabled { opacity: .4; cursor: default; }
.story-steps { display: flex; align-items: center; flex-wrap: wrap; justify-content: center; }
.story-steps button { border: 0; background: none; width: 30px; height: 44px; padding: 8px; cursor: pointer; }
.story-steps span { display: block; height: 8px; border: 1px solid var(--teal); border-radius: 8px; }
.story-steps .is-current span { background: var(--teal); }
.keep-language { margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); }
.keep-language p { max-width: 55ch; margin: 8px 0 0; }
.language-shelf { grid-area: shelf; min-width: 0; }
.shelf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 16px; }
.shelf-book { position: relative; display: grid; grid-template-columns: 1fr; gap: 12px; border: 1px solid var(--line); border-left: 6px solid var(--teal); border-radius: 4px 14px 14px 4px; padding: 18px; background: var(--card); }
.shelf-book h3 { margin: 0; font-family: var(--font-display); font-size: 26px; overflow-wrap: anywhere; }
.shelf-glyphs { display: flex; gap: 6px; padding-right: 24px; }
.shelf-glyphs .glyph { width: 30px; height: 30px; }
.shelf-remove { position: absolute; right: 4px; top: 4px; width: 40px; height: 40px; font-size: 24px; }
.shelf-undo { padding-top: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
@media (prefers-reduced-motion: no-preference) {
  .story-scene { animation: story-arrive .3s ease-out; }
  @keyframes story-arrive { from { opacity: .25; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
}
@media (max-width: 600px) {
  .story-heading { display: block; }
  .story-scene { grid-template-columns: 1fr; gap: 20px; min-height: 390px; }
  .story-narration { text-align: center; }
  .story-narration .glyph-row { justify-content: center; }
  .story-pictures figure { width: 120px; }
  .story-steps button { width: 24px; padding: 5px; }
  .story-controls { gap: 3px; }
  .story-controls .btn-link { font-size: 12px; }
}
