:root {
  --bg: #13161f;
  --bg-soft: #1a1f2c;
  --panel: #1e2431;
  --panel-hi: #262d3d;
  --ink: #eef1f6;
  --ink-dim: #a3adbe;
  --dim: #6f7a8c;
  --line: #2c3446;
  --accent: #ffb454;
  --accent-hi: #ffc978;
  --accent-deep: #b87a28;
  --win: #ffb454;
  --hot: #ff6b6b;
  --warm: #ffb454;
  --cool: #6cc4b6;
  --cold: #5b6578;
}
* {
  box-sizing: border-box;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
[hidden] {
  /* biome-ignore lint/complexity/noImportantStyles: hidden attr must beat any display rule */
  display: none !important;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Inter", "Noto Sans Arabic", "Noto Sans Bengali", "Noto Sans Devanagari", ui-sans-serif,
    system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
header {
  padding: 20px 28px 18px;
  max-width: 640px;
  margin: 0 auto;
}
header h1 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 34px;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--accent) 0%, #ff7e6b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
header h1 .th-a {
  display: inline-block;
  margin-left: 10px;
  font-size: 0.72em;
  color: #c97ac4;
  -webkit-text-fill-color: #c97ac4;
  vertical-align: 0.08em;
  transform-origin: center;
  text-shadow: 0 0 9px rgba(200, 130, 190, 0.4);
  animation:
    th-a-pop 2.1s cubic-bezier(0.22, 0.9, 0.3, 1.15) both,
    th-a-flash 2.1s ease-out both,
    th-a-hue 2.1s ease-out both;
}
header h1 .th-a.th-a-static {
  animation: none;
}
.th-pulse {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 130, 170, 0.22) 0%,
    rgba(201, 122, 196, 0.14) 35%,
    rgba(201, 122, 196, 0) 70%
  );
  opacity: 0;
  animation: th-pulse 2.1s ease-out both;
}
@keyframes th-pulse {
  0% {
    opacity: 0;
    transform: scale(0.85);
  }
  35% {
    opacity: 1;
    transform: scale(1.02);
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}
.score-pulse {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  font:
    700 14px Inter,
    ui-sans-serif,
    system-ui;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(255, 180, 84, 0.35);
  animation: score-pulse 2s ease-out both;
}
@keyframes score-pulse {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.92);
  }
  15% {
    opacity: 1;
    transform: translateY(-4px) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translateY(-28px) scale(1);
  }
}
@keyframes th-a-pop {
  0% {
    transform: scale(0) rotate(-8deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.75) rotate(2deg);
    opacity: 1;
  }
  70% {
    transform: scale(1.6) rotate(-1deg);
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}
@keyframes th-a-flash {
  0%,
  20% {
    text-shadow: 0 0 0 rgba(255, 107, 138, 0);
    filter: brightness(1);
  }
  50% {
    text-shadow:
      0 0 16px rgba(255, 130, 155, 0.7),
      0 0 5px rgba(255, 180, 84, 0.4);
    filter: brightness(1.25);
  }
  100% {
    text-shadow: 0 0 9px rgba(200, 130, 190, 0.4);
    filter: brightness(1);
  }
}
@keyframes th-a-hue {
  0% {
    color: #ff6b8a;
    -webkit-text-fill-color: #ff6b8a;
  }
  50% {
    color: #ff7aa0;
    -webkit-text-fill-color: #ff7aa0;
  }
  100% {
    color: #c97ac4;
    -webkit-text-fill-color: #c97ac4;
  }
}
.tagline {
  width: 100%;
  margin: 2px 0 0;
  font-size: 10px;
  color: var(--dim);
  font-style: italic;
  letter-spacing: 0.01em;
}
#meta {
  display: flex;
  justify-content: space-between;
  color: var(--dim);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
  letter-spacing: 0.03em;
}

main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 28px 28px;
  max-width: 640px;
  margin: 0 auto;
}

#plot-wrap {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.03) inset,
    0 8px 24px rgba(0, 0, 0, 0.25);
}
canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: default;
  border-radius: 8px;
}
#tooltip {
  position: absolute;
  pointer-events: none;
  background: #0f1115;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 12px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transform: translate(-50%, -100%);
  margin-top: -10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}
#tooltip .tt-user {
  font-weight: 600;
  color: var(--accent);
  margin-right: 4px;
  font-size: 11px;
}
#tooltip .tt-word {
  font-weight: 600;
}
#tooltip .tt-rank {
  font-weight: 700;
  margin-left: 8px;
}
#tooltip .tt-rank.win {
  color: var(--win);
}
#tooltip .tt-rank.hot {
  color: var(--hot);
}
#tooltip .tt-rank.warm {
  color: var(--warm);
}
#tooltip .tt-rank.cool {
  color: var(--cool);
}
#tooltip .tt-rank.cold {
  color: var(--cold);
}
#tooltip .tt-translation {
  color: var(--dim);
  font-style: italic;
  font-size: 11px;
  margin-left: 4px;
}
#tooltip .tt-sim {
  color: var(--dim);
  margin-left: 6px;
  font-size: 11px;
}
#tooltip .tt-lang {
  font-size: 9px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-left: 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 4px;
}

#side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#guess-form {
  display: flex;
  gap: 8px;
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: var(--bg);
  padding: 8px 0;
}
#guess-input {
  flex: 1;
  padding: 14px 16px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
#guess-input::placeholder {
  color: var(--dim);
  font-weight: 400;
}
#guess-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 180, 84, 0.15);
}
button {
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  background: var(--accent);
  color: #1a1205;
  transition:
    background 0.15s,
    transform 0.05s;
}
button:hover {
  background: var(--accent-hi);
}
button:active {
  transform: translateY(1px);
}
/* Hold width steady so the "guess" -> "…" loading swap doesn't resize the input row. */
#guess-form button[type="submit"] {
  min-width: 92px;
}

#toolbar {
  display: flex;
  justify-content: center;
  /* flex-start (not the default stretch) so every button keeps its natural
     height: hint/labels/clear/multiplayer end up equal with tops AND bottoms
     aligned. The reveal button is taller (chips + extra bottom padding); it
     stays top-aligned and extends downward past the shared bottom edge. */
  align-items: flex-start;
  gap: 6px;
  margin-top: 10px;
}
button.ghost {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
}
button.ghost:hover {
  background: transparent;
  color: var(--hot);
  border-color: var(--hot);
}
button.ghost:disabled {
  opacity: 0.3;
  pointer-events: none;
}

#hint-btn.hint-meter {
  --hint-meter-progress: 0%;
  color: var(--ink-dim);
  border-color: rgba(163, 173, 190, 0.22);
  background: linear-gradient(
    90deg,
    rgba(163, 173, 190, 0.16) 0 var(--hint-meter-progress),
    rgba(111, 122, 140, 0.06) var(--hint-meter-progress) 100%
  );
}
#hint-btn.hint-meter:disabled {
  opacity: 0.42;
  border-style: dotted;
  cursor: not-allowed;
}

#hint-wrap {
  position: relative;
}
#hint-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 6px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 20;
}
#hint-picker[hidden] {
  display: none;
}
.hint-header {
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
  padding: 4px 4px 0;
}
.hint-row {
  display: flex;
  gap: 4px;
  white-space: nowrap;
}
.hint-lang {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
}
.hint-lang:hover {
  background: var(--panel-hi);
  color: var(--ink);
  border-color: var(--accent);
}
.hint-lang:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--panel-hi);
  border-style: dashed;
  text-decoration: line-through;
}
.hint-lang:disabled:hover {
  background: var(--panel-hi);
  color: var(--ink-dim);
  border-color: var(--line);
}

#status {
  font-size: 13px;
  color: var(--ink-dim);
  padding: 0 4px;
}
/* Collapse entirely when empty so it claims no space (and no #side flex gap).
   Errors/loading/win banner add content, so they don't match :empty and flow in normally. */
#status:empty {
  display: none;
}
#status.win {
  color: #1a1a1a;
  font-weight: 600;
  cursor: pointer;
  background: #c0c7d2;
  border-radius: 12px;
  padding: 12px 20px;
  text-align: center;
  font-size: 14px;
  margin: 6px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
}
#status.win .win-target {
  font-family: "Fraunces", Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: 0.01em;
  word-break: break-word;
  max-width: 100%;
  /* Blurred on the banner; the recap popup is the reveal (tap to open). */
  filter: blur(7px);
  user-select: none;
  -webkit-user-select: none;
  transition: filter 0.18s ease;
}
#status.win:hover .win-target {
  filter: blur(5px);
}
#status.win .win-hint {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1a1a1a;
  opacity: 0.55;
}
#status.err {
  color: var(--hot);
}

#guess-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 58vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
#guess-list::-webkit-scrollbar {
  width: 8px;
}
#guess-list::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}
#guess-list li {
  display: grid;
  grid-template-columns: 26px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  transition: background 0.15s;
}
#guess-list li:last-child {
  border-bottom: none;
}
#guess-list li.latest {
  background: var(--panel-hi);
}
#guess-list .n {
  color: var(--dim);
  font-size: 12px;
}
#guess-list .word-group {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}
/* Hide the answer in the #1 row once solved; the banner/recap is the reveal. */
#guess-list li.solved-word .word-group {
  filter: blur(5px);
  user-select: none;
  -webkit-user-select: none;
}
#guess-list li.alt-input .word-group {
  opacity: 0.4;
}
#guess-list .word {
  font-weight: 600;
  white-space: nowrap;
}
#guess-list .translation {
  color: var(--dim);
  font-size: 12px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
#guess-list .transliterated {
  color: var(--dim);
  font-size: 11px;
  font-style: italic;
  opacity: 0.7;
  margin-left: 4px;
}
#guess-list .lang {
  font-size: 9.5px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-weight: 600;
}
#guess-list .lang.ar {
  color: #a5b4fc;
  border-color: #3b3f66;
}
#guess-list .lang.bn {
  color: #f5a1d6;
  border-color: #66324f;
}
#guess-list .hint-tag {
  font-size: 9.5px;
  color: #ffb454;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border: 1px solid #66501e;
  border-radius: 4px;
  background: rgba(255, 180, 84, 0.08);
  font-weight: 700;
  margin-left: 4px;
}
#guess-list li.from-hint {
  border-left: 2px solid #ffb454;
  padding-left: 6px;
}
#guess-list .rank {
  font-size: 14px;
  font-weight: 700;
  min-width: 50px;
  text-align: right;
}
#guess-list .rank.win {
  color: var(--win);
}
#guess-list .rank.hot {
  color: var(--hot);
}
#guess-list .rank.warm {
  color: var(--warm);
}
#guess-list .rank.cool {
  color: var(--cool);
}
#guess-list .rank.cold {
  color: var(--cold);
}
#guess-list li.tier-win .word {
  color: var(--win);
}
#guess-list li.revealed {
  opacity: 0.55;
  border-left: 2px solid var(--dim);
}
#guess-list li.list-sep {
  display: block;
  height: 1px;
  padding: 0;
  min-height: 0;
  border: none;
  background: var(--line);
  margin: 4px 0;
}

/* ===== Win overlay / recap ===== */
#win-overlay[hidden] {
  display: none;
}
#win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 17, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fade-in 0.25s ease;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.win-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 32px 24px;
  max-width: 680px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: pop-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.recap-target {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 32px;
  text-align: center;
  color: var(--accent);
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 4px 32px 18px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  word-break: break-word;
}
.recap-target[hidden] {
  display: none;
}
.recap-target.typing::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 0.9em;
  margin-left: 4px;
  vertical-align: -0.08em;
  background: var(--accent);
  animation: recap-caret 0.85s steps(2, start) infinite;
}
@keyframes recap-caret {
  50% {
    opacity: 0;
  }
}
.win-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  color: var(--dim);
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
  font-weight: 400;
}
.win-close:hover {
  background: var(--panel-hi);
  color: var(--ink);
}
.win-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.win-solved {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.win-eyebrow {
  font-size: 13px;
  font-weight: 600;
  color: var(--dim);
  letter-spacing: 0.02em;
}
.win-title {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 34px;
  letter-spacing: -0.01em;
  color: var(--accent);
  line-height: 1.1;
}
.win-brand {
  text-align: right;
  flex-shrink: 0;
}
.win-wordmark {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 26px;
  color: var(--ink);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.win-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.win-hsep {
  width: 42px;
  height: 2px;
  background: var(--accent-deep);
  margin: 6px 0 6px auto;
}
.win-tagline {
  font-size: 12px;
  color: var(--dim);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.win-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.stat {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center;
}
.stat-val {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 28px;
  color: var(--accent);
  line-height: 1.1;
}
.stat-label {
  font-size: 11px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
  font-weight: 600;
}
#recap-plot {
  width: 100%;
  height: auto;
  max-height: 50vh;
  object-fit: contain;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.win-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.win-actions button {
  padding: 10px 16px;
  font-size: 14px;
  white-space: nowrap;
}
.win-actions button.secondary {
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--line);
}
.win-actions button.secondary:hover {
  background: var(--panel-hi);
  color: var(--ink);
  border-color: var(--accent);
}
/* Three buttons on one row on phones: tighten padding/gap so they fit before
   the flex-wrap fallback kicks in on the narrowest screens. */
@media (max-width: 480px) {
  .win-actions {
    gap: 6px;
  }
  .win-actions button {
    padding: 9px 10px;
    font-size: 12.5px;
  }
}
#reaction-bar {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.rxn-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  border-right: 1px solid var(--line);
  padding: 7px 0;
  cursor: pointer;
  flex: 1;
  transition: background 0.12s;
}
.rxn-btn:last-child {
  border-right: none;
}
.rxn-btn:hover {
  background: var(--panel-hi);
}
.rxn-btn.mine {
  background: rgba(255, 180, 84, 0.12);
}
.rxn-btn.mine:hover {
  background: rgba(255, 180, 84, 0.2);
}
.rxn-emoji {
  font-size: 1.2rem;
  line-height: 1;
}
.rxn-count {
  font-size: 0.66rem;
  color: var(--ink-dim);
  min-height: 1em;
  font-variant-numeric: tabular-nums;
}
.rxn-tip {
  position: fixed;
  background: var(--panel-hi);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.72rem;
  color: var(--ink);
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 8px));
}

/* ===== Archive ("waiting room") mode ===== */
#archive-controls[hidden] {
  display: none;
}
#archive-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}
#archive-keep {
  flex: 1;
}
#archive-keep:disabled {
  opacity: 0.6;
  cursor: default;
}
/* Toolbar back control: hollow white, matching the archive bar. */
#archive-back {
  white-space: nowrap;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}
#archive-back:hover {
  color: #fff;
  border-color: #fff;
  background: transparent;
}

/* Archive bar: mode label + progress ticks, one thin banner at the top of #side,
   just above the guess input (#side's flex gap spaces it from the plot above and
   the input below). Markers are slim vertical ticks so the whole archive packs
   into a single non-wrapping row: solved fill gold, the round you're on is white,
   the rest dim. The row scrolls horizontally if it overruns; the scrollbar is
   hidden (it scrolls by touch/trackpad) since the chrome reads as clutter. */
#archive-bar[hidden] {
  display: none;
}
#archive-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(584px, 100%);
  padding: 6px 12px;
  /* Negative margins claw back #side's 14px flex gap so the banner sits snug:
     ~8px from the plot above, ~2px from the guess input below. */
  margin: -6px auto -12px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 10px;
}
.archive-bar-label {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.arc-grid {
  flex: 1;
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none; /* Firefox */
  mask-image: linear-gradient(to right, transparent 0%, #000 12%, #000 88%, transparent 100%);
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    #000 12%,
    #000 88%,
    transparent 100%
  );
  cursor: grab;
  user-select: none;
}
.arc-grid.dragging {
  cursor: grabbing;
}
.arc-grid::-webkit-scrollbar {
  display: none;
} /* WebKit */
.arc-dot {
  flex: 0 0 auto;
  width: 2px;
  height: 12px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.14);
}
.arc-dot.current {
  background: rgba(255, 255, 255, 0.9);
}
.arc-dot.solved {
  background: #ffb454;
} /* after .current so a solved current tick reads gold */

/* "beta" pill on the brand row, shown only during archive play (see archive.js).
   Hollow white to echo the Archive Round banner; click toggles #beta-pop. */
.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.beta-pill[hidden] {
  display: none;
}
.beta-pill {
  padding: 3px 10px;
  border-radius: 999px;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: transparent;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.beta-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #fff;
  color: #fff;
}
.beta-pop[hidden] {
  display: none;
}
.beta-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  max-width: 320px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}
.beta-pop p {
  margin: 0 0 8px;
}
.beta-pop p:last-child {
  margin: 0;
}

/* ===== Tab takeover overlay ===== */
#tab-overlay[hidden] {
  display: none;
}
#tab-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 17, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: fade-in 0.25s ease;
}
.tab-overlay-card {
  text-align: center;
  color: var(--ink-dim);
  font-size: 15px;
}
.tab-overlay-card p {
  margin: 0 0 16px;
}
#tab-reconnect {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
#tab-reconnect:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== About / explainer footer ===== */
.tagline-star {
  color: var(--muted);
  font-style: normal;
}
#about {
  max-width: 640px;
  margin: 48px auto 0;
  padding: 0 28px 48px;
}
.about-inner {
  border-top: 1px solid var(--line);
  padding-top: 32px;
}
#about h2 {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  margin: 28px 0 8px;
  letter-spacing: -0.01em;
}
#about h2:first-child {
  margin-top: 0;
}
#about p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-dim);
  margin: 0 0 10px;
}
#about ul {
  margin: 6px 0 10px 18px;
  padding: 0;
}
#about li {
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-dim);
  margin-bottom: 2px;
}
#about ul.rank-legend {
  list-style: none;
  margin: 8px 0 12px;
  padding: 0;
}
#about ul.rank-legend li {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.rank-pill {
  display: inline-block;
  width: 80px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 0;
  border-radius: 4px;
  border: 1.5px solid;
  line-height: 1.4;
  font-family: "Inter", sans-serif;
  box-sizing: border-box;
}
.rank-pill-hot {
  color: var(--hot);
  border-color: var(--hot);
}
.rank-pill-warm {
  color: var(--warm);
  border-color: var(--warm);
}
.rank-pill-cool {
  color: var(--cool);
  border-color: var(--cool);
}
.rank-pill-cold {
  color: var(--cold);
  border-color: var(--cold);
}

#about a {
  color: var(--accent);
  text-decoration: none;
}
#about a:hover {
  text-decoration: underline;
}
#about em {
  font-style: italic;
  color: var(--ink);
}
#about strong {
  font-weight: 600;
}

.past-words-link {
  margin-top: 18px;
}
.past-words-link a {
  display: inline-block;
  font-weight: 600;
  font-size: 15px;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
#about .past-words-link a:hover {
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
}
#pwa-install-link {
  margin-right: 10px;
}
#pwa-install-link::before {
  content: "+";
  color: var(--dim);
  font-weight: 700;
  margin-right: 5px;
}
.footer-fine {
  margin-top: 22px;
  font-size: 12px;
}
.footer-fine a {
  color: var(--dim);
}
.contact-row .bmc-link {
  display: block;
  margin-bottom: 10px;
}
.contact-row .bmc-link img {
  height: 34px;
  width: auto;
  display: block;
}

/* ===== Multiplayer panel ===== */
#mp-wrap {
  position: relative;
}
#mp-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  width: 220px;
  z-index: 20;
}
#mp-panel[hidden] {
  display: none;
}
#mp-panel label {
  font-size: 11px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}
#mp-panel input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-soft);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  margin-bottom: 8px;
}
#mp-panel input::placeholder {
  color: var(--dim);
}
#mp-panel input:focus {
  border-color: var(--accent);
}
.mp-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.mp-row input {
  flex: 1;
  margin-bottom: 0;
}
.mp-row button {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 7px;
  white-space: nowrap;
}
#mp-create {
  width: 100%;
  padding: 8px;
  font-size: 12px;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  cursor: pointer;
  font-family: inherit;
}
#mp-create:hover:not(:disabled) {
  background: var(--panel-hi);
  color: var(--ink);
  border-color: var(--accent);
}
#mp-create:disabled {
  opacity: 0.3;
  cursor: default;
}
#mp-choose-view[hidden] {
  display: none;
}
#mp-name-view[hidden] {
  display: none;
}
#mp-name-view label {
  margin-bottom: 6px;
}
.mp-name-actions {
  margin-top: 4px;
  margin-bottom: 0;
}
.mp-back {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 7px;
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--line);
  cursor: pointer;
  font-family: inherit;
}
.mp-back:hover {
  color: var(--ink);
  border-color: var(--accent);
}
#mp-name-go {
  flex: 1;
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 7px;
  white-space: nowrap;
}
#mp-active-view[hidden] {
  display: none;
}
/* One-time pulsing backdrops for the plot card (#plot-wrap) */
@keyframes trigger-pulse-white {
  0% {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 15px 5px rgba(255, 255, 255, 0.45);
    border-color: rgba(255, 255, 255, 0.4);
  }
  100% {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 60px 20px rgba(255, 255, 255, 0);
    border-color: var(--line);
  }
}
@keyframes trigger-pulse-teal {
  0% {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 15px 5px rgba(108, 196, 182, 0.45);
    border-color: var(--cool);
  }
  100% {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 60px 20px rgba(108, 196, 182, 0);
    border-color: var(--line);
  }
}
@keyframes trigger-pulse-orange {
  0% {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 15px 5px rgba(255, 180, 84, 0.45);
    border-color: var(--accent);
  }
  100% {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 60px 20px rgba(255, 180, 84, 0);
    border-color: var(--line);
  }
}
@keyframes trigger-pulse-red {
  0% {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 15px 5px rgba(255, 107, 107, 0.45);
    border-color: var(--hot);
  }
  100% {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 60px 20px rgba(255, 107, 107, 0);
    border-color: var(--line);
  }
}

#plot-wrap.reveal-trigger-white {
  animation: trigger-pulse-white 1s ease-out 1 forwards;
}
#plot-wrap.reveal-trigger-teal {
  animation: trigger-pulse-teal 1s ease-out 1 forwards;
}
#plot-wrap.reveal-trigger-orange {
  animation: trigger-pulse-orange 1s ease-out 1 forwards;
}
#plot-wrap.reveal-trigger-red {
  animation: trigger-pulse-red 1s ease-out 1 forwards;
}

/* Same tier pulse around the guess-list card. It has no resting box-shadow, so
   a glow-only keyframe settles back to none (the plot's keyframes would leave a
   permanent drop shadow here). --reveal-glow is the tier color's RGB triplet. */
@keyframes list-reveal-pulse {
  0% {
    box-shadow: 0 0 15px 5px rgba(var(--reveal-glow), 0.45);
  }
  100% {
    box-shadow: 0 0 60px 20px rgba(var(--reveal-glow), 0);
  }
}
#guess-list.reveal-trigger-white {
  --reveal-glow: 255, 255, 255;
  animation: list-reveal-pulse 1s ease-out 1 forwards;
}
#guess-list.reveal-trigger-teal {
  --reveal-glow: 108, 196, 182;
  animation: list-reveal-pulse 1s ease-out 1 forwards;
}
#guess-list.reveal-trigger-orange {
  --reveal-glow: 255, 180, 84;
  animation: list-reveal-pulse 1s ease-out 1 forwards;
}
#guess-list.reveal-trigger-red {
  --reveal-glow: 255, 107, 107;
  animation: list-reveal-pulse 1s ease-out 1 forwards;
}

/* One-time pulsing enabled button */
@keyframes trigger-btn-pulse {
  0% {
    box-shadow: 0 0 0 0px rgba(255, 255, 255, 0.7);
  }
  100% {
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
  }
}
.reveal-btn-trigger-unlock {
  animation: trigger-btn-pulse 0.8s cubic-bezier(0.16, 1, 0.3, 1) 1 forwards;
}

#mp-reveal-btn {
  position: relative;
  padding: 6px 12px 10px 12px !important;
}
.mp-reveal-btn-text {
  display: inline-block;
  transform: translateY(-1px);
}

/* Button text and border color styles for sequential stages */
.reveal-btn-next-white {
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
}
.reveal-btn-next-white:hover {
  border-color: rgba(255, 255, 255, 0.75) !important;
  background: rgba(255, 255, 255, 0.05) !important;
}

.reveal-btn-next-teal {
  color: var(--cool) !important;
  border-color: rgba(108, 196, 182, 0.35) !important;
}
.reveal-btn-next-teal:hover {
  border-color: var(--cool) !important;
  background: rgba(108, 196, 182, 0.05) !important;
}

.reveal-btn-next-orange {
  color: var(--accent) !important;
  border-color: rgba(255, 180, 84, 0.35) !important;
}
.reveal-btn-next-orange:hover {
  border-color: var(--accent) !important;
  background: rgba(255, 180, 84, 0.05) !important;
}

.reveal-btn-next-red {
  color: var(--hot) !important;
  border-color: rgba(255, 107, 107, 0.35) !important;
}
.reveal-btn-next-red:hover {
  border-color: var(--hot) !important;
  background: rgba(255, 107, 107, 0.05) !important;
}

/* Final state after every tier is spent: a "solve?" forfeit that skips to the
   win screen. Subdued red on a dark fill with a dashed outline, so it steps out
   of the white->teal->orange->red heat ramp and reads as a separate action. */
.reveal-btn-solve {
  color: rgba(255, 107, 107, 0.72) !important;
  border-style: dashed !important;
  border-color: rgba(255, 107, 107, 0.42) !important;
  background: rgba(0, 0, 0, 0.28) !important;
  font-style: italic;
}
.reveal-btn-solve:hover {
  color: var(--hot) !important;
  border-color: rgba(255, 107, 107, 0.75) !important;
  background: rgba(0, 0, 0, 0.42) !important;
}
.reveal-btn-solve .reveal-chips {
  display: none;
}

/* Ticks / Color chips styled along the bottom */
.reveal-chips {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
  pointer-events: none;
  align-items: center;
  justify-content: center;
}

.reveal-chip {
  width: 6px;
  height: 2px;
  border-radius: 1px;
  opacity: 0.5;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#mp-reveal-btn:hover .reveal-chip {
  opacity: 0.95;
}

/* Individual chip colors */
.chip-white {
  background-color: #ffffff;
  box-shadow: 0 0 2px rgba(255, 255, 255, 0.4);
}
.chip-teal {
  background-color: var(--cool);
  box-shadow: 0 0 2px var(--cool);
}
.chip-orange {
  background-color: var(--accent);
  box-shadow: 0 0 2px var(--accent);
}
.chip-red {
  background-color: var(--hot);
  box-shadow: 0 0 2px var(--hot);
}

/* Consumption logic for chips based on which color tier is next */
.reveal-btn-next-teal .chip-white {
  display: none;
}
.reveal-btn-next-orange .chip-white,
.reveal-btn-next-orange .chip-teal {
  display: none;
}
.reveal-btn-next-red .chip-white,
.reveal-btn-next-red .chip-teal,
.reveal-btn-next-red .chip-orange {
  display: none;
}
/* If button is disabled (locked or fully revealed), hide the chips */
#mp-reveal-btn:disabled .reveal-chips {
  display: none;
}
#mp-room-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.mp-label {
  font-size: 11px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
#mp-room-code {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.12em;
  font-family: "Inter", ui-monospace, monospace;
}
.mp-sep {
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}
.mp-copy {
  padding: 3px 8px;
  font-size: 10px;
  border-radius: 5px;
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--line);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}
.mp-copy:hover {
  color: var(--ink);
  border-color: var(--accent);
  background: transparent;
}
#mp-players {
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 10px;
  line-height: 1.6;
}
#mp-leave {
  width: 100%;
  padding: 7px;
  font-size: 12px;
  border-radius: 7px;
  background: transparent;
  color: var(--hot);
  border: 1px solid rgba(255, 107, 107, 0.3);
  cursor: pointer;
  font-family: inherit;
}
#mp-leave:hover {
  background: rgba(255, 107, 107, 0.08);
  border-color: var(--hot);
}
#mp-btn.mp-active {
  color: var(--accent);
  border-color: var(--accent);
}

/* ===== Multiplayer top bar ===== */
#mp-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  max-width: 584px;
  margin: 0 auto;
  padding: 6px 12px;
  background: rgba(255, 180, 84, 0.06);
  border-radius: 10px;
}
#mp-bar[hidden] {
  display: none;
}
#mp-bar-label {
  font-size: 11px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  white-space: nowrap;
}
#mp-bar-code {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
  font-family: "Inter", ui-monospace, monospace;
  white-space: nowrap;
}
#mp-bar .mp-copy {
  padding: 3px 7px;
}
#mp-bar-players {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
}
.mp-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 10px;
  white-space: nowrap;
  border: 1.5px solid;
  line-height: 1.4;
}
.mp-pill-inactive {
  opacity: 0.4;
}

/* ===== Leaderboard modal ===== */
#lb-overlay[hidden] {
  display: none;
}
#lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(7, 9, 14, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lb-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-hi);
  border-radius: 14px;
  padding: 20px 22px 16px;
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}
.lb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-right: 40px;
}
.lb-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.lb-beta {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 180, 84, 0.15);
  color: var(--accent);
  border: 1px solid rgba(255, 180, 84, 0.35);
  position: relative;
  top: 2px; /* nudge down to optical center of the uppercase title */
}
.lb-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-hi);
}
.lb-actions button {
  padding: 8px 14px;
  font-size: 13px;
}
.lb-actions button.secondary {
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--line);
}
.lb-actions button.secondary:hover {
  background: var(--panel-hi);
  color: var(--ink);
  border-color: var(--accent);
}
.lb-toggle {
  display: flex;
  gap: 0;
}
.lb-tab {
  font:
    600 11px Inter,
    ui-sans-serif,
    system-ui;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--panel-hi);
  cursor: pointer;
}
.lb-tab:first-child {
  border-radius: 6px 0 0 6px;
}
.lb-tab:last-child {
  border-radius: 0 6px 6px 0;
  border-left: 0;
}
.lb-tab.active {
  color: var(--ink);
  background: var(--panel-hi);
  border-color: var(--accent);
}
#lb-body {
  font-variant-numeric: tabular-nums;
}
.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.lb-table th {
  text-align: left;
  padding: 6px 8px;
  color: var(--dim);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--panel-hi);
}
.lb-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.lb-table td.num {
  text-align: right;
  color: var(--ink);
}
.lb-table tr.me td {
  color: var(--accent);
  font-weight: 600;
}
.lb-table tr.me td:first-child::before {
  content: "▶ ";
  color: var(--accent);
}
.lb-empty {
  padding: 20px 4px;
  color: var(--dim);
  text-align: center;
  font-size: 13px;
}
.lb-note {
  margin: 10px 2px 0;
  color: var(--dim);
  font-size: 11px;
  font-style: italic;
}

/* ===== Room guess styling ===== */
#guess-list li.room-guess {
  grid-template-columns: 26px 1fr auto auto auto;
}
#guess-list li.room-guess .mp-user {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  line-height: 1.4;
  border: 1.5px solid;
  white-space: nowrap;
  text-align: right;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Collapsed multi-player word: neutral pill, no per-user color. */
#guess-list .mp-user.mp-multi {
  color: var(--dim);
  border-color: var(--line);
  cursor: pointer;
}
/* Tap-revealed name list behind a collapsed "N players" pill. title= covers the
   desktop hover; this covers mobile tap, where title never fires. */
.pill-popup {
  position: fixed;
  z-index: 9999;
  max-width: 220px;
  padding: 6px 10px;
  background: var(--panel-hi);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  font:
    600 12px Inter,
    ui-sans-serif,
    system-ui;
  color: var(--ink-dim);
  pointer-events: none;
  animation: pill-popup-in 0.12s ease-out both;
}
.pill-popup-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}
@keyframes pill-popup-in {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 820px) {
  main {
    padding: 4px 16px 28px;
  }
  header {
    padding: 16px 16px 14px;
  }
  #guess-list {
    max-height: 42vh;
  }
  .win-title {
    font-size: 28px;
  }
  .stat-val {
    font-size: 22px;
  }
  .win-header {
    flex-direction: column;
  }
  .win-brand {
    text-align: left;
  }
  .win-hsep {
    margin-left: 0;
  }
}

/* ===== PWA floating menu ===== */
#pwa-menu-btn {
  position: fixed;
  /* Below the header account chip (in-flow, top-right) so the fixed button can't
     cover the sign-in link / profile chip on narrow screens. */
  top: 56px;
  right: 14px;
  z-index: 9000;
  background: var(--panel);
  border: 1px solid var(--panel-hi);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 18px;
  color: var(--ink);
  cursor: pointer;
  line-height: 1;
}
#pwa-menu-btn[hidden] {
  display: none;
}
#pwa-menu {
  position: fixed;
  top: 96px;
  right: 14px;
  z-index: 8999;
  background: var(--panel);
  border: 1px solid var(--panel-hi);
  border-radius: 12px;
  padding: 17px 17px 12px;
  min-width: 228px;
  max-width: 300px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}
#pwa-menu[hidden] {
  display: none;
}
.pwa-menu-section {
  margin-bottom: 17px;
}
.pwa-menu-section:last-child {
  margin-bottom: 0;
}
.pwa-menu-heading {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--dim);
  font-weight: 600;
  margin-bottom: 8px;
}
.pwa-room-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pwa-room-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  gap: 8px;
}
.pwa-room-row + .pwa-room-row {
  border-top: 1px solid var(--panel-hi);
}
.pwa-room-code {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--ink);
  font-family: "Inter", ui-monospace, monospace;
}
.pwa-room-row-current .pwa-room-code {
  color: var(--accent);
}
.pwa-room-here {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.06em;
}
.pwa-room-notif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 0 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--panel-hi);
}
.pwa-room-join {
  font-size: 13px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--panel-hi);
  background: transparent;
  color: var(--dim);
  cursor: pointer;
}
.pwa-room-join:hover {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.pwa-addlink-row {
  display: flex;
  gap: 7px;
}
.pwa-addlink-input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  padding: 5px 9px;
  border-radius: 7px;
  border: 1.5px solid var(--panel-hi);
  background: var(--bg);
  color: var(--ink);
}
.pwa-addlink-input::placeholder {
  color: var(--dim);
}
.pwa-menu-footer {
  display: flex;
  gap: 7px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-hi);
}
.pwa-action-btn {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 8px;
  border: 1.5px solid var(--panel-hi);
  background: transparent;
  color: var(--dim);
  cursor: pointer;
}
.pwa-action-btn:hover {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.pwa-notif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--panel-hi);
}
.pwa-notif-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pwa-notif-label > span:first-child {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.pwa-notif-sub {
  font-size: 12px;
  color: var(--dim);
}
.pwa-toggle {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--panel-hi);
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.pwa-toggle:hover {
  background: transparent;
}
.pwa-toggle.on {
  color: var(--accent);
  border-color: var(--accent);
}
.pwa-toggle:disabled {
  opacity: 0.4;
  cursor: default;
}
.pwa-profile-input {
  width: 100%;
  box-sizing: border-box;
  font-size: 13px;
  padding: 6px 9px;
  border-radius: 7px;
  border: 1.5px solid var(--panel-hi);
  background: var(--bg);
  color: var(--ink);
}
.pwa-profile-input::placeholder {
  color: var(--dim);
}
.pwa-profile-input:focus {
  outline: none;
  border-color: var(--accent);
}
.pwa-color-row {
  display: flex;
  gap: 5px;
  padding: 3px 0 6px;
}
.pwa-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--dot);
  border: none;
  cursor: pointer;
  padding: 0;
  opacity: 0.65;
  transition: opacity 0.1s;
}
.pwa-color-dot:hover {
  opacity: 1;
}
.pwa-color-dot.sel {
  opacity: 1;
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Account chip in the brand row: sign-in link when anonymous, avatar + nickname
   when signed in. mounted by game/account-widget.js. */
.acct-widget {
  margin-left: auto;
  font-size: 12px;
  line-height: 1;
}
.acct-widget a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--dim);
}
.acct-signin {
  color: var(--accent);
  font-weight: 600;
}
.acct-widget a:hover {
  opacity: 0.8;
}
.acct-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--panel-hi);
}
.acct-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
