/* ==========================================================================
   HEX CHAIN — team colours + hex board styles (host and contestant board).
   Site-wide colours and fonts come from shared/theme.css.
   ========================================================================== */

:root {
  /* Team colours. teams.js overwrites these from the colours picked at setup. */
  --t1: #1e7bff;
  --t1-hi: #8ccaff;
  --t1-deep: #0a2c9c;
  --t1-ink: #ffffff;
  --t2: #ffc928;
  --t2-hi: #fff4b0;
  --t2-deep: #b06d00;
  --t2-ink: #3a2000;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.05em 0.4em;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-bottom-width: 2px;
  border-radius: 5px;
  font: 700 0.72em/1.4 ui-monospace, 'SFMono-Regular', Consolas, monospace;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
}

/* ---------------------------- Hex board (SVG) ----------------------------
   Animations here only move/scale/fade (no blur or glow filters), which keeps
   the board smooth when it is being screen-shared. */

.hexboard { display: block; width: 100%; height: 100%; overflow: visible; -webkit-user-select: none; user-select: none; }

.hexboard .bar-glow { opacity: 0.22; }

.hexboard .hex {
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.5s ease;
}

.hexboard .hex-base {
  stroke: rgba(190, 205, 255, 0.35);
  stroke-width: 2.5;
  transition: stroke 0.25s, stroke-width 0.25s;
}
.hexboard .kind-number .hex-base { stroke: rgba(230, 190, 255, 0.45); stroke-dasharray: 7 5; }
.hexboard .owner-t1 .hex-base { stroke: var(--t1-hi); stroke-dasharray: none; }
.hexboard .owner-t2 .hex-base { stroke: var(--t2-hi); stroke-dasharray: none; }
.hexboard .hex-shine { pointer-events: none; }

/* Team 2's hexes carry an inner ring, so the teams differ by more than colour. */
.hexboard .hex-ring { stroke: none; pointer-events: none; }
.hexboard .owner-t2 .hex-ring { stroke: var(--t2-ink); stroke-width: 2.5; opacity: 0.55; }

.hexboard .hex-letter {
  fill: #fff;
  font-family: var(--font-ui);
  font-weight: 900;
  font-size: 50px;
  text-anchor: middle;
  dominant-baseline: central;
  paint-order: stroke;
  stroke: rgba(0, 0, 20, 0.45);
  stroke-width: 3px;
  pointer-events: none;
}
.hexboard .hex-letter.len-2 { font-size: 40px; }
.hexboard .hex-letter.len-3 { font-size: 29px; }
.hexboard .hex-letter.len-4 { font-size: 23px; }
.hexboard .kind-number .hex-letter { font-family: var(--font-display); font-weight: 400; font-size: 60px; letter-spacing: 1px; }
.hexboard .kind-number .hex-letter.len-2 { font-size: 54px; }
.hexboard .kind-number .hex-letter.len-3 { font-size: 42px; }
.hexboard .kind-number .hex-letter.len-4 { font-size: 33px; }
.hexboard .owner-t1 .hex-letter { fill: var(--t1-ink); stroke: rgba(0, 0, 0, 0.18); }
.hexboard .owner-t2 .hex-letter { fill: var(--t2-ink); stroke: rgba(255, 255, 255, 0.22); }

/* Selected hex: white outline and a gentle pulse */
.hexboard .hex.selected .hex-base { stroke: #fff; stroke-width: 6; stroke-dasharray: none; }
.hexboard .hex.selected { animation: hexSelected 1.3s ease-in-out infinite; }
@keyframes hexSelected {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

/* Claim flip (the new colour is applied mid-flip by render.js) */
.hexboard .hex.flip { animation: hexFlip 0.7s cubic-bezier(0.45, 0, 0.55, 1); }
@keyframes hexFlip {
  0% { transform: scaleX(1); }
  42%, 58% { transform: scaleX(0.02) scaleY(1.1); }
  80% { transform: scaleX(1.1) scaleY(1.1); }
  100% { transform: scaleX(1); }
}

/* New-board deal-in */
.hexboard .hex.intro { animation: hexIn 0.6s cubic-bezier(0.2, 1.5, 0.4, 1) both; animation-delay: var(--d, 0ms); }
@keyframes hexIn {
  from { transform: scale(0) rotate(-60deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

/* Winning chain */
.hexboard .hex.win .hex-base { stroke: #fff; stroke-width: 5; }
.hexboard .hex.win { animation: hexWin 1.1s ease-in-out var(--wd, 0s) infinite both; }
@keyframes hexWin {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.hexboard .hex.dim { opacity: 0.28; }

.hexboard .win-line {
  stroke: #fff;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
  pointer-events: none;
}
.hexboard .win-line.draw { animation: drawLine 1.2s ease-out 0.25s forwards; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }

/* Host-only interactions */
.hexboard--host .hex { cursor: pointer; }
.hexboard--host .hex:not(.claimed):hover .hex-base { stroke: #fff; stroke-width: 4; }
.hexboard--host .hex.claimed { cursor: not-allowed; }
.hexboard--host.editing .hex { cursor: crosshair; }
.hexboard--host.editing .hex:hover .hex-base { stroke: #ff5fd2; stroke-width: 4; }
.hexboard .hex.edit-sel .hex-base { stroke: #ff5fd2; stroke-width: 7; stroke-dasharray: 12 7; }

/* Pause decorative animation while the window is hidden or minimised. */
.is-hidden *, .is-hidden *::before, .is-hidden *::after { animation-play-state: paused !important; }
