/* Version 2 theme. Loaded after style.css so the live stylesheet stays
   untouched: everything here is either a variable override or a v2-only rule.

   The idea is physical neon, not "glow applied everywhere". A tube that is not
   lit is grey glass, so all 36 tiles start unlit and light is used to mean
   something: amber for what you picked, ice for the span you are about to
   read, mint for a word the board accepted. */

:root {
  --substrate: #0e0d13;
  --glass: #1b1a24;
  --tube: #2e2838;
  --unlit: #9b95ad;
  --muted: #8a84a0;

  --gas-amber: #ffb02e;
  --gas-ice: #5ad1ff;
  --gas-mint: #6ef2a8;

  /* Re-point the variables style.css already uses. */
  --sand: var(--glass);
  --sand-border: var(--tube);
  --blue: var(--gas-ice);
  --blue-dark: var(--gas-ice);
  --text: #ece9f5;
  --error: #ff6b7a;
}

body {
  background: var(--substrate);
  color: var(--text);
  font-family: "Helvetica Neue", Arial, sans-serif;
  padding-bottom: 3rem;
}

.sr-only {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip-path: inset(50%);
  white-space: nowrap;
}

.shell {
  width: min(100%, 1180px);
  margin: 0 auto;
}

.dev-banner {
  margin: 0 0 1.25rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid rgb(255 176 46 / 22%);
  background: rgb(255 176 46 / 7%);
  color: #f4c77a;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.site-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3.5rem;
}

h1 {
  margin: 0.25rem 0 1.25rem;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Only the second half of the wordmark is lit, like a sign with one live tube. */
.title-glow {
  color: #fff;
  text-shadow:
    0 0 1px #fff,
    0 0 8px var(--gas-amber),
    0 0 26px rgb(255 176 46 / 55%);
}

/* ---------- layout ---------- */

.layout {
  display: grid;
  align-items: start;
  gap: clamp(1rem, 3vw, 2.5rem);
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0 1rem;
}

@media (min-width: 900px) {
  .shell {
    display: flex;
    min-height: calc(100vh - 4.5rem);
    flex-direction: column;
    justify-content: center;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    justify-items: stretch;
  }

  .panel {
    position: sticky;
    top: 1.5rem;
  }
}

.board-area {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
}

.board-frame {
  display: flex;
  width: 100%;
  justify-content: center;
}

#game {
  margin-top: 0;
  transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), height 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- tiles ---------- */

.tile {
  border: 2px solid var(--tube);
  border-radius: 14px;
  background: var(--glass);
  box-shadow: none;
  color: var(--unlit);
  font-weight: 800;
  text-shadow: none;
  transition:
    transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.25s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.tile:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--gas-ice) 45%, var(--tube));
  color: #d6d2e4;
}

/* A lit tube: white-hot core, gas-coloured halo, light escaping from inside.
   The white core is what separates neon from a coloured blur. */
.tile.selected,
.tile.preview,
.tile.flare {
  border-color: var(--gas);
  /* The face stays dark. It is the tube that is lit, not the tile. */
  background: var(--glass);
  color: #fff;
  text-shadow:
    0 0 1px #fff,
    0 0 7px var(--gas),
    0 0 20px color-mix(in srgb, var(--gas) 55%, transparent);
  box-shadow:
    0 0 4px -1px var(--gas),
    0 0 14px -3px var(--gas),
    inset 0 0 12px -6px var(--gas);
}

.tile.selected {
  --gas: var(--gas-amber);
  z-index: 2;
}

.tile.preview {
  --gas: var(--gas-ice);
  z-index: 1;
}

.tile.flare {
  --gas: var(--gas-mint);
  z-index: 3;
}

/* Where a selection could legally go: a hint, not a light. */
.tile.candidate:not(:disabled) {
  border-color: color-mix(in srgb, var(--gas-ice) 32%, var(--tube));
  color: color-mix(in srgb, var(--gas-ice) 40%, var(--unlit));
}

/* Cleared tiles stay visible as recessed slots. An invisible hole hides the
   rule that a word reads straight across it. */
.tile.empty {
  border-color: transparent;
  opacity: 1;
  background: rgb(0 0 0 / 32%);
  box-shadow: inset 0 2px 7px rgb(0 0 0 / 65%);
  color: transparent;
  text-shadow: none;
}

.tile.fade-out {
  opacity: 0;
}

.tile:focus-visible {
  outline: 2px solid var(--gas-ice);
  outline-offset: 3px;
}

/* ---------- side panel ---------- */

.panel {
  display: flex;
  width: min(100%, 340px);
  flex-direction: column;
  gap: 1rem;
}

.stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 1rem;
  border: 1px solid var(--tube);
  border-radius: 18px;
  margin-top: 0;
  background: rgb(255 255 255 / 2.5%);
  font-size: 1rem;
  font-weight: 400;
  gap: 1.1rem;
}

.progress {
  position: relative;
  width: 132px;
  height: 132px;
}

.ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track,
.ring-fill {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
}

.ring-track {
  stroke: var(--tube);
}

.ring-fill {
  stroke: var(--gas-mint);
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  filter: drop-shadow(0 0 5px var(--gas-mint));
  transition: stroke-dashoffset 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ring-label {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  inset: 0;
  line-height: 1.1;
}

.ring-value {
  font-size: 2.4rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.ring-sub {
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.stat-row {
  display: grid;
  width: 100%;
  gap: 0.6rem;
  grid-template-columns: 1fr 1fr;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6rem 0.5rem;
  border: 1px solid var(--tube);
  border-radius: 12px;
  background: rgb(0 0 0 / 22%);
  gap: 0.15rem;
}

.stat-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-value {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

/* ---------- controls ---------- */

.undo-button,
#shareButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--gas-ice) 40%, var(--tube));
  border-radius: 12px;
  margin: 0;
  background: rgb(90 209 255 / 8%);
  box-shadow: none;
  color: #cfeeff;
  cursor: pointer;
  font-weight: 700;
  gap: 0.45rem;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.undo-button:hover:not(:disabled),
#shareButton:hover:not(:disabled) {
  border-color: var(--gas-ice);
  background: rgb(90 209 255 / 16%);
  box-shadow: 0 0 18px -6px var(--gas-ice);
  color: #fff;
}

.undo-button:disabled {
  border-color: var(--tube);
  background: transparent;
  color: #58536a;
  cursor: default;
}

.help-button {
  position: absolute;
  top: 0.1rem;
  right: 1rem;
  border: 1px solid var(--tube);
  background: var(--glass);
  color: var(--unlit);
}

.help-button:hover {
  border-color: var(--gas-amber);
  color: var(--gas-amber);
}

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

#foundWordsContainer {
  width: 100%;
  margin-top: 0;
  padding: 1rem;
  border: 1px solid var(--tube);
  border-radius: 18px;
  background: rgb(255 255 255 / 2.5%);
}

#foundWordsContainer h2 {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.word-badges {
  gap: 6px;
}

.badge {
  padding: 3px 9px;
  border: 1px solid color-mix(in srgb, var(--gas-mint) 34%, var(--tube));
  border-radius: 8px;
  background: rgb(110 242 168 / 8%);
  box-shadow: none;
  color: #bff5d6;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  animation: badge-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.empty-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ---------- feedback and completion ---------- */

.feedback {
  min-height: 1.6rem;
  margin: 1rem 0 0;
  color: var(--error);
  font-size: 1rem;
  font-weight: 600;
}

.game-over {
  margin: 2.5rem auto 0;
  padding: 2rem 1.5rem;
  border: 1px solid color-mix(in srgb, var(--gas-mint) 30%, var(--tube));
  border-radius: 20px;
  width: min(100%, 480px);
  background: rgb(110 242 168 / 6%);
}

.game-over h2 {
  margin: 0 0 0.6rem;
  color: #fff;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  letter-spacing: 0.06em;
  text-shadow: 0 0 1px #fff, 0 0 10px var(--gas-mint), 0 0 30px rgb(110 242 168 / 45%);
  text-transform: uppercase;
}

.game-over p {
  color: var(--unlit);
  font-size: 1.05rem;
}

/* ---------- overlays ---------- */

.modal {
  background: rgb(6 5 10 / 78%);
}

.modal-content {
  border: 1px solid var(--tube);
  background: #16141d;
  box-shadow: 0 24px 60px rgb(0 0 0 / 60%);
  color: var(--text);
  text-align: left;
}

.modal-content h2 {
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.modal-content p {
  color: var(--unlit);
  font-size: 0.95rem;
  line-height: 1.6;
}

.modal-content button {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--gas-amber) 45%, var(--tube));
  background: rgb(255 176 46 / 10%);
  box-shadow: none;
  color: #ffd9a0;
}

.modal-content button:hover {
  border-color: var(--gas-amber);
  background: rgb(255 176 46 / 18%);
  color: #fff;
}

.copy-modal {
  border: 1px solid var(--tube);
  background: #16141d;
  color: var(--text);
  font-size: 1rem;
}

@keyframes badge-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.92); }
  to { opacity: 1; transform: none; }
}
