:root {
  --paper: #e9dec6;
  --paper-2: #f6efdd;
  --paper-3: #fbf6ea;
  --ink: #2f2818;
  --ink-soft: #6e5f45;
  --line: #cdbb98;
  --line-strong: #b8a37c;
  --red: #9e3123;
  --red-dark: #822518;
  --board-frame-1: #7d5c3e;
  --board-frame-2: #5f4530;
  --cell: #d8cbab;
  --tw: #b4493b;
  --dw: #dca08e;
  --tl: #49768e;
  --dl: #b3c8cf;
  --tile-top: #f6e8c6;
  --tile-bottom: #e8d3a0;
  --tile-edge: #c9ae77;
  --tile-text: #46361a;
  --green-ink: #3f6f4f;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  background-color: var(--paper);
  background-image: linear-gradient(180deg, rgba(255, 252, 240, 0.5), rgba(120, 95, 55, 0.08));
  color: var(--ink);
}

button { font-family: inherit; cursor: pointer; }
button:disabled { opacity: 0.4; cursor: default; }

h1, h2, h3 { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; }

/* ========== buttons ========== */

.btn {
  border: 1px solid var(--line-strong);
  background: var(--paper-3);
  color: var(--ink);
  padding: 8px 15px;
  border-radius: 4px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(120, 95, 55, 0.15);
}
.btn:not(:disabled):hover { background: #fffdf4; border-color: var(--ink-soft); }
.btn:not(:disabled):active { transform: translateY(1px); box-shadow: none; }
.btn.primary {
  background: var(--red);
  border-color: var(--red-dark);
  color: #fdf6e9;
}
.btn.primary:not(:disabled):hover { background: var(--red-dark); }
.btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-soft);
}
.btn.ghost:not(:disabled):hover { background: transparent; text-decoration: underline; color: var(--ink); }
.btn.big { font-size: 15px; padding: 12px 24px; }

.chip {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
  padding: 7px 14px;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 600;
}
.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper-3);
}

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.hint { color: var(--ink-soft); font-size: 13px; }

/* ========== setup screen ========== */

#screen-setup,
#screen-daily,
#screen-balda,
#screen-hc,
#screen-rules {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: 48px 24px;
}

.setup-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: 5px;
  box-shadow: 0 2px 14px rgba(80, 60, 30, 0.18);
  padding: 34px 38px 38px;
  width: min(480px, 94vw);
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.setup-card h1 {
  margin: 0;
  text-align: center;
  line-height: 1;
}

/* title spelled out in little tiles */
.tlt {
  display: inline-block;
  width: 40px;
  height: 44px;
  line-height: 44px;
  margin: 0 2px;
  background: linear-gradient(170deg, var(--tile-top), var(--tile-bottom));
  border: 1px solid var(--tile-edge);
  border-radius: 4px;
  box-shadow: 0 2px 2px rgba(80, 60, 30, 0.35);
  font-size: 24px;
  font-weight: 700;
  color: var(--tile-text);
  text-align: center;
}
.tlt:nth-child(odd) { transform: rotate(-2.4deg); }
.tlt:nth-child(even) { transform: rotate(1.6deg) translateY(1px); }
.tlt:nth-child(3n) { transform: rotate(0.6deg) translateY(-1px); }
.tlt { text-transform: uppercase; }
@media (max-width: 520px) {
  .tlt { width: 31px; height: 35px; line-height: 35px; font-size: 18px; margin: 0 1px; }
}

/* portal navigation — header strip at the top of every page card */
.portal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.portal-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  padding: 5px 11px;
  border: 1px solid transparent;
  border-radius: 3px;
  white-space: nowrap;
}
.portal-nav a:hover {
  color: var(--red);
  border-color: var(--line-strong);
  background: var(--paper-3);
}
.portal-nav a.on {
  background: var(--ink);
  color: var(--paper-3);
  border-color: var(--ink);
  pointer-events: none;
}

.setup-section {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.setup-section:first-of-type { border-top: none; padding-top: 0; }
.setup-section label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--ink-soft);
  font-weight: 700;
}

.tabs {
  display: flex;
  gap: 22px;
  border-bottom: 2px solid var(--line);
}
.tab {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  padding: 9px 2px;
  font-size: 14.5px;
  font-weight: 600;
  margin-bottom: -2px;
  border-bottom: 2px solid transparent;
}
.tab.on { color: var(--ink); border-bottom-color: var(--red); }

#setup-local, #setup-online { display: flex; flex-direction: column; gap: 20px; }
#setup-main, #setup-lobby { display: flex; flex-direction: column; gap: 24px; }

#player-names { display: flex; flex-direction: column; gap: 8px; }
#player-names input,
#setup-online input {
  background: var(--paper-3);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--ink);
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
#player-names input:focus,
#setup-online input:focus { border-color: var(--red); }

.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 3px; }

#or-sep { text-align: center; }

.room-code {
  font-family: Georgia, serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 12px;
  color: var(--ink);
  background: var(--paper-3);
  border: 2px dashed var(--line-strong);
  border-radius: 4px;
  padding: 12px 4px 12px 16px;
  text-align: center;
  user-select: all;
}

.lobby-list { display: flex; flex-direction: column; }
.lobby-player {
  padding: 9px 2px;
  border-bottom: 1px dotted var(--line);
  font-size: 15px;
}

.you-marker { color: var(--ink-soft); font-style: italic; font-size: 12px; }
.off-marker { color: var(--red); font-style: italic; font-size: 11px; }

/* ========== game layout ========== */

.game-layout {
  display: flex;
  gap: 18px;
  padding: 18px;
  max-width: 1180px;
  margin: 0 auto;
  align-items: flex-start;
}

.board-col {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.sidebar {
  flex: 0 0 248px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
}

.panel {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 13px 15px;
  box-shadow: 0 1px 3px rgba(80, 60, 30, 0.1);
}
.panel.grow { flex: 1 1 auto; overflow: hidden; display: flex; flex-direction: column; }
.panel-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--ink-soft);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

#turn-info {
  font-family: Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
}
#room-info { text-align: center; margin-top: 4px; letter-spacing: 2px; }

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 2px;
  border-bottom: 1px dotted var(--line);
  font-size: 14.5px;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.score-row:last-child { border-bottom: none; }
.score-row b { font-family: Georgia, serif; font-size: 16px; }
.score-row.active .score-name { color: var(--red); font-weight: 700; }
.score-row.active .score-name::before { content: "▸ "; }
.score-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#bag-info { margin-top: 9px; font-size: 13px; color: var(--ink-soft); text-align: center; }
#dict-info { margin-top: 3px; text-align: center; }

#history { overflow-y: auto; flex: 1; font-size: 13.5px; display: flex; flex-direction: column; min-height: 60px; }
.history-row {
  color: var(--ink-soft);
  line-height: 1.4;
  padding: 4px 0;
  border-bottom: 1px dotted var(--line);
}
.history-row:last-child { border-bottom: none; }
.history-name { color: var(--ink); font-weight: 600; }

/* ========== board ========== */

.board-wrap {
  background: linear-gradient(165deg, var(--board-frame-1), var(--board-frame-2));
  padding: 11px;
  border-radius: 6px;
  border: 1px solid #4c3825;
  box-shadow: 0 3px 14px rgba(60, 40, 20, 0.4);
  width: min(100%, 86vmin, 650px);
}

#board {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 2px;
  aspect-ratio: 1;
}

.cell {
  position: relative;
  background: var(--cell);
  border-radius: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  container-type: size;
}
.cell.pm-T { background: var(--tw); }
.cell.pm-D, .cell.pm-star { background: var(--dw); }
.cell.pm-t { background: var(--tl); }
.cell.pm-d { background: var(--dl); }

.pm-label {
  font-size: clamp(6px, 52cqw, 11px);
  font-weight: 800;
  color: rgba(47, 40, 24, 0.55);
  text-align: center;
  line-height: 1;
  pointer-events: none;
}
.cell.pm-star .pm-label { font-size: clamp(10px, 80cqw, 22px); }
.cell.pm-T .pm-label, .cell.pm-t .pm-label { color: rgba(252, 246, 232, 0.9); }

.cell.last { outline: 2px solid rgba(158, 49, 35, 0.9); outline-offset: -2px; z-index: 1; }

/* ========== tiles ========== */

.tile {
  position: absolute;
  inset: 1px;
  background: linear-gradient(170deg, var(--tile-top), var(--tile-bottom));
  border: 1px solid var(--tile-edge);
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(60, 40, 20, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tile-text);
  font-family: Georgia, "Times New Roman", serif;
}

.tile .letter {
  font-weight: 700;
  font-size: clamp(9px, 60cqw, 23px);
  line-height: 1;
}

.tile .value {
  position: absolute;
  right: 6%;
  bottom: 4%;
  font-size: clamp(5px, 25cqw, 10px);
  font-weight: 700;
  opacity: 0.75;
  font-family: "Segoe UI", system-ui, sans-serif;
}

.tile.blank .letter { color: var(--red); }
.rack .tile.blank .letter { opacity: 0.45; }

/* premium squares stay visible under played tiles via a colored corner */
.cell.pm-T .tile::before,
.cell.pm-D .tile::before,
.cell.pm-star .tile::before,
.cell.pm-t .tile::before,
.cell.pm-d .tile::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  border-style: solid;
  border-width: 26cqw 26cqw 0 0;
  border-right-color: transparent;
  border-top-left-radius: 2px;
  opacity: 0.9;
  pointer-events: none;
}
.cell.pm-T .tile::before { border-top-color: var(--tw); }
.cell.pm-D .tile::before, .cell.pm-star .tile::before { border-top-color: var(--dw); }
.cell.pm-t .tile::before { border-top-color: var(--tl); }
.cell.pm-d .tile::before { border-top-color: var(--dl); }

.tile.pending {
  outline: 2px solid var(--red);
  outline-offset: -1px;
  cursor: grab;
}

/* ========== rack ========== */

.rack-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.rack {
  display: flex;
  gap: 7px;
  background: linear-gradient(175deg, var(--board-frame-1), var(--board-frame-2));
  border: 1px solid #4c3825;
  border-radius: 5px;
  padding: 9px 14px;
  min-height: 66px;
  min-width: 420px;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(60, 40, 20, 0.35), inset 0 2px 5px rgba(30, 20, 10, 0.45);
}

.rack .tile {
  position: relative;
  inset: auto;
  width: 48px;
  height: 48px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.rack .tile .letter { font-size: 24px; }
.rack .tile .value { font-size: 10px; }

.rack .tile.selected {
  transform: translateY(-7px);
  outline: 2px solid var(--red);
  box-shadow: 0 8px 10px rgba(30, 20, 10, 0.5);
}
.rack .tile.ex-selected {
  transform: translateY(-7px);
  outline: 2px dashed var(--red);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

/* ========== overlays & modals ========== */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(47, 40, 24, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.overlay.opaque { background: var(--paper); }

.overlay-card {
  background: var(--paper-2);
  border: 1px solid var(--line-strong);
  border-top: 4px solid var(--red);
  border-radius: 5px;
  padding: 28px 34px;
  width: min(440px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 17px;
  text-align: center;
  box-shadow: 0 14px 40px rgba(50, 35, 15, 0.4);
}

.overlay-card h2 { margin: 0; font-size: 22px; }

.pass-last { font-size: 13px; color: var(--ink-soft); min-height: 1em; }

.letter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
}

.letter-btn {
  background: linear-gradient(170deg, var(--tile-top), var(--tile-bottom));
  color: var(--tile-text);
  border: 1px solid var(--tile-edge);
  border-radius: 4px;
  font-family: Georgia, serif;
  font-size: 19px;
  font-weight: 700;
  padding: 8px 0;
  box-shadow: 0 1px 2px rgba(60, 40, 20, 0.35);
}
.letter-btn:hover { transform: scale(1.08); }

.word-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 15.5px;
  padding: 6px 4px;
  border-bottom: 1px dotted var(--line);
  font-variant-numeric: tabular-nums;
}
.word-row b { font-family: Georgia, serif; }
.word-row.bad span { color: var(--red); }
.bad-mark { color: var(--red); font-size: 11px; font-weight: 600; font-style: italic; }
.word-row.bingo { color: var(--red); font-weight: 700; border-bottom: 1px dotted var(--line); }
.word-row.total {
  font-weight: 700;
  font-size: 17px;
  border-bottom: none;
  border-top: 3px double var(--ink);
  margin-top: 2px;
}

#modal-body { display: flex; flex-direction: column; gap: 2px; }
#modal-body p { margin: 0; }
#modal .btn-row { justify-content: center; }

.end-winner { font-family: Georgia, serif; font-size: 19px; font-weight: 700; color: var(--red); }
#end-scores { display: flex; flex-direction: column; }
#end-scores .score-row { font-size: 15.5px; }
.adj { font-size: 12px; font-style: italic; }
.adj.minus { color: var(--red); }
.adj.plus { color: var(--green-ink); }

/* ========== toast ========== */

#toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #f3ecd9;
  border: none;
  padding: 11px 20px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  z-index: 100;
  box-shadow: 0 6px 18px rgba(40, 30, 15, 0.45);
  transition: opacity 0.4s;
  max-width: 90vw;
  text-align: center;
}
#toast.fade { opacity: 0; }

/* ========== daily word game ========== */

.daily-card { width: min(520px, 96vw); gap: 18px; }

.daily-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.tlt-space { display: inline-block; width: 14px; }

.dgrid { display: flex; flex-direction: column; gap: 6px; align-self: center; }
.drow { display: grid; grid-template-columns: repeat(5, var(--dts, 52px)); gap: 6px; }

.dtile {
  width: var(--dts, 52px);
  height: var(--dts, 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 24px;
  text-transform: uppercase;
  background: var(--paper-3);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--ink);
}
.dtile.typed { border-color: var(--ink-soft); animation: pop 0.1s; }
.dtile.correct { background: #56855f; border-color: #47734f; color: #f6f1e2; }
.dtile.present { background: #c9a23f; border-color: #b08c2f; color: #fdf8ea; }
.dtile.absent { background: #b9ad93; border-color: #a4977a; color: #efe8d6; }

@keyframes pop { from { transform: scale(0.85); } to { transform: scale(1); } }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}
.drow.shake { animation: shake 0.5s; }

.kbd { display: flex; flex-direction: column; gap: 7px; }
.kbd-row { display: flex; gap: 5px; justify-content: center; }
.key {
  flex: 1 1 0;
  max-width: 40px;
  min-width: 0;
  padding: 12px 0;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: var(--paper-3);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(120, 95, 55, 0.15);
}
.key:not(:disabled):active { transform: translateY(1px); box-shadow: none; }
.key.wide { max-width: 62px; flex-grow: 1.7; font-size: 12px; }
.key.correct { background: #56855f; border-color: #47734f; color: #f6f1e2; }
.key.present { background: #c9a23f; border-color: #b08c2f; color: #fdf8ea; }
.key.absent { background: #b9ad93; border-color: #a4977a; color: #efe8d6; }

.endbox {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.daily-stats { display: flex; gap: 28px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat b { font-family: Georgia, serif; font-size: 24px; }
.stat span { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-soft); }

/* ========== balda ========== */

.balda-card { width: min(560px, 96vw); gap: 18px; }

.bgrid {
  display: grid;
  grid-template-columns: repeat(5, var(--bts, 56px));
  gap: 7px;
  align-self: center;
}
.bcell {
  width: var(--bts, 56px);
  height: var(--bts, 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 25px;
  background: var(--cell);
  border: 1px solid rgba(120, 95, 55, 0.3);
  border-radius: 3px;
  color: var(--tile-text);
  cursor: pointer;
  user-select: none;
  position: relative;
}
.bcell.filled {
  background: linear-gradient(170deg, var(--tile-top), var(--tile-bottom));
  border: 1px solid var(--tile-edge);
  box-shadow: 0 1px 2px rgba(60, 40, 20, 0.35);
}
.bcell.can { box-shadow: inset 0 0 0 2px var(--line-strong); }
.bcell.newcell { box-shadow: inset 0 0 0 2px var(--red); }
.bcell.path { box-shadow: inset 0 0 0 2px var(--red); }
.bcell.path::after {
  content: attr(data-step);
  position: absolute;
  top: 1px;
  right: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--red);
  font-family: "Segoe UI", system-ui, sans-serif;
}

.balda-status { text-align: center; font-family: Georgia, serif; font-size: 17px; font-weight: 700; min-height: 1.2em; }
.word-preview {
  text-align: center;
  letter-spacing: 4px;
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  min-height: 26px;
}
.balda-scores { display: flex; gap: 10px; }
.pscore {
  flex: 1;
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
}
.pscore b { font-family: Georgia, serif; font-size: 17px; }
.pscore.active { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.pscore .pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.balda-history { max-height: 140px; overflow-y: auto; display: flex; flex-direction: column; }

@media (max-width: 460px) {
  :root { --dts: 46px; --bts: 50px; }
  .key { padding: 10px 0; font-size: 13px; }
}

/* ========== responsive ========== */

@media (max-width: 900px) {
  .game-layout { flex-direction: column; align-items: stretch; }
  .sidebar { flex: none; position: static; max-height: none; order: 2; }
  .board-col { order: 1; }
  .rack { min-width: 0; width: 100%; max-width: 440px; }
  .rack .tile { width: 44px; height: 44px; }
  .setup-card { padding: 26px 22px 30px; }
  #screen-setup,
  #screen-daily,
  #screen-balda,
  #screen-hc,
  #screen-rules { padding: 20px 12px; }
}

/* ========== turn timer ========== */

.timer-info {
  font-family: Georgia, serif;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.timer-info:empty { display: none; }
.timer-info.low { color: var(--red); font-weight: 700; }

.score-val { display: inline-flex; align-items: baseline; gap: 8px; }
.clock {
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ========== end-of-game stats ========== */

.end-stats { text-align: left; }
.end-chart { width: 100%; height: auto; display: block; }
.end-chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.end-chart .axis.dash { stroke-dasharray: 3 4; }
.end-chart .axis-lbl { font-size: 10px; fill: var(--ink-soft); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 5px 14px; font-size: 13px; margin-top: 6px; }
.leg { display: inline-flex; align-items: center; gap: 6px; }
.leg i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.leg small { color: var(--ink-soft); }
.best-word { font-size: 13.5px; color: var(--ink-soft); margin-top: 8px; }
.best-word b { color: var(--ink); letter-spacing: 1px; }

/* ========== hot-cold game ========== */

.hc-card { width: min(520px, 96vw); gap: 18px; }
.hc-intro { text-align: left; line-height: 1.45; margin: 0; }

.hc-form { display: flex; gap: 8px; }
.hc-form input {
  flex: 1;
  border: 1px solid var(--line-strong);
  background: var(--paper-3);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 3px;
  font-size: 16px;
  font-family: inherit;
}
.hc-form input:focus { outline: 2px solid var(--line-strong); }

.hc-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  margin-top: 5px;
  overflow: hidden;
  font-size: 15px;
  background: var(--paper-3);
}
.hc-row i {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  opacity: 0.32;
  border-radius: 2px;
}
.hc-row.hot i { background: #56855f; }
.hc-row.warm i { background: #c9a23f; }
.hc-row.cold i { background: #a8563f; }
.hc-row .hc-word { position: relative; font-weight: 600; letter-spacing: 0.4px; }
.hc-row .hc-rank {
  position: relative;
  font-family: Georgia, serif;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.hc-row.latest { border-color: var(--ink); box-shadow: 0 1px 4px rgba(80, 60, 30, 0.25); }

.hc-last:empty { display: none; }
.hc-last { padding-bottom: 4px; border-bottom: 1px dashed var(--line-strong); }

.hc-list { max-height: 46vh; overflow-y: auto; }
.hc-top { text-align: left; }
.hc-top-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--ink-soft);
  font-weight: 700;
  margin-bottom: 4px;
}

/* tile titles: keep word chunks unbreakable */
.tlt-word { white-space: nowrap; display: inline-block; }
