/* Late Night Trivia — uses the site's colours and fonts from /css/styles.css */

body.trivia { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- Top bar ---------- */
.t-top {
  display: flex; align-items: center; gap: 14px; padding: 12px 24px;
  border-bottom: 2px solid var(--line); background: var(--black);
}
.t-brand img { height: 44px; width: auto; display: block; }
.t-title { font-size: 22px; color: var(--white); line-height: 1.1; }
.t-title span { color: var(--cyan); text-shadow: 0 0 14px rgba(0,245,225,.6); }
.t-top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 15px; }
.t-code-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  border: 2px solid var(--line-2); border-radius: 999px; color: var(--white); font-weight: 700;
}
.t-code-pill b { font-family: var(--display); font-weight: 400; color: var(--cyan); letter-spacing: .08em; font-size: 18px; }
.t-net { width: 10px; height: 10px; border-radius: 50%; background: var(--cyan); flex: none; }
.t-net.off { background: var(--orange); animation: pulse 1s infinite; }

.t-app { flex: 1; width: 100%; max-width: 1500px; margin: 0 auto; padding: 24px; }
.t-msg { padding: 60px 20px; text-align: center; font-size: 19px; }

/* ---------- Join / host setup cards ---------- */
.t-hero { text-align: center; padding: 24px 0 8px; }
.t-hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(40px, 8vw, 84px); line-height: 1; color: var(--white); }
.t-hero h1 span { display: block; color: var(--cyan); text-shadow: 0 0 28px rgba(0,245,225,.7); }
.t-hero p { margin-top: 14px; font-size: 19px; }
.t-card {
  max-width: 480px; margin: 32px auto 0; border: 5px solid var(--white); border-radius: 28px; padding: 32px;
  background: var(--black); box-shadow: 0 0 60px rgba(0,245,225,.25);
}
.t-card .field + .field { margin-top: 18px; }
.t-check { display: flex; gap: 12px; align-items: flex-start; margin-top: 20px; font-size: 16px; color: var(--white); cursor: pointer; }
.t-check input { width: 22px; height: 22px; margin-top: 1px; flex: none; accent-color: var(--cyan); }
.t-check small { display: block; margin-top: 2px; font-size: 14px; color: var(--muted); }
.t-card .btn { width: 100%; height: 58px; margin-top: 24px; font-size: 19px; }
.t-card .form-status { margin-top: 12px; }
.t-code-input { text-transform: uppercase; letter-spacing: .3em; font-family: var(--display) !important; font-size: 26px !important; text-align: center; }
.t-hint { margin-top: 14px; font-size: 15px; color: var(--muted); text-align: center; }

/* ---------- Game layout ---------- */
.t-game { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.t-stage { min-width: 0; }
.t-side {
  border: 2px solid var(--line); border-radius: 20px; background: var(--deep); padding: 16px;
  position: sticky; top: 16px;
}
.t-side h2 { font-size: 15px; font-weight: 700; color: var(--muted); margin: 0 0 10px 4px; }

.t-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; font-size: 18px; color: var(--white); font-weight: 700; min-height: 48px;
}
.t-banner .t-round { font-family: var(--display); font-weight: 400; color: var(--cyan); font-size: 22px; }
.t-banner .t-you-pick { color: var(--black); background: var(--cyan); padding: 4px 14px; border-radius: 999px; }

/* ---------- Board ---------- */
.t-board {
  display: grid; gap: 8px; grid-auto-rows: auto;
  border: 2px solid var(--line); border-radius: 20px; padding: 12px; background: var(--black);
}
.t-cat {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 72px;
  padding: 8px; border-radius: 12px; background: var(--deep); border: 2px solid var(--line-2);
  color: var(--white); font-weight: 800; font-size: clamp(11px, 1.4vw, 17px); line-height: 1.2; text-transform: uppercase;
  overflow-wrap: break-word; hyphens: auto; min-width: 0;
}
.t-cell {
  display: flex; align-items: center; justify-content: center; min-height: 72px; border-radius: 12px;
  font-family: var(--display); font-size: clamp(16px, 2.6vw, 34px); color: var(--cyan);
  background: var(--deep); background-image: var(--stripe-cyan); border: 2px solid var(--line-2);
  text-shadow: 0 0 14px rgba(0,245,225,.6); padding: 0;
}
button.t-cell { cursor: pointer; transition: transform .12s ease, border-color .12s ease, filter .12s ease; }
button.t-cell:hover { transform: scale(1.04); border-color: var(--white); filter: brightness(1.15); }
.t-cell[disabled] { cursor: default; }
.t-cell.used { background: transparent; border-style: dashed; border-color: var(--line); color: transparent; text-shadow: none; }

/* ---------- Clue / reveal ---------- */
.t-clue {
  position: relative; border: 5px solid var(--white); border-radius: 28px; padding: clamp(24px, 4vw, 48px);
  background: var(--deep); background-image: var(--stripe-cyan); box-shadow: 0 0 60px rgba(0,245,225,.25);
  min-height: 340px; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 18px;
}
.t-clue-meta { font-weight: 800; color: var(--cyan); font-size: 18px; text-transform: uppercase; letter-spacing: .04em; }
.t-clue-text {
  font-family: var(--display); font-weight: 400; color: var(--white); font-size: clamp(24px, 3.6vw, 48px); line-height: 1.2;
  text-shadow: 0 2px 0 #000, 0 0 24px rgba(0,0,0,.8);
}
.t-timer { height: 14px; border-radius: 999px; background: rgba(0,0,0,.6); border: 2px solid var(--line-2); overflow: hidden; }
.t-timer-fill { height: 100%; width: 100%; background: var(--cyan); transform-origin: left; }
.t-timer-fill.low { background: var(--orange); }
.t-timer-row { display: flex; align-items: center; gap: 14px; }
.t-timer-row .t-timer { flex: 1; }
.t-secs { font-family: var(--display); font-size: 28px; color: var(--white); min-width: 2.2ch; text-align: right; }
.t-counts { font-size: 16px; color: var(--text); }

.t-answer-label { font-size: 16px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.t-answer { font-family: var(--display); font-size: clamp(30px, 5vw, 64px); line-height: 1.1; color: var(--cyan); text-shadow: 0 0 28px rgba(0,245,225,.7); }
.t-reveal-clue { font-size: 18px; color: var(--text); max-width: 60ch; margin: 0 auto; }

.t-results { margin-top: 18px; border: 2px solid var(--line); border-radius: 20px; overflow: hidden; }
.t-result {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1.3fr) auto auto; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 2px solid var(--line); background: var(--black);
}
.t-result:last-child { border-bottom: 0; }
.t-result.me { background: var(--hover); }
.t-mark { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--black); }
.t-mark.right { background: var(--cyan); }
.t-mark.wrong { background: var(--orange); }
.t-result .name { font-weight: 800; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-result .said { color: var(--text); overflow-wrap: anywhere; }
.t-result .said em { color: var(--muted); }
.t-result .delta { font-family: var(--display); font-size: 20px; }
.t-result .delta.plus { color: var(--cyan); }
.t-result .delta.minus { color: var(--orange); }
.t-flip { height: 36px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line-2); background: transparent; color: var(--white); font-weight: 700; font-size: 14px; }
.t-flip:hover { border-color: var(--cyan); color: var(--cyan); }
.t-tag { font-size: 12px; color: var(--muted); font-weight: 700; margin-left: 6px; }
.t-nobody { padding: 18px; text-align: center; color: var(--muted); }
.t-auto { margin-top: 14px; min-height: 1.4em; font-size: 15px; font-weight: 700; color: var(--muted); }
.t-opt { font-weight: 500; font-size: 14px; color: var(--muted); }
.t-diff-name { color: var(--cyan); }
.t-range { width: 100%; height: 28px; accent-color: var(--cyan); background: transparent; border: 0 !important; padding: 0 !important; }
.t-range-ends { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: -4px; }

/* Host: answer history */
.t-history:empty { display: none; }
.t-history { margin-top: 24px; border-top: 2px solid var(--line); padding-top: 18px; scroll-margin-top: 16px; }
.t-history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.t-history-head h2 { font-family: var(--display); font-weight: 400; font-size: 26px; color: var(--white); }
.t-h-item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.t-h-item .t-clue-meta { text-align: left; }
.t-h-clue { margin-top: 4px; color: var(--text); }
.t-h-answer { margin-top: 4px; color: var(--muted); }
.t-h-answer b { color: var(--cyan); }
.t-h-item .t-results { margin-top: 10px; }

/* ---------- Lobby ---------- */
.t-lobby { text-align: center; border: 5px solid var(--white); border-radius: 28px; padding: clamp(24px, 4vw, 48px); background: var(--black); box-shadow: 0 0 60px rgba(0,245,225,.25); }
.t-lobby .t-big-code { font-family: var(--display); font-size: clamp(56px, 12vw, 140px); line-height: 1; color: var(--cyan); letter-spacing: .08em; text-shadow: 0 0 36px rgba(0,245,225,.7); }
.t-lobby .t-join-at { font-size: clamp(16px, 2vw, 24px); color: var(--white); font-weight: 700; }
.t-lobby .t-join-at a { color: var(--cyan); text-decoration: underline; text-underline-offset: 4px; overflow-wrap: anywhere; }
.t-lobby-players { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }
.t-chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; background: var(--deep); border: 2px solid var(--line-2); color: var(--white); font-weight: 700; }
.t-chip button { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; padding: 0 0 0 4px; }
.t-chip button:hover { color: var(--orange); }
.t-waiting { margin-top: 22px; color: var(--muted); }

/* ---------- Standings ---------- */
.t-scores { display: flex; flex-direction: column; gap: 6px; }
.t-score {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto auto; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px; background: var(--black); border: 2px solid transparent;
}
.t-score.me { border-color: var(--cyan); }
.t-score.off { opacity: .45; }
.t-score .rank { color: var(--muted); font-weight: 700; font-size: 14px; text-align: right; }
.t-score .who { font-weight: 700; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-score .pts { font-family: var(--display); color: var(--cyan); font-size: 17px; }
.t-score .pts.neg { color: var(--orange); }
.t-score .st { font-size: 12px; font-weight: 800; padding: 1px 8px; border-radius: 999px; min-width: 0; }
.st-buzzed { background: var(--orange); color: var(--black); }
.st-answered { background: var(--cyan); color: var(--black); }
.st-passed { color: var(--muted); border: 1px solid var(--line-2); }
.st-picker { color: var(--black); background: var(--white); }
.t-empty { color: var(--muted); font-size: 15px; padding: 6px; }

.t-final { text-align: center; }
.t-final .t-winner { font-family: var(--display); font-size: clamp(36px, 7vw, 80px); color: var(--cyan); line-height: 1.05; text-shadow: 0 0 36px rgba(0,245,225,.7); }
.t-final .t-scores { max-width: 560px; margin: 28px auto 0; text-align: left; }
.t-final .t-score { padding: 12px 14px; font-size: 18px; }

/* ---------- Controls ---------- */
.t-controls { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; }
.t-controls .btn { height: 60px; padding: 0 34px; font-size: 20px; }
.t-buzz { min-width: 220px; font-size: 24px !important; height: 72px !important; box-shadow: 0 0 36px rgba(0,245,225,.45); }
.t-answer-form { display: flex; gap: 10px; width: 100%; max-width: 640px; }
.t-answer-form input {
  flex: 1; min-width: 0; height: 60px; padding: 0 18px; background: var(--black); color: var(--white);
  border: 3px solid var(--cyan); border-radius: 14px; font-family: inherit; font-size: 20px;
}
.t-answer-form .btn { height: 60px; padding: 0 24px; }
.t-locked { font-size: 19px; color: var(--white); font-weight: 700; }
.t-locked b { color: var(--cyan); }
.t-host-bar {
  margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center;
  padding: 12px; border: 2px dashed var(--line-2); border-radius: 16px;
}
.t-host-bar .btn { height: 48px; padding: 0 22px; font-size: 16px; }
.t-host-bar .t-host-label { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-right: 4px; }

/* ---------- Toast ---------- */
.t-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); z-index: 50;
  background: var(--orange); color: var(--black); font-weight: 800; padding: 12px 22px; border-radius: 999px;
  transition: transform .25s ease, visibility .25s; max-width: calc(100% - 32px); text-align: center;
  visibility: hidden;
}
.t-toast.show { transform: translate(-50%, 0); visibility: visible; }

/* ---------- Small screens ---------- */
@media (max-width: 1000px) {
  .t-game { grid-template-columns: 1fr; }
  .t-side { position: static; }
}
@media (max-width: 760px) {
  .t-top { padding: 10px 16px; gap: 10px; }
  .t-brand img { height: 36px; }
  .t-title { font-size: 17px; }
  .t-code-pill { height: 34px; padding: 0 12px; font-size: 13px; }
  .t-app { padding: 14px; }
  .t-card { padding: 22px 18px; border-width: 4px; }
  .t-board { gap: 4px; padding: 6px; border-radius: 14px; }
  .t-cat { min-height: 56px; padding: 3px 2px; font-size: 9px; letter-spacing: -.01em; border-radius: 8px; }
  .t-cell { min-height: 48px; border-radius: 8px; }
  .t-clue { min-height: 240px; border-width: 4px; }
  .t-result { grid-template-columns: 30px minmax(0, 1fr) auto; }
  .t-result .said { grid-column: 2 / -1; grid-row: 2; }
  .t-result .t-flip { grid-column: 1 / -1; }
  .t-controls .btn { flex: 1; }
  .t-answer-form .btn { flex: none; }
}
@media (prefers-reduced-motion: reduce) {
  button.t-cell { transition: none; }
  .t-toast { transition: none; }
}
