/* Word Mash
   Same family as the other games: navy dotted table, cream tiles, chunky buttons, round font.
   Dark-first, with a light version.  */

:root{
  --bg: #e3ebf3;
  --bg-dot: #cfdbe7;
  --surface: #ffffff;
  --surface-edge: #cbd8e5;
  --ink: #152230;
  --muted: #5b6f84;
  --tile: #f4e9cf;
  --tile-ink: #3a2f17;
  --tile-edge: #cbb98f;
  --accent: #3e6fe0;
  --accent-edge: #2a52b3;
  --good: #2fae6c;
  --bad: #e2604f;
  /* the logo colours, from the family's neon set */
  --p0: #ffb000; --p0e: #b87d00;
  --p1: #00e5ff; --p1e: #00a3b8;
  --p2: #b6ff1a; --p2e: #7fb30e;
  --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: #111c26;
  --bg-dot: #1a2835;
  --surface: #182633;
  --surface-edge: #24384a;
  --ink: #eef3f8;
  --muted: #8ea2b6;
  --accent: #5b86f0;
  --accent-edge: #3b63c7;
  --good: #4fc28c;
  --bad: #ee6f5f;
}

*{ 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; }   /* 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: two 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: #111c26; box-shadow: 0 3px 0 var(--e);
  display: grid; place-items: center;
  font-style: normal; font-weight: 500; font-size: clamp(0.95rem, 2.4vh, 1.25rem);
}
.logo i.c0{ --c: var(--p0); --e: var(--p0e); }
.logo i.c1{ --c: var(--p1); --e: var(--p1e); }
.logo b{ width: clamp(10px, 1.8vh, 14px); height: clamp(10px, 1.8vh, 14px); border-radius: 50%; background: var(--p2); box-shadow: 0 0 10px var(--p2); 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; }
.logo-spin i{ animation: hop 1.2s ease-in-out infinite; }
.logo-spin i:nth-child(2){ animation-delay: 0.15s; }
.logo-spin b{ animation: blink 1.2s ease-in-out infinite 0.3s; }
@keyframes hop{ 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes blink{ 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ---- letter tag ---- */
.letter-tag{ display: inline-block; padding: 2px 12px; border-radius: 999px; background: var(--tile, #f4e9cf); color: #3a2f17; font-weight: 900; font-size: 0.85rem; letter-spacing: 0.02em; }

/* ---- menu: the layout (the screen column, today card, button rows) is shared: shared/public/base.css and menu-layout.css ---- */

/* the puzzle: the letter and where it goes */
.pattern{ display: flex; gap: 6px; justify-content: center; align-items: center; }
.slot{ width: clamp(30px, 8vw, 38px); height: clamp(34px, 9vw, 42px); border-radius: 9px; display: grid; place-items: center; font-style: normal; color: var(--muted); font-weight: 500; }
.slot.on{
  border: 0; background: var(--tile); color: var(--tile-ink); box-shadow: 0 4px 0 var(--tile-edge);
  font-size: clamp(1.4rem, 4vh, 1.9rem); width: clamp(42px, 11vw, 52px); height: clamp(48px, 12.5vw, 58px); border-radius: 12px; text-transform: uppercase;
}
.rule{ margin: 0; text-align: center; font-weight: 800; }

/* ---- the game ---- */
.game{ justify-content: flex-start; gap: clamp(6px, 1.2vh, 10px); }
.hud{ display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; flex: none; }
.timer{ text-align: center; font-weight: 900; font-size: clamp(1.5rem, 4.4vh, 2rem); line-height: 1; font-variant-numeric: tabular-nums; }
.timer.low{ color: var(--bad); animation: blink 1s ease-in-out infinite; }
.count-pill{ display: inline-flex; align-items: center; gap: 5px; padding: 2px 12px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--surface-edge); font-weight: 900; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.meter{ height: 8px; border-radius: 4px; background: var(--surface-edge); overflow: hidden; flex: none; }
.meter i{ display: block; height: 100%; width: 100%; background: var(--accent); border-radius: 4px; transform-origin: left; }
.meter.low i{ background: var(--bad); }
.game .pattern{ flex: none; margin-top: 2px; }
.game .rule{ flex: none; font-size: 0.9rem; color: var(--muted); }
.typed{
  flex: none; min-height: clamp(46px, 8vh, 60px); display: grid; place-items: center;
  border-radius: 14px; background: var(--surface); border: 1.5px solid var(--surface-edge);
  font-weight: 500; font-size: clamp(1.6rem, 4.6vh, 2.1rem); text-transform: uppercase; padding: 0 12px; overflow: hidden;
}
.typed .w{ display: inline-block; white-space: nowrap; letter-spacing: 0.06em; }
.typed .w::after{ content: ""; display: inline-block; width: 3px; height: 1.05em; margin-left: 3px; vertical-align: -0.15em; background: var(--accent); animation: blink 1s steps(2) infinite; }
.typed.empty .w::after{ margin-left: 0; }
.typed.shake{ animation: shake 0.4s; }
@keyframes shake{ 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.found-wrap{ position: relative; flex: 1 1 0; min-height: 0; }
.found{
  position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; align-content: flex-start;
  display: flex; flex-wrap: wrap; gap: 6px; scrollbar-width: thin; scrollbar-color: var(--surface-edge) transparent;
}
.chip{ padding: 3px 10px; border-radius: 10px; background: var(--surface); border: 1.5px solid var(--surface-edge); font-weight: 800; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.03em; animation: pop 0.18s ease-out; }
.chip.pending{ opacity: 0.5; }
.chip.new{ border-color: var(--good); }
@keyframes pop{ from { transform: scale(0.7); opacity: 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); }

/* ---- 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; }
.done .found-wrap{ flex: 1 1 0; }
.done .found{ justify-content: center; }
.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; }

/* ---- panels fill the whole screen ---- */
@keyframes slide-in{ from { transform: translateX(30px); opacity: 0; } }

.rules-list{ list-style: none; margin: 0; 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); }
.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; }

/* ---- leaderboard ---- */

/* ---- 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); }

/* ---- 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); }

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

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

/* Surrender: a quiet red link under the rule while playing, and the red "Surrendered" on the menu, board and results */
.surrender{ flex: none; align-self: center; background: none; border: 0; padding: 2px 12px; font: inherit; font-size: 0.85rem; font-weight: 700; color: var(--bad); cursor: pointer; }
.surrender.sure{ font-weight: 900; }
.surrender[hidden]{ display: none; }

/* Your stats (same look as the other games) */

/* leaderboard pictures */

/* Colour-blind mode: blue and orange in place of green and red */
:root[data-cb="1"]{ --good: #0072b2; --bad: #d55e00; }
:root[data-cb="1"] .chip.new{ border-style: dashed; }

/* result screen: "Game complete", the player's own words, and 10 more they could have entered */
.done-head .complete{ margin: 0; font-size: 1.05rem; font-weight: 900; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.list-h{ margin: 0; text-align: center; color: var(--muted); font-weight: 800; font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; flex: none; }
.list-h[hidden]{ display: none; }
.could-wrap{ flex: none; display: grid; gap: 6px; }
.could-wrap[hidden]{ display: none; }
.could{ display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.chip.mine{ border-color: var(--good); background: var(--surface); }
.chip.sug{ background: transparent; border: 1.5px dashed var(--surface-edge); color: var(--muted); font-weight: 700; animation: none; }

/* 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 result screens scroll from the top, and the game screen gets a shorter keyboard (it was cut off top and bottom) */
@media (max-height: 520px){
  .screen.menu, .screen.done{ overflow-y: auto; overscroll-behavior: contain; justify-content: flex-start; padding-bottom: 8px; }
  .game{ gap: 4px; }
  .game .pattern{ display: none; }
  .typed{ min-height: 34px; height: 34px; }
}

/* After surrendering, every game says SURRENDERED in red. */

/* Phones and tablets: their own keyboard instead of the on-screen one. A see-through text box covers the word; tapping the word raises the keyboard. */
#typed{ position: relative; }
#native{ position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; font-size: 16px; }   /* 16px: iPhones zoom in on anything smaller */
.native-kb .typed.empty:not(:focus-within) .w::after{ display: none; }
.native-kb .typed.empty:not(:focus-within)::after{ content: "Tap here to type"; position: absolute; left: 0; right: 0; text-align: center; font-size: .42em; font-weight: 700; opacity: .5; letter-spacing: .04em; pointer-events: none; }

/* the leaderboard rows look the same as in the other games */

/* the splash that shows today's rule before the daily puzzle */
.splash{ gap: clamp(10px, 2vh, 18px); }
.splash-k{ margin: 0; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.splash .rule{ font-size: 1.15rem; }
.splash-buttons{ width: 100%; display: grid; gap: 10px; margin-top: clamp(8px, 2vh, 20px); }
.splash .pattern{ transform: scale(1.8); margin: 18px 0; }

/* ---- splash: tidy (same look as Number Smash) ---- */
.splash{ gap: 0; }
.splash-k{ font-size: 0.8rem; letter-spacing: 0.16em; }
.splash .pattern.splash-letter{ transform: none; margin: 14px 0 18px; }
.splash .splash-letter .slot.on{ width: 64px; height: 76px; font-size: 2.4rem; border-radius: 16px; }
.splash-title{ margin: 0; font-size: clamp(1.5rem, 7vw, 2rem); font-weight: 900; line-height: 1.1; text-align: center; text-wrap: balance; }
.splash-sub{ margin: 6px 0 0; color: var(--muted); font-weight: 700; }
.splash-facts{ display: flex; gap: 8px; width: 100%; margin: 22px 0 12px; }
.splash-facts div{ flex: 1 1 0; min-width: 0; padding: 12px 6px 10px; border-radius: 16px; background: var(--surface, #1a2735); border: 1px solid var(--surface-edge, #26384a); display: grid; justify-items: center; gap: 2px; }
.splash-facts b{ font-size: 1.7rem; font-weight: 900; line-height: 1; }
.splash-facts span{ color: var(--muted); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; text-align: center; }
.splash .quiet.small{ margin: 0; }
.splash-buttons{ margin-top: clamp(14px, 3vh, 28px); }

/* loading screen: the Word Mash logo, spinning */
.wm-spin { display: block; width: clamp(120px, 38vw, 180px); height: auto; animation: wm-spin 1.6s linear infinite; filter: drop-shadow(0 8px 16px rgb(0 0 0 / 0.3)); }
@keyframes wm-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .wm-spin { animation-duration: 6s; } }

/* a three-letter ending (ING, RED) in the letter tile */
.slot.long { width: auto; min-width: clamp(58px, 17vw, 78px); padding: 0 12px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 800; }
.splash .splash-letter .slot.on.long { width: auto; min-width: 96px; padding: 0 18px; font-size: 2rem; }
.card-note:empty{ display: none; }
