/* ---------------------------------------------------------------
   doodly.io - all styling
   --------------------------------------------------------------- */
:root {
  --indigo: #4B0082;
  --rebecca: #663399;
  --violet: #B200ED;
  --panel: #ffffff;
  --panel-2: #f2f4f8;
  --row-a: #ffffff;
  --row-b: #e9ecf3;
  --ink: #2b2f38;
  --muted: #6f7789;
  --line: #dfe3ea;
  --green: #2fae4a;
  --green-d: #23883a;
  --red: #e0483c;
  --blue: #2f7fe0;
  --grey: #8a93a6;
  --radius: 8px;
  --shadow: 0 2px 0 rgba(0, 0, 0, .18);
  --font: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
  --gap: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  min-height: 100vh;
  background: 
    repeating-linear-gradient(45deg, rgba(75, 0, 130, 0.6) 0px, rgba(75, 0, 130, 0.6) 2px, transparent 2px, transparent 10px),
    repeating-linear-gradient(-45deg, rgba(102, 51, 153, 0.4) 0px, rgba(102, 51, 153, 0.4) 1px, transparent 1px, transparent 12px),
    linear-gradient(160deg, #4B0082 0%, #57238d 45%, #663399 100%) fixed;
  background-color: #56218c;
}

/* no accidental pinch/double-tap zoom or text selection while playing */
.screen, .topbar, .panel, .toolbar, .logo, .arrow, .fb, .tool, .size {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
input, textarea, .chat-log, .tab-body { -webkit-user-select: text; user-select: text; }

.hidden { display: none !important; }
.muted { color: rgba(255,255,255,0.7); }

button, input, select, textarea { font-family: inherit; font-size: 13px; }
button { cursor: pointer; }

/* ------------------------------- buttons ------------------------------- */
.btn {
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: var(--shadow);
  transition: filter .12s ease, transform .05s ease;
}
.btn.big { font-size: 19px; padding: 13px 16px; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn-green { background: var(--green); }
.btn-blue { background: var(--blue); }
.btn-grey { background: var(--grey); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.icon-btn {
  background: rgba(255,255,255,.25);
  color: #fff;
  border: 0;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 16px;
  line-height: 1;
  flex: 0 0 auto;
}
.icon-btn:hover { background: rgba(255,255,255,.4); }

.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 10px;
  font-size: 15px;
  background: #fff;
  color: var(--ink);
}
.input:focus { outline: 2px solid var(--rebecca); outline-offset: -1px; }

.card {
  background: rgba(178, 0, 237, 0.15);
  backdrop-filter: blur(4px);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 3px 0 rgba(0,0,0,.22);
  margin-bottom: 12px;
  color: #fff;
}

.notice {
  margin-top: 8px;
  font-size: 13px;
  color: #ff9a9a;
  text-align: center;
}
.hint-line { margin: 0; font-size: 12px; color: rgba(255,255,255,0.8); text-align: center; }

/* ------------------------------- logo ------------------------------- */
.logo {
  text-align: center;
  margin: 6px 0 10px;
  font-size: 58px;
  letter-spacing: 1px;
}
.logo .l {
  display: inline-block;
  font-weight: 800;
  text-shadow: 0 3px 0 rgba(0,0,0,.3);
  animation: bob 2.2s ease-in-out infinite;
}
.logo .l1 { color: #23c552; animation-delay: 0s }
.logo .l2 { color: #ff8c1a; animation-delay: .08s }
.logo .l3 { color: #e5342a; animation-delay: .16s }
.logo .l4 { color: #2f8fff; animation-delay: .24s }
.logo .l5 { color: #ffd21f; animation-delay: .32s }
.logo .l6 { color: #ff5fae; animation-delay: .40s }
.logo .dot { color: #8b5a2b; animation-delay: .48s }
.logo .l7 { color: #23c552; animation-delay: .56s }
.logo .l8 { color: #ff8c1a; animation-delay: .64s }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-7px) } }
@media (prefers-reduced-motion: reduce) { .logo .l { animation: none } }

.logo.mini { font-size: 26px; margin: 0; text-align: left; cursor: pointer; }

/* ------------------------------- home ------------------------------- */
.screen { min-height: 100%; }

.home-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 12px 28px;
}

.preview-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.preview-row canvas { 
  width: 54px; 
  height: 54px; 
  image-rendering: pixelated;
  animation: bob 2.2s ease-in-out infinite;
}

.login-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}
.avatar-picker { text-align: center; }
.avatar-big {
  width: 132px;
  height: 132px;
  image-rendering: pixelated;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
}
.pick-row { display: flex; align-items: center; gap: 8px; justify-content: center; }
.arrow-col { display: flex; flex-direction: column; gap: 6px; }
.arrow, .dice {
  background: #0080FE;
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-weight: 700;
  line-height: 1;
}
.arrow {
  padding: 8px 10px;
  font-size: 14px;
  min-width: 34px;
}
.arrow:hover, .dice:hover { background: #0072e6; }
.arrow:active, .dice:active { transform: translateY(1px); }
.dice { margin-top: 10px; padding: 8px 12px; font-size: 13px; }
.room-code-input { text-transform: uppercase; letter-spacing: 2px; font-weight: 700; text-align: center; }

.login-fields { display: flex; flex-direction: column; gap: 10px; }
.row-2 { display: flex; gap: 8px; }
.row-2 .btn { flex: 1; }

.room-code-row { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: -5px; }

.ad-slot {
  background: rgba(255,255,255,.06);
  border-radius: 8px;
  min-height: 90px;
  margin-bottom: 12px;
  overflow: hidden;
}
.ad-slot ins { display: block; width: 100%; }
.ad-game { min-height: 60px; margin: 8px auto 0; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid rgba(255,255,255,0.2); margin-bottom: 10px; }
.tab {
  background: none; border: 0; padding: 7px 11px; font-size: 13.5px; font-weight: 700;
  color: rgba(255,255,255,0.7); border-bottom: 2px solid transparent;
}
.tab.active { color: #fff; border-bottom-color: #fff; }
.tab-body { font-size: 13.5px; line-height: 1.55; max-height: 420px; overflow: auto; }
.tab-body p { margin: 0 0 8px; }
.tab-body h3 { margin: 4px 0 6px; font-size: 17px; }
.tab-body h4 { margin: 12px 0 4px; font-size: 14px; }
.tab-body ol, .tab-body ul { margin: 0 0 8px; padding-left: 18px; }
.tab-body li { margin-bottom: 3px; }
.tab-body a { color: #fff; text-decoration: underline; }

.footer {
  text-align: center;
  color: #fff;
  font-size: 12px;
  line-height: 1.7;
}
.footer a { color: #fff; text-decoration: underline; }
.footer .sep { margin: 0 5px; }
.footer .muted { color: rgba(255,255,255,0.7); display: block; margin-top: 3px; }

/* ------------------------------- game ------------------------------- */
#game { display: flex; flex-direction: column; align-items: center; min-height: 100vh; padding: 6px 0 8px; }

.game-shell {
  width: var(--shell, 1000px);
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.game-head { display: flex; align-items: center; margin: 0 0 4px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: var(--gap);
  box-shadow: 0 2px 0 rgba(0,0,0,.22);
  min-height: 46px;
}
.timer {
  display: flex; align-items: center; gap: 4px;
  font-weight: 800; font-size: 17px; min-width: 52px;
}
.timer .clock { font-size: 15px; }
.round { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.word-box { flex: 1; min-width: 0; text-align: center; display: flex; flex-direction: column; justify-content: center; align-items: center;}
.word-len { font-size: 11px; color: var(--muted); line-height: 1.1; }
.word-hint {
  font-size: 19px; font-weight: 800; letter-spacing: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.game-grid {
  display: grid;
  grid-template-columns: var(--side, 180px) minmax(0, 1fr) var(--chat, 230px);
  gap: var(--gap);
  align-items: start;
}

.panel {
  background: var(--panel);
  border-radius: 8px;
  box-shadow: 0 2px 0 rgba(0,0,0,.22);
  overflow: hidden;
}
.players-panel, .chat-panel { height: var(--panelH, 480px); display: flex; flex-direction: column; }
.canvas-panel { background: transparent; box-shadow: none; overflow: visible; }

.player-list { flex: 1; overflow-y: auto; overflow-x: hidden; }
.pl {
  display: grid;
  grid-template-columns: 24px 42px minmax(0, 1fr);
  align-items: center;
  column-gap: 4px;
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  padding: 0 4px 0 2px;
  border-bottom: 1px solid rgba(0,0,0,.05);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.pl:nth-child(odd) { background: #ffffff; }
.pl:nth-child(even) { background: #f2f4f8; }
.pl.me .nm { color: var(--rebecca); }
.pl.guessed { background: #22c55e !important; color: #064e3b; }
.pl.guessed .sc, .pl.guessed .rank { color: #064e3b; }
.pl.drawing { background: #fbbf24 !important; color: #451a03; box-shadow: inset 3px 0 0 var(--blue); }
.pl.drawing .nm, .pl.drawing .sc, .pl.drawing .rank { color: #451a03; }
.pl .rank { text-align: left; font-size: 14px; font-weight: 800; color: var(--muted); }
.pl canvas { width: 42px; height: 42px; image-rendering: pixelated; display: block; }
.pl .who { min-width: 0; overflow: hidden; }
.pl .nm {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.2;
}
.pl .sc { font-size: 12px; color: var(--muted); white-space: nowrap; line-height: 1.2; }
.pl .badge { margin-left: 4px; font-size: 12px; }

.room-code-bar {
  flex: 0 0 auto;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 4px;
  text-align: center;
  white-space: nowrap;
}
.room-code-bar b { color: var(--rebecca); letter-spacing: 1px; }

/* floating chat bubbles + reaction icons - never affect any layout */
.float-layer { position: fixed; inset: 0; pointer-events: none; z-index: 65; }
.floater {
  position: fixed;
  pointer-events: none;
  animation: pop .16s ease;
  max-width: 46vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.floater.bubble {
  background: #fff;
  border: 2px solid var(--rebecca);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(0,0,0,.28);
}
.floater.react { font-size: 30px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
@keyframes pop { from { transform: scale(.4); opacity: 0 } to { transform: scale(1); opacity: 1 } }

/* canvas */
.canvas-stage { display: flex; justify-content: center; }
.canvas-holder {
  position: relative;
  width: var(--boardW, 640px);
  height: var(--boardH, 480px);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 0 rgba(0,0,0,.22);
  background: #fff;
}
#board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  background: #fff;
}

.feedback-row {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 6px;
}
.fb {
  border: 0; border-radius: 6px; color: #fff;
  font-size: 20px; font-weight: 800; line-height: 1;
  padding: 8px 12px; display: flex; align-items: center; gap: 5px;
  box-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.fb span { font-size: 15px; }
.fb.like { background: var(--green); }
.fb.dislike { background: var(--red); }
.fb:active { transform: translateY(1px); box-shadow: none; }

.overlay {
  position: absolute; inset: 0;
  background: rgba(24, 8, 40, .88);
  color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; padding: 12px; overflow: auto;
}
.overlay h3 { margin: 0; font-size: 20px; }
.overlay p { margin: 0; font-size: 13px; color: rgba(255,255,255,.75); }
.word-choices { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.word-choices button {
  background: var(--green); color: #fff; border: 0; border-radius: 8px;
  padding: 11px 15px; font-size: 16px; font-weight: 700;
}
.overlay table { border-collapse: collapse; font-size: 14px; color: #fff; }
.overlay td { padding: 2px 10px; }
.overlay .plus { color: #6ee787; font-weight: 700; }
.overlay .zero { color: rgba(255,255,255,.5); }

.results { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 380px; }
.res-row {
  display: grid; grid-template-columns: 30px auto minmax(0,1fr) auto;
  align-items: center; gap: 8px;
  background: rgba(255,255,255,.1); border-radius: 8px; padding: 3px 8px;
  text-align: left;
}
.res-row canvas { image-rendering: pixelated; width: 34px; height: 34px; }
.res-row .rp { font-weight: 800; font-size: 15px; }
.res-row .rn { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-row .rs { font-weight: 800; font-size: 14px; color: #ffd85e; }
.res-row.top1 { background: rgba(255,216,94,.28); }
.res-row.top1 canvas { width: 56px; height: 56px; }
.res-row.top1 .rn, .res-row.top1 .rs, .res-row.top1 .rp { font-size: 19px; }
.res-row.top2 canvas, .res-row.top3 canvas { width: 46px; height: 46px; }
.res-row.top2 .rn, .res-row.top3 .rn,
.res-row.top2 .rs, .res-row.top3 .rs,
.res-row.top2 .rp, .res-row.top3 .rp { font-size: 16px; }
.win-line { font-size: 20px; font-weight: 800; color: #ffd85e; }
.countdown-note { font-size: 12px; color: rgba(255,255,255,.7); }

/* toolbar */
.toolbar { margin-top: var(--gap); }
.palette {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 2px;
  max-width: var(--boardW, 640px);
  margin: 0 auto 6px;
}
.palette button { height: 22px; border: 1px solid rgba(0,0,0,.25); border-radius: 3px; padding: 0; }
.palette button.sel { outline: 2px solid #fff; outline-offset: -3px; }
.tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  justify-content: center; max-width: var(--boardW, 640px); margin: 0 auto;
}
.tool {
  background: #fff; border: 1px solid var(--line); border-radius: 7px;
  width: 40px; height: 40px; padding: 6px; display: grid; place-items: center;
}
.tool svg { width: 100%; height: 100%; }
.tool.active { border-color: var(--rebecca); box-shadow: 0 0 0 2px rgba(102,51,153,.35); }
.sizes { display: flex; gap: 4px; }
.size {
  background: #fff; border: 1px solid var(--line); border-radius: 7px;
  width: 34px; height: 38px; display: grid; place-items: center;
}
.size i { display: block; background: #2b2f38; border-radius: 50%; }
.size.active { border-color: var(--rebecca); box-shadow: 0 0 0 2px rgba(102,51,153,.35); }
.current-color { width: 34px; height: 38px; border-radius: 7px; border: 1px solid var(--line); }

/* chat */
.chat-log { flex: 1; overflow-y: auto; padding: 6px 8px; font-size: 13px; line-height: 1.4; }
.chat-log .m { padding: 3px 0; border-bottom: 1px solid rgba(0,0,0,.04); overflow-wrap: anywhere; word-break: break-word; overflow: visible; }
.chat-log .m b { white-space: normal; overflow-wrap: anywhere; word-break: break-word; text-overflow: clip; }
.m.msg { color: var(--ink); }
.m.correct, .m.join, .m.reveal { color: #1f8b3a; font-weight: 700; }
.m.guessed { color: #7a7a1f; }
.m.close { color: #b58900; }
.m.next { color: #2f6fd0; font-weight: 700; }
.m.win { color: #d97706; font-weight: 800; }
.m.red, .m.leave { color: #c0392b; }
.m.info { color: var(--muted); }
.chat-form { display: flex; gap: 6px; padding: 6px; border-top: 1px solid var(--line); }
.chat-input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 6px;
  padding: 8px; font-size: 14px;
}
.chat-form .send { padding: 8px 12px; font-size: 13px; }

/* modal */
.modal {
  position: fixed; inset: 0; background: rgba(20, 6, 34, .68);
  display: flex; align-items: center; justify-content: center; padding: 14px; z-index: 60;
}
.modal-card {
  background: #fff; border-radius: 10px; padding: 16px; width: 100%; max-width: 380px;
  position: relative; max-height: 86vh; overflow: auto;
}
.modal-close { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 22px; line-height: 1; }
.modal-card h3 { margin: 0 0 8px; font-size: 18px; }
.modal-card label { display: block; font-size: 13px; margin-bottom: 8px; }
.modal-card input[type=range] { width: 100%; }
.hk-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; font-size: 13px; }
.hk-row button {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px;
  min-width: 44px; padding: 4px 8px; font-weight: 700;
}

/* context menu */
.ctx {
  position: fixed; background: #fff; border-radius: 8px; padding: 5px;
  box-shadow: 0 6px 18px rgba(0,0,0,.3); z-index: 70; width: 172px;
}
.ctx .h { font-size: 12px; font-weight: 800; padding: 4px 6px; color: var(--muted); }
.ctx button {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 7px 8px; font-size: 13px; border-radius: 5px;
}
.ctx button:hover { background: var(--panel-2); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: rgba(20,6,34,.92); color: #fff; padding: 9px 14px; border-radius: 8px;
  font-size: 13px; z-index: 80;
}

/* ------------------------------- responsive ------------------------------- */

/* Portrait / narrow phones: canvas on top, players + chat side by side under it.
   Everything is visible at once - nothing is ever one-at-a-time. */
body.stacked .game-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "canvas canvas"
    "players chat";
  gap: 6px;
}
body.stacked .canvas-panel { grid-area: canvas; }
body.stacked .players-panel { grid-area: players; }
body.stacked .chat-panel { grid-area: chat; }
body.stacked .players-panel,
body.stacked .chat-panel { height: var(--panelH, 200px); }
body.stacked .game-shell { width: 100%; max-width: 100vw; padding: 0 4px; }
body.stacked .logo.mini { font-size: 22px; }
body.stacked .pl { grid-template-columns: 20px 34px minmax(0, 1fr); height: 44px; min-height: 44px; max-height: 44px; }
body.stacked .pl canvas { width: 34px; height: 34px; }
body.stacked .pl .sc { font-size: 11px; }
body.stacked .chat-log { font-size: 12.5px; }
body.stacked .chat-form .send { padding: 8px 10px; }
body.stacked .toolbar { margin-top: 6px; }

/* Landscape phones / tablets keep the full desktop three column layout. */
@media (orientation: landscape) and (max-height: 520px) {
  .logo.mini { font-size: 20px; }
  .topbar { min-height: 38px; padding: 3px 8px; }
  .word-hint { font-size: 16px; letter-spacing: 2px; }
  .tool { width: 28px; height: 28px; }
  .size { width: 24px; height: 26px; }
  .game-shell { padding-bottom: 6px; }
  .palette button { height: 14px; }
  .toolbar { margin-top: 4px; gap: 4px; }
  .sizes { margin-top: 2px; }
  .logo.mini { margin: 2px 0; }
  .ad-game { display: none; }
}

@media (max-width: 860px) {
  .logo { font-size: 40px; }
  .login-grid { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .login-fields { width: 100%; }
}

@media (max-width: 520px) {
  .word-hint { font-size: 16px; letter-spacing: 2px; }
  .round { font-size: 11px; }
  .tool { width: 34px; height: 34px; }
  .size { width: 30px; height: 34px; }
}

/* ================= static content pages (about / privacy / terms / etc) ============ */
.page-body { overflow: auto; }
.page {
  max-width: 820px; margin: 0 auto; padding: 18px 16px 40px;
  color: #fff; font-size: 15px; line-height: 1.65;
}
.page-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding-bottom: 12px; margin-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,.2);
}
.page-logo {
  font-family: inherit; font-size: 26px; font-weight: 900; color: #fff;
  text-decoration: none; letter-spacing: .5px;
}
.page-logo span { color: #ffd23f; }
.page-nav { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-left: auto; }
.page-nav a, .page-foot a { color: rgba(255,255,255,.85); font-weight: 700; font-size: 14px; }
.page-nav a:hover, .page-foot a:hover { color: #fff; }
.page-main {
  background: rgba(0,0,0,.22); border-radius: 14px; padding: 20px 22px;
}
.page-main h1 { font-size: 30px; margin: 0 0 14px; }
.page-main h2 { font-size: 19px; margin: 22px 0 6px; }
.page-main p, .page-main li { overflow-wrap: anywhere; }
.page-main ul, .page-main ol { padding-left: 20px; margin: 0 0 10px; }
.page-main a { color: #ffd23f; }
.page-main .muted { opacity: .75; font-size: 13px; }
.big-mail { font-size: 18px; font-weight: 800; margin: 6px 0 16px; }
.ad-page { margin: 16px 0; }
.page-foot {
  margin-top: 18px; text-align: center; font-size: 13px; color: rgba(255,255,255,.7);
}
@media (max-width: 560px) {
  .page-main { padding: 16px 14px; }
  .page-main h1 { font-size: 24px; }
}

/* ================= logo tail + theme switch ================= */
.logo .l9 { color: #8b5a2b; animation-delay: .72s }

.theme-row { display: flex; justify-content: center; margin: -4px 0 12px; }
.theme-switch {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,.22); border: 0; border-radius: 999px;
  padding: 6px 12px 6px 8px; color: #fff; font-weight: 700; font-size: 13px;
}
.theme-switch .track {
  width: 40px; height: 22px; border-radius: 999px; background: rgba(255,255,255,.35);
  position: relative; display: inline-block; transition: background .15s ease;
}
.theme-switch .knob {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .15s ease;
}
.theme-switch[aria-pressed="true"] .track { background: #0080FE; }
.theme-switch[aria-pressed="true"] .knob { transform: translateX(18px); }

/* ================= lobby browser (home, right side) ================= */
.home-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 12px;
  align-items: start;
}
.lobby-card { padding: 10px; }
.lobby-head {
  font-size: 14px; font-weight: 800; color: #fff; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.lobby-count {
  background: rgba(0,0,0,.3); border-radius: 999px; padding: 1px 8px; font-size: 12px;
}
.lobby-list {
  max-height: 234px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
  -webkit-overflow-scrolling: touch;
}
.lobby-empty { color: rgba(255,255,255,.75); font-size: 12px; padding: 6px 2px; }
.lobby-row {
  background: rgba(0,0,0,.22); border-radius: 8px; padding: 6px 7px;
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 6px; align-items: center;
  height: 74px;
}
.lobby-row .lb-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lobby-row .lb-code { font-weight: 800; font-size: 13px; color: #ffd23f; letter-spacing: 1px; }
.lobby-row .lb-num { font-size: 11.5px; color: rgba(255,255,255,.85); white-space: nowrap; }
.lobby-row .lb-avs { display: flex; gap: 2px; flex-wrap: nowrap; overflow: hidden; grid-column: 1 / -1; }
.lobby-row .lb-avs canvas { width: 22px; height: 22px; image-rendering: pixelated; flex: 0 0 auto; }
.lobby-row .lb-names {
  grid-column: 1 / -1; font-size: 11px; color: rgba(255,255,255,.8);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb-join {
  background: var(--green); color: #fff; border: 0; border-radius: 6px;
  font-size: 11.5px; font-weight: 800; padding: 4px 9px; line-height: 1;
}
.lb-join:disabled { background: var(--grey); cursor: not-allowed; }

@media (max-width: 860px) {
  .home-top { grid-template-columns: minmax(0, 1fr); }
  .lobby-list { max-height: 240px; }
}

/* ================= dark mode ================= */
body.theme-dark .input,
body.theme-dark .room-code-input {
  background: #3a3f47; color: #fff; border-color: #4c525c;
}
body.theme-dark .input::placeholder { color: rgba(255,255,255,.75); }

body.theme-dark .topbar { background: #3a3f47; }
body.theme-dark .topbar .round,
body.theme-dark .topbar .timer,
body.theme-dark .topbar .word-len,
body.theme-dark .topbar .word-hint { color: #fff; }

body.theme-dark .panel { background: #4a5058; }
body.theme-dark .pl:nth-child(odd) { background: #565d66; }
body.theme-dark .pl:nth-child(even) { background: #3a3f47; }
body.theme-dark .pl .nm,
body.theme-dark .pl .sc,
body.theme-dark .pl .rank { color: #fff; }
body.theme-dark .pl.me .nm { color: #c9a6ff; }
body.theme-dark .pl.guessed { background: #22c55e !important; }
body.theme-dark .pl.guessed .nm, body.theme-dark .pl.guessed .sc, body.theme-dark .pl.guessed .rank { color: #05300f; }
body.theme-dark .pl.drawing { background: #fbbf24 !important; }
body.theme-dark .pl.drawing .nm, body.theme-dark .pl.drawing .sc, body.theme-dark .pl.drawing .rank { color: #451a03; }

body.theme-dark .chat-log { background: #4a5058; }
body.theme-dark .chat-log .m:nth-child(odd) { background: #565d66; }
body.theme-dark .chat-log .m:nth-child(even) { background: #3a3f47; }
body.theme-dark .chat-log .m { padding: 3px 6px; border-bottom-color: rgba(255,255,255,.06); }
body.theme-dark .m.msg { color: #fff; }
body.theme-dark .m.info { color: #d6dae0; }
body.theme-dark .chat-form { background: #3a3f47; border-top-color: #4c525c; }
body.theme-dark .chat-input { background: #3a3f47; color: #fff; border-color: #4c525c; }
body.theme-dark .chat-input::placeholder { color: rgba(255,255,255,.75); }

body.theme-dark .room-code-bar { background: #000; color: #fff; border-top-color: #000; }
body.theme-dark .room-code-bar b { color: #b98bff; }

/* like / dislike chat lines */
.m.like { color: #1f8b3a; font-weight: 700; }
.m.dislike { color: #d2691e; font-weight: 700; }
body.theme-dark .m.like { color: #6ee787; }
body.theme-dark .m.dislike { color: #ffb066; }
body.theme-dark .m.correct, body.theme-dark .m.join, body.theme-dark .m.reveal { color: #6ee787; }
body.theme-dark .m.next { color: #8ab6ff; }
body.theme-dark .m.close { color: #ffd85e; }
body.theme-dark .m.win { color: #ffc24d; }
body.theme-dark .m.red, body.theme-dark .m.leave { color: #ff8b7d; }
body.theme-dark .m.guessed { color: #e2e26a; }

/* room-code label must stay on one line on every browser */
.room-code-row > span { white-space: nowrap; }
.room-code-row { flex-wrap: nowrap; }
