/* Word Nibbles - everything specific to the word game; the shared look
   comes from /theme.css, loaded before this file. */

/* ------------------------------------------------------------------ hud */

/* The screen-filling slack layout comes from theme.css (.game-screen /
   .game-area) - shared with the sudoku. */

/* The HUD (score pill, timer ring, stat pill) lives in theme.css now -
   shared with the sudoku. */

/* --------------------------------------------------------------- word bar */

.wordbar { position: relative; min-height: 54px; display: flex; align-items: center; justify-content: center; }

.current-word {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--surface-3);
  border: 2px solid var(--pink-soft);
  border-radius: 18px;
  padding: 0 20px;
  min-width: 150px;
  text-align: center;
  box-shadow: 0 6px 14px rgba(190, 140, 170, .16);
  transition: color .2s ease, border-color .2s ease;
}

.current-word .placeholder {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--edge-soft);
}

.current-word.valid { color: var(--mint-deep); border-color: var(--mint); }
.current-word.dupe  { color: var(--lavender); border-color: var(--lavender); }
.current-word.bad   { border-color: var(--danger); color: var(--danger); }

/* @keyframes pop-word lives in theme.css - both games use it. */

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.hint-bubble {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 0);
  background: linear-gradient(160deg, var(--lavender), #a78bff);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: 16px;
  box-shadow: 0 8px 18px rgba(150, 120, 220, .35);
  white-space: nowrap;
  cursor: pointer;
  animation: pop-in .35s ease both;
  z-index: 5;
}

.hint-bubble::after {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  margin-left: -7px;
  border: 7px solid transparent;
  border-bottom-color: var(--lavender);
  border-top: 0;
}

@keyframes pop-in {
  from { opacity: 0; transform: translate(-50%, -80%) scale(.8); }
  to   { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}

/* ------------------------------------------------------------------ board */

.board-wrap {
  position: relative;
  width: var(--board-w);
  margin-inline: auto;   /* .game-area (theme) supplies the vertical slack */
  touch-action: none;
}

.board {
  display: grid;
  grid-template-columns: repeat(var(--size), 1fr);
  gap: calc(var(--tile) * .07);
  touch-action: none;
}

.tile {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--tile) * .40);
  font-weight: 800;
  color: var(--ink);
  background: var(--tile-face);
  border-radius: calc(var(--tile) * .24);
  box-shadow: 0 calc(var(--tile) * .055) 0 var(--tile-edge),
              0 calc(var(--tile) * .1) calc(var(--tile) * .12) rgba(190, 140, 170, .2);
  /* --s is the class-driven resting scale; --js/--jr belong to Juice.
     Transform stays out of the transition list so springs run clean. */
  transform: scale(calc(var(--s, 1) * var(--js, 1))) rotate(var(--jr, 0deg));
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
  user-select: none;
}

.tile.qu { font-size: calc(var(--tile) * .30); }

.tile.sel {
  background: linear-gradient(160deg, var(--pink), var(--pink-deep));
  color: var(--on-accent);
  --s: 1.06;
  box-shadow: 0 calc(var(--tile) * .05) 0 #d9548c,
              0 0 0 calc(var(--tile) * .05) rgba(255, 143, 190, .35);
  z-index: 2;
}

/* Purple is the hint colour, the same as the bubble that names the word.
   Amber used to be shared with the clock running out, which made a hinted
   tile and thirty seconds left look like the same warning. */
.tile.hint-start {
  background: linear-gradient(160deg, var(--lavender), #a78bff);
  color: var(--on-bright);
  animation: hint-pulse 1.1s ease-in-out infinite;
}

.tile.hint-path {
  background: linear-gradient(160deg, #ded2ff, var(--lavender));
  color: var(--on-bright);
}

@keyframes hint-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.09); }
}

/* Line drawn through the traced tiles. */
.trace-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 3;
}

#trace-line {
  fill: none;
  stroke: rgba(255, 255, 255, .85);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 6px rgba(230, 100, 160, .55));
}

.sparkles { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: visible; }

.spark {
  position: absolute;
  font-size: 20px;
  animation: spark-fly .9s ease-out forwards;
}

/* Tiny dots that trail the finger while tracing. */
.trail-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  pointer-events: none;
  animation: trail-fade .55s ease-out forwards;
}

@keyframes trail-fade {
  from { opacity: .85; transform: scale(1); }
  to   { opacity: 0; transform: scale(.15) translateY(8px); }
}

@keyframes spark-fly {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(.4) rotate(0deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2) rotate(var(--rot)); }
}

/* Floating "+3" that rises off the board. */
.plus {
  position: absolute;
  left: 50%;
  top: 40%;
  font-size: 34px;
  font-weight: 800;
  color: var(--mint-deep);
  text-shadow: 0 2px 0 var(--emboss), 0 6px 14px rgba(60, 180, 150, .4);
  pointer-events: none;
  animation: plus-rise 1.1s ease-out forwards;
}

@keyframes plus-rise {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(.6); }
  25%  { opacity: 1; transform: translate(-50%, -20px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -90px) scale(1); }
}

.pause-veil {
  position: absolute;
  inset: calc(var(--tile) * -.2);
  background: var(--veil);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
}

.pause-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pause-card p { margin: 0; font-size: 20px; font-weight: 800; }

/* ------------------------------------------------------------ found words */

.found-strip {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  min-height: 44px;
  align-items: center;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.found-strip::-webkit-scrollbar { display: none; }
.found-empty { font-size: 13px; color: var(--edge-soft); padding-left: 4px; }

.found-chip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-3);
  border: 2px solid var(--mint);
  border-radius: 14px;
  padding: 5px 10px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  animation: chip-in .35s ease both;
}

.found-chip small {
  background: var(--mint);
  color: var(--on-accent);
  border-radius: 8px;
  padding: 1px 5px;
  font-size: 11px;
}

@keyframes chip-in {
  from { opacity: 0; transform: scale(.6) translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* -------------------------------------------------------------- game foot */

/* .game-foot lives in theme.css - shared with the sudoku. */




/* ---------------------------------------------------------------- results */

.score-card {
  background: linear-gradient(160deg, var(--surface-3), var(--pink-soft));
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
}

.score-big {
  font-size: 62px;
  font-weight: 800;
  line-height: 1;
  color: var(--pink-deep);
  text-shadow: 0 3px 0 var(--emboss);
  animation: pop-word .6s ease;
}

.score-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 2px;
}

.score-stats { display: flex; justify-content: space-around; margin-top: 16px; gap: 8px; }
.score-stats div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.score-stats strong { font-size: 18px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; }
.score-stats span { font-size: 11px; color: var(--ink-soft); font-weight: 700; }

.word-cloud { display: flex; flex-wrap: wrap; gap: 6px; max-height: 190px; overflow-y: auto; }

.word-cloud span {
  font-size: 13.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  background: var(--surface-3);
  border: 2px solid var(--pink-soft);
  border-radius: 12px;
  padding: 4px 9px;
}

.word-cloud span.big { border-color: var(--lemon); background: var(--tint-lemon); }
.word-cloud.missed span { border-color: var(--edge-soft); color: var(--ink-soft); background: var(--surface-2); }
.word-cloud .empty-note { border: none; background: none; font-size: 13px; color: var(--ink-soft); text-transform: none; }

.result-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }

/* Every word pill on a results screen opens its story card. */
.word-cloud span:not(.empty-note) { cursor: pointer; transition: transform .1s ease; }
.word-cloud span:not(.empty-note):active { transform: scale(.93); }

/* ---------------------------------------------------------- word card
   The story of one word: its trace, its points, and your history with it. */

/* No backdrop blur here: a full-screen blur over the still-animating
   screens behind (bobbing towers, the floaty sky) makes opening the
   modal visibly stutter. A stronger tint and a solid card do the job. */
.word-veil {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(92, 70, 87, .5);
}

.word-card,
.report-card {
  background: linear-gradient(160deg, var(--surface-3), var(--cream));
  backdrop-filter: none;
}

.word-card {
  width: min(340px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  text-align: center;
  align-items: center;
  gap: 10px;
  animation: pop-word .35s ease;
}

.wc-word {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--pink-deep);
  text-shadow: 0 2px 0 var(--emboss);
}

.wc-points { font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.wc-board { margin: 2px auto; }
.wc-tally { font-size: 13px; font-weight: 700; color: var(--ink-soft); line-height: 1.5; margin: 0; }

.wc-finders { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

.wc-define {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  color: var(--ink);
  background: var(--surface-2);
  border: 2px solid var(--pink-soft);
  border-radius: 14px;
  padding: 10px 12px;
}

.wc-define b {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--ink-soft);
}

.wc-define b + span { display: block; margin-bottom: 8px; }
.wc-define span:last-child { margin-bottom: 0; }

.wc-finders span {
  font-size: 12.5px;
  font-weight: 700;
  background: var(--surface-3);
  border: 2px solid var(--pink-soft);
  border-radius: 12px;
  padding: 3px 8px;
}

/* -------------------------------------------------------- word report
   The per-player summary behind its own button: chips to pick a player,
   then their score line and found/missed word clouds, on a veil so the
   party screen stays one screen. */

.report-card {
  width: min(430px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  gap: 12px;
}

.sum-title { text-align: center; }

.sum-players { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

.sum-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-soft);
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
}

.sum-chip.on {
  color: var(--ink);
  background: var(--surface-3);
  border-color: var(--pink);
  box-shadow: 0 2px 0 var(--tile-edge);
}

.sum-missed { display: flex; flex-direction: column; gap: 8px; }

/* ------------------------------------------------------------------ party */

/* The identity/lobby widgets (.name-input, .party-code-big, .lobby-player,
   .kick-btn, .emoji-btn...) live in theme.css - shared with the sudoku. */


/* Live word counts for everyone in the round. */
.party-strip {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.party-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 2px solid var(--edge);
  border-radius: 12px;
  padding: 3px 9px;
  font-size: 12.5px;
  font-weight: 800;
}

.party-pill.me { border-color: var(--mint); }
.party-pill b { color: var(--pink-deep); }

/* 3.. 2.. 1.. Go! */
.count-veil {
  position: absolute;
  pointer-events: none;   /* input is gated by game state, not by this veil */
  inset: calc(var(--tile) * -.2);
  background: var(--veil);
  backdrop-filter: blur(6px);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 7;
}

.count-num {
  font-size: 120px;
  font-weight: 800;
  color: var(--pink-deep);
  text-shadow: 0 6px 0 var(--emboss), 0 14px 30px rgba(230, 100, 160, .4);
  /* Invisible until a number fires; .pop is re-added per number so the
     animation actually restarts for 3, 2, 1 AND go. */
  opacity: 0;
}

.count-num.pop { animation: count-pop .9s ease both; }
.count-num.go { font-size: 84px; color: var(--mint-deep); }

@keyframes count-pop {
  0%   { opacity: 0; transform: scale(2.2); }
  25%  { opacity: 1; transform: scale(1); }
  80%  { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(.8); }
}

/* ------------------------------------------------------------ emoji picker */

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

/* The travelling settings card sits directly in the lobby, always visible;
   guests get it locked (theme .is-locked) with a note beneath. */

/* ------------------------------------------------------- party results
   The structure follows the big-screen party games - rules recap up top, the
   board centre-stage replaying every word, a tally meter, and player towers
   that grow as points land - but everything wears Word Nibbles' pastels. */

.rules-row { display: flex; gap: 6px; }

.rule-chip {
  flex: 1;
  background: var(--surface-3);
  border: 2px solid var(--pink-soft);
  border-radius: 14px;
  padding: 7px 6px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink-soft);
  text-align: center;
  transition: background .25s ease, border-color .25s ease, color .25s ease;
}

.rule-chip b { color: var(--pink-deep); }

/* Lights up lemon-yellow every time a unique word doubles. */
.rule-chip.flash {
  background: linear-gradient(160deg, var(--tint-lemon), var(--lemon));
  border-color: #ffc93c;
  color: var(--ink);
  animation: bump .5s ease;
}

.pr-board-row { display: flex; gap: 12px; align-items: stretch; justify-content: center; }

.pr-board { width: min(232px, 56vw); }

.pr-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  min-width: 88px;
  text-align: left;
}

.pr-stat b { font-size: 19px; color: var(--pink-deep); }

/* The "/ total" half of the counter stays quiet next to the live number. */
.pr-of { margin: 0 3px; color: var(--ink-soft); font-weight: 700; }
.pr-stat b.pr-of-total { font-size: 14px; color: var(--ink-soft); }

/* A vertical meter running the full height of the board: regular words fill
   the pink segment from the bottom up, then the unique finds fill the gold
   segment above it - two segments, one line, a tiny gap between. */
.pr-bar {
  display: flex;
  flex-direction: column-reverse;   /* first segment (regular) sits at the bottom */
  gap: 3px;
  width: 14px;
  align-self: stretch;
}

.pr-bar-seg {
  flex: 1 0 0;
  min-height: 14px;
  background: var(--surface-3);
  border: 2px solid var(--pink-soft);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;   /* fills climb from the bottom */
}

.pr-bar-seg.unique { border-color: #ffe9a3; }

.pr-bar-fill {
  width: 100%;
  height: 0%;
  background: linear-gradient(0deg, var(--pink-deep), var(--pink));
  border-radius: 7px;
  transition: height .3s ease;
}

.pr-bar-seg.unique .pr-bar-fill {
  background: linear-gradient(0deg, #ffc93c, var(--lemon));
}

/* The word being counted right now. */
.pr-pill-row { min-height: 58px; display: flex; align-items: center; justify-content: center; }

.pr-pill {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 12px;
  background: var(--surface-3);
  border: 2px solid var(--pink-soft);
  border-radius: 999px;
  padding: 9px 24px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink);
  box-shadow: 0 6px 14px rgba(190, 140, 170, .18);
  animation: pill-pop .3s ease both;
}

/* Opacity only - Juice.excite() drives the motion, scaled by the word's
   value, and CSS transform animations would override it. */
@keyframes pill-pop {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.pr-pill b { font-size: 19px; letter-spacing: 0; color: var(--mint-deep); }
.pr-pill.unique { border-color: var(--lemon); background: linear-gradient(160deg, var(--surface-3), var(--tint-lemon)); }
.pr-pill.unique b { color: #d99a00; }

/* Better words wear better colours. */
.pr-pill.tier-good  { border-color: var(--mint); }
.pr-pill.tier-good  span { color: var(--mint-deep); }
.pr-pill.tier-great { border-color: var(--lavender); }
.pr-pill.tier-great span { color: #8a6ce0; }
.pr-pill.tier-epic  { border-color: #ffb27a; }
.pr-pill.tier-epic  span { color: #e8722a; }
.pr-pill.tier-legend {
  border-color: transparent;
  background:
    linear-gradient(var(--surface-3), var(--surface-3)) padding-box,
    linear-gradient(100deg, var(--pink-deep), var(--lavender), var(--mint-deep), var(--lemon)) border-box;
}
.pr-pill.tier-legend span {
  background: linear-gradient(100deg, var(--pink-deep), var(--lavender) 55%, var(--mint-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pr-pill.unique.tier-legend { background: linear-gradient(160deg, var(--surface-3), var(--tint-lemon)); border-color: var(--lemon); }


/* ------------------------------------------------------------- towers --- */

#screen-party-results.is-active {
  min-height: calc(100dvh - 34px - var(--safe-top) - var(--safe-bottom));
}

.towers {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: flex-end;
  min-height: 168px;
  /* Rise from the very bottom edge of the screen, like game-show podiums. */
  margin: auto -16px calc(-20px - var(--safe-bottom));
}

.tower {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(76px, 22vw, 116px);
  position: relative;
}

.tower-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: -12px;
}

.tower-avatar {
  font-size: 30px;
  filter: drop-shadow(0 3px 5px rgba(190, 130, 165, .35));
  animation: bob 2.4s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}

.tower-avatar-inner { display: inline-block; }

/* Little reactions floating off a scoring tower. */
.tower-heart {
  position: absolute;
  top: -6px;
  left: 50%;
  font-size: 15px;
  pointer-events: none;
  animation: heart-float 1.1s ease-out forwards;
}

@keyframes heart-float {
  from { opacity: 0; transform: translate(-50%, 4px) scale(.5); }
  25%  { opacity: 1; }
  to   { opacity: 0; transform: translate(calc(-50% + var(--hx, 0px)), -52px) scale(1.2) rotate(var(--hr, 0deg)); }
}

.tower-score {
  background: var(--surface-3);
  border: 2px solid var(--pink-soft);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 18px;
  font-weight: 800;
  color: var(--pink-deep);
}


.streak-star {
  position: relative;
  display: inline-block;
  font-size: 24px;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(190, 130, 165, .4));
}

.streak-star b {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 3px;
  font-size: 10px;
  font-weight: 800;
  color: #7a4c00;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
}

.lobby-player .streak-star { font-size: 20px; }
.lobby-player .streak-star b { font-size: 9px; padding-top: 2px; }
.party-pill .streak-star { font-size: 16px; }
.party-pill .streak-star b { font-size: 8px; padding-top: 2px; }

.tower-x2 {
  position: absolute;
  right: -14px;
  top: -12px;
  background: linear-gradient(160deg, var(--lemon), #ffc93c);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  padding: 2px 6px;
  transform: rotate(12deg);
  opacity: 0;
  transition: opacity .2s ease;
}

.tower-x2.show { opacity: 1; animation: bump .5s ease; }

.tower-plus {
  position: absolute;
  top: -24px;
  left: 50%;
  font-size: 21px;
  font-weight: 800;
  color: var(--ink);
  text-shadow: 0 2px 0 var(--emboss);
  pointer-events: none;
  animation: plus-rise 1s ease-out forwards;
}

/* The float matches the tier colour its word wore on the pill. */
.tower-plus.tier-good  { color: var(--mint-deep); }
.tower-plus.tier-great { color: #8a6ce0; }
.tower-plus.tier-epic  { color: #e8722a; }
.tower-plus.tier-legend {
  background: linear-gradient(100deg, var(--pink-deep), var(--lavender) 55%, var(--mint-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

.tower-body {
  position: relative;
  width: 100%;
  height: 96px;
  transform-origin: bottom center;
  background: linear-gradient(180deg, var(--surface-3), var(--pink-soft));
  border: 2px solid var(--edge);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -6px 18px rgba(190, 140, 170, .18);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 6px 6px;
  transition: height .45s cubic-bezier(.4, 1.3, .5, 1), background .3s ease;
  overflow: hidden;
}

/* Your own tower gets a mint edge instead of squeezing "(you)" into the name. */
.tower.me .tower-body { border-color: var(--mint); }
.tower.me .tower-score { border-color: var(--mint); }

.tower.leader .tower-body {
  background: linear-gradient(180deg, var(--tint-lemon), var(--lemon));
  color: var(--on-bright);
  border-color: #ffe9a3;
}

.tower-host {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--mint-deep);
}

.tower-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tower-words { font-size: 10.5px; font-weight: 700; color: var(--ink-soft); }

.tower-place {
  position: absolute;
  bottom: 0;
  font-size: 30px;
  font-weight: 800;
  color: var(--pink-deep);
  opacity: .18;
  pointer-events: none;
}

.tower.leader .tower-place { opacity: .35; color: #d99a00; }



/* ------------------------------------------------------- winner banner --- */

.win-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(160deg, var(--surface-3), var(--pink-soft));
  border: 2px solid var(--edge);
  border-radius: 20px;
  padding: 13px 20px;
  box-shadow: var(--shadow);
  animation: banner-pop .55s cubic-bezier(.3, 1.5, .5, 1) both;
}

.win-star { font-size: 22px; animation: bob 1.6s ease-in-out infinite; }

.win-text {
  font-size: 21px;
  font-weight: 800;
  text-align: center;
  background: linear-gradient(100deg, var(--pink-deep), var(--lavender) 55%, var(--mint-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@keyframes banner-pop {
  from { transform: scale(.4) rotate(-4deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ---------------------------------------------------- longest word card --- */

.longest-callout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: var(--surface-3);
  border: 2px solid var(--lemon);
  border-radius: 18px;
  padding: 11px 16px;
  text-align: center;
  animation: chip-in .35s ease both;
}

.longest-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: var(--lemon);
  color: var(--on-bright);
  border-radius: 10px;
  padding: 3px 10px;
}

.longest-callout p { margin: 0; font-size: 15.5px; font-weight: 700; color: var(--ink-soft); }

.longest-callout p b {
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--pink-deep);
  font-size: 18px;
}

.longest-finders {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 12.5px;
  font-weight: 700;
}

.longest-finders span {
  background: var(--pink-soft);
  border-radius: 10px;
  padding: 2px 8px;
}

/* ----------------------------------------------------------- confetti --- */

.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }

.fw-spark {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 255, 255, .7);
  animation: fw-fly .95s ease-out forwards;
}

@keyframes fw-fly {
  from { transform: translate(0, 0) scale(1.2); opacity: 1; }
  70%  { opacity: 1; }
  to   { transform: translate(var(--fx, 0px), calc(var(--fy, 0px) + 18px)) scale(.3); opacity: 0; }
}

.food-bit {
  position: absolute;
  font-size: 22px;
  margin: -11px 0 0 -11px;
  pointer-events: none;
  z-index: 65;
  filter: drop-shadow(0 2px 4px rgba(190, 130, 165, .4));
}

.confetti-bit {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  border-radius: 3px;
  animation: confetti-fall ease-in forwards;
}

@keyframes confetti-fall {
  from { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  85%  { opacity: 1; }
  to   { transform: translateY(106vh) rotate(680deg); opacity: 0; }
}

/* ------------------------------------------------------- mini board --- */

.mini-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n, 4), 1fr);
  gap: 4px;
  width: min(200px, 56vw);
}

.mini-tile {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-soft);
  background: var(--surface-3);
  border-radius: 8px;
  box-shadow: 0 2px 0 var(--tile-edge);
  transform: scale(calc(var(--s, 1) * var(--js, 1))) rotate(var(--jr, 0deg));
  transition: background .2s ease, color .2s ease;
}

/* The trace pop, as a plain transform keyframe. Going through --js meant
   a style recalculation per tile per frame; this one the compositor can
   take. Ends on the resting scale .mini-tile.on sets, so there is no jump. */
@keyframes mini-pop {
  from { transform: scale(1.34); }
  to   { transform: scale(1.08); }
}

.mini-tile.on {
  animation: mini-pop .34s cubic-bezier(.34, 1.56, .64, 1) both;
  background: linear-gradient(160deg, var(--pink), var(--pink-deep));
  color: var(--on-accent);
  --s: 1.08;
}

.mini-tile.gold {
  background: linear-gradient(160deg, var(--lemon), #ffc93c);
  color: var(--on-bright);
  --s: 1.08;
}

.mini-trace {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

/* Half-strength, so the replay line never buries the letters. The live
   trace on the playing board itself stays full strength (#trace-line). */
.mini-trace polyline {
  fill: none;
  stroke: rgba(255, 255, 255, .5);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 3px rgba(230, 100, 160, .6));
}


/* Short phones: trim the vertical rhythm so the board still fits. */
@media (max-height: 700px) {
  .mascot { font-size: 44px; }
  .title { font-size: 28px; }
  :root { --board-w: min(100vw - 32px, 400px); }
  .timer { width: 72px; height: 72px; }
  .current-word { font-size: 23px; padding: 5px 16px; }
}

/* ------------------------------------------------------------ invite mode
   Landing on an invite link (/p/CODE) strips the setup screen down to the
   join essentials: who invited you, the code, a name, an animal, one button. */
/* .invite-card and friends live in theme.css - shared with the sudoku. */
body.inviting #settings-home,
body.inviting #btn-start,
body.inviting #btn-host,
body.inviting #join-code,
body.inviting .card-quiet > .field-label,
body.inviting .card-quiet > .hint-text:not(.error) { display: none; }
body.inviting #btn-join { flex: 1; }

/* The hub link lives on the setup screen only. */
