/* Odd One Out
   One idea carries the look: a row of chunky tiles where one is different.
   Dark-first (Discord is mostly dark), with a light version. */

:root{
  --bg: #e3ebf3;
  --bg-dot: #cfdbe7;
  --surface: #ffffff;
  --surface-edge: #cbd8e5;
  --ink: #152230;
  --muted: #5b6f84;
  --tile: #ffffff;
  --tile-ink: #152230;
  --tile-edge: #b3c3d3;
  --odd: #f2b23a;
  --odd-edge: #c98a14;
  --right: #2fae6c;
  --right-edge: #1f8350;
  --wrong: #e2604f;
  --blue: #3e6fe0;
  --blue-edge: #2a52b3;
  --font: "Outfit", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
/* dark: follows the device unless the player has picked a side in Settings */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg: #111c26;
    --bg-dot: #1a2835;
    --surface: #182633;
    --surface-edge: #24384a;
    --ink: #eef3f8;
    --muted: #8ea2b6;
    --tile: #f3f6fa;
    --tile-ink: #152230;
    --tile-edge: #92a5b8;
    --blue: #5b86f0;
    --blue-edge: #3b63c7;
  }
}
:root[data-theme="dark"]{
  --bg: #111c26;
  --bg-dot: #1a2835;
  --surface: #182633;
  --surface-edge: #24384a;
  --ink: #eef3f8;
  --muted: #8ea2b6;
  --tile: #f3f6fa;
  --tile-ink: #152230;
  --tile-edge: #92a5b8;
  --blue: #5b86f0;
  --blue-edge: #3b63c7;
}

html, body{ margin: 0; min-height: 100%; }

html, body{ height: 100%; overflow: hidden; }

/* every screen fits the height it's given: sizes shrink on short screens */

/* ---- the logo: five tiles, one odd ---- */
.logo{ display: flex; gap: 6px; justify-content: center; }
.logo i{
  width: clamp(18px, 3.4vh, 26px); height: clamp(18px, 3.4vh, 26px); border-radius: 8px;
  background: var(--tile);
  box-shadow: 0 4px 0 var(--tile-edge);
}
.logo i.odd{
  background: var(--odd);
  box-shadow: 0 4px 0 var(--odd-edge);
  transform: translateY(-8px) rotate(14deg);
}
.logo-spin i.odd{ animation: hop 1.1s ease-in-out infinite; }
@keyframes hop{
  0%, 100% { transform: translateY(-8px) rotate(14deg); }
  50% { transform: translateY(-14px) rotate(-10deg); }
}

/* ---- type ---- */

.heading{ font-size: 1.6rem; margin: 0; font-weight: 900; letter-spacing: -0.01em; }
.lede{ margin: 0; font-size: 1.05rem; color: var(--muted); }

/* ---- buttons ---- */
button:focus-visible{ outline-color: var(--odd); }
.big{
  appearance: none; border: 0; width: 100%;
  border-radius: 16px;
  background: var(--blue);
  box-shadow: 0 5px 0 var(--blue-edge);
  color: #fff;
  font-size: clamp(1.05rem, 2.6vh, 1.25rem); font-weight: 900;
  padding: clamp(11px, 2vh, 16px) 20px;
  margin-bottom: 5px;
  transition: transform 0.06s, box-shadow 0.06s;
}
.big:active{ transform: translateY(4px); box-shadow: 0 1px 0 var(--blue-edge); }

.soft:active{ transform: translateY(3px); box-shadow: 0 1px 0 var(--surface-edge); }

/* ---- menu ---- */
.panel{
  background: var(--surface);
  border: 1.5px solid var(--surface-edge);
  border-radius: 20px;
  padding: clamp(10px, 1.8vh, 14px) 16px;
  display: flex; flex-direction: column; gap: clamp(6px, 1.2vh, 10px);
  min-height: 0;
  flex: 0 1 auto;
}
/* only scrolls if a huge group won't fit, which a small server never reaches */

/* ---- game ---- */
.game{ justify-content: flex-start; }
.hud{ display: flex; align-items: center; gap: 12px; flex: none; }
.progress{ flex: 1; display: grid; gap: 6px; }
.bars{ list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.bars li{ height: 7px; border-radius: 4px; background: var(--surface-edge); }
.bars li.done{ background: var(--right); }
.bars li.now{ background: var(--odd); }
.penalty{
  font-weight: 900; color: #fff; background: var(--wrong);
  border-radius: 999px; padding: 3px 10px; font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.clock-wrap{ display: flex; justify-content: center; flex: none; }
.clock{
  margin: 0;
  font-size: min(17vw, clamp(2.2rem, 8.5vh, 4.4rem));
  font-weight: 900; line-height: 1; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.clock.frozen{ color: var(--muted); }
.prompt{ margin: -4px 0 0; text-align: center; color: var(--muted); font-weight: 700; font-size: clamp(0.85rem, 2vh, 1rem); flex: none; }

.tiles{
  flex: 1 1 auto; min-height: 0; max-height: 470px;
  display: grid; grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: clamp(6px, 1.4vh, 12px);
  padding-bottom: 5px;
}
.tile{
  appearance: none; width: 100%;
  min-height: 0; height: 100%; padding: 4px 16px;
  border: 0; border-radius: clamp(12px, 2vh, 16px);
  background: var(--tile); color: var(--tile-ink);
  box-shadow: 0 5px 0 var(--tile-edge);
  font-size: clamp(1rem, 3.1vh, 1.35rem); font-weight: 900; line-height: 1.1;
  touch-action: manipulation;
  transition: transform 0.06s, box-shadow 0.06s;
}
.tile:active:not(:disabled){ transform: translateY(4px); box-shadow: 0 1px 0 var(--tile-edge); }
.tile:disabled{ cursor: default; }
.tile.wrong{
  background: transparent; color: var(--muted);
  box-shadow: inset 0 0 0 2px var(--surface-edge);
  text-decoration: line-through; text-decoration-thickness: 3px; text-decoration-color: var(--wrong);
  transform: translateY(5px);
}
.tile.right{
  background: var(--odd); color: #2a1c00;
  box-shadow: 0 5px 0 var(--odd-edge);
  animation: pop 0.35s ease-out;
}
.tile.shake{ animation: shake 0.3s; }
/* a picture round: six drawn pictures, two across and three down */
.tiles.pics{ grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, minmax(0, 1fr)); }
.tile.pic{ padding: 8px; display: flex; align-items: center; justify-content: center; }
.tile.pic svg{ height: 100%; max-height: 100%; width: auto; max-width: 100%; aspect-ratio: 1; pointer-events: none; }
.tile.pic.wrong svg{ opacity: 0.3; filter: grayscale(1); }
.tile.pic.wrong{ text-decoration: none; background: transparent; position: relative; }
.tile.pic.wrong::after{ content: ""; position: absolute; left: 14%; right: 14%; top: 50%; border-top: 4px solid var(--wrong); transform: rotate(-35deg); }
@keyframes shake{
  20% { transform: translate(-7px, 5px); }
  60% { transform: translate(7px, 5px); }
}
@keyframes pop{
  40% { transform: scale(1.05) rotate(-2deg); }
}
.tiles.fresh .tile{ animation: rise 0.25s ease-out both; }
.tiles.fresh .tile:nth-child(2){ animation-delay: 0.03s; }
.tiles.fresh .tile:nth-child(3){ animation-delay: 0.06s; }
.tiles.fresh .tile:nth-child(4){ animation-delay: 0.09s; }
.tiles.fresh .tile:nth-child(5){ animation-delay: 0.12s; }
@keyframes rise{ from { opacity: 0; transform: translateY(10px); } }

/* keeps its space even when empty, so nothing jumps */

/* ---- paused ---- */
.pause-badge{ --pause-bg: var(--odd); --pause-edge: var(--odd-edge); --pause-ink: #2a1c00; }   /* the rest of the Paused screen: pause.css (shared) */

/* ---- results ---- */
.stamp{
  margin-top: 4px; padding: 4px 12px; border-radius: 999px;
  background: var(--right); color: #fff; font-weight: 900; font-size: 0.9rem;
  transform: rotate(-3deg);
}
.stamp[hidden]{ display: none; }
.review{
  margin: 0; padding: 0; list-style: none;
  display: grid; grid-template-rows: repeat(5, minmax(0, 1fr)); gap: clamp(5px, 1.2vh, 10px);
  flex: 1 1 auto; min-height: 0; max-height: 330px;
}
.review li{ min-height: 0; }
.review button{
  appearance: none; width: 100%; height: 100%; min-height: 0; text-align: left;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  background: var(--surface);
  border: 1.5px solid var(--surface-edge);
  border-radius: 14px;
  font-weight: 800; font-size: clamp(0.85rem, 2.2vh, 1rem);
}
.review .num{ color: var(--muted); font-weight: 800; flex: none; }
.review .ans{
  padding: 2px 9px; border-radius: 8px; background: var(--odd); color: #2a1c00;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.review .level{ flex: none; margin: 0; padding: 2px 8px; font-size: 0.68rem; line-height: 1.3; }
.review .time{ margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; white-space: nowrap; flex: none; }
.review .time .x{ color: var(--wrong); }
.words{ display: flex; flex-wrap: wrap; gap: 6px; }
.words .w{
  padding: 4px 10px; border-radius: 8px;
  background: var(--bg); color: var(--muted);
  font-weight: 700;
}
.words .w.odd{ background: var(--odd); color: #2a1c00; }
.why{ margin: 0; color: var(--muted); }
.why b{ color: var(--ink); }

/* ---- sheets ---- */

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation: none !important; transition: none !important; }
}

/* ---- terms and privacy pages ---- */

.doc p, .doc li{ color: var(--ink); }
.doc a{ color: var(--blue); }

/* the explanation box keeps its space between rounds */

/* results rows look and feel like the game's other buttons, with an arrow */
.review button{
  box-shadow: 0 4px 0 var(--surface-edge);
  margin-bottom: 4px;
  transition: transform 0.06s, box-shadow 0.06s;
}
.review button:active{ transform: translateY(3px); box-shadow: 0 1px 0 var(--surface-edge); }
.review .chev{
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: var(--muted); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
}

/* centred titles everywhere */
.heading{ text-align: center; }

/* how to play: one short line per rule, each with a small tile icon */

.ri{
  flex: none; width: 38px; height: 38px; border-radius: 11px;
  background: var(--tile); box-shadow: 0 4px 0 var(--tile-edge);
  display: grid; place-items: center;
}
.ri-wrong{ background: var(--wrong); box-shadow: 0 4px 0 #b7473a; }
.ri-wrong svg{ stroke: #fff; }
.ri:not(.ri-odd):not(.ri-wrong){ border: 1.5px solid var(--surface-edge); }

/* round details: the five words as a neat stack of mini tiles, like the game */

/* one feel throughout: headings, single lines and messages are centred;
   lists that line up in columns (rules, players, rounds) stay left-aligned so they're easy to scan */
.lede, .quiet, .date, .today-line, .prompt, .breakdown, .why{ text-align: center; }
#next-board{ text-align: center; }
/* keep "Round 3 of 5" in the true middle of the screen */
.hud{ display: grid; grid-template-columns: 56px 1fr 56px; }
.hud .penalty{ justify-self: end; }
.hud .penalty[hidden]{ display: none; }

/* testing mode: a strip across the top of every screen */
.test-banner{
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  padding: calc(env(safe-area-inset-top) + 5px) 12px 5px;
  background: repeating-linear-gradient(-45deg, var(--odd) 0 14px, #f5c25c 14px 28px);
  color: #2b1d00; font-weight: 900; font-size: 13px; letter-spacing: .04em;
  text-align: center; text-transform: uppercase; box-shadow: 0 2px 0 var(--odd-edge);
}

body.testing #app{ padding-top: calc(env(safe-area-inset-top) + 36px); }

/* leaderboard */

/* ---- panels (How to play, stats, leaderboard, round review) fill the screen ---- */
.back{ display: inline-flex; align-items: center; gap: 4px; border: 0; background: var(--bg); color: var(--ink); font: inherit; font-weight: 900; padding: 5px 12px 5px 6px; margin-left: 0; min-height: 32px; box-sizing: border-box; border-radius: 12px; cursor: pointer; }

/* test banner sits at the bottom, clear of Discord's own buttons at the top */
.test-banner{ top: auto; bottom: 0; padding: 5px 12px calc(env(safe-area-inset-bottom) + 5px); box-shadow: 0 -2px 0 var(--odd-edge); }
body.testing #app{ padding-top: max(clamp(10px, 2.2vh, 20px), env(safe-area-inset-top)); padding-bottom: calc(env(safe-area-inset-bottom) + 36px); }

/* the round's difficulty, shown beside the question */
.level{
  display: inline-block; margin-right: 8px; padding: 1px 10px; border-radius: 999px;
  font-size: 0.85em; font-weight: 900; color: #fff; vertical-align: 1px;
}
.level[hidden]{ display: none; }
.level.easy{ background: #2e9b63; }
.level.medium{ background: #5b86f0; }
.level.hard{ background: #e2604f; }

/* ---- tutorial ---- */

.tut-dots li.on{ width: 22px; background: var(--odd); }
.tut-dots li.past{ background: var(--right); }

.tut-stage{ flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: clamp(6px, 1.4vh, 12px); }
.tut-stage .tiles{ flex: 1 1 auto; max-height: 380px; }
.tut-stage .tile{ font-size: clamp(0.95rem, 2.7vh, 1.2rem); }
.tut-pills{ display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.tut-pills .level{ margin: 0; font-size: 1rem; padding: 4px 14px; }
.tut-card{
  background: var(--surface); border: 1.5px solid var(--surface-edge); border-radius: 18px;
  padding: 14px 16px; display: grid; gap: 10px;
}
.tut-card .row{ display: flex; align-items: center; gap: 12px; font-weight: 700; }
.tut-card .row .ri{ flex: none; }

.tut-note.good{ color: var(--right-edge); }
.tut-note.bad{ color: var(--wrong); }

/* Discord on phones covers the top of the game with its own bar: keep clear of it */

/* the clock runs but is hidden while playing; the words get the extra room */
.clock-wrap[hidden]{ display: none; }

/* ---- shared tidy-up: key information sits in the middle of the screen ---- */
/* tutorial: progress dots in the middle, Skip on the right */
.tut-top .tut-dots{ justify-self: center; }

.tut-stage{ align-items: stretch; text-align: center; }
.tut-card .quiet{ text-align: center; }
.lede[hidden], .breakdown[hidden]{ display: none; }
/* How to play, stats and round panels: Back at the top, the content centred below it
   (the leaderboard stays top-aligned so the tabs don't jump when lists change length) */
.tut-card .row{ text-align: left; }

/* tutorial: Back on the left, Next on the right */

.big.secondary:active{ box-shadow: 0 1px 0 var(--surface-edge); }
.big.secondary:disabled{ opacity: 0.4; }

/* tutorial: a preview of the results screen */
.tut-result{ justify-items: center; text-align: center; gap: 6px; padding: 18px 16px; }
.tut-result .k{ font-weight: 800; color: var(--muted); }
.tut-result .tt{ font-size: clamp(2.2rem, 7vh, 3.2rem); font-weight: 900; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.tut-result .pen-line{ font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.tut-result .pen-line b{ color: var(--wrong); }
.tut-review{ width: 100%; max-height: none; margin-top: 8px; display: grid; grid-template-rows: none; gap: 6px; }
.tut-review .row-in{
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; text-align: left;
  background: var(--bg); border-radius: 12px; font-weight: 800; font-size: 0.95rem;
}

.today-line[hidden]{ display: none; }
/* the progress bars carry "round 3 of 5" on their own; the level sits in the middle under them */
.progress{ align-self: center; }

/* stats: small grouped rows, so the whole page fits without scrolling */

/* test mode: choose the level */
.pick-level{ display: grid; gap: 6px; }
.pick-level[hidden]{ display: none; }
.pick-row{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pick-row .level{
  margin: 0; border: 0; cursor: pointer; padding: 7px 2px; font-size: clamp(0.72rem, 3.3vw, 0.85rem);
  white-space: nowrap; opacity: 0.45; box-shadow: 0 3px 0 rgb(0 0 0 / 0.25);
}
.pick-row .level[aria-pressed="true"]{ opacity: 1; outline: 2.5px solid var(--ink); outline-offset: 2px; }
.pick-row .level:disabled{ cursor: wait; }

/* ---- big screens (desktop, tablet): the whole game grows with the window instead of staying phone-sized ---- */
@media (min-height: 800px) and (min-width: 760px){
  html{ font-size: clamp(16px, 2vh, 26px); }
  body{ font-size: clamp(17px, 2.1vh, 28px); }
  .screen{ max-width: clamp(440px, 56vh, 760px); }
}

/* ---- settings ---- */

:root[data-theme="dark"]{ color-scheme: dark; }

/* sheets scroll when their content doesn't fit (a long leaderboard, a phone on its side) rather than being cut off */

/* the tutorial on a short screen: tighter text and buttons so the steps still fit */
@media (max-height: 480px){
  .tut{ gap: 6px; }
  .tut .heading{ font-size: 1.25rem; }
  .tut .lede{ font-size: 0.95rem; line-height: 1.3; }
  .tut-nav .big{ padding-top: 9px; padding-bottom: 9px; min-height: 0; }
  .tut-note{ min-height: 0; margin: 0; }
}

/* shown on the first tutorial step for players who have been through an older tutorial */

@media (max-height: 480px){ .tut-updated{ padding: 2px 10px; font-size: 0.72rem; } }

/* ---- colour-blind mode: blue and orange instead of green and red, with a mark beside the colour ---- */
:root[data-cb="1"] .tile.wrong, :root[data-cb="1"] .tiles .wrong{ outline: 3px dashed var(--wrong); outline-offset: -3px; }
:root[data-cb="1"] .tile.right, :root[data-cb="1"] .tiles .right{ outline: 3px solid var(--right); outline-offset: -3px; }

.review .time .tag{ margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--surface-edge); color: var(--muted); font-size: 0.7rem; font-weight: 900; letter-spacing: 0.02em; }

/* ---- practice: a blue strip along the bottom ---- */

/* Practice: a quiet button, almost the colour of the page, so the eye stays on Play and Results */

/* Settings: 'Our other games' pinned to the bottom, the same in every game */

/* Practice: a pop-up with the game's levels, like the language pop-up */

/* Podium rows on the leaderboard: gold, silver and bronze behind the whole row */
   /* same inset on every row so the podium colour has room and names still line up */

/* other games: a button on the menu opens a popup with the other games' app icons */

          /* the main block sits centred between the top and the two buttons, which stay at the bottom */

/* today's leaderboard, locked until today's puzzle is finished */

/* every panel ends with one blue Close button at the bottom (there is no Back button at the top) */
   /* the last leaderboard row always clears the Close button */

/* Surrender: a quiet red link on the pause screen, and the red "Surrendered" on the leaderboard and menu */

/* Languages are switched off (LANGUAGES_ON in client/i18n.js): no Language button, no leaderboard flag */
/* every panel: the content sits in the vertical middle and only the Close button stays at the bottom */

/* Other games on a short screen (a phone on its side): three across, so all the games and Close fit without scrolling */
@media (max-height: 520px){
  .other-games{ grid-template-columns: repeat(3, 1fr); gap: 8px 12px; }
  .other-games img{ width: clamp(40px, 15vh, 64px); }
  .other-games button{ gap: 4px; }
}

/* a phone on its side: the menu and the result screen are taller than the screen, so they scroll from the top (they used to be cut off at both ends) */
@media (max-height: 520px){
  .screen.menu, .screen.done{ overflow-y: auto; overscroll-behavior: contain; justify-content: flex-start; padding-bottom: 8px; }
}

/* the menu card: the rounds are the headline, the level, time and mistakes are small pills under it */
.today-line{ display: grid; gap: 6px; justify-items: center; }
.tl-key{ font-size: 1.15rem; font-weight: 900; color: var(--ink); }
.tl-pills{ display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.tl-pills .level{ margin: 0; }
.pill{ display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 0.85em; font-weight: 900; font-variant-numeric: tabular-nums; background: var(--surface-edge); color: var(--ink); vertical-align: 1px; }
.pill.good{ background: #2e9b63; color: #fff; }
.pill.bad{ background: #e2604f; color: #fff; }

/* colour-blind mode: the level colours come from the shared base.css; the good / bad pills follow the same blue / vermilion */
:root[data-cb="1"] .pill.good{ background: #0072b2; }
:root[data-cb="1"] .pill.bad{ background: #d55e00; }

/* this game's own level colour in the stats */
