/* Evil Wordle. The game brings its own palette: a violet night, an ember-magenta
   imp, and jewel tiles. High-contrast swaps the tiles for orange and blue. */

/* Colour emoji for the result squares: monospace fonts carry their own
   black square, which reads as a white bar on a dark background. */
@font-face {
  font-family: 'EvwEmoji';
  src: local('Segoe UI Emoji'), local('Apple Color Emoji'), local('Noto Color Emoji');
  unicode-range: U+2B1B, U+1F7E6-1F7E9, U+1F608, U+1F440, U+2694, U+FE0F;
}

:root {
  --bg: #0b0714;
  --bg-2: #160c27;
  --panel: rgba(32, 19, 56, .66);
  --panel-solid: #1b1030;
  --panel-line: rgba(196, 160, 255, .16);
  --ink: #f5f0ff;
  --ink-2: #cfc3e8;
  --muted: #9d8fbd;
  --faint: rgba(245, 240, 255, .08);
  --accent: #ff2e88;
  --ember: #ff7a3d;
  --violet: #8b5cf6;
  --glow: 0 0 0 1px rgba(255, 46, 136, .35), 0 10px 40px -10px rgba(255, 46, 136, .55);
  --grad: linear-gradient(135deg, #ff2e88 0%, #ff7a3d 100%);

  --t-correct: #17b26a;
  --t-correct-2: #0f8f54;
  --t-present: #f0a81c;
  --t-present-2: #c98a0e;
  --t-absent: #3a2e55;
  --t-absent-2: #2d2344;
  --t-empty: rgba(255, 255, 255, .13);
  --t-filled: rgba(255, 255, 255, .5);

  --key-bg: #2a1d45;
  --key-bg-hover: #36265a;

  --tile: 58px;
  --gap: 6px;
  --radius: 10px;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Unbounded', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  color-scheme: dark;
}
:root.contrast {
  --t-correct: #ff7b1a; --t-correct-2: #d9620b;
  --t-present: #3fa9f5; --t-present-2: #1f86d1;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ── Backdrop: slow ember and violet glows ───────────────────────────────── */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(139, 92, 246, .22), transparent 60%),
    radial-gradient(900px 500px at 50% 115%, rgba(255, 46, 136, .16), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
.bg i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; animation: drift 26s ease-in-out infinite alternate; }
.bg i:nth-child(1) { width: 420px; height: 420px; left: -120px; top: 18%; background: rgba(255, 46, 136, .22); }
.bg i:nth-child(2) { width: 360px; height: 360px; right: -100px; top: 48%; background: rgba(255, 122, 61, .16); animation-duration: 32s; }
.bg i:nth-child(3) { width: 520px; height: 520px; left: 30%; bottom: -320px; background: rgba(139, 92, 246, .22); animation-duration: 38s; }
.bg::after { content: ''; position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
@keyframes drift { to { transform: translate3d(60px, -40px, 0) scale(1.12); } }

/* ── App frame ───────────────────────────────────────────────────────────── */
.app { position: relative; z-index: 1; height: 100%; height: 100dvh; display: flex; flex-direction: column; }

.top {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 10px max(14px, env(safe-area-inset-left)) 8px;
  border-bottom: 1px solid var(--panel-line);
  background: linear-gradient(180deg, rgba(11, 7, 20, .85), rgba(11, 7, 20, .35));
  backdrop-filter: blur(10px);
}
.top-l, .top-r { display: flex; gap: 6px; }
.top-r { justify-content: flex-end; }
.logo { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: 22px; letter-spacing: .02em;
  display: flex; align-items: center; gap: 8px; white-space: nowrap; user-select: none; }
.logo b { font-weight: 900; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 46, 136, .45)); }
.logo span { font-weight: 500; color: var(--ink); }
.logo svg { width: 26px; height: 26px; flex: none; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--ink-2);
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.icon-btn:hover { background: var(--faint); color: var(--ink); border-color: var(--panel-line); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:focus-visible, .key:focus-visible, .btn:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* challenge banner */
.challenge {
  margin: 10px auto 0; max-width: 560px; width: calc(100% - 28px);
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 46, 136, .18), rgba(255, 122, 61, .12));
  border: 1px solid rgba(255, 46, 136, .4); font-size: 14px; color: var(--ink);
  animation: rise .5s cubic-bezier(.2, .9, .3, 1.2) both;
}
.challenge strong { font-family: var(--font-display); font-weight: 700; }
.challenge .x { margin-left: auto; }

/* ── Stage: imp panel + play column ──────────────────────────────────────── */
.stage {
  flex: 1; min-height: 0; width: 100%; max-width: 1080px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr;
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  gap: 10px;
}
.play { min-height: 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* The imp panel: a compact strip on phones, a full column on desktop. */
.imp-panel {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 18px; background: var(--panel); border: 1px solid var(--panel-line);
  backdrop-filter: blur(14px); max-width: 560px; width: 100%; margin: 0 auto; min-width: 0;
}
.imp-wrap { width: 58px; height: 58px; position: relative; }
.imp { width: 100%; height: 100%; overflow: visible; }
.bubble {
  margin: 0; min-width: 0; font-size: 13px; line-height: 1.35; color: var(--ink-2); min-height: 2.7em;
  display: flex; align-items: center;
}
.bubble q { quotes: none; }
.spots { text-align: right; }
.spots-n { display: block; font-family: var(--font-display); font-weight: 900; font-size: 24px; line-height: 1;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.spots-l { display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.meter { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .06); overflow: hidden; display: none; }
.meter i { display: block; height: 100%; width: 100%; background: var(--grad); border-radius: 6px; transform-origin: left center;
  transition: transform .9s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 0 16px rgba(255, 46, 136, .6); }
.trail { display: none; }
.imp-panel { grid-template-columns: auto 1fr auto auto; }
.imp-actions { display: flex; flex-direction: column; gap: 4px; }
.imp-actions .chip { padding: 0; width: 32px; height: 30px; justify-content: center; }
.imp-actions .chip .lbl { display: none; }
.imp-actions .chip svg { width: 15px; height: 15px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--panel-line); background: rgba(255, 255, 255, .03); color: var(--ink-2);
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.chip:hover:not(:disabled) { border-color: rgba(255, 46, 136, .5); color: var(--ink); background: rgba(255, 46, 136, .08); }
.chip:disabled { opacity: .4; cursor: default; }
.chip svg { width: 14px; height: 14px; }

/* peek reveal */
.peek { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; font-family: var(--font-mono);
  font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.peek span { padding: 4px 8px; border-radius: 8px; background: rgba(139, 92, 246, .18); border: 1px solid rgba(139, 92, 246, .4);
  animation: rise .35s ease both; }

@media (min-width: 920px) {
  .stage { grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: 1fr; gap: 28px; padding-top: 22px; }
  .imp-actions { grid-column: 1 / -1; flex-direction: row; justify-content: center; gap: 8px; }
  .imp-actions .chip { width: auto; height: auto; padding: 6px 12px; }
  .imp-actions .chip .lbl { display: inline; }
  .imp-panel {
    grid-template-columns: 1fr; align-content: start; align-self: start; gap: 14px; padding: 22px 20px;
    margin: 0; max-width: none; text-align: center; position: sticky; top: 0;
  }
  .imp-wrap { width: 150px; height: 150px; margin: 4px auto 0; }
  .bubble { position: relative; justify-content: center; text-align: center; font-size: 14.5px; min-height: 4.2em;
    padding: 12px 14px; background: rgba(255, 255, 255, .04); border: 1px solid var(--panel-line); border-radius: 14px; color: var(--ink); }
  .bubble::before { content: ''; position: absolute; top: -7px; left: 50%; width: 12px; height: 12px; transform: translateX(-50%) rotate(45deg);
    background: #25183d; border-left: 1px solid var(--panel-line); border-top: 1px solid var(--panel-line); }
  .spots { text-align: center; }
  .spots-n { font-size: 46px; }
  .meter { display: block; }
  .trail { display: flex; flex-direction: column; gap: 6px; list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
  .trail li { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center; color: var(--ink-2);
    animation: rise .4s ease both; }
  .trail li .n { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
  .trail li .w { font-family: var(--font-mono); letter-spacing: .14em; text-transform: uppercase; text-align: left; color: var(--ink); }
  .trail li .c { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }
  .trail li .bar { grid-column: 2 / -1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .06); overflow: hidden; }
  .trail li .bar i { display: block; height: 100%; background: var(--grad); opacity: .8; }
  .trail:empty { display: none; }
  .play { padding-top: 4px; }
}

/* ── Board ───────────────────────────────────────────────────────────────── */
.board-wrap { flex: 1; min-height: 0; width: 100%; display: flex; justify-content: center; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.board { display: grid; gap: var(--gap); padding: 6px 54px 6px 54px; margin: auto 0; }
.row { display: grid; grid-template-columns: repeat(5, var(--tile)); gap: var(--gap); position: relative; }
.row.shake { animation: shake .5s; }
.row .count {
  position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap;
  font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .4s;
}
.row .count.show { opacity: 1; }
.row .count small { display: block; font-size: 9px; letter-spacing: .1em; font-weight: 500; text-transform: uppercase; opacity: .8; }
.row .num { position: absolute; right: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 11px; color: rgba(255,255,255,.22); }
.row.active .num { color: var(--accent); }
.hide-counts .row .count { display: none; }

.tile {
  width: var(--tile); height: var(--tile); border-radius: var(--radius); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: calc(var(--tile) * .5); text-transform: uppercase; line-height: 1;
  border: 2px solid var(--t-empty); background: rgba(255, 255, 255, .015); color: var(--ink); user-select: none;
  transition: border-color .12s;
}
.tile.filled { border-color: var(--t-filled); animation: pop .12s ease-out; }
.row.active .tile:not(.filled) { border-color: rgba(255, 255, 255, .2); }
.tile.ghost { opacity: .45; }
.tile.s0, .tile.s1, .tile.s2 { border-color: transparent; color: #fff; }
.tile.s0 { background: linear-gradient(180deg, var(--t-absent), var(--t-absent-2)); color: rgba(255, 255, 255, .8); }
.tile.s1 { background: linear-gradient(180deg, var(--t-present), var(--t-present-2)); box-shadow: 0 6px 22px -8px var(--t-present); }
.tile.s2 { background: linear-gradient(180deg, var(--t-correct), var(--t-correct-2)); box-shadow: 0 6px 22px -8px var(--t-correct); }
.tile.flip { animation: flip .56s ease-in-out both; }
.tile.win { animation: bounce .9s ease both; }

@keyframes pop { 0% { transform: scale(.86); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(-90deg); } 100% { transform: rotateX(0); } }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
@keyframes bounce { 0%, 20% { transform: translateY(0); } 40% { transform: translateY(-26px); } 50% { transform: translateY(4px); } 60% { transform: translateY(-12px); } 80% { transform: translateY(2px); } 100% { transform: translateY(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Keyboard ────────────────────────────────────────────────────────────── */
.keyboard { width: 100%; max-width: 520px; display: grid; gap: 7px; user-select: none; flex: none; }
.krow { display: flex; gap: 6px; justify-content: center; }
.key {
  flex: 1; height: 54px; border-radius: 9px; border: 0; cursor: pointer; padding: 0;
  background: var(--key-bg); color: var(--ink); font-weight: 700; font-size: 14px; text-transform: uppercase;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: background .15s, transform .08s;
  display: grid; place-items: center; min-width: 0;
}
.key:hover { background: var(--key-bg-hover); }
.key:active, .key.pressed { transform: translateY(1px) scale(.97); }
.key.wide { flex: 1.55; font-size: 11px; letter-spacing: .06em; }
.key svg { width: 22px; height: 22px; }
.krow .spacer { flex: .5; }
.key.s0 { background: #1a1229; color: rgba(255, 255, 255, .35); box-shadow: none; }
.key.s1 { background: var(--t-present); color: #fff; }
.key.s2 { background: var(--t-correct); color: #fff; }
.key.enter { background: linear-gradient(135deg, rgba(255, 46, 136, .85), rgba(255, 122, 61, .85)); }
.key.enter:hover { filter: brightness(1.08); }

/* ── Toasts ──────────────────────────────────────────────────────────────── */
.toasts { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #160c27; font-weight: 700; font-size: 14px; padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .6); animation: rise .2s ease both; }
.toast.out { opacity: 0; transition: opacity .35s; }

/* ── Dialogs ─────────────────────────────────────────────────────────────── */
dialog {
  border: 1px solid var(--panel-line); border-radius: 22px; padding: 0; color: var(--ink);
  background: linear-gradient(180deg, #1d1133, #140b25); width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 46, 136, .08);
}
dialog[open] { animation: dlg .3s cubic-bezier(.2, .9, .3, 1.15) both; }
dialog::backdrop { background: rgba(6, 3, 12, .72); backdrop-filter: blur(6px); }
@keyframes dlg { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.dlg { padding: 26px 26px 24px; overflow-y: auto; max-height: calc(100dvh - 34px); }
.dlg-x { position: absolute; top: 12px; right: 12px; }
.dlg h2 { font-family: var(--font-display); font-weight: 900; font-size: 22px; margin: 0 0 6px; letter-spacing: .01em; padding-right: 36px; }
.dlg h3 { font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin: 22px 0 10px; }
.dlg p, .dlg li { font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }
.dlg p { margin: 0 0 10px; }
.dlg strong { color: var(--ink); }
.lede { font-size: 16px !important; color: var(--ink) !important; }
.eg { display: grid; gap: 8px; margin: 12px 0 14px; }
.eg .row { --tile: 38px; --gap: 5px; }
.eg .tile { font-size: 18px; border-radius: 8px; }
.eg-note { font-size: 13.5px !important; margin: -2px 0 12px !important; }

.split { display: grid; gap: 6px; margin: 12px 0; padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, .03); border: 1px solid var(--panel-line); }
.split-row { display: grid; grid-template-columns: 96px 1fr 56px; gap: 10px; align-items: center; font-size: 12.5px; }
.split-row .pat { display: flex; gap: 2px; }
.split-row .pat i { width: 14px; height: 14px; border-radius: 3px; }
.split-row .pat i.s0 { background: var(--t-absent); } .split-row .pat i.s1 { background: var(--t-present); } .split-row .pat i.s2 { background: var(--t-correct); }
.split-row .bar { height: 10px; border-radius: 5px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.split-row .bar i { display: block; height: 100%; background: rgba(255, 255, 255, .25); border-radius: 5px; }
.split-row.kept .bar i { background: var(--grad); box-shadow: 0 0 12px rgba(255, 46, 136, .5); }
.split-row .n { font-family: var(--font-mono); text-align: right; color: var(--ink-2); }
.split-row.kept .n { color: var(--accent); font-weight: 700; }
.split-cap { font-size: 12.5px !important; color: var(--muted) !important; margin: 4px 0 0 !important; }

.tips { padding-left: 18px; margin: 0; }
.tips li { margin-bottom: 6px; }
.spoiler { cursor: pointer; border-radius: 6px; padding: 0 6px; background: var(--ink-2); color: transparent; transition: all .2s; font-family: var(--font-mono); }
.spoiler.shown { background: rgba(255, 46, 136, .15); color: var(--ink); }
.fine { font-size: 12.5px !important; color: var(--muted) !important; margin-top: 18px !important; border-top: 1px solid var(--panel-line); padding-top: 14px; }
.fine a { color: var(--ink-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; cursor: pointer;
  font-weight: 800; font-size: 14px; padding: 12px 22px; border: 1px solid var(--panel-line); background: rgba(255, 255, 255, .04);
  color: var(--ink); text-decoration: none; transition: transform .12s, filter .15s, background .15s;
}
.btn:hover { background: rgba(255, 255, 255, .08); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--glow); }
.btn.primary:hover { filter: brightness(1.08); }
.btn svg { width: 18px; height: 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn-row .btn { flex: 1 1 auto; }

/* share */
.share-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 7px; margin-top: 12px; }
@media (max-width: 520px) { .share-grid { grid-template-columns: repeat(5, 1fr); } }
.soc {
  height: 46px; border-radius: 12px; display: grid; place-items: center; border: 1px solid var(--panel-line);
  background: rgba(255, 255, 255, .03); color: var(--ink-2); cursor: pointer; text-decoration: none; transition: all .15s;
}
.soc:hover { color: #fff; transform: translateY(-2px); background: var(--brand, rgba(255, 255, 255, .1)); border-color: transparent; }
.soc svg { width: 20px; height: 20px; }

/* stats */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0 4px; }
.kpi { text-align: center; padding: 12px 6px; border-radius: 14px; background: rgba(255, 255, 255, .035); border: 1px solid var(--panel-line); }
.kpi b { display: block; font-family: var(--font-display); font-weight: 900; font-size: 26px; font-variant-numeric: tabular-nums; }
.kpi span { display: block; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.dist { display: grid; gap: 5px; }
.dist-row { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: center; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.dist-row .bar { height: 22px; min-width: 26px; border-radius: 6px; background: var(--t-absent); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: flex-end; padding: 0 8px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.dist-row.last .bar { background: var(--grad); box-shadow: var(--glow); }
.recent { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.recent li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; font-size: 13px; padding: 7px 10px; border-radius: 9px; background: rgba(255, 255, 255, .025); }
.recent li .w { font-family: var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); }
.recent li .r { font-family: var(--font-mono); color: var(--ink-2); }
.recent li.lost .r { color: #ff6b8b; }
.recent li .d { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted) !important; font-size: 14px; }

/* settings */
.set { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--panel-line); }
.set:last-of-type { border-bottom: 0; }
.set-t b { display: block; font-size: 15px; color: var(--ink); }
.set-t span { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid var(--panel-line); flex: none; }
.seg button { border: 0; background: transparent; padding: 8px 11px; border-radius: 9px; cursor: pointer; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--grad); color: #fff; box-shadow: 0 4px 16px -4px rgba(255, 46, 136, .6); }
.budget-note { font-size: 12.5px !important; color: var(--muted) !important; margin: -6px 0 0 !important; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: rgba(255, 255, 255, .12); transition: background .2s; }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + i { background: var(--grad); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:disabled + i { opacity: .4; }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.danger { color: #ff6b8b !important; }

/* end screen */
.end-head { text-align: center; }
.end-imp { width: 120px; height: 120px; margin: 0 auto 6px; }
.end-head h2 { padding: 0; font-size: 26px; }
.end-head .sub { color: var(--ink-2); font-size: 15px; margin: 4px 0 0; }
.end-word { display: inline-flex; gap: 5px; margin: 14px 0 4px; }
.end-word .tile { --tile: 40px; font-size: 20px; border-radius: 8px; }
.chase { display: grid; gap: 8px; }
.chase-row { display: grid; grid-template-columns: 22px 92px 1fr; gap: 10px; align-items: center; }
.chase-row .n { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.chase-row .g { display: flex; gap: 2px; }
.chase-row .g i { width: 17px; height: 17px; border-radius: 4px; display: grid; place-items: center; font-style: normal; font-size: 10px; font-weight: 800; text-transform: uppercase; color: #fff; }
.chase-row .g i.s0 { background: var(--t-absent); color: rgba(255,255,255,.7); } .chase-row .g i.s1 { background: var(--t-present); } .chase-row .g i.s2 { background: var(--t-correct); }
.chase-row .info { min-width: 0; }
.chase-row .bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.chase-row .bar i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: 4px; transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.chase-row .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 4px; flex-wrap: wrap; }
.chase-row .meta b { color: var(--ink); font-family: var(--font-mono); font-weight: 700; }
.chase-row .meta .verdict { color: var(--ink-2); }
.chase-row .meta .verdict.is-best { color: var(--t-correct); }
.chase-row .meta .verdict em { font-style: normal; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink); }
.lineup { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lineup span { font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; padding: 4px 8px; border-radius: 8px; background: rgba(255, 255, 255, .05); border: 1px solid var(--panel-line); }
.share-preview { font-family: 'EvwEmoji', var(--font-mono); font-size: 13px; line-height: 1.35; white-space: pre; padding: 12px 14px; border-radius: 12px;
  background: rgba(0, 0, 0, .25); border: 1px solid var(--panel-line); color: var(--ink-2); overflow-x: auto; margin: 10px 0 0; }

/* ── The imp ─────────────────────────────────────────────────────────────── */
.imp .mouth, .imp .brow, .imp .extra { display: none; }
.imp[data-mood="smug"] .m-smug, .imp[data-mood="smug"] .b-up,
.imp[data-mood="sure"] .m-smirk, .imp[data-mood="sure"] .b-up,
.imp[data-mood="uneasy"] .m-flat, .imp[data-mood="uneasy"] .b-worry, .imp[data-mood="uneasy"] .x-sweat1,
.imp[data-mood="panic"] .m-wave, .imp[data-mood="panic"] .b-worry, .imp[data-mood="panic"] .x-sweat1, .imp[data-mood="panic"] .x-sweat2,
.imp[data-mood="cornered"] .m-teeth, .imp[data-mood="cornered"] .b-worry, .imp[data-mood="cornered"] .x-sweat1, .imp[data-mood="cornered"] .x-sweat2,
.imp[data-mood="beaten"] .m-o, .imp[data-mood="beaten"] .x-dizzy, .imp[data-mood="beaten"] .x-stars,
.imp[data-mood="gloat"] .m-grin, .imp[data-mood="gloat"] .b-evil, .imp[data-mood="gloat"] .x-flame { display: inline; }
.imp[data-mood="beaten"] .eyes { display: none; }
.imp[data-mood="panic"] .eyes, .imp[data-mood="cornered"] .eyes { transform-box: fill-box; }
.imp[data-mood="panic"] .head-g, .imp[data-mood="cornered"] .head-g { animation: tremble .18s linear infinite; }
.imp .float { animation: bob 3.6s ease-in-out infinite; transform-origin: 50% 60%; }
.imp .lids { transform-origin: 50% 50%; transform-box: view-box; transform: scaleY(0); animation: blink 5.2s infinite; }
.imp .pupil { transition: transform .25s ease-out; }
.imp .x-flame { animation: flicker .5s ease-in-out infinite alternate; transform-origin: 50% 100%; transform-box: fill-box; }
.imp .x-stars { animation: spin 2.4s linear infinite; transform-origin: 60px 22px; }
.imp .x-sweat1, .imp .x-sweat2 { animation: drip 1.6s ease-in infinite; }
.imp .x-sweat2 { animation-delay: .7s; }
.imp.hit .head-g { animation: hit .5s ease; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(0); } 95.5% { transform: scaleY(1); } }
@keyframes tremble { 0% { transform: translate(0, 0); } 25% { transform: translate(.8px, -.4px); } 50% { transform: translate(-.6px, .5px); } 75% { transform: translate(.5px, .6px); } }
@keyframes flicker { from { transform: scale(1, .92); opacity: .85; } to { transform: scale(1.04, 1.06); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drip { 0% { transform: translateY(-2px); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(8px); opacity: 0; } }
@keyframes hit { 0% { transform: none; } 30% { transform: translateX(-4px) rotate(-6deg); } 60% { transform: translateX(3px) rotate(4deg); } 100% { transform: none; } }

/* loading */
.loading { position: fixed; inset: 0; display: grid; place-items: center; z-index: 5; font-family: var(--font-display); color: var(--muted); letter-spacing: .2em; font-size: 12px; text-transform: uppercase; }
.loading::before { content: ''; width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .1); border-top-color: var(--accent);
  animation: spin .8s linear infinite; margin-bottom: 14px; display: block; justify-self: center; }

/* ── Small screens ───────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .top { padding: 6px 8px; }
  .logo { font-size: 18px; gap: 6px; }
  .logo svg { width: 22px; height: 22px; }
  .icon-btn { width: 36px; height: 36px; }
  .stage { padding: 8px 8px max(8px, env(safe-area-inset-bottom)); gap: 8px; }
  .imp-panel { padding: 6px 10px; gap: 8px; }
  .imp-wrap { width: 48px; height: 48px; }
  .bubble { font-size: 12.5px; }
  .spots-n { font-size: 21px; }
  .board { padding: 4px 44px; }
  .row .num { right: calc(100% + 8px); }
  .row .count { left: calc(100% + 6px); font-size: 11px; }
  .key { height: 50px; font-size: 13px; border-radius: 7px; }
  .krow { gap: 5px; }
  .keyboard { gap: 6px; }
  .dlg { padding: 22px 18px 20px; }
  .kpi b { font-size: 22px; }
}
@media (max-height: 640px) { .key { height: 44px; } }

/* reduced motion: keep the colours, drop the movement */
:root.calm *, :root.calm *::before, :root.calm *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
