/* Word Guess Daily · Victorian telegraph office. Round brass typewriter-key tiles on telegram paper strips. */
:root {
  --paper: #f3e9d2; --paper-2: #e6d7b3; --paper-edge: #c9b384;
  --ink: #23262d; --ink-soft: #545862;
  --brass-hi: #ffe79c; --brass: #dca73e; --brass-lo: #a4701f; --brass-ring: #7d5316;
  --steel-hi: #b5d3ee; --steel: #5b8ab5; --steel-lo: #2f5578; --steel-ring: #1d3a55;
  --dark-hi: #5b606b; --dark: #30333a; --dark-lo: #1a1c21; --dark-ring: #0d0e11;
  --bottle: #253a30; --bottle-2: #34503f; --wood: #5a3a24; --red: #b3322a;
  --t: 58px;            /* tile size (set by JS) */
  --kh: 52px;           /* key height */
  --gap: 7px;
  --font: "Baloo 2", "Nunito", system-ui, "Noto Sans", sans-serif;
  --font-body: "Nunito", system-ui, "Noto Sans", sans-serif;
  --mono: "Courier New", Courier, ui-monospace, "Noto Sans Mono", monospace;
}
body.cb {
  --brass-hi: #ffc39a; --brass: #f5793a; --brass-lo: #c2521b; --brass-ring: #7a2e08;
  --steel-hi: #d6ecff; --steel: #85c0f9; --steel-lo: #4f8fcf; --steel-ring: #1f4f86;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body); color: var(--ink); overflow: hidden; -webkit-tap-highlight-color: transparent;
  background: #2b3b33 url(assets/bg_office.webp) center / cover no-repeat;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
body::before { /* lamp-light vignette so the board reads over the art */
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 70% at 50% 55%, rgba(255, 244, 214, 0.35), rgba(30, 34, 30, 0.45) 75%, rgba(15, 18, 16, 0.7));
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, select:focus-visible { outline: 3px solid #ffd76a; outline-offset: 2px; }
.hidden { display: none !important; }

#app { position: relative; height: 100vh; 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); }

/* ---------------------------------------------------------------- header */
#top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px 4px; }
.brand { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 8px; line-height: 1; color: var(--paper); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); }
.brand .l1 { font: 800 clamp(22px, 3.2vw, 34px) var(--font); letter-spacing: 0.5px; }
.brand .l2 { font: 800 clamp(22px, 3.2vw, 34px) var(--font); color: var(--brass-hi); }
.brand .tagline { flex-basis: 100%; font: 700 12px var(--mono); letter-spacing: 1px; opacity: 0.8; margin-top: 2px; text-transform: uppercase; }
.top-btns { display: flex; gap: 8px; }
.icon-btn {
  position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 20px;
  background: radial-gradient(circle at 40% 30%, #4a5049, #262b27); box-shadow: 0 0 0 3px var(--brass-lo), 0 3px 0 2px #111, inset 0 2px 3px rgba(255, 255, 255, 0.2);
  transition: transform 0.1s;
}
.icon-btn::before { content: ''; position: absolute; inset: -5px; border-radius: 50%; } /* hit area ≥ 44 px even when drawn at 34 px */
.icon-btn .q { font: 900 22px var(--font); color: var(--brass-hi); }
.icon-btn:hover { transform: translateY(-2px); }
.icon-btn:active { transform: translateY(2px) scale(0.95); }
.badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font: 800 12px/18px var(--font-body); }

/* ---------------------------------------------------------------- mode bar */
#modebar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; padding: 4px 10px 6px; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(20, 24, 22, 0.55); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5); }
.seg-btn { padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: 14px; color: var(--paper); opacity: 0.75; transition: background 0.15s, opacity 0.15s; white-space: nowrap; }
.seg-btn b { font-family: var(--mono); font-size: 12px; opacity: 0.85; }
.seg-btn.on { background: linear-gradient(var(--brass-hi), var(--brass)); color: #2a1d08; opacity: 1; box-shadow: 0 2px 0 var(--brass-ring); }
.seg.small .seg-btn { font-size: 13px; padding: 5px 10px; }
.pill { padding: 6px 12px; border-radius: 999px; background: var(--paper); color: var(--ink); font-weight: 800; font-size: 14px; box-shadow: 0 0 0 2px var(--paper-edge), 0 2px 0 3px rgba(0, 0, 0, 0.35); white-space: nowrap; }
.pill:active { transform: translateY(1px); }
.lens { display: inline-flex; gap: 4px; }
.lens button { width: 34px; height: 34px; border-radius: 50%; font: 800 15px var(--font); background: radial-gradient(circle at 40% 30%, #fffaf0, #e5d7b6); box-shadow: 0 0 0 2px var(--brass-lo), 0 2px 0 2px rgba(0, 0, 0, 0.35); }
.lens button.on { background: radial-gradient(circle at 40% 30%, var(--brass-hi), var(--brass) 60%, var(--brass-lo)); }

/* ---------------------------------------------------------------- play area */
#play { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr minmax(0, 600px) 1fr; align-items: stretch; gap: 8px; padding: 0 10px 8px; }
#clerk { grid-column: 1; display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; padding-bottom: 12%; position: relative; }
#desk { grid-column: 2; min-height: 0; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
#board-wrap { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }

.parrot { --ph: 230px; --pw: calc(var(--ph) * 0.8306); width: var(--pw); height: var(--ph); margin-right: 6px; cursor: pointer; }
.parrot .sprite {
  width: 100%; height: 100%; background-repeat: no-repeat; background-size: calc(var(--pw) * var(--frames, 8)) var(--ph);
  background-position: calc(var(--pw) * var(--f, 0) * -1) 0; transform-origin: 50% 100%; animation: breathe 2.6s ease-in-out infinite;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.35));
}
.parrot.hop .sprite { animation: hop 0.45s ease-out, breathe 2.6s 0.45s ease-in-out infinite; }
.parrot.shake .sprite { animation: pshake 0.4s ease-in-out, breathe 2.6s 0.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.02, 0.975); } }
@keyframes hop { 0% { transform: scale(1.1, 0.88); } 40% { transform: translateY(-22%) scale(0.94, 1.08); } 75% { transform: translateY(0) scale(1.08, 0.92); } 100% { transform: scale(1); } }
@keyframes pshake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-7deg); } 60% { transform: rotate(6deg); } }

.bubble {
  position: relative; order: -1; max-width: 250px; margin: 0 8px 10px 0; padding: 8px 12px 10px; font: 700 15px/1.3 var(--font-body);
  background: #fbf4df; color: var(--ink); border-radius: 4px; box-shadow: 0 0 0 1px #c4ae7c, 0 5px 14px rgba(0, 0, 0, 0.35);
  transform-origin: 80% 100%; animation: slip 0.25s ease-out;
  background-image: repeating-linear-gradient(transparent 0 20px, rgba(120, 90, 40, 0.08) 20px 21px);
}
.bubble::after { content: ''; position: absolute; right: 36px; bottom: -9px; border: 9px solid transparent; border-top-color: #fbf4df; border-bottom: 0; }
.bubble .who { display: block; font: 700 12px var(--mono); letter-spacing: 1px; text-transform: uppercase; color: var(--red); margin-bottom: 2px; }
@keyframes slip { from { transform: scale(0.6) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------------------------------------------------------- board */
#board {
  position: relative; display: flex; flex-direction: column; gap: calc(var(--t) * 0.1); padding: calc(var(--t) * 0.22) calc(var(--t) * 0.18);
  background: linear-gradient(170deg, #f7efdb, #eadcb9); border-radius: 6px;
  box-shadow: 0 0 0 2px #b79d66, 0 0 0 6px #6a4a2c, 0 0 0 8px #3e2a18, 0 14px 30px rgba(0, 0, 0, 0.5);
}
#board::before { /* ruled telegram-form lines */
  content: ''; position: absolute; inset: 6px; border: 1px solid rgba(140, 100, 50, 0.35); border-radius: 3px; pointer-events: none;
}
.row { position: relative; display: flex; gap: calc(var(--t) * 0.12); padding: calc(var(--t) * 0.05) calc(var(--t) * 0.12); border-radius: 3px; }
.row.current { background: rgba(255, 235, 170, 0.45); box-shadow: inset 0 0 0 1px rgba(170, 120, 40, 0.35); }
.row.shake { animation: rshake 0.45s; }
@keyframes rshake { 0%, 100% { transform: none; } 15%, 55% { transform: translateX(-9px); } 35%, 75% { transform: translateX(9px); } }

.tile {
  position: relative; width: var(--t); height: var(--t); border-radius: 50%; display: grid; place-items: center; flex: none;
  font: 800 calc(var(--t) * 0.5) / 1 var(--font); text-transform: none;
  background: radial-gradient(circle at 50% 42%, rgba(120, 90, 40, 0.08), rgba(120, 90, 40, 0.16));
  box-shadow: inset 0 2px 5px rgba(80, 55, 20, 0.35); border: 2px dashed rgba(120, 90, 40, 0.3);
}
.tile span { position: relative; top: 0.04em; }
.tile.filled, .tile[data-s] {
  border: 0; color: var(--ink);
  background: radial-gradient(circle at 40% 32%, #fffdf6, #efe4c9 58%, #d7c7a0);
  box-shadow: 0 0 0 calc(var(--t) * 0.07) #b8862e, 0 0 0 calc(var(--t) * 0.085) #6f4b17, 0 calc(var(--t) * 0.08) 0 calc(var(--t) * 0.07) #3a2a14, inset 0 -3px 5px rgba(0, 0, 0, 0.18);
}
.tile.pop { animation: pop 0.12s ease-out; }
@keyframes pop { 0% { transform: scale(0.8); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.tile.flip { animation: flip 0.36s ease-in-out; }
@keyframes flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg) scale(0.95); } 100% { transform: rotateX(0); } }
.tile.hop { animation: thop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes thop { 0% { transform: translateY(0); } 40% { transform: translateY(-38%) scale(1.06); } 100% { transform: translateY(0); } }
.tile[data-s="correct"] { color: #2a1d08; background: radial-gradient(circle at 38% 30%, var(--brass-hi), var(--brass) 55%, var(--brass-lo)); box-shadow: 0 0 0 calc(var(--t) * 0.07) var(--brass-ring), 0 calc(var(--t) * 0.08) 0 calc(var(--t) * 0.07) #2d1e08, inset 0 -3px 6px rgba(0, 0, 0, 0.25), 0 0 14px rgba(255, 200, 90, 0.45); }
.tile[data-s="present"] { color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); background: radial-gradient(circle at 38% 30%, var(--steel-hi), var(--steel) 55%, var(--steel-lo)); box-shadow: 0 0 0 calc(var(--t) * 0.07) var(--steel-ring), 0 calc(var(--t) * 0.08) 0 calc(var(--t) * 0.07) #0e1d2b, inset 0 -3px 6px rgba(0, 0, 0, 0.25); }
.tile[data-s="absent"] { color: #aeb2ba; background: radial-gradient(circle at 38% 30%, var(--dark-hi), var(--dark) 58%, var(--dark-lo)); box-shadow: 0 0 0 calc(var(--t) * 0.07) var(--dark-ring), 0 calc(var(--t) * 0.08) 0 calc(var(--t) * 0.07) #000, inset 0 -3px 6px rgba(0, 0, 0, 0.4); }
.tile.hinted:not([data-s]) { color: rgba(125, 83, 22, 0.55); }
body.cb .tile[data-s="present"] { color: var(--ink); text-shadow: none; }
/* colour-blind: shape marks as well as colour */
body.cb .tile[data-s="correct"]::after, body.cb .tile[data-s="present"]::after {
  position: absolute; right: -2%; top: -4%; width: 34%; height: 34%; border-radius: 50%; display: grid; place-items: center;
  font: 900 calc(var(--t) * 0.2) / 1 var(--font-body); background: #fff; color: #111; box-shadow: 0 0 0 2px #111;
}
body.cb .tile[data-s="correct"]::after { content: '✓'; }
body.cb .tile[data-s="present"]::after { content: '↔'; }

.stamp {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%) rotate(-11deg); padding: 6px 18px; pointer-events: none;
  font: 900 clamp(17px, 5.2vw, 46px) / 1.05 var(--font); letter-spacing: 3px; text-transform: uppercase; white-space: nowrap;
  color: var(--red); border: 5px double var(--red); border-radius: 8px; opacity: 0.88; mix-blend-mode: multiply; background: rgba(255, 250, 235, 0.25);
  animation: stampIn 0.34s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.stamp.lost { color: #3b3f48; border-color: #3b3f48; }
@keyframes stampIn { from { transform: translate(-50%, -50%) rotate(-24deg) scale(2.6); opacity: 0; } to { transform: translate(-50%, -50%) rotate(-11deg) scale(1); opacity: 0.88; } }

/* ---------------------------------------------------------------- tools row */
#tools { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 30px; }
.tool-btn { padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: 14px; background: rgba(251, 244, 223, 0.92); box-shadow: 0 0 0 2px var(--paper-edge), 0 2px 0 3px rgba(0, 0, 0, 0.3); }
.tool-btn:active { transform: translateY(1px); }
.countdown { font: 700 14px var(--mono); color: var(--paper); background: rgba(20, 24, 22, 0.6); padding: 4px 12px; border-radius: 999px; }

/* ---------------------------------------------------------------- keyboard */
#keyboard { display: flex; flex-direction: column; gap: 6px; padding: 8px 6px 6px; border-radius: 12px; background: linear-gradient(#3b2a1c, #2a1d13); box-shadow: 0 0 0 2px #7a5a33, 0 8px 18px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.krow { display: flex; gap: 5px; justify-content: center; }
.key {
  flex: 1 1 0; min-width: 0; max-width: 58px; height: var(--kh); border-radius: 10px; display: grid; place-items: center;
  font: 800 clamp(14px, calc(var(--kh) * 0.42), 22px) / 1 var(--font); color: #f3e9d2;
  background: radial-gradient(circle at 45% 30%, #5b606b, #30333a 60%, #1f2126);
  box-shadow: 0 0 0 2px #a67a2b, 0 3px 0 2px #0b0b0d, inset 0 1px 2px rgba(255, 255, 255, 0.25);
  transition: transform 0.06s, filter 0.1s;
}
.key.wide { flex: 1.6 1 0; max-width: 96px; font-size: clamp(11px, calc(var(--kh) * 0.28), 15px); letter-spacing: 0.5px; }
.key:hover { filter: brightness(1.15); }
.key:active, .key.down { transform: translateY(3px); box-shadow: 0 0 0 2px #a67a2b, 0 0 0 2px #0b0b0d, inset 0 1px 2px rgba(255, 255, 255, 0.25); }
.key[data-s="correct"] { color: #2a1d08; background: radial-gradient(circle at 45% 30%, var(--brass-hi), var(--brass) 60%, var(--brass-lo)); }
.key[data-s="present"] { color: #fff; background: radial-gradient(circle at 45% 30%, var(--steel-hi), var(--steel) 60%, var(--steel-lo)); }
body.cb .key[data-s="present"] { color: var(--ink); }
.key[data-s="absent"] { color: #6c707a; background: #17181c; box-shadow: 0 0 0 2px #3c3024, 0 3px 0 2px #000; }

/* ---------------------------------------------------------------- pigeon */
.pigeon { position: fixed; top: 9%; left: 0; width: 78px; height: 100px; z-index: 5; pointer-events: none; background-repeat: no-repeat; background-size: 400% 100%; animation: flyacross 6.5s linear forwards, flap 0.36s steps(4) infinite; }
@keyframes flyacross { from { transform: translateX(-120px) translateY(0); } 50% { transform: translateX(50vw) translateY(26px); } to { transform: translateX(calc(100vw + 40px)) translateY(-10px); } }
@keyframes flap { from { background-position: 0 0; } to { background-position: -400% 0; } }

/* ---------------------------------------------------------------- overlays */
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }
.toast {
  position: fixed; left: 50%; top: 14%; transform: translateX(-50%); z-index: 40; max-width: min(90vw, 460px); text-align: center;
  padding: 10px 18px; font: 800 15px/1.3 var(--font-body); color: var(--paper); background: #1c1f1d; border-radius: 6px;
  box-shadow: 0 0 0 2px var(--brass-lo), 0 8px 20px rgba(0, 0, 0, 0.5); animation: toastIn 0.25s ease-out;
}
@keyframes toastIn { from { transform: translate(-50%, -12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 14px; background: rgba(14, 16, 14, 0.62); backdrop-filter: blur(2px); }
.modal {
  position: relative; width: min(94vw, 460px); max-height: calc(100dvh - 28px); overflow-y: auto; padding: 18px 20px 16px;
  background: linear-gradient(170deg, #fbf5e4, #efe2c2); border-radius: 8px; color: var(--ink);
  box-shadow: 0 0 0 2px #b79d66, 0 0 0 6px #5a3e24, 0 20px 40px rgba(0, 0, 0, 0.5); animation: modalIn 0.22s ease-out;
}
@keyframes modalIn { from { transform: translateY(14px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h2 { margin: 0 0 10px; font: 800 26px/1.1 var(--font); text-align: center; color: #3a2a14; }
.modal h3 { margin: 14px 0 6px; font: 800 17px var(--font); }
.modal p { margin: 6px 0; font-size: 15px; line-height: 1.4; }
.note { font-size: 13px !important; color: var(--ink-soft); font-style: italic; }
.actions { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.actions.col { flex-direction: column; align-items: stretch; }
.btn { padding: 10px 20px; border-radius: 999px; font: 800 16px var(--font-body); transition: transform 0.08s, filter 0.1s; }
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(2px); }
.btn.big { font-size: 18px; padding: 12px 22px; }
.btn.brass { color: #2a1d08; background: linear-gradient(#ffe39a, #d7a13a); box-shadow: 0 0 0 2px #7d5316, 0 3px 0 2px #3a2708; }
.btn.blue { color: #fff; background: linear-gradient(#6f9cc6, #3b6a96); box-shadow: 0 0 0 2px #1d3a55, 0 3px 0 2px #0c1a28; }
.btn.ink { color: var(--paper); background: linear-gradient(#474c55, #25282e); box-shadow: 0 0 0 2px #0d0e11, 0 3px 0 2px #000; }
.close-x { position: absolute; top: 6px; right: 10px; font: 700 28px/1 var(--font-body); color: #6b5530; }

.example { display: flex; gap: 6px; margin: 8px 0 2px; --t: 38px; }
.example + p { margin-top: 2px; font-size: 14px; }
.set-grid { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center; font-weight: 800; }
.set-grid select { font: 700 15px var(--font-body); padding: 7px 8px; border-radius: 6px; border: 2px solid var(--paper-edge); background: #fffaf0; color: var(--ink); min-width: 0; }
.toggles { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.tg-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px dashed rgba(120, 90, 40, 0.3); }
.tg-row small { display: block; font-size: 12px; color: var(--ink-soft); }
.switch { flex: none; position: relative; width: 52px; height: 28px; border-radius: 14px; background: #8b8f96; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35); transition: background 0.15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 40% 30%, #fff, #ddd); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); transition: transform 0.15s; }
.switch::before { content: ''; position: absolute; inset: -9px -6px; } /* ≥ 44 px touch target */
.switch.on { background: linear-gradient(var(--brass), var(--brass-lo)); }
.switch.on::after { transform: translateX(24px); }
.switch.locked { opacity: 0.5; }

.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.lang-grid button { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 8px; font-weight: 800; font-size: 15px; background: #fffaf0; box-shadow: 0 0 0 2px var(--paper-edge); text-align: left; }
.lang-grid button.on { background: linear-gradient(var(--brass-hi), var(--brass)); box-shadow: 0 0 0 2px var(--brass-ring); }
.lang-grid .fl { font-size: 22px; }

.stat-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; text-align: center; }
.stat-nums b { display: block; font: 800 28px/1 var(--font); color: #3a2a14; }
.stat-nums small { font-size: 12px; color: var(--ink-soft); line-height: 1.1; display: block; }
.dist { display: flex; flex-direction: column; gap: 4px; }
.dist-row { display: flex; align-items: center; gap: 6px; font: 800 14px var(--font-body); }
.dist-row .n { width: 14px; text-align: right; }
.dist-row .db { flex: 1; }
.dist-row .db i { display: block; min-width: 26px; padding: 2px 8px; border-radius: 3px; text-align: right; color: var(--paper); background: #5d626c; font-style: normal; transition: width 0.4s; }
.dist-row.hl .db i { background: linear-gradient(90deg, var(--brass-lo), var(--brass)); color: #2a1d08; }
.next-row { text-align: center; font-weight: 800; margin-top: 10px !important; }
.next-row b { font-family: var(--mono); font-size: 20px; display: block; }

.rank-card { text-align: center; padding: 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.5); box-shadow: 0 0 0 1px var(--paper-edge); }
.rank-card b { display: block; font: 800 22px var(--font); color: #3a2a14; margin: 2px 0 6px; }
.bar { height: 10px; border-radius: 5px; background: rgba(0, 0, 0, 0.15); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brass-lo), var(--brass-hi)); }
.missions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.missions li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.55); box-shadow: 0 0 0 1px var(--paper-edge); font-weight: 700; font-size: 14px; }
.missions li .ck { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #d8ccad; font-size: 14px; }
.missions li.done .ck { background: var(--brass); }
.missions li.done span { text-decoration: line-through; opacity: 0.7; }
.missions li .rw { margin-left: auto; font: 800 13px var(--mono); color: var(--red); white-space: nowrap; }
.missions li .pg { font: 700 12px var(--mono); color: var(--ink-soft); }

/* result telegram */
.telegram { text-align: center; background-image: repeating-linear-gradient(transparent 0 26px, rgba(120, 90, 40, 0.07) 26px 27px), linear-gradient(170deg, #fbf5e4, #efe2c2); }
.tg-head { display: flex; justify-content: space-between; align-items: baseline; font: 700 13px var(--mono); letter-spacing: 2px; color: var(--red); border-bottom: 2px solid var(--red); padding-bottom: 4px; margin-bottom: 10px; }
.res-word-label { font-size: 13px !important; color: var(--ink-soft); margin: 0 !important; }
.res-word { font: 800 34px/1.1 var(--font) !important; letter-spacing: 1px; color: #3a2a14; margin: 0 0 6px !important; }
.quip { font-style: italic; color: #4a3a22; }
.res-stats { display: flex; justify-content: center; gap: 18px; font-weight: 800; margin: 8px 0; flex-wrap: wrap; }
.res-stats span { display: flex; flex-direction: column; font-size: 12px; color: var(--ink-soft); }
.res-stats b { font: 800 22px var(--font); color: #3a2a14; }
.share-preview { text-align: left; font: 14px/1.25 var(--mono); background: #fffaf0; padding: 8px; border-radius: 6px; user-select: text; -webkit-user-select: text; white-space: pre-wrap; }

#loading { background: #243129; }
.loader { text-align: center; color: var(--paper); font-weight: 800; }
.morse { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }
.morse i { width: 14px; height: 14px; border-radius: 7px; background: var(--brass); animation: blink 1.2s infinite; }
.morse i:nth-child(2) { animation-delay: 0.2s; }
.morse i.dash { width: 38px; animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.2; } 30% { opacity: 1; } }

/* ---------------------------------------------------------------- responsive */
/* narrow / portrait: Horatio sits in a strip above the board */
@media (max-width: 860px), (orientation: portrait) {
  #play { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 4px; padding: 0 6px 6px; }
  #clerk { grid-column: 1; grid-row: 1; flex-direction: row; align-items: center; justify-content: center; padding: 0; min-height: 64px; }
  #desk { grid-column: 1; grid-row: 2; }
  .parrot { --ph: 78px; margin: 0; order: -2; }
  .bubble { order: 0; max-width: min(72vw, 420px); margin: 0 0 0 10px; font-size: 13px; padding: 5px 10px 6px; }
  .bubble::after { left: -9px; right: auto; bottom: auto; top: 50%; transform: translateY(-50%); border: 9px solid transparent; border-right-color: #fbf4df; border-left: 0; }
  #top { padding: 6px 10px 2px; }
  .brand .tagline { display: none; }
  .icon-btn { width: 38px; height: 38px; font-size: 17px; }
  #keyboard { padding: 6px 4px 4px; gap: 5px; }
  .krow { gap: 4px; }
  .seg-btn { font-size: 13px; padding: 5px 11px; }
}
/* short landscape phones: board left, keyboard right */
@media (orientation: landscape) and (max-height: 540px) {
  #top { padding: 4px 10px 0; }
  .brand .tagline { display: none; }
  .brand .l1, .brand .l2 { font-size: 20px; }
  .icon-btn { width: 34px; height: 34px; font-size: 15px; }
  #modebar { padding: 2px 8px 4px; }
  #play { grid-template-columns: auto 1fr; grid-template-rows: 1fr; padding: 0 8px 6px; }
  #clerk { grid-column: 1; grid-row: 1; flex-direction: column; justify-content: flex-end; align-items: center; width: 118px; min-height: 0; padding-bottom: 6px; }
  .parrot { --ph: 104px; order: 0; }
  .bubble { order: -1; max-width: 124px; margin: 0 0 8px; font-size: 12px; padding: 5px 8px 6px; }
  .bubble::after { left: auto; right: 40px; top: auto; bottom: -9px; transform: none; border: 9px solid transparent; border-top-color: #fbf4df; border-bottom: 0; }
  #desk { grid-column: 2; grid-row: 1; flex-direction: row; align-items: center; }
  #board-wrap { flex: 1 1 auto; height: 100%; min-width: 0; }
  #tools { position: absolute; left: 128px; bottom: 6px; }
  #keyboard { flex: 0 0 min(52%, 440px); }
}
/* very narrow phones: keep header and mode bar on one line each */
@media (max-width: 430px) {
  .brand .l1, .brand .l2 { font-size: 20px; }
  .brand { flex-wrap: nowrap; white-space: nowrap; }
  .icon-btn { width: 34px; height: 34px; font-size: 15px; }
  .top-btns { gap: 6px; }
  #modebar { flex-wrap: nowrap; gap: 6px; padding: 2px 6px 4px; }
  .seg-btn { font-size: 12px; padding: 5px 8px; }
  .seg-btn b { display: none; }
  #wl-name { display: none; }
  .pill { padding: 6px 9px; }
  .lens button { width: 28px; height: 28px; font-size: 13px; }
  #clerk { min-height: 52px; }
  .parrot { --ph: 62px; }
}
@media (prefers-reduced-motion: reduce) {
  .parrot .sprite { animation: none; }
}
body.nomotion .parrot .sprite, body.nomotion .tile, body.nomotion .row, body.nomotion .stamp { animation: none !important; }

.credits { font-size: 12px; opacity: .75; margin-top: 10px; }
.credits a { color: inherit; }
