:root {
  color-scheme: dark;
  --ink: #f4f1e8;
  --muted: #aaa9a4;
  --surface: #17181c;
  --surface-raised: #202126;
  --line: #3a3c43;
  --line-strong: #62646c;
  --accent: #ffcf4a;
  --accent-ink: #201a08;
  --correct: #3b8f62;
  --present: #b68b2c;
  --absent: #4a4c54;
  --orange: #c98a3f;
  --danger: #ef6b73;
  --tile: min(11.5vw, 3.75rem);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--surface);
  color: var(--ink);
}

* { box-sizing: border-box; }

body {
  min-width: 0;
  min-height: 100dvh;
  margin: 0;
  background:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px),
    var(--surface);
  background-size: 24px 24px;
}

button, input { font: inherit; }
button { cursor: pointer; }

.shell {
  width: 100%;
  max-width: 66rem;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 0 clamp(1rem, 4vw, 3rem);
}

.topbar {
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 850;
  letter-spacing: .08em;
}

.brand-mark { display: flex; gap: 2px; }
.brand-mark i {
  width: 1.35rem;
  height: 1.35rem;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: .67rem;
  font-style: normal;
  font-weight: 900;
}
.brand-mark i:nth-child(2) { background: var(--correct); color: white; }
.brand-mark i:nth-child(3) { background: var(--present); color: white; }

.puzzle-meta {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-align: right;
}

.seed-copy-button {
  min-height: auto;
  padding: .15rem .35rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: .68rem;
}

.seed-copy-button:hover { color: var(--ink); border-color: var(--line-strong); background: transparent; box-shadow: none; }

.dot { width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); }
main { flex: 1; display: grid; place-items: center; padding: 2rem 0; }

.identity-panel {
  width: min(100%, 46rem);
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

h1, h2, p { margin-top: 0; }
h1 {
  max-width: 12ch;
  margin-bottom: 1rem;
  font-size: 2.35rem;
  line-height: 1.03;
  letter-spacing: -.035em;
}

.identity-panel > div > p, .game-heading p {
  max-width: 34rem;
  color: var(--muted);
  line-height: 1.55;
}

label {
  display: block;
  margin-bottom: .55rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .035em;
}

.input-row { display: flex; gap: .55rem; }
input {
  min-width: 0;
  width: 100%;
  height: 3.15rem;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  outline: 0;
  padding: 0 .9rem;
  background: #111216;
  color: var(--ink);
  font-weight: 700;
}
input::placeholder { color: #777980; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 207, 74, .16); }

button {
  min-height: 3.15rem;
  border: 0;
  border-radius: 3px;
  padding: 0 1.1rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 850;
  white-space: nowrap;
  transition: background-color 160ms ease-out, transform 160ms ease-out, box-shadow 160ms ease-out;
}
button:hover { background: #ffda75; box-shadow: 0 5px 16px rgba(0, 0, 0, .28); }
button:active { transform: translateY(1px); box-shadow: none; }
button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .5; box-shadow: none; }

.field-note {
  margin: .65rem 0 0;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.45;
}

.game { width: min(100%, 42rem); }
.game { max-width: 100%; min-width: 0; }
.redactedle-text {
  min-height: 14rem;
  margin: 1.25rem 0 .6rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #111216;
  color: var(--ink);
  font: 650 1rem/1.7 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.redactedle-progress {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: .78rem;
}
.game-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1.35rem;
}
.game-heading h1 { margin-bottom: .35rem; font-size: 1.7rem; }
.game-heading p { margin-bottom: 0; font-size: .9rem; }

.text-button {
  min-height: auto;
  padding: .35rem 0;
  background: transparent;
  color: var(--muted);
  font-size: .8rem;
  border-bottom: 1px solid var(--line-strong);
}
.text-button:hover { background: transparent; color: var(--ink); box-shadow: none; }

.discord-activity #identity-panel,
.discord-activity #change-guild {
  display: none !important;
}

.notice {
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  padding: .7rem .85rem;
  background: var(--surface-raised);
  color: var(--ink);
  font-size: .85rem;
  line-height: 1.4;
}
.notice.error { border-color: var(--danger); color: #ffd9dc; }

.game-tabs {
  display: flex;
  gap: .35rem;
  margin-bottom: 1rem;
  padding: .25rem;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.tab-button {
  min-height: 2.35rem;
  padding: 0 .95rem;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}
.tab-button:hover { background: rgba(255, 255, 255, .04); }
.tab-button.active {
  background: var(--accent);
  color: var(--accent-ink);
}

.game-panel { width: 100%; }
.game-panel { max-width: 100%; min-width: 0; }

.towerdle-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: .7rem;
}
.towerdle-heading-actions { display: flex; align-items: start; gap: .85rem; }

.towerdle-title { margin: 0 0 .3rem; font-size: 1.1rem; }
.towerdle-heading p { margin: 0; color: var(--muted); font-size: .85rem; }
.towerdle-stats { display: flex; gap: .8rem; color: var(--muted); font-size: .75rem; white-space: nowrap; }
.towerdle-stats strong { color: var(--ink); font-size: 1rem; }
.towerdle-next { position: absolute; top: .8rem; right: .8rem; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: .35rem; color: rgba(255,255,255,.9); font-size: .75rem; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.towerdle-next > div { display: flex; flex-direction: column; gap: .45rem; }
.towerdle-queue-piece { display: grid; place-items: center; width: 2.7rem; height: 2.7rem; border: 1px solid rgba(255,255,255,.8); color: var(--piece-color); background: rgba(8,28,69,.55); font-size: 1.1rem; }
.towerdle-queue-piece-future { width: 2.3rem; height: 2.3rem; opacity: .78; }
.towerdle-drop-button { padding: .55rem 1.2rem; border: 1px solid rgba(255,255,255,.85); border-radius: .6rem; background: var(--accent); color: #06213a; font-weight: 800; font-size: .85rem; letter-spacing: .05em; cursor: pointer; pointer-events: auto; }
.towerdle-drop-button:disabled { opacity: .35; cursor: not-allowed; background: rgba(255,255,255,.25); color: rgba(255,255,255,.75); }
.towerdle-stage { position: relative; width: 100%; height: min(84vh, 50rem); min-height: 28rem; overflow: hidden; border: 1px solid #9bb9c8; background: #bfeafa; box-shadow: 0 12px 30px rgba(0,0,0,.2); }
/* A portrait play area on wide screens, close to a phone's shape, so PC and mobile frame the tower alike. */
#towerdle-panel { max-width: 28rem; margin-inline: auto; }
#towerdle-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.towerdle-zoom-controls { position: absolute; top: .65rem; left: .65rem; z-index: 3; gap: .3rem; }
.towerdle-zoom-controls button { width: 2.2rem; height: 2.2rem; border: 1px solid rgba(255,255,255,.85); border-radius: .5rem; background: rgba(8,28,69,.78); color: #fff; font-size: 1.35rem; line-height: 1; cursor: pointer; }
.towerdle-settlement-overlay { position: absolute; top: .8rem; left: 50%; transform: translateX(-50%); padding: .4rem .75rem; border: 1px solid rgba(255,255,255,.7); border-radius: 999px; background: rgba(8,28,69,.72); color: #fff; font-size: .75rem; font-weight: 800; letter-spacing: .08em; pointer-events: none; }
.towerdle-placement-hint { position: absolute; left: 0; right: 0; bottom: .55rem; text-align: center; color: rgba(31,54,70,.72); font-size: .7rem; pointer-events: none; }
.towerdle-footer { display: flex; align-items: center; gap: 1rem; margin-top: .7rem; color: var(--muted); font-size: .8rem; }
.towerdle-footer > div:first-child { color: var(--accent); font-weight: 800; }
.towerdle-height { flex: 1; }
.towerdle-replay-stage {
  width: 100%;
  height: min(55vh, 32rem);
  min-height: 20rem;
  overflow: hidden;
  border: 1px solid #9bb9c8;
  background: #bfeafa;
}
#towerdle-replay-canvas { display: block; width: 100%; height: 100%; }
.towerdle-result-player { display: inline-flex; align-items: center; gap: .6rem; min-width: 0; flex: 1; }
.towerdle-leaderboard-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.towerdle-result-avatar {
  width: 1.8rem; height: 1.8rem; flex: 0 0 auto; border-radius: 50%;
  object-fit: cover; background: var(--line); color: var(--ink); display: grid; place-items: center;
  font-size: .68rem; font-weight: 800;
}
.towerdle-result-status { color: var(--muted); font-size: .72rem; font-weight: 600; }

.board {
  display: grid;
  gap: .35rem;
  justify-content: center;
  margin: 0 auto 1.25rem;
}
.board-row { display: grid; grid-template-columns: repeat(5, var(--tile)); gap: .35rem; }
.tile {
  width: var(--tile);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  color: var(--ink);
  font-size: calc(var(--tile) * .46);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}
.tile.filled { border-color: var(--line-strong); }
.tile.correct, .tile.present, .tile.absent { border-color: transparent; color: white; }
.tile.correct { background: var(--correct); }
.tile.present { background: var(--present); }
.tile.absent { background: var(--absent); }
.tile.reveal { animation: reveal 420ms cubic-bezier(.2, .8, .2, 1) both; animation-delay: var(--delay); }

@keyframes reveal {
  0% { transform: rotateX(0); }
  48% { transform: rotateX(88deg); filter: brightness(.65); }
  100% { transform: rotateX(0); }
}

.guess-form { width: min(100%, 25rem); margin: 0 auto 1rem; }
.guess-form input { text-transform: uppercase; letter-spacing: .13em; }

.keyboard { display: grid; gap: .32rem; margin: 0 auto; }
.key-row { display: flex; justify-content: center; gap: .25rem; }
.key {
  min-width: 0;
  width: 2.25rem;
  min-height: 2.7rem;
  padding: 0;
  background: var(--line);
  color: var(--ink);
  font-size: .74rem;
}
.key.wide { width: 3.5rem; font-size: .63rem; }
.key:hover { background: var(--line-strong); }
.key.correct { background: var(--correct); color: white; }
.key.present { background: var(--present); color: white; }
.key.absent { background: #292a30; color: #96979d; }

.result {
  margin-top: 1.25rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.result h2 { margin-bottom: .25rem; font-size: 1.05rem; }
.result p { margin-bottom: 0; color: var(--muted); font-size: .85rem; }
.result button { min-height: 2.7rem; }

.rules { margin: 1rem auto 0; width: min(100%, 25rem); color: var(--muted); font-size: .78rem; }
.rules summary { cursor: pointer; padding: .45rem 0; }
.rules ul { list-style: none; margin: .35rem 0 0; padding: 0; display: grid; gap: .45rem; }
.rules code {
  display: inline-block;
  min-width: 1.25rem;
  padding: .08rem .28rem;
  border: 1px solid var(--line);
  background: #111216;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.swatch { display: inline-block; width: .75rem; height: .75rem; margin-right: .4rem; vertical-align: -1px; }
.swatch.correct { background: var(--correct); }
.swatch.present { background: var(--present); }
.swatch.absent { background: var(--absent); }

.city-status {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.city-difficulty-tabs {
  display: inline-flex;
  margin-bottom: 1rem;
}

.actordle-status {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.actordle-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: .75rem;
}

.actordle-leaderboard-button {
  padding: .5rem .9rem;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--ink);
  font-size: .8rem;
  font-weight: 700;
}

.actordle-leaderboard-button:hover { border-color: var(--accent); color: var(--accent); }

.actordle-title {
  margin-bottom: .3rem;
  font-size: 1.1rem;
}

.actordle-summary {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .88rem;
}

.actordle-actors {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: .9rem;
  align-items: center;
  margin-bottom: 1rem;
}

.actordle-actor-card {
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 0;
  text-align: left;
}

.actordle-actor-card h3 {
  margin: 0;
  min-width: 0;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actordle-actor-image {
  width: 2.75rem;
  height: 2.75rem;
  object-fit: cover;
  border-radius: 999px;
  margin-bottom: 0;
  flex-shrink: 0;
  background: #111216;
}

.actordle-separator {
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.actordle-form {
  width: 100%;
  margin: 0 0 1rem;
}

.actordle-form input {
  letter-spacing: normal;
  text-transform: none;
}

.actordle-history {
  display: grid;
  gap: .75rem;
}

.footballmatrix-players {
  display: block;
  margin: 0 0 .9rem;
}

.footballmatrix-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  width: 100%;
  margin: 0 0 1rem;
}

.footballmatrix-scoreboard {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.footballmatrix-stat {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: .5rem .7rem;
  border: 1px solid var(--line);
  border-radius: .35rem;
  background: var(--surface-raised);
  color: var(--text);
  font-size: .78rem;
  font-weight: 800;
  white-space: nowrap;
}

.footballmatrix-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem;
}

.footballmatrix-cell {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  min-width: 0;
}

.footballmatrix-cell.empty {
  border-style: dashed;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: .78rem;
}

/* Dev-mode only (see app.js's isDevMode/?dev=1): overlays row/column criteria labels around the
   4x4 grid so a developer can see the real puzzle structure without solving it. */
.footballmatrix-grid.dev-labeled {
  grid-template-columns: minmax(64px, .85fr) repeat(4, minmax(0, 1fr));
  grid-template-rows: auto repeat(4, minmax(0, 1fr));
}

.footballmatrix-corner,
.footballmatrix-colhead,
.footballmatrix-rowhead {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: .3rem;
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.15;
}

.footballmatrix-player-card {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  cursor: grab;
  display: grid;
  grid-template-rows: 1fr auto;
  background: #10131a;
  color: #eef2f7;
  border: 1px solid transparent;
}

.footballmatrix-player-card:active {
  cursor: grabbing;
}

.footballmatrix-player-card.selected {
  border-color: #4da3ff;
  box-shadow: 0 0 0 1px rgba(77, 163, 255, .35) inset;
}

.footballmatrix-player-card:disabled {
  cursor: default;
}

.footballmatrix-player-card.locked {
  cursor: default;
}

.footballmatrix-player-card.locked .footballmatrix-player-name {
  background: #14532d;
  border: 1px solid #4ade80;
  color: #d7ffe3;
}

.footballmatrix-legend {
  margin: 0 0 1rem;
}

.footballmatrix-legend h3 {
  margin: 0 0 .4rem;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.footballmatrix-legend ul {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footballmatrix-legend li {
  padding: .3rem .6rem;
  border: 1px solid var(--line);
  border-radius: .35rem;
  background: var(--surface-raised);
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
}

.footballmatrix-legend li b {
  color: var(--accent);
}

.footballmatrix-legend li {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}

.footballmatrix-flag {
  width: 1.15rem;
  height: .85rem;
  object-fit: cover;
  border-radius: 2px;
}

.footballmatrix-actions {
  display: flex;
  gap: .5rem;
}

/* Feedback from the last submission: three of a line belong together (orange), or a line's four
   players are all from different rows and columns (red). Green (locked) always wins. */
.footballmatrix-player-card.hint-close .footballmatrix-player-name {
  background: #7c3f00;
  border: 1px solid #fb923c;
  color: #ffedd5;
}

.footballmatrix-player-card.hint-none .footballmatrix-player-name {
  background: #7f1d1d;
  border: 1px solid #f87171;
  color: #fee2e2;
}

.footballmatrix-player-card.hint-close { background: rgba(251, 146, 60, .35); box-shadow: inset 0 0 0 3px #fb923c; }
.footballmatrix-player-card.hint-none { background: rgba(248, 113, 113, .35); box-shadow: inset 0 0 0 3px #f87171; }

.footballmatrix-player-photo {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  background: #1f2937;
}

.footballmatrix-player-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: .35rem .4rem .42rem;
  font-size: .72rem;
  line-height: 1.2;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 520px) {
  .footballmatrix-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .footballmatrix-scoreboard {
    justify-content: space-between;
  }

  .footballmatrix-stat {
    flex: 1 1 auto;
    justify-content: center;
  }

  .footballmatrix-grid {
    gap: .4rem;
  }

  .footballmatrix-player-name {
    font-size: .66rem;
    padding: .3rem .3rem .36rem;
  }
}

.actordle-movie-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: .6rem;
}

.actordle-movie-item,
.actordle-leaderboard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .7rem .8rem;
  border: 1px solid var(--line);
  background: var(--surface-raised);
}

.actordle-movie-copy {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: .15rem;
}

.actordle-movie-copy strong {
  font-size: .95rem;
}

.actordle-movie-copy span {
  color: var(--muted);
  font-size: .76rem;
}

.actordle-thumb,
.actordle-list-thumb,
.actordle-suggestion-thumb,
.actordle-chain-thumb {
  width: 2.4rem;
  height: 3.4rem;
  object-fit: cover;
  border-radius: 3px;
  background: #111216;
  border: 1px solid var(--line);
}

.actordle-suggestion {
  align-items: center;
  justify-content: start;
}

.actordle-suggestions .suggestion-name {
  display: block;
}

.actordle-result {
  margin-top: 1rem;
  justify-content: start;
}

.actordle-result.success {
  padding: 1.1rem 1rem;
  border: 1px solid rgba(59, 143, 98, .7);
  background: rgba(59, 143, 98, .16);
}

.actordle-result.success h2 {
  color: #8ee0ad;
  font-size: 1.25rem;
  letter-spacing: .04em;
}

.actordle-chain,
.actordle-leaderboard {
  margin-top: 1rem;
}

.actordle-chain + .actordle-form + .actordle-history {
  margin-top: .85rem;
}

.actordle-chain h3,
.actordle-leaderboard h3 {
  margin-bottom: .65rem;
  font-size: .95rem;
}

.actordle-chain-items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
}

.actordle-chain-node {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  background: var(--surface-raised);
}

.actordle-chain-node.movie {
  border-color: rgba(255, 207, 74, .35);
}

.actordle-chain-arrow {
  color: var(--muted);
  font-weight: 900;
}

.actordle-leaderboard-items {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: .55rem;
}

.actordle-leaderboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  background: var(--surface);
  padding: 1.1rem clamp(1rem, 4vw, 3rem) 2rem;
}

.actordle-leaderboard-overlay-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.actordle-leaderboard-overlay-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.actordle-leaderboard-subtitle {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.4;
}

.actordle-leaderboard-empty {
  color: var(--muted);
  font-size: .88rem;
}

.actordle-leaderboard-page-item {
  width: 100%;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}

.actordle-leaderboard-page-item:hover { border-color: var(--accent); }

.actordle-leaderboard-rank {
  color: var(--accent);
  font-weight: 900;
  min-width: 1.8rem;
}

.actordle-leaderboard-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actordle-leaderboard-detail-score {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: .88rem;
}

.actordle-leaderboard-detail h4 {
  margin: 1.25rem 0 .65rem;
  font-size: .9rem;
}

.city-title {
  margin-bottom: .3rem;
  font-size: 1.1rem;
}

.city-summary {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .88rem;
}

.city-attempts {
  padding: .45rem .65rem;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--ink);
  font-size: .78rem;
  font-weight: 800;
  white-space: nowrap;
}

.city-globe-shell {
  margin: .8rem 0 1rem;
  border: 1px solid var(--line);
  background: #0b111a;
  padding: .65rem;
  max-width: 100%;
  min-width: 0;
}

.city-globe-canvas {
  display: block;
  width: 100%;
  height: min(44vh, 23rem);
  background: radial-gradient(circle at 40% 32%, #12243a 0%, #09131f 65%);
  border: 1px solid rgba(255, 255, 255, .08);
  touch-action: none;
  overscroll-behavior: contain;
  user-select: none;
}

.city-globe-hint {
  margin: .55rem 0 0;
  color: var(--muted);
  font-size: .78rem;
  overflow-wrap: anywhere;
}

.city-guess-form {
  width: 100%;
  margin: 0 0 1rem;
}

.city-turn-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 12rem) 1fr;
  gap: .5rem;
  align-items: center;
  margin-top: .6rem;
  min-width: 0;
}

.city-turn-actions label {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 700;
}

.city-turn-actions > button {
  min-width: 0;
}

.city-guess-form,
.city-history,
.city-result,
.city-status {
  max-width: 100%;
  min-width: 0;
}

.city-radius-control {
  display: grid;
  gap: .28rem;
}

.city-radius-control input[type="range"] {
  width: 100%;
  margin: 0;
  height: 1.5rem;
  accent-color: var(--accent);
  touch-action: none;
}

.city-radius-control output {
  font-size: .76rem;
  color: var(--muted);
  font-weight: 700;
}

.city-turn-actions select {
  min-height: 2.3rem;
}

.city-guess-form input {
  letter-spacing: normal;
  text-transform: none;
}

.city-input-row {
  position: relative;
}

.city-suggestions {
  position: absolute;
  top: calc(100% + .35rem);
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: .3rem;
  list-style: none;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  box-shadow: 0 .6rem 1.4rem rgba(0, 0, 0, .35);
}

.city-suggestion {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem;
  width: 100%;
  padding: .5rem .6rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.city-suggestion:hover,
.city-suggestion:focus-visible,
.city-suggestion.active {
  background: rgba(255, 207, 74, .12);
  outline: none;
}

.city-suggestion .suggestion-name {
  font-weight: 700;
}

.city-suggestion .suggestion-country {
  color: var(--muted);
  font-size: .82rem;
  white-space: nowrap;
}

.actordle-suggestion-message {
  padding: .6rem .7rem;
  color: var(--muted);
  font-size: .9rem;
}

.actordle-suggestion-message.error {
  color: #ff9d9d;
}

.actordle-suggestions {
  max-height: min(20rem, 45dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.actordle-suggestions.floating {
  position: fixed;
  z-index: 100;
  margin: 0;
}

.outlinedle-outline-shell {
  margin: 1rem 0 1.2rem;
  border: 1px solid var(--line);
  background: #0f1014;
  padding: .75rem;
  min-height: 14rem;
  display: grid;
  place-items: center;
}

.outlinedle-image {
  width: 100%;
  max-height: min(40vh, 22rem);
  object-fit: contain;
  filter: invert(1) contrast(1.05);
}

.outlinedle-guess-list {
  margin: 0;
  padding-left: 1.4rem;
}

.outlinedle-guess-list li {
  padding: .28rem 0;
  font-weight: 750;
}

.outlinedle-guess-list .correct { color: #8ad6a4; }
.outlinedle-guess-list .incorrect { color: var(--muted); }

.framedle-mosaic {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .35rem;
  margin: 1rem 0 1.2rem;
  border: 1px solid var(--line);
  background: #0f1014;
  padding: .35rem;
}

.framedle-tile {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #0a0b0e;
}

.framedle-tile canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.framedle-guess-list {
  margin: 0;
  padding-left: 1.4rem;
}

.framedle-guess-list li {
  padding: .28rem 0;
  font-weight: 750;
}

.framedle-guess-list .correct { color: #8ad6a4; }
.framedle-guess-list .incorrect { color: var(--muted); }

.city-history {
  display: grid;
  gap: .75rem;
}

.city-history-empty {
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.city-guess {
  border: 1px solid var(--line);
  background: var(--surface-raised);
  padding: .85rem;
}

.city-guess-header {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: baseline;
  margin-bottom: .75rem;
}

.city-guess-header h3 {
  margin: 0;
  font-size: 1rem;
}

.city-guess-header span {
  color: var(--muted);
  font-size: .78rem;
}

.city-clues {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .5rem;
}

.city-clue {
  min-width: 0;
  padding: .6rem;
  border: 1px solid transparent;
  color: white;
}

.city-clue small {
  display: block;
  margin-bottom: .32rem;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .05em;
  opacity: .88;
  text-transform: uppercase;
}

.city-clue strong {
  display: block;
  font-size: .84rem;
  line-height: 1.3;
}

.city-clue.green { background: var(--correct); }
.city-clue.orange { background: var(--orange); }
.city-clue.red { background: var(--absent); }

.city-turn-outcome {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: .01em;
}

.city-result {
  margin-top: 1rem;
  justify-content: start;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .7rem;
  letter-spacing: .025em;
}

[hidden] { display: none !important; }

@media (max-width: 640px) {
  :root { --tile: min(15.5vw, 3.5rem); }
  .shell { padding: 0 .75rem; }
  .topbar { min-height: 3.8rem; }
  .puzzle-meta { max-width: 12rem; }
  main { place-items: start center; padding: 1.35rem 0; }
  .identity-panel { grid-template-columns: 1fr; gap: 1.7rem; }
  h1 { font-size: 2rem; }
  .game-heading h1 { font-size: 1.45rem; }
  .city-clues { grid-template-columns: 1fr 1fr; }
  .city-turn-actions {
    grid-template-columns: 1fr;
  }
  .city-turn-actions label {
    grid-column: 1 / -1;
  }
  .city-radius-control {
    grid-column: 1 / -1;
  }
  .key { width: calc((100vw - 3.5rem) / 10); max-width: 2.25rem; }
  .key.wide { width: calc((100vw - 2.4rem) / 7); max-width: 3.5rem; }
  .result { align-items: flex-start; }
  .actordle-actors { gap: .5rem; }
  .actordle-actor-card { padding: .45rem .55rem; gap: .45rem; }
  .actordle-actor-card h3 { font-size: .85rem; }
  .actordle-actor-image { width: 2.2rem; height: 2.2rem; }
  .actordle-separator { font-size: 1.05rem; }
  .actordle-suggestion { min-height: 3.25rem; }
  .towerdle-heading { align-items: end; }
  .towerdle-heading-actions { flex-direction: column; align-items: end; gap: .35rem; }
  .towerdle-stats { flex-direction: column; gap: .1rem; text-align: right; }
  .towerdle-stage { height: 70vh; min-height: 24rem; }
  .towerdle-zoom-controls { display: none !important; }
  .towerdle-next { top: .65rem; left: .65rem; right: auto; transform: none; flex-direction: column; align-items: flex-start; gap: .35rem; }
  .towerdle-next > div { flex-direction: row; gap: .3rem; }
  .towerdle-queue-piece { width: 2.35rem; height: 2.35rem; }
  .towerdle-queue-piece-future { width: 2rem; height: 2rem; }
  .towerdle-drop-button { position: absolute; top: .65rem; right: .65rem; left: auto; white-space: nowrap; }
  .towerdle-placement-hint { font-size: .62rem; }
  .towerdle-footer { flex-wrap: wrap; }
  .towerdle-height { order: 3; flex-basis: 100%; }
}

@media (max-width: 390px) {
  .input-row { flex-direction: column; }
  .input-row button { width: 100%; }
  .game-heading { align-items: end; }
  .city-status,
  .actordle-status,
  .city-guess-header,
  .city-status { flex-direction: column; align-items: start; }
  .city-clues { grid-template-columns: 1fr; }
  footer { flex-direction: column; gap: .3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* One-screen mobile app shell: a compact appbar (hamburger game-picker, title, results) pinned
   to the bottom (see order:1 below - Discord's own activity chrome overlaps the top), with the
   active game filling the rest of the viewport above it and scrolling internally if it needs to -
   the outer page itself never scrolls, so the appbar (and any per-game fixed HUD) is always
   reachable no matter how deep into a game's own content the player has scrolled. */
.mobile-appbar { display: none; }
.mobile-topbrand { display: none; }

@media (max-width: 760px) {
  html, body { height: 100%; overflow: hidden; }
  .shell {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding: 0 .6rem;
    overflow: hidden;
  }
  .topbar { display: none; }
  /* Discord's own activity chrome (a drag/hide handle top-left, a "Leave" button top-right)
     floats directly over the very top of the iframe on mobile - rather than leave a patch of
     bare background peeking out from behind it, fill that strip with our own bar and put the
     wordmark where it's actually visible, between the two native controls. It's a real flex
     child (not fixed/overlaid), so it simply pushes the rest of the layout down and never
     covers anything of ours. */
  .mobile-topbrand {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    height: 2.5rem;
    padding-top: env(safe-area-inset-top);
    font-weight: 900;
    letter-spacing: .18em;
    font-size: .85rem;
    color: var(--accent);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }
  main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    place-items: stretch;
    padding: 0;
    overflow: hidden;
  }
  #identity-panel { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 1rem 0; }
  #game {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
  }
  .mobile-appbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    flex: 0 0 auto;
    order: 1; /* DOM stays first (a11y reading order), but render last/at the bottom - Discord's
      own activity chrome (drag handle, "Leave" button) floats over the top of the iframe and was
      blocking a top-anchored hamburger/results button. */
    min-height: 2.75rem;
    padding: .4rem 0 calc(.4rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    position: relative;
    z-index: 90;
    background: var(--surface);
  }
  /* Hide the bottom bar while an on-screen keyboard is likely open (any text input focused, see
     app.js) so it doesn't float awkwardly on top of the keyboard - not every game has a keyboard,
     so this only ever triggers when something is actually focused. */
  body.keyboard-open .mobile-appbar { display: none; }
  .mobile-appbar-btn {
    min-height: 2.15rem;
    padding: 0 .7rem;
    background: var(--surface-raised);
    color: var(--ink);
    border: 1px solid var(--line);
    font-size: .8rem;
    font-weight: 700;
  }
  .mobile-appbar-title {
    flex: 1 1 auto;
    text-align: center;
    font-weight: 800;
    font-size: .95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .game-heading, #notice { display: none; }
  /* Each game's own in-panel header (title/summary + "Today's Results" button) duplicates what
     the shared bottom appbar already shows (title, and a proxied results button) - on mobile it
     just eats space and can visually collide with a game's own fixed HUD (e.g. IEDle's status
     banner), so hide it there. */
  .game-panel > .actordle-status { display: none; }
  /* The page's own footer (reset time / play-mode note) isn't needed while actively playing on a
     small screen, especially with a keyboard up. */
  footer { display: none; }
  .game-tabs {
    display: none;
    position: absolute;
    bottom: calc(2.75rem + env(safe-area-inset-bottom));
    top: auto;
    left: 0;
    right: 0;
    z-index: 95;
    flex-direction: column;
    max-height: 70vh;
    margin: 0;
    box-shadow: 0 -14px 32px rgba(0, 0, 0, .55);
  }
  .game-tabs.mobile-open { display: flex; overflow-y: auto; }
  .tab-button { text-align: left; }
  .game-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.game-heading-actions { display: flex; align-items: center; gap: 1rem; }
.streaks-button { color: var(--ink); font-weight: 700; }
.streak-badge {
  margin-left: .45rem;
  font-size: .78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.streak-badge.at-risk { opacity: .6; animation: streak-pulse 2s ease-in-out infinite; }
.streak-row { flex-wrap: wrap; }
.streak-row.at-risk { border-color: var(--accent); }
.streak-status { color: var(--muted); font-size: .78rem; }
@keyframes streak-pulse { 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .streak-badge.at-risk { animation: none; } }

/* Actordle board: a pool of posters and a chain that stretches from actor A to actor B */
.ac { --ac-ok: #8ee0ad; --ac-bad: var(--danger); margin-bottom: 1rem; }
.ac-status { margin: 0 0 .6rem; color: var(--muted); font-size: .85rem; }
.ac-status.ok { color: var(--ac-ok); font-weight: 700; }
.ac-rail { position: relative; overflow: hidden; padding: .8rem .5rem; border: 1px solid var(--line); background: var(--surface-raised); min-height: 11.5rem; display: flex; align-items: center; touch-action: pan-y; cursor: grab; user-select: none; }
.ac-viewport { position: relative; flex: 1 1 0; min-width: 0; align-self: stretch; display: flex; align-items: center; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.ac-stub { flex: none; width: 1.7rem; height: 2rem; position: relative; display: flex; align-items: center; justify-content: center; }
.ac-stub::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 3px solid var(--line-strong); }
.ac-stub.ok::before { border-top-color: var(--ac-ok); }
.ac-stub.bad::before { border-top: 3px dashed var(--ac-bad); }
.ac-stub.empty::before { border-top-style: dashed; }
.ac-stub .ac-link-mark { display: flex; }
.ac-stub.ok .ac-link-mark { color: var(--ac-ok); border: 2px solid var(--ac-ok); }
.ac-stub.bad .ac-link-mark { color: var(--ac-bad); border: 2px solid var(--ac-bad); }
.ac-stub.empty .ac-link-mark { display: none; }
.ac-rail.over, .ac-pool.over { border-color: var(--accent); }
.ac-rail.complete { border-color: rgba(59, 143, 98, .8); }
.ac-track { display: flex; align-items: center; width: max-content; position: relative; transition: transform .28s ease; will-change: transform; }
.ac-node { flex: none; opacity: .5; transform: scale(.82); transition: opacity .28s, transform .28s; }
.ac-node.near { opacity: 1; transform: none; }
.ac-end { flex: none; display: flex; flex-direction: column; align-items: center; gap: .3rem; width: 4.6rem; text-align: center; font-size: .78rem; font-weight: 700; overflow-wrap: anywhere; }
.ac-face { width: 2.4rem; height: 2.4rem; flex: none; border-radius: 50%; object-fit: cover; border: 2px solid var(--line-strong); background: #111216; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 800; color: var(--muted); }
.ac-face-large { width: 3.6rem; height: 3.6rem; font-size: 1.1rem; }
.ac-end-a .ac-face-large { border-color: var(--accent); }
.ac-end-b .ac-face-large { border-color: #4fb3c8; }
.ac-link { flex: none; width: 1.6rem; align-self: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; position: relative; min-height: 2rem; }
.ac-link.center { width: 4.6rem; }
.ac-link::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 3px solid var(--line-strong); }
.ac-link.ok::before { border-top-color: var(--ac-ok); }
.ac-link.bad::before { border-top: 3px dashed var(--ac-bad); }
.ac-link-mid.ok.center::before { display: none; }
.ac-link > * { display: none; }
.ac-link.center > * { display: flex; }
.ac-link-mark { position: relative; z-index: 1; width: 1.5rem; height: 1.5rem; border-radius: 50%; align-items: center; justify-content: center; font-size: .8rem; font-weight: 900; background: var(--surface-raised); }
.ac-link.ok .ac-link-mark { color: var(--ac-ok); border: 2px solid var(--ac-ok); }
.ac-link.bad .ac-link-mark { color: var(--ac-bad); border: 2px solid var(--ac-bad); }
.ac-link-empty .ac-link-mark { color: var(--muted); border: 2px dashed var(--line-strong); }
.ac-faces { position: relative; z-index: 1; flex-direction: column; align-items: center; gap: .2rem; padding: .3rem 0; background: var(--surface-raised); }
.ac-faces .ac-face { width: 2.1rem; height: 2.1rem; border-color: var(--ac-ok); }
.ac-more { color: var(--ac-ok); font-size: .74rem; font-weight: 800; }
.ac-slot { position: relative; }
.ac-empty-slot { flex: none; width: 9rem; height: 6.8rem; display: flex; align-items: center; justify-content: center; border: 2px dashed var(--line-strong); color: var(--muted); font-size: .85rem; text-align: center; }
@media (max-width: 480px) { .ac-end { width: 3.8rem; font-size: .7rem; } .ac-face-large { width: 2.9rem; height: 2.9rem; } .ac-stub { width: 1.2rem; } .ac-link.center { width: 3.6rem; } }
.ac-poster { position: relative; flex: none; width: 4.6rem; height: 6.8rem; padding: 0; overflow: hidden; border: 2px solid var(--line-strong); border-radius: 4px; background: #111216; cursor: grab; touch-action: none; user-select: none; }
.ac-slot.ac-insert-before::before, .ac-slot.ac-insert-after::after { content: ""; position: absolute; top: -.3rem; bottom: -.3rem; width: 4px; border-radius: 2px; background: var(--accent); z-index: 2; }
.ac-slot.ac-insert-before::before { left: -.8rem; }
.ac-slot.ac-insert-after::after { right: -.8rem; }
.ac-poster:disabled { cursor: default; opacity: 1; }
.ac-poster img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.ac-poster-title { position: absolute; inset: auto 0 0 0; padding: .5rem .25rem .2rem; background: linear-gradient(transparent, rgba(0, 0, 0, .85)); color: #fff; font-size: .62rem; line-height: 1.15; text-align: center; overflow: hidden; overflow-wrap: anywhere; }
.ac-poster.no-image { display: flex; align-items: center; justify-content: center; }
.ac-poster.no-image .ac-poster-title { position: static; background: none; font-size: .72rem; padding: .3rem; white-space: normal; }
.ac-poster.dragging { opacity: .35; }
.ac-ghost { position: fixed; z-index: 100; transform: translate(-50%, -60%) rotate(4deg); pointer-events: none; box-shadow: 0 8px 24px rgba(0, 0, 0, .55); border-color: var(--accent); }
.ac-pool { margin-top: .8rem; padding: .7rem .8rem; border: 1px solid var(--line); }
.ac-pool h3 { margin: 0 0 .5rem; font-size: .85rem; color: var(--muted); }
.ac-shelf { display: flex; flex-wrap: wrap; gap: .5rem; min-height: 6.8rem; align-items: flex-start; }
.ac-hint { margin: 0; align-self: center; color: var(--muted); font-size: .8rem; }
