/* Zerdle: the standard family tokens in Zerdle's own colours (green, yellow, slate), then the board and keyboard. */
:root{
  --bg: #ffffff;
  --bg-dot: #eceef0;
  --surface: #f1f2f4;
  --surface-edge: #d3d6da;
  --ink: #1a1a1b;
  --muted: #5f666d;
  --tile: #d9dce0;
  --tile-ink: #1a1a1b;
  --tile-edge: #b9bdc2;
  --accent: #2fa84f;
  --accent-edge: #1f7a37;
  --good: #2fa84f;
  --bad: #e5484d;
  --correct: #2fa84f;
  --present: #f7c600;
  --absent: #787c7e;
  --filled: #878a8c;
  --keyabs: #ffffff;
  --p0: #2fa84f; --p0e: #1f7a37;
  --p1: #f7c600; --p1e: #b08f00;
  --p2: #46586a; --p2e: #34495a;
  --font: "Outfit", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
:root[data-theme="dark"]{
  --bg: #111b24;
  --bg-dot: #1a2835;
  --surface: #1a2733;
  --surface-edge: #34495a;
  --ink: #ffffff;
  --muted: #8fa3b5;
  --tile: #243442;
  --tile-ink: #ffffff;
  --tile-edge: #34495a;
  --absent: #46586a;
  --filled: #5d7488;
  --keyabs: #9db0c0;
}
/* a chosen theme (Settings > Theme) colours the letters too: right place = the theme's accent, wrong place = a lighter/softer tint of it, not in the word = the theme's tile colour */
html[data-skin]:not([data-skin=""]){ --correct: var(--accent); --present: color-mix(in srgb, var(--accent) 40%, var(--ink)); --absent: var(--cell); --filled: var(--muted); --keyabs: var(--muted); --tile: var(--cell); --tile-ink: var(--ink); --tile-edge: var(--cell-edge); }
html[data-skin]:not([data-skin=""]) :is(.tile.correct, .key.correct, .ri.ok){ color: var(--on-accent); }
html[data-skin]:not([data-skin=""]) :is(.tile.present, .key.present, .ri.warn, .hard-tag){ color: var(--bg); }
html[data-skin]:not([data-skin=""]) :is(.tile.absent, .ri.off){ color: var(--ink); }
/* colour-blind mode (the shared setting): orange and light blue instead of green and yellow (wins over a theme) */
html:root[data-cb="1"]{ --correct: #f5793a; --present: #85c0f9; }
html:root[data-cb="1"] :is(.tile.correct, .key.correct){ color: #fff; }
html:root[data-cb="1"] :is(.tile.present, .key.present, .help-tiles .y){ color: #111b24; }

*{ box-sizing: border-box; }
html, body{ margin: 0; height: 100%; overflow: hidden; }
body{
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dot) 1.2px, transparent 1.3px);
  background-size: 18px 18px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

/* ---- type ---- */
.title{ font-size: clamp(1.8rem, 6vh, 2.5rem); line-height: 1; margin: clamp(8px, 1.6vh, 14px) 0 0; font-weight: 900; letter-spacing: -0.03em; text-align: center; }
.heading{ font-size: 1.6rem; margin: 0; font-weight: 900; letter-spacing: -0.01em; text-align: center; }
.lede{ margin: 0; font-size: 1.05rem; color: var(--muted); text-align: center; }
.small{ font-size: 0.9rem; }

/* ---- buttons ---- */
button{ font: inherit; color: inherit; cursor: pointer; }
button:focus-visible{ outline-color: var(--p1); }
.big{
  appearance: none; border: 0; width: 100%;
  border-radius: 16px;
  background: var(--accent);
  box-shadow: 0 5px 0 var(--accent-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:not(:disabled){ transform: translateY(4px); box-shadow: 0 1px 0 var(--accent-edge); }
.big:disabled{ opacity: 0.45; }
.big.secondary{ background: var(--surface); color: var(--ink); border: 1.5px solid var(--surface-edge); box-shadow: 0 5px 0 var(--surface-edge); }
.big.secondary:active:not(:disabled){ box-shadow: 0 1px 0 var(--surface-edge); }
.soft:active:not(:disabled){ transform: translateY(3px); box-shadow: 0 1px 0 var(--surface-edge); }
.soft:disabled{ opacity: 0.5; }
.soft[hidden], .big[hidden], .lede[hidden]{ display: none; }
.rank-line[hidden]{ display: block; visibility: hidden; }   /* the space is kept, so the line appearing never moves the screen */
.link{ appearance: none; border: 0; background: none; color: var(--muted); font-weight: 700; padding: 8px; }

/* ---- the name: three tiles and a light ---- */
.logo{ display: flex; gap: 5px; justify-content: center; align-items: center; }
.logo i{
  width: clamp(24px, 4.2vh, 34px); height: clamp(26px, 4.6vh, 37px); border-radius: 7px;
  background: var(--c); color: #fff; box-shadow: 0 3px 0 var(--e);
  display: grid; place-items: center;
  font-style: normal; font-weight: 900; font-size: clamp(1.1rem, 3vh, 1.5rem);
}
.logo i.c0{ --c: #2fa84f; --e: #1f7a37; }
.logo i.c1{ --c: #f7c600; --e: #b08f00; color: #111b24; }
.logo i.c2{ --c: #46586a; --e: #34495a; }
.logo b{ width: clamp(10px, 1.8vh, 14px); height: clamp(10px, 1.8vh, 14px); border-radius: 50%; background: #f7c600; box-shadow: 0 0 10px #f7c600; margin-left: 3px; }
.big-logo{ gap: 7px; }
.big-logo i{ width: clamp(48px, 13vw, 62px); height: clamp(52px, 14vw, 67px); font-size: clamp(1.6rem, 4.6vh, 2.1rem); border-radius: 12px; box-shadow: 0 5px 0 var(--e); }
.big-logo b{ width: 16px; height: 16px; margin-left: 4px; }
.small-logo{ gap: 3px; }
.small-logo i{ width: 22px; height: 26px; font-size: 0.85rem; border-radius: 6px; box-shadow: 0 2px 0 var(--e); }
.small-logo b{ width: 8px; height: 8px; margin-left: 2px; }
.logo-spin i{ animation: hop 1.2s ease-in-out infinite; }
.logo-spin i:nth-child(2){ animation-delay: 0.15s; }
.logo-spin i:nth-child(3){ animation-delay: 0.3s; }
.logo-spin b{ animation: blink 1.2s ease-in-out infinite 0.45s; }
@keyframes hop{ 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes blink{ 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

.letter-tag{ display: inline-block; padding: 2px 12px; border-radius: 999px; background: var(--tile); color: var(--ink); font-weight: 900; font-size: 0.85rem; letter-spacing: 0.02em; }
.hard-tag{ display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--present); color: #111b24; font-weight: 900; font-size: 0.72rem; letter-spacing: 0.06em; }
.hard-tag[hidden]{ display: none; }

/* ---- the game: header, board, keyboard ---- */
.game{ justify-content: flex-start; gap: clamp(4px, 1vh, 8px); }
.zhud{ display: flex; gap: 8px; align-items: center; flex: none; }
.pause-btn{ margin-left: auto; width: 36px; height: 36px; border-radius: 11px; border: 1.5px solid var(--surface-edge); background: var(--surface); color: var(--ink); display: grid; place-items: center; padding: 0; }
.pause-btn svg{ fill: currentColor; }
#board-wrap{ position: relative; flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
#guess-board{ display: grid; grid-template-rows: repeat(6, 1fr); gap: 6px; width: min(100%, 330px); aspect-ratio: 5 / 6; max-height: 100%; }
.row{ display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tile{ border: 2px solid var(--surface-edge); border-radius: 10px; display: grid; place-items: center; font-weight: 900; font-size: clamp(22px, 7vw, 32px); text-transform: uppercase; background: transparent; transition: transform .1s; }
.tile.filled{ border-color: var(--filled); transform: scale(1.04); }
.tile.correct{ background: var(--correct); border-color: var(--correct); color: #fff; }
.tile.present{ background: var(--present); border-color: var(--present); color: #111b24; }
.tile.absent{ background: var(--absent); border-color: var(--absent); color: #fff; }
.tile.flip{ animation: flip .5s ease both; }
@keyframes flip{ 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
.row.shake{ animation: shake .4s; }
@keyframes shake{ 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.row.bounce .tile{ animation: bounce .6s ease both; }
@keyframes bounce{ 0%, 20% { transform: translateY(0); } 40% { transform: translateY(-14px); } 60% { transform: translateY(4px); } 80% { transform: translateY(-4px); } 100% { transform: translateY(0); } }
#toast{
  position: absolute; top: 4px; left: 50%; transform: translate(-50%, -6px); z-index: 3; pointer-events: none; opacity: 0;
  background: var(--ink); color: var(--bg); font-weight: 800; font-size: 0.95rem; padding: 7px 14px; border-radius: 12px;
  white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.35); transition: opacity 0.15s, transform 0.15s;
}
#toast.show{ opacity: 1; transform: translate(-50%, 0); }
#kb{ display: flex; flex-direction: column; gap: 0; flex: none; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6px); }
.kr{ display: flex; gap: 0; justify-content: center; }
/* the gap between keys is a transparent border, so it is part of the key's tap area (no dead spots between keys) */
.key{ flex: 1; max-width: 49px; height: calc(clamp(28px, 9vh, 52px) + 6px); border: 3px solid transparent; border-radius: 12px; background: var(--tile); background-clip: padding-box; color: var(--ink);
  font-weight: 800; font-size: 15px; text-transform: uppercase; cursor: pointer; touch-action: manipulation; padding: 0; }
.key.wide{ flex: 1.6; max-width: 71px; font-size: 12px; }
.key:active{ filter: brightness(1.3); }
.key.correct{ background: var(--correct); color: #fff; }
.key.present{ background: var(--present); color: #111b24; }
.key.absent{ background: var(--absent); color: var(--keyabs); opacity: .55; }
@media (max-height: 460px){ #guess-board{ width: auto; height: 100%; max-height: none; } }
@media (prefers-reduced-motion: reduce){ *, *::before, *::after{ animation: none !important; transition: none !important; } }

/* ---- results ---- */
.done-head{ text-align: center; display: grid; gap: clamp(3px, 0.8vh, 6px); justify-items: center; flex: none; }
.done-head .k{ margin: 0; color: var(--muted); font-weight: 800; }
.final{ margin: 0; font-size: min(18vw, clamp(2.6rem, 10vh, 4.6rem)); font-weight: 900; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.answer-word{ margin: 4px 0 0; font-size: 1.6rem; font-weight: 900; letter-spacing: 0.2em; text-transform: uppercase; color: var(--present); }
.answer-word[hidden]{ display: none; }
.recap-grid{ display: grid; grid-template-rows: repeat(6, 1fr); gap: 5px; width: min(60%, 220px); margin: 6px auto; flex: none; }
.recap-grid .row{ gap: 5px; }
.recap-grid .tile{ border-radius: 7px; font-size: 0.8rem; aspect-ratio: 1; }
.card-note{ margin: 0; text-align: center; color: var(--muted); font-weight: 700; font-size: 0.9rem; min-height: 1.3em; flex: none; }
.done-buttons{ display: grid; gap: 8px; flex: none; }
.done-head .complete{ margin: 0; font-size: 1.05rem; font-weight: 900; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }

/* ---- the How to play sheet ---- */
.rules-list{ list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: clamp(8px, 1.6vh, 14px); }
.rules-list li{ display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: clamp(0.9rem, 2.1vh, 1rem); line-height: 1.3; }
.rules-list b{ color: var(--ink); }
.rules-list b.c-correct{ color: var(--correct); }
.rules-list b.c-present{ color: var(--present); }
.ri{ flex: none; width: 38px; height: 38px; border-radius: 11px; background: var(--tile); color: var(--tile-ink); box-shadow: 0 4px 0 var(--tile-edge); display: grid; place-items: center; font-weight: 900; font-size: 1rem; }
.ri svg{ width: 22px; height: 22px; fill: none; stroke: var(--tile-ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ri.ok{ background: var(--correct); color: #fff; box-shadow: none; }
.ri.warn{ background: var(--present); color: #111b24; box-shadow: none; }
.ri.off{ background: var(--absent); color: #fff; box-shadow: none; }
.help-tiles{ display: none; }

/* ---- the Hard Mode row in Settings ---- */
.set-sub{ display: block; color: var(--muted); font-size: 0.78rem; font-weight: 600; margin-top: 2px; }

/* ---- pop-ups: Other games ---- */
.other-games{ display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; justify-items: center; }
.other-games button{ display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0; border: 0; background: none; cursor: pointer; color: var(--ink); font-weight: 800; font-size: 0.85rem; }
.other-games img{ width: clamp(64px, 22vw, 84px); height: auto; aspect-ratio: 1; border-radius: 22%; display: block; box-shadow: 0 3px 0 rgba(0,0,0,0.25); }
.other-games button:active{ transform: translateY(2px); }
@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; }
  .screen.menu, .screen.done{ overflow-y: auto; overscroll-behavior: contain; justify-content: flex-start; padding-bottom: 8px; }
}

/* ---- testing mode and practice: a strip along the bottom ---- */
.test-banner{
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  padding: 5px 12px calc(env(safe-area-inset-bottom) + 5px);
  background: repeating-linear-gradient(-45deg, #f2b23a 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 #c98a14;
}
.test-banner[hidden]{ display: none; }
body.testing #app{ padding-bottom: calc(env(safe-area-inset-bottom) + 36px); }

/* Surrender: the red "Surrendered" */
.surrendered{ color: var(--bad); font-weight: 900; text-transform: uppercase; letter-spacing: .03em; }
