/* =========================================================
   Notebook theme — every screen except the home page
   Loaded after styles.css and home.css. It re-points the old
   glass-theme tokens at the notebook palette, then restyles the
   shared pieces (cards, buttons, inputs, topbar) and each screen.
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --nb-ink:    #0d0d0d;   /* page */
  --nb-paper:  #1a1a1a;   /* raised panels */
  --nb-deep:   #080808;   /* inputs, wells */
  --nb-line:   rgba(244, 239, 227, .3);
  --nb-yellow: #ff9a2e;
  --nb-mint:   #f4efe3;
  --nb-pink:   #ff5a36;
  --nb-lilac:  #fde3b0;

  --primary:       #ff9a2e;
  --primary-light: #fde3b0;
  --primary-dark:  #b45f0b;
  --primary-glow:  rgba(0, 0, 0, 0);

  --accent: #ff9a2e;
  --good:   #f4efe3;
  --bad:    #ff5a36;
  --rose:   #ff5a36;
  --purple: #fde3b0;

  --glass:        #1a1a1a;
  --glass-hi:     #262626;
  --glass-border: rgba(244, 239, 227, .3);

  --ink:      #f4efe3;
  --ink-soft: rgba(244, 239, 227, .72);
  --muted:    rgba(244, 239, 227, .64); /* AA contrast on the near-black board */
  --line:     rgba(244, 239, 227, .22);

  --radius:    20px;
  --radius-sm: 14px;

  --shadow:      6px 6px 0 rgba(0, 0, 0, .35);
  --shadow-glow: 6px 6px 0 rgba(0, 0, 0, .35);
}

/* ---------- Page: plum with a dot grid ---------- */
body {
  background-color: var(--nb-ink);
  background-image:
    radial-gradient(ellipse 80% 60% at 30% 20%, rgba(244, 239, 227, .035), transparent 70%),
    radial-gradient(ellipse 70% 50% at 80% 85%, rgba(244, 239, 227, .025), transparent 70%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
body::before, body::after { display: none; }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--nb-ink);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 2px dashed var(--nb-line);
}
.logo { letter-spacing: -.02em; }
.logo-mark.accent { color: var(--nb-yellow); }

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--nb-paper);
  border: 2px solid var(--nb-line);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}
.icon-btn:hover  { background: var(--glass-hi); }
.icon-btn:active { transform: translateY(3px); box-shadow: none; }

/* ---------- Settings panel ---------- */
.settings-panel {
  background: var(--nb-paper);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 2px solid var(--nb-line);
}
.settings-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: .92rem;
  color: var(--ink);
}
.settings-opt {
  background: var(--nb-deep);
  border: 2px solid var(--nb-line);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .3);
}
.settings-opt.active {
  background: var(--nb-yellow);
  border-color: var(--nb-ink);
  color: #2a1400;
  box-shadow: 0 3px 0 #b45f0b;
}

/* ---------- Cards: paper panels ---------- */
.card {
  background: var(--nb-paper);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 2px solid var(--nb-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Forms ---------- */
input[type="text"], select {
  background: var(--nb-deep);
  border: 2px solid var(--nb-line);
  color: var(--ink);
}
input[type="text"]:focus, select:focus {
  background: var(--nb-deep);
  border-color: var(--nb-yellow);
  box-shadow: 0 0 0 3px rgba(255, 154, 46, .25);
}
select option { background: var(--nb-paper); }
.field > span { color: var(--ink); letter-spacing: 0; font-size: .95rem; }

/* ---------- Buttons: stickers ---------- */
button.primary, button.secondary, button.ghost {
  border: 2px solid var(--nb-ink);
  border-radius: 14px;
  letter-spacing: 0;
  transition: transform .08s, box-shadow .08s;
}
button.primary::after { display: none; }
button.primary {
  background: var(--nb-yellow);
  color: #2a1400;
  box-shadow: 0 4px 0 #b45f0b;
}
button.primary:hover  { transform: translateY(-2px); box-shadow: 0 6px 0 #b45f0b; }
button.primary:active { transform: translateY(4px);  box-shadow: none; }
button.primary.cta { animation: none; }

button.secondary {
  background: var(--nb-mint);
  color: #1a1a1a;
  box-shadow: 0 4px 0 #9c9482;
}
button.secondary:hover  { background: var(--nb-mint); transform: translateY(-2px); box-shadow: 0 6px 0 #9c9482; }
button.secondary:active { transform: translateY(4px); box-shadow: none; }

button.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--nb-line);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .3);
}
button.ghost:hover  { background: rgba(244, 239, 227, .12); color: var(--ink); }
button.ghost:active { transform: translateY(4px); box-shadow: none; }

button:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.divider::before, .divider::after { height: 0; border-top: 2px dashed var(--nb-line); background: none; }

/* ---------- Public rooms + lobby ---------- */
.public-room-card {
  background: var(--nb-deep);
  border: 2px solid var(--nb-line);
  border-radius: var(--radius-sm);
}
.public-room-card:hover { border-color: var(--nb-yellow); box-shadow: none; }

.badge-public { background: var(--nb-mint); color: #1a1a1a; }

.room-code-pill {
  background: var(--nb-yellow);
  color: #2a1400;
  border: 2px solid var(--nb-ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 #b45f0b;
  animation: none;
}

.players-list li {
  background: var(--nb-deep);
  border: 2px solid var(--nb-line);
}
.players-list li.is-bot { background: rgba(244, 239, 227, .1); border-color: rgba(244, 239, 227, .4); }
.players-list li .badge {
  background: var(--nb-yellow);
  color: #2a1400;
  letter-spacing: 0;
}
.players-list li.is-bot .badge { background: var(--nb-lilac); color: #0d0d0d; }
.players-list li .score { color: var(--nb-yellow); }
.badge-ready {
  background: rgba(244, 239, 227, .15);
  color: var(--nb-mint);
  border-color: rgba(244, 239, 227, .45);
}
.avatar-picker {
  background: var(--nb-paper);
  backdrop-filter: none;
  border: 2px solid var(--nb-line);
}
#ready-section { border-top: 2px dashed var(--nb-line); }

/* ---------- Game ---------- */
.role-label, .word-label, .scoreboard h4,
#screen-game .role-label, #screen-game .word-label, #screen-game .scoreboard h4 {
  text-transform: none;
  letter-spacing: 0;
}
.role-box {
  background: rgba(255, 154, 46, .12);
  border: 2px dashed rgba(255, 154, 46, .6);
}
.role-box.is-impostor {
  background: rgba(255, 90, 54, .14);
  border-color: rgba(255, 90, 54, .75);
}
.word-value.strong { color: var(--nb-mint); }

.scoreboard li.me {
  background: rgba(255, 154, 46, .14);
  border: 2px solid rgba(255, 154, 46, .5);
}
.scoreboard li:not(.me):nth-child(odd) { background: rgba(244, 239, 227, .07); }
#screen-game .scoreboard li.drawing {
  background: rgba(255, 154, 46, .12);
  border: 2px solid rgba(255, 154, 46, .5);
  box-shadow: inset 4px 0 0 var(--nb-yellow);
}

/* the canvas stays white: it is the sheet of paper */
.canvas-wrap, #screen-game .canvas-wrap {
  border: 3px solid var(--nb-ink);
  border-radius: 14px;
  box-shadow: 0 0 0 2px var(--nb-line), 5px 5px 0 rgba(0, 0, 0, .35);
}

.canvas-clock, .canvas-round {
  background: var(--nb-paper);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 2px solid var(--nb-ink);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .4);
}
.canvas-round { text-transform: none; letter-spacing: 0; }
.canvas-round strong { color: var(--nb-yellow); }
.canvas-clock.low {
  background: var(--nb-pink);
  color: #2a0800;
  border-color: var(--nb-ink);
  box-shadow: 0 3px 0 #a62a10;
}

.drawing-indicator {
  background: var(--nb-deep);
  border: 2px solid var(--nb-line);
  letter-spacing: 0;
}
.drawing-indicator.is-me {
  background: rgba(255, 154, 46, .16);
  border-color: var(--nb-yellow);
  color: var(--nb-yellow);
  animation: none;
}

.palette button {
  border: 3px solid var(--nb-ink);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .4);
}
.palette button:hover { box-shadow: 0 4px 0 rgba(0, 0, 0, .4); }
.palette button.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--nb-ink), 0 0 0 5px var(--ink);
}

.timer-bar {
  height: 14px;
  background: var(--nb-deep);
  border: 2px solid var(--nb-line);
}
.timer-bar.low > div { box-shadow: none; }

.turn-line.strong { color: var(--nb-lilac); text-shadow: none; }
.turn-line.strong.is-me { color: var(--nb-yellow); text-shadow: none; animation: none; }

.turn-announce {
  background: rgba(13, 13, 13, .92);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.turn-announce-round { text-transform: none; letter-spacing: 0; }
.turn-announce-name { color: var(--nb-lilac); text-shadow: none; }
.turn-announce-name.is-me { color: var(--nb-yellow); text-shadow: none; }

/* ---------- Vote ---------- */
.vote-list button:not(.kick-btn) {
  background: var(--nb-deep);
  border: 2px solid var(--nb-line);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .35);
}
.vote-list button:not(.kick-btn):not(:disabled):hover {
  background: var(--nb-deep);
  border-color: var(--nb-yellow);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .35);
}
.vote-list button.selected {
  background: var(--nb-yellow);
  border-color: var(--nb-ink);
  color: #2a1400;
  box-shadow: 0 4px 0 #b45f0b;
}

/* ---------- Results ---------- */
.result-line { border-bottom: 2px dashed var(--nb-line); }
.result-line strong { color: var(--nb-yellow); }
.impostor-tag { color: var(--nb-pink); text-transform: none; letter-spacing: 0; }
.winner-banner {
  background: rgba(255, 154, 46, .14);
  border: 2px dashed var(--nb-yellow);
  color: var(--nb-yellow);
  animation: none;
}

/* ---------- Rules (shared) + toast ---------- */
.rules { background: var(--nb-deep); border: 2px solid var(--nb-line); }
.rules summary { color: var(--nb-lilac); }

#toast {
  background: var(--nb-paper);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 2px solid var(--nb-line);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .35);
}

@media (prefers-reduced-motion: reduce) {
  .screen.active, .role-box, .turn-announce-inner { animation: none; }
}

/* ---------- Offset: topbar is a little taller in this theme ---------- */
#screen-lobby.active,
#screen-game.active,
#screen-vote.active,
#screen-guess.active,
#screen-results.active,
#screen-public.active { top: 68px; }

/* Tall results card: align from the top and scroll, instead of clipping its title */
#screen-results.active { align-items: safe center; }

/* ---------- Avatars: chalk drawings instead of emoji ---------- */
img.av {
  width: 1.7em;
  height: 1.7em;
  object-fit: contain;
  vertical-align: middle;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-drag: none;
}
.players-list li img.av { width: 38px; height: 38px; }
.scoreboard li img.av   { width: 34px; height: 34px; }
#result-scores li img.av { width: 40px; height: 40px; }
.avatar-btn { padding: 2px 4px; line-height: 0; }
.avatar-btn img.av { width: 42px; height: 42px; }
.ap-opt { line-height: 0; padding: 6px; }
.ap-opt img.av { width: 52px; height: 52px; }
.vote-list button img.av { display: block; margin: 0 auto 8px; width: 64px; height: 64px; }
.turn-announce-name img.av { width: 1.5em; height: 1.5em; margin-inline-end: .15em; }
.drawing-indicator img.av { width: 30px; height: 30px; }
.winner-banner img.av, .result-line img.av { width: 34px; height: 34px; }
.public-room-card img.av { width: 34px; height: 34px; }
.avatar-picker { gap: 6px; }

/* Names stay on one line now that avatars are wider than emoji */
.players-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.players-list li { white-space: nowrap; }

/* ---------- Chalk icons (settings gear, home house) ---------- */
img.ico {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.icon-btn img.ico { margin: auto; }
img.ico-title {
  display: inline-block;
  width: 1.3em;
  height: 1.3em;
  vertical-align: -.2em;
}
/* the chalk gear is dark grey: lift it so it reads on the plum button */
#settings-btn img.ico { filter: brightness(1.6); }

/* =========================================================
   Chalkboard finish: wooden frame, chalk lines, hand-drawn corners
   ========================================================= */
:root {
  --wood:      #ff8a1f;
  --wood-dark: #b45f0b;
  --wob-lg: 22px 26px 20px 27px / 26px 20px 27px 22px;
  --wob-md: 14px 17px 13px 18px / 17px 13px 18px 14px;
}

/* the board texture on every in-game screen */
body {
  background-color: var(--nb-ink);
  background-image:
    radial-gradient(ellipse 80% 60% at 30% 20%, rgba(244, 239, 227, .035), transparent 70%),
    radial-gradient(ellipse 70% 50% at 80% 85%, rgba(244, 239, 227, .025), transparent 70%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: auto, auto, 220px 220px;
}

/* wooden ledge along the top */
.topbar {
  background: linear-gradient(#161616, #000000);
  border-bottom: 4px solid #ff8a1f;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .14), 0 4px 0 rgba(0, 0, 0, .3);
}
.logo-mark { color: #f4efe3; }
.logo-mark.accent { color: #ff9a2e; }
.icon-btn { background: rgba(255, 255, 255, .07); border-color: rgba(255, 138, 31, .55); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 3px 0 rgba(0, 0, 0, .3); }
.icon-btn:hover { background: rgba(255, 138, 31, .18); }

/* hand-drawn corners */
.card, .h-panel { border-radius: var(--wob-lg); }
button.primary, button.secondary, button.ghost,
.h-btn, input[type="text"], select,
.players-list li, .vote-list button:not(.kick-btn),
.room-code-pill, .public-room-card, .rules, .drawing-indicator { border-radius: var(--wob-md); }

/* a framed sheet of paper for the canvas, held by a wooden frame */
.canvas-wrap, #screen-game .canvas-wrap {
  border: 6px solid var(--wood);
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px var(--wood-dark), 0 0 0 2px var(--wood-dark), 6px 6px 0 rgba(0, 0, 0, .35);
}

/* chalk-smudged lettering */
.card h2, .card h3, #screen-home .h-word {
  text-shadow: 0 0 1px rgba(244, 239, 227, .55);
}

/* The role card must always show the secret word: size it to its content,
   and let the scoreboard take whatever height is left. */
#screen-game .sidebar > .card:nth-child(1) { flex: 0 0 auto; overflow: visible; }
#screen-game .sidebar > .card:nth-child(2) { flex: 1 1 0; min-height: 0; }
#screen-game .role-value { font-size: clamp(1.6rem, 3.4vh, 2.2rem); margin-bottom: 4px; }
#screen-game .word-value.strong { font-size: clamp(1.3rem, 3vh, 1.7rem); }


/* ---------- Embroidered icons (palette, globe, trophy, target, pencil) ---------- */
img.ico-inline { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -.25em; }
.h-ico-img { width: 1.7em; height: 1.7em; object-fit: contain; flex: none; display: block; }

/* ---------- Turn clock: the number sits inside the white face of the alarm clock ---------- */
.canvas-clock {
  width: 104px; height: 104px; min-width: 0; padding: 0;
  display: block;
  background: none; border: 0; box-shadow: none; border-radius: 0;
  top: 6px;
}
.canvas-clock .clock-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.canvas-clock #canvas-clock-time {
  position: absolute; left: 50%; top: 56%;
  transform: translate(-50%, -50%);
  color: #1a1a1a;
  font-size: 1.75rem; font-weight: 800; line-height: 1;
  letter-spacing: 0;
}
.canvas-clock.low { background: none; border: 0; box-shadow: none; filter: drop-shadow(0 0 10px rgba(255, 90, 54, .8)); }
.canvas-clock.low #canvas-clock-time { color: #e01f0b; }
@media (max-width: 560px) {
  .canvas-clock { width: 78px; height: 78px; }
  .canvas-clock #canvas-clock-time { font-size: 1.3rem; }
}

/* ---------- Game sidebar: bigger role panel, and the scoreboard marks only whose turn it is ---------- */
/* Desktop: a wider sidebar so the role and the secret word are easy to read. */
@media (min-width: 781px) {
  #screen-game .game-grid { grid-template-columns: 350px 1fr; }
}
#screen-game .role-box { padding: 26px 18px; gap: 12px; }
#screen-game .role-label { font-size: 1.05rem; }
#screen-game .role-value { font-size: clamp(2.6rem, 6vh, 3.6rem); line-height: 1.1; margin-bottom: 6px; }
#screen-game .word-label { font-size: 1rem; }
#screen-game .word-value { font-size: clamp(1.5rem, 3.4vh, 2rem); }
#screen-game .word-value.strong { font-size: clamp(2rem, 4.8vh, 2.8rem); line-height: 1.15; }
@media (max-width: 780px) {
  #screen-game .role-value { font-size: 2.4rem; }
  #screen-game .word-value.strong { font-size: 1.9rem; }
}

/* You are no longer highlighted in the scoreboard: your row looks like everyone else's.
   Only the player whose turn it is (li.drawing) stands out. */
#screen-game .scoreboard li.me {
  background: transparent;
  border: 0;
  font-size: 1.25rem;
  font-weight: inherit;
  padding: 14px 18px;
}
#screen-game .scoreboard li.me:nth-child(odd) { background: rgba(244, 239, 227, .07); }
#screen-game .scoreboard li.me.drawing {
  background: rgba(255, 154, 46, .12);
  border: 2px solid rgba(255, 154, 46, .5);
}

/* ---------- Room language picker (lobby) ---------- */
.lang-toggle { display: flex; gap: 8px; }
.lang-toggle .settings-opt { flex: 1; min-height: 44px; }
.room-lang-info { text-align: center; color: var(--ink-soft); margin: 8px 0 0; }
