/* ------------------------------------------------------------------
   RANDOLF — Personal index
   Dark, minimal, experimental digital identity.
   ------------------------------------------------------------------ */

:root {
  --bg: #0a0a0c;
  --bg-2: #0e0e12;
  --fg: #ececf0;
  --muted: #6f6f7a;
  --dim: #33333b;
  --line: rgba(236, 236, 240, 0.09);
  --accent: #c9f44d;
  --accent-ink: #0a0a0c;

  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --grid: 72px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

.mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ------------------------------------------------------------------
   Background layers
   ------------------------------------------------------------------ */

.bg-grid,
.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: var(--grid) var(--grid);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, #000 30%, transparent 78%);
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, #000 30%, transparent 78%);
}

.bg-noise {
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------------
   Header
   ------------------------------------------------------------------ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem clamp(1.25rem, 4vw, 3.5rem);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 10, 12, 0.9), rgba(10, 10, 12, 0));
  backdrop-filter: blur(6px);
}

.brand {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.brand-dot {
  color: var(--accent);
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.site-nav a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.3s var(--ease);
}

.site-nav a:hover {
  color: var(--fg);
}

.nav-clock {
  padding-left: 2rem;
  border-left: 1px solid var(--line);
}

/* ------------------------------------------------------------------
   Hero
   ------------------------------------------------------------------ */

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 6rem clamp(1.25rem, 4vw, 3.5rem) 4rem;
  z-index: 1;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  width: 100%;
}

.eyebrow {
  font-family: var(--mono);
  font-size: clamp(10px, 1.1vw, 12px);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.hero-title {
  position: relative;
  font-family: var(--sans);
  font-size: clamp(3.4rem, 13.5vw, 15rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  margin-bottom: 2.5rem;
  will-change: transform;
}

.hero-ghost {
  position: absolute;
  inset: 0;
  color: transparent;
  -webkit-text-stroke: 1px rgba(236, 236, 240, 0.14);
  pointer-events: none;
  transform: translate(0.03em, 0.03em);
  animation: ghost-in 1.4s var(--ease) 0.2s both;
}

.hero-line {
  position: relative;
}

.hero-char {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}

.hero-char > span {
  display: inline-block;
  transform: translateY(115%);
  animation: rise 1.1s var(--ease) forwards;
  animation-delay: var(--d, 0s);
}

.hero-cursor {
  display: inline-block;
  width: 0.08em;
  height: 0.9em;
  margin-left: 0.06em;
  background: var(--accent);
  animation: blink 1.15s steps(1) infinite;
}

.hero-sub {
  max-width: 34rem;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  color: var(--muted);
  font-weight: 400;
}

.hero-foot {
  position: absolute;
  left: clamp(1.25rem, 4vw, 3.5rem);
  bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hero-foot-line {
  display: inline-block;
  width: 1px;
  height: 2.5rem;
  background: linear-gradient(180deg, var(--muted), transparent);
  position: relative;
  overflow: hidden;
}

.hero-foot-line::after {
  content: "";
  position: absolute;
  left: 0;
  top: -50%;
  width: 100%;
  height: 50%;
  background: var(--accent);
  animation: drop 2s var(--ease) infinite;
}

/* ------------------------------------------------------------------
   Sigil — abstract geometry, shield + wolf inspiration
   ------------------------------------------------------------------ */

.sigil {
  position: absolute;
  right: clamp(0rem, 3vw, 3.5rem);
  top: 50%;
  width: clamp(240px, 26vw, 400px);
  transform: translateY(-50%);
  opacity: 0;
  animation: sigil-fade 1.4s var(--ease) 0.5s forwards;
  will-change: transform;
  z-index: 0;
}

.sigil svg {
  display: block;
  width: 100%;
  height: auto;
  animation: sigil-scale 1.4s var(--ease) 0.5s forwards;
}

.sigil-orbit {
  stroke: rgba(236, 236, 240, 0.12);
  stroke-width: 1;
  stroke-dasharray: 3 9;
  animation: spin 40s linear infinite;
  transform-origin: center;
  transform-box: fill-box;
}

.sigil-lines {
  stroke: rgba(236, 236, 240, 0.28);
  stroke-width: 1.5;
}

.sigil-core {
  fill: var(--accent);
  filter: drop-shadow(0 0 14px rgba(201, 244, 77, 0.35));
}

/* ------------------------------------------------------------------
   Sections
   ------------------------------------------------------------------ */

main {
  position: relative;
  z-index: 1;
}

.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(4rem, 9vw, 8rem) clamp(1.25rem, 4vw, 3.5rem);
}

.section-head {
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.section-label {
  margin-bottom: 1rem;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.index-list {
  border-top: 1px solid var(--line);
}

.index-row {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1rem 1.5rem;
  padding: clamp(1.25rem, 2.5vw, 2rem) 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.4s var(--ease), padding 0.4s var(--ease);
}

.index-row:hover {
  background: linear-gradient(90deg, rgba(201, 244, 77, 0.05), transparent 60%);
  padding-left: 1rem;
}

.index-num {
  color: var(--accent);
}

.index-main {
  display: block;
  min-width: 0;
}

.index-name {
  display: block;
  font-size: clamp(1.05rem, 2vw, 1.5rem);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.index-desc {
  display: block;
  margin-top: 0.3rem;
  max-width: 40rem;
  font-size: clamp(0.8rem, 1.2vw, 0.92rem);
  color: var(--muted);
}

.index-go {
  justify-self: end;
  align-self: center;
  color: var(--accent);
  font-size: 1.15rem;
  transition: transform 0.35s var(--ease);
}

.index-row:hover .index-go {
  transform: translateX(0.25rem);
}

.index-status {
  justify-self: end;
}

.section-info .statement {
  max-width: 46rem;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  line-height: 1.6;
  color: var(--fg);
}

.statement::before {
  content: "→ ";
  color: var(--accent);
}

/* ------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------ */

.site-footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.5rem;
  justify-content: space-between;
  padding: 2rem clamp(1.25rem, 4vw, 3.5rem);
  border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------------
   Reveal on scroll
   ------------------------------------------------------------------ */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: var(--d, 0s);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ------------------------------------------------------------------
   Animations
   ------------------------------------------------------------------ */

@keyframes rise {
  to { transform: translateY(0); }
}

@keyframes ghost-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes blink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0; }
}

@keyframes drop {
  0% { top: -50%; }
  100% { top: 100%; }
}

@keyframes sigil-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sigil-scale {
  from { transform: scale(0.92); }
  to { transform: scale(1); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------
   Reduced motion
   ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .sigil {
    opacity: 1;
    transform: translateY(-50%);
  }

  .sigil svg {
    transform: scale(1);
  }

  .hero-foot-line {
    display: none;
  }
}

/* ------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------ */

@media (max-width: 900px) {
  .sigil {
    right: auto;
    left: 50%;
    top: auto;
    bottom: 0;
    width: min(78vw, 340px);
    transform: translateX(-50%) translateY(20%);
    animation-name: sigil-fade-mobile;
  }

  .sigil svg {
    animation-name: sigil-scale-mobile;
  }

  .sigil-lines { stroke: rgba(236, 236, 240, 0.16); }
  .sigil-orbit { stroke: rgba(236, 236, 240, 0.08); }

  .hero {
    align-items: flex-start;
    justify-content: flex-end;
    padding-top: 8rem;
    padding-bottom: 8rem;
  }

  .hero-foot {
    display: none;
  }
}

@keyframes sigil-scale-mobile {
  from { transform: scale(0.94); }
  to { transform: scale(1); }
}

@keyframes sigil-fade-mobile {
  from { opacity: 0; }
  to { opacity: 0.5; }
}

@media (max-width: 640px) {
  :root { --grid: 44px; }

  .site-nav ul { gap: 1.25rem; }
  .nav-clock { display: none; }

  .index-row {
    grid-template-columns: 2.75rem minmax(0, 1fr) auto;
  }

  .index-desc {
    font-size: 0.78rem;
  }

  .hero-sub {
    max-width: 24rem;
  }
}

@media (max-width: 420px) {
  .eyebrow { letter-spacing: 0.22em; }
}

/* ------------------------------------------------------------------
   Focus
   ------------------------------------------------------------------ */

a:focus-visible,
.brand:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------
   Hero name evolution
   ------------------------------------------------------------------ */

.hero-line {
  display: inline-block;
  vertical-align: top;
  white-space: nowrap;
}

.site-nav a[aria-current="page"] {
  color: var(--fg);
}

/* Keep the 8-letter name forms inside the hero on narrow screens. */
@media (max-width: 400px) {
  .hero-title {
    font-size: clamp(2.5rem, 12.5vw, 3.4rem);
  }
}

/* ------------------------------------------------------------------
   Reduced motion — static name forms, no perpetual animation
   ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .hero-line {
    white-space: normal;
  }

  .hero-title {
    font-size: clamp(2.4rem, 7.5vw, 6rem);
    line-height: 1.05;
  }

  .hero-ghost,
  .hero-cursor,
  .sigil {
    display: none;
  }
}

/* ------------------------------------------------------------------
   Subpages — shared layout
   ------------------------------------------------------------------ */

.page {
  position: relative;
  z-index: 1;
  padding: clamp(6.5rem, 12vh, 9rem) clamp(1.25rem, 4vw, 3.5rem) clamp(3rem, 6vw, 5.5rem);
}

.page-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.page-head {
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.page-title {
  margin: 0.6rem 0 1.4rem;
  font-size: clamp(2.6rem, 8vw, 6.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.page-lede {
  max-width: 46rem;
  font-size: clamp(1.05rem, 1.9vw, 1.35rem);
  color: var(--muted);
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
}

.crumbs a {
  color: var(--muted);
  transition: color 0.3s var(--ease);
}

.crumbs a:hover,
.crumbs a:focus-visible {
  color: var(--fg);
}

.crumb-arr {
  color: var(--accent);
}

.crumb-sep {
  color: var(--dim);
}

.block {
  padding: clamp(2.5rem, 5vw, 4rem) 0;
  border-top: 1px solid var(--line);
}

.block-head {
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}

.block-title {
  font-size: clamp(1.3rem, 2.4vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.para {
  max-width: 52rem;
  margin: 0 0 1.1rem;
  color: var(--fg);
}

.para:last-child {
  margin-bottom: 0;
}

/* ------------------------------------------------------------------
   Empty placeholder state (games, news, ideas)
   ------------------------------------------------------------------ */

.empty {
  padding: clamp(1.75rem, 4vw, 2.75rem) 0;
  border-top: 1px solid var(--line);
}

.empty-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.empty-note {
  color: var(--muted);
}

/* ------------------------------------------------------------------
   Games — release list
   ------------------------------------------------------------------ */

.release-list {
  border-top: 1px solid var(--line);
}

.release-item {
  border-bottom: 1px solid var(--line);
}

.release-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding: clamp(1.25rem, 2.5vw, 2rem) 0;
  transition: background 0.4s var(--ease), padding 0.4s var(--ease);
}

.release-link:hover {
  background: linear-gradient(90deg, rgba(201, 244, 77, 0.05), transparent 60%);
  padding-left: 1rem;
}

.release-name {
  display: block;
  font-size: clamp(1.05rem, 2vw, 1.5rem);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.release-desc {
  display: block;
  margin-top: 0.3rem;
  max-width: 40rem;
  font-size: clamp(0.8rem, 1.2vw, 0.92rem);
  color: var(--muted);
}

.release-alt {
  margin-left: 0.4rem;
  font-size: 0.7em;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.release-tag {
  justify-self: end;
  align-self: center;
  padding: 0.25rem 0.6rem;
  border: 1px solid rgba(201, 244, 77, 0.4);
  border-radius: 999px;
  color: var(--accent);
  font-size: 10px;
}

/* ------------------------------------------------------------------
   Minesweeper
   ------------------------------------------------------------------ */

.ms {
  --cell: 32px;
  --ms-gap: 3px;
}

/* Board scale per difficulty — Beginner gets room to breathe, Expert stays
   compact rather than being blown up. */
.ms[data-diff="beginner"] { --cell: 44px; }
.ms[data-diff="intermediate"] { --cell: 38px; }
.ms[data-diff="expert"] { --cell: 32px; }

/* Author display rules would otherwise beat the [hidden] attribute. */
.ms [hidden] {
  display: none;
}

/* Trim dead vertical space on the game page so the board sits higher. */
.ms-page .page-head {
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.ms-page .page-title {
  margin-bottom: 0.8rem;
}

.ms-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ms-difficulty {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ms-controls-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ms-diff,
.ms-restart,
.ms-stats-toggle,
.ms-fullscreen {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease),
    background 0.3s var(--ease);
}

.ms-diff:hover,
.ms-restart:hover,
.ms-stats-toggle:hover,
.ms-fullscreen:hover {
  color: var(--fg);
  border-color: var(--muted);
}

.ms-diff[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.ms-stats-toggle[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

.ms-restart {
  color: var(--fg);
  border-color: rgba(201, 244, 77, 0.4);
}

.ms-restart:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.ms-diff:focus-visible,
.ms-restart:focus-visible,
.ms-stats-toggle:focus-visible,
.ms-fullscreen:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

.ms-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  margin-bottom: 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg-2);
}

.ms-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 4.25rem;
}

.ms-stat-label {
  font-size: 10px;
}

.ms-stat-value {
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--fg);
  transition: color 0.25s var(--ease);
}

.ms-stat-secondary .ms-stat-value {
  color: var(--muted);
}

.ms-stat-value[data-result="won"] {
  color: var(--accent);
}

.ms-stat-value[data-result="lost"] {
  color: #ff7a7a;
}

.ms-stat-status .ms-stat-value[data-status="won"] {
  color: var(--accent);
}

.ms-stat-status .ms-stat-value[data-status="lost"] {
  color: #ff7a7a;
}

@media (min-width: 760px) {
  .ms-stat-status {
    margin-left: auto;
  }
}

/* ------------------------------------------------------------------
   Minesweeper — result panel
   ------------------------------------------------------------------ */

.ms-result {
  display: grid;
  gap: 0.9rem;
  justify-items: start;
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(201, 244, 77, 0.3);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  background: var(--bg-2);
}

.ms-result[hidden] {
  display: none;
}

.ms-result[data-result="lost"] {
  border-color: rgba(255, 122, 122, 0.3);
  border-left-color: #ff7a7a;
}

.ms-result.is-shown {
  animation: ms-result-in 260ms var(--ease) both;
}

.ms-result-title {
  font-size: 13px;
  letter-spacing: 0.22em;
  color: var(--accent);
}

.ms-result[data-result="lost"] .ms-result-title {
  color: #ff7a7a;
}

.ms-result-figures {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
}

.ms-result-new {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.ms-result-new[hidden] {
  display: none;
}

.ms-result.is-shown .ms-result-new:not([hidden]) {
  animation: ms-newbest 800ms var(--ease) both;
}

.ms-playagain {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  transition: opacity 0.2s var(--ease);
}

.ms-playagain:hover {
  opacity: 0.85;
}

.ms-playagain:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------
   Minesweeper — local statistics panel
   ------------------------------------------------------------------ */

.ms-stats-panel {
  margin-top: 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg-2);
}

.ms-stats-panel[hidden] {
  display: none;
}

.ms-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1.25rem;
}

.ms-stats-block {
  display: grid;
  align-content: start;
  gap: 0.35rem;
}

.ms-stats-name {
  margin-bottom: 0.2rem;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.18em;
}

.ms-stats-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.ms-stats-row span {
  font-size: 11px;
  color: var(--muted);
}

.ms-stats-row span:last-child {
  color: var(--fg);
}

.ms-stats-foot {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.ms-stats-reset {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.ms-stats-reset:hover {
  color: var(--fg);
  border-color: var(--muted);
}

.ms-stats-reset.is-confirming {
  color: #ff7a7a;
  border-color: rgba(255, 122, 122, 0.5);
}

.ms-stats-reset:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

.ms-board-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.ms-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell));
  grid-auto-rows: var(--cell);
  gap: var(--ms-gap);
  width: max-content;
  margin: 0 auto;
  padding: 8px;
  background: #14171b;
  border: 1px solid rgba(236, 236, 240, 0.09);
  border-radius: 4px;
  --ms-board-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 14px 34px rgba(0, 0, 0, 0.38);
  box-shadow: var(--ms-board-shadow);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.ms-board.is-entering {
  animation: ms-board-in 220ms var(--ease) both;
}

.ms-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: calc(var(--cell) * 0.5);
  font-weight: 700;
  line-height: 1;
  color: var(--fg);
  background: #343a42;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease,
    color 0.14s ease, box-shadow 0.14s ease;
}

.ms-cell:hover {
  background: #3e454e;
  border-color: rgba(255, 255, 255, 0.18);
}

.ms-cell:active {
  background: #2b3037;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.ms-cell.is-revealed {
  background: #15181c;
  border-color: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
  cursor: default;
}

.ms-cell.is-revealed:hover,
.ms-cell.is-revealed:active {
  background: #15181c;
  border-color: rgba(255, 255, 255, 0.035);
}

.ms-cell.is-mine {
  background: #241417;
}

.ms-cell.is-exploded {
  background: #3a0f12;
  border-color: #ff4d4d;
  box-shadow: inset 0 0 0 2px #ff4d4d;
}

.ms-cell.is-wrong {
  background: #241417;
}

.ms-cell.is-mine::before,
.ms-cell.is-flagged::before,
.ms-cell.is-wrong::before {
  content: "";
  display: block;
  width: 62%;
  height: 62%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.ms-cell.is-mine::before {
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cg%20stroke%3D%22%23ff7a7a%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%3E%3Cline%20x1%3D%2212%22%20y1%3D%222%22%20x2%3D%2212%22%20y2%3D%2222%22%2F%3E%3Cline%20x1%3D%222%22%20y1%3D%2212%22%20x2%3D%2222%22%20y2%3D%2212%22%2F%3E%3Cline%20x1%3D%225%22%20y1%3D%225%22%20x2%3D%2219%22%20y2%3D%2219%22%2F%3E%3Cline%20x1%3D%2219%22%20y1%3D%225%22%20x2%3D%225%22%20y2%3D%2219%22%2F%3E%3C%2Fg%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%224.5%22%20fill%3D%22%23ff7a7a%22%2F%3E%3C%2Fsvg%3E");
}

.ms-cell.is-flagged::before {
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M7%2021%20V3%22%20stroke%3D%22%23c9f44d%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%2F%3E%3Cpath%20d%3D%22M7%204%20L18%207%20L7%2010%20Z%22%20fill%3D%22%23c9f44d%22%2F%3E%3C%2Fsvg%3E");
}

.ms-cell.is-wrong::before {
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M6%206%20L18%2018%20M18%206%20L6%2018%22%20stroke%3D%22%23ff7a7a%22%20stroke-width%3D%222.5%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E");
}

.ms-cell.is-questioned::before {
  content: "?";
  display: block;
  font-family: var(--mono);
  font-size: calc(var(--cell) * 0.58);
  font-weight: 700;
  line-height: 1;
  color: #ffcf5c;
  animation: ms-mark-in 130ms var(--ease) both;
}

.ms-cell.is-questioned.is-mark-out::before {
  animation: ms-mark-out 140ms var(--ease) both;
}

.ms-cell.is-flagged::before {
  animation: ms-flag-pop 180ms var(--ease) both;
}

/* --- Game-end feedback: win sweep + lose impact ------------------ */

.ms-board.is-won {
  box-shadow: var(--ms-board-shadow), 0 0 0 1px rgba(201, 244, 77, 0.22),
    0 0 46px rgba(201, 244, 77, 0.07);
}

.ms-board.is-won::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 4px;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 32%,
    rgba(201, 244, 77, 0.16) 50%,
    transparent 68%
  );
  transform: translateX(-120%);
  animation: ms-sweep 700ms var(--ease) 120ms both;
}

.ms-board.is-won .ms-cell.is-revealed {
  animation: ms-win-pulse 520ms ease-out both;
  animation-delay: calc(min(var(--ms-i, 0), 40) * 6ms);
}

.ms-board.is-shaking {
  animation: ms-shake 280ms ease-out;
}

.ms-board.is-lost .ms-cell.is-mine:not(.is-exploded) {
  animation: ms-mine-in 200ms ease-out both;
}

.ms-cell.is-exploded {
  animation: ms-explode 340ms ease-out both;
}

@keyframes ms-board-in {
  from { opacity: 0; transform: scale(0.992); }
  to { opacity: 1; transform: none; }
}

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

@keyframes ms-sweep {
  from { transform: translateX(-120%); }
  to { transform: translateX(120%); }
}

@keyframes ms-win-pulse {
  0% { background: #101015; }
  40% { background: rgba(201, 244, 77, 0.14); }
  100% { background: #101015; }
}

@keyframes ms-explode {
  0% {
    background: #ff4d4d;
    box-shadow: inset 0 0 0 2px #ff4d4d, 0 0 18px rgba(255, 77, 77, 0.6);
  }
  100% {
    background: #3a0f12;
    box-shadow: inset 0 0 0 2px #ff4d4d;
  }
}

@keyframes ms-mine-in {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: none; }
}

@keyframes ms-flag-pop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes ms-mark-in {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes ms-mark-out {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.85); }
}

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

@keyframes ms-newbest {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.ms-cell.n1 { color: #7fb8ff; }
.ms-cell.n2 { color: #7ee787; }
.ms-cell.n3 { color: #ff9f6e; }
.ms-cell.n4 { color: #c792ea; }
.ms-cell.n5 { color: #ffd166; }
.ms-cell.n6 { color: #6ee7e7; }
.ms-cell.n7 { color: #f0f0f5; }
.ms-cell.n8 { color: #b0b0bd; }

.ms-help {
  display: grid;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.ms-help .para {
  margin: 0;
}

@media (max-width: 640px) {
  .ms[data-diff="beginner"] { --cell: 34px; }
  .ms[data-diff="intermediate"] { --cell: 30px; }
  .ms[data-diff="expert"] { --cell: 30px; }

  .ms-board {
    padding: 6px;
  }

  .ms-hud {
    gap: 0.6rem 1.1rem;
  }
}

@media (max-width: 520px) {
  .ms-stat-secondary {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ms-cell,
  .ms-diff,
  .ms-restart,
  .ms-stats-toggle,
  .ms-fullscreen,
  .release-link {
    transition: none;
  }

  .ms-board.is-entering,
  .ms-board.is-shaking,
  .ms-board.is-won::after,
  .ms-board.is-won .ms-cell.is-revealed,
  .ms-board.is-lost .ms-cell.is-mine:not(.is-exploded),
  .ms-cell.is-exploded,
  .ms-cell.is-flagged::before,
  .ms-cell.is-questioned::before,
  .ms-cell.is-questioned.is-mark-out::before,
  .ms-result.is-shown,
  .ms-result.is-shown .ms-result-new:not([hidden]) {
    animation: none !important;
    animation-delay: 0s !important;
  }

  .ms-board.is-won {
    box-shadow: var(--ms-board-shadow), 0 0 0 1px rgba(201, 244, 77, 0.28);
  }
}

/* ------------------------------------------------------------------
   Minesweeper — fullscreen mode
   Fullscreen target is the whole .ms section, so the game keeps its
   difficulty selector, controls, HUD, result, stats panel and help.
   ------------------------------------------------------------------ */

.ms:fullscreen {
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  overflow: auto;
  box-sizing: border-box;
  background: var(--bg);
  border-top: 0;
  padding:
    calc(clamp(1.25rem, 3.5vw, 2.75rem) + env(safe-area-inset-top))
    calc(clamp(1rem, 3vw, 2.5rem) + env(safe-area-inset-right))
    calc(clamp(1.5rem, 4vw, 3rem) + env(safe-area-inset-bottom))
    calc(clamp(1rem, 3vw, 2.5rem) + env(safe-area-inset-left));
}

/* Keep the content column tidy on wide screens; the board-wrap still
   scrolls horizontally inside it when the Expert board overflows. */
.ms:fullscreen > * {
  max-width: 75rem;
  margin-left: auto;
  margin-right: auto;
}

/* Legacy WebKit fullscreen (older Safari), same treatment. */
.ms:-webkit-full-screen {
  width: 100%;
  height: 100vh;
  overflow: auto;
  box-sizing: border-box;
  background: var(--bg);
  border-top: 0;
  padding:
    calc(clamp(1.25rem, 3.5vw, 2.75rem) + env(safe-area-inset-top))
    calc(clamp(1rem, 3vw, 2.5rem) + env(safe-area-inset-right))
    calc(clamp(1.5rem, 4vw, 3rem) + env(safe-area-inset-bottom))
    calc(clamp(1rem, 3vw, 2.5rem) + env(safe-area-inset-left));
}

.ms:-webkit-full-screen > * {
  max-width: 75rem;
  margin-left: auto;
  margin-right: auto;
}


/* ------------------------------------------------------------------
   Gomoku
   ------------------------------------------------------------------ */

.gm {
  --gm-accent: var(--accent);
}

.gm [hidden] {
  display: none;
}

.gm-page .page-head {
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.gm-page .page-title {
  margin-bottom: 0.8rem;
}

.gm-rule {
  margin-top: 0.75rem;
  font-size: 10px;
  letter-spacing: 0.18em;
}

/* --- setup ------------------------------------------------------- */

.gm-setup {
  display: grid;
  gap: 1.5rem;
  max-width: 40rem;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg-2);
}

.gm-field {
  display: grid;
  gap: 0.6rem;
}

.gm-field-label {
  font-size: 10px;
}

.gm-side {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.gm-side-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.gm-side-btn:hover {
  border-color: var(--muted);
}

.gm-side-btn.is-selected {
  border-color: var(--accent);
  background: rgba(201, 244, 77, 0.08);
}

.gm-side-note {
  font-size: 9px;
  color: var(--muted);
}

.gm-stone {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.gm-stone--black {
  background: radial-gradient(circle at 35% 32%, #5b5b68, #1d1d25 48%, #08080c);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.gm-stone--white {
  background: radial-gradient(circle at 35% 32%, #ffffff, #f2eee5 58%, #cec6b6);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(96, 84, 66, 0.4);
}

.gm-difficulty {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.gm-diff,
.gm-btn {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease),
    background 0.3s var(--ease), opacity 0.3s var(--ease);
}

.gm-diff:hover,
.gm-btn:hover {
  color: var(--fg);
  border-color: var(--muted);
}

.gm-diff[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.gm-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.gm-btn:disabled:hover {
  color: var(--muted);
  border-color: var(--line);
}

.gm-start,
.gm-playagain {
  justify-self: start;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 0.7rem 1.2rem;
  cursor: pointer;
  transition: opacity 0.2s var(--ease);
}

.gm-start:hover,
.gm-playagain:hover {
  opacity: 0.85;
}

.gm-side-btn:focus-visible,
.gm-diff:focus-visible,
.gm-btn:focus-visible,
.gm-start:focus-visible,
.gm-playagain:focus-visible,
.gm-stats-reset:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

/* --- game controls / HUD ---------------------------------------- */

.gm-game {
  display: grid;
  gap: 1.25rem;
}

.gm-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
}

.gm-controls-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.gm-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg-2);
}

.gm-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 4.25rem;
}

.gm-stat-label {
  font-size: 10px;
}

.gm-stat-value {
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--fg);
  transition: color 0.25s var(--ease);
}

.gm-stat-turn .gm-stat-value {
  color: var(--accent);
}

.gm-stat-turn .gm-stat-value[data-state="thinking"] {
  color: var(--muted);
}

.gm-stat-turn .gm-stat-value[data-state="loss"] {
  color: #ff7a7a;
}

.gm-stat-turn .gm-stat-value[data-state="draw"] {
  color: var(--fg);
}

.gm-stat-status .gm-stat-value[data-status="won"] {
  color: var(--accent);
}

@media (min-width: 760px) {
  .gm-stat-status {
    margin-left: auto;
  }
}

/* --- result panel ----------------------------------------------- */

.gm-result {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(201, 244, 77, 0.3);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  background: var(--bg-2);
}

.gm-result[hidden] {
  display: none;
}

.gm-result[data-result="loss"] {
  border-color: rgba(255, 122, 122, 0.3);
  border-left-color: #ff7a7a;
}

.gm-result[data-result="loss"] .gm-result-title {
  color: #ff7a7a;
}

.gm-result[data-result="draw"] {
  border-color: rgba(236, 236, 240, 0.2);
  border-left-color: var(--muted);
}

.gm-result.is-shown {
  animation: gm-result-in 240ms var(--ease) both;
}

.gm-result-title {
  font-size: 14px;
  letter-spacing: 0.22em;
  color: var(--accent);
}

.gm-result-meta {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.gm-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

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

.gm-board-wrap {
  display: flex;
  justify-content: center;
  max-width: 100%;
}

.gm-board {
  display: block;
  width: min(100%, 620px);
  height: auto;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* --- statistics panel ------------------------------------------- */

.gm-stats-panel {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg-2);
}

.gm-stats-panel[hidden] {
  display: none;
}

.gm-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1.25rem;
}

.gm-stats-block {
  display: grid;
  align-content: start;
  gap: 0.35rem;
}

.gm-stats-name {
  margin-bottom: 0.2rem;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.gm-stats-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.gm-stats-row span {
  font-size: 11px;
  color: var(--muted);
}

.gm-stats-row span:last-child {
  color: var(--fg);
}

.gm-stats-foot {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.gm-stats-reset {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.gm-stats-reset:hover {
  color: var(--fg);
  border-color: var(--muted);
}

.gm-stats-reset.is-confirming {
  color: #ff7a7a;
  border-color: rgba(255, 122, 122, 0.5);
}

.gm-help {
  display: grid;
  gap: 0.5rem;
}

.gm-help .para {
  margin: 0;
}

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

@media (max-width: 640px) {
  .gm-board {
    width: min(100%, 520px);
  }

  .gm-controls {
    justify-content: flex-start;
  }

  .gm-hud {
    gap: 0.6rem 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gm-side-btn,
  .gm-diff,
  .gm-btn,
  .gm-start,
  .gm-playagain,
  .gm-stats-reset,
  .gm-stat-value {
    transition: none;
  }

  .gm-result.is-shown {
    animation: none !important;
  }
}

/* ------------------------------------------------------------------
   Reversi
   The board is deliberately a rich, recognisable green so it reads as
   a physical game board against the near-black page.
   ------------------------------------------------------------------ */

.rv [hidden] {
  display: none;
}

.rv-page .page-head {
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.rv-page .page-title {
  margin-bottom: 0.8rem;
}

.rv-rule {
  margin-top: 0.75rem;
  font-size: 10px;
  letter-spacing: 0.18em;
}

/* --- setup ------------------------------------------------------- */

.rv-setup {
  display: grid;
  gap: 1.5rem;
  max-width: 40rem;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg-2);
}

.rv-field {
  display: grid;
  gap: 0.6rem;
}

.rv-field-label {
  font-size: 10px;
}

.rv-side {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.rv-side-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.rv-side-btn:hover {
  border-color: var(--muted);
}

.rv-side-btn.is-selected {
  border-color: var(--accent);
  background: rgba(201, 244, 77, 0.08);
}

.rv-side-note {
  font-size: 9px;
  color: var(--muted);
}

.rv-difficulty {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.rv-diff,
.rv-btn {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease),
    background 0.3s var(--ease), opacity 0.3s var(--ease);
}

.rv-diff:hover,
.rv-btn:hover {
  color: var(--fg);
  border-color: var(--muted);
}

.rv-diff[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.rv-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.rv-btn:disabled:hover {
  color: var(--muted);
  border-color: var(--line);
}

.rv-start,
.rv-playagain {
  justify-self: start;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 0.7rem 1.2rem;
  cursor: pointer;
  transition: opacity 0.2s var(--ease);
}

.rv-start:hover,
.rv-playagain:hover {
  opacity: 0.85;
}

.rv-side-btn:focus-visible,
.rv-diff:focus-visible,
.rv-btn:focus-visible,
.rv-start:focus-visible,
.rv-playagain:focus-visible,
.rv-stats-reset:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

/* --- discs ------------------------------------------------------- */

.rv-disc {
  position: relative;
  display: block;
  width: 78%;
  height: 78%;
  border-radius: 50%;
  transform: rotateY(0deg);
  transition: transform 220ms var(--ease);
  will-change: transform;
}

.rv-disc--hidden {
  opacity: 0;
}

.rv-disc--black {
  background: radial-gradient(circle at 35% 30%, #4d4d59, #1c1c24 48%, #08080c);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.55),
    inset 0 1px 1px rgba(255, 255, 255, 0.14);
}

.rv-disc--white {
  background: radial-gradient(circle at 35% 30%, #ffffff, #f2eee4 55%, #d3ccbc);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(96, 84, 62, 0.5);
}

.rv-disc--swatch {
  width: 18px;
  height: 18px;
  flex: none;
}

.rv-disc.is-placing {
  animation: rv-place 150ms var(--ease) both;
}

.rv-disc.is-flipping {
  transform: rotateY(180deg);
}

.rv-disc.no-transition {
  transition: none !important;
}

@keyframes rv-place {
  from { transform: scale(0.55); opacity: 0.4; }
  to { transform: scale(1); opacity: 1; }
}

/* --- game controls / HUD ---------------------------------------- */

.rv-game {
  display: grid;
  gap: 1.25rem;
}

.rv-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
}

.rv-controls-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.rv-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.75rem 1.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg-2);
}

.rv-score {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 5.5rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 2px;
}

.rv-score-name {
  font-size: 10px;
  color: var(--muted);
}

.rv-score-count {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 17px;
  color: var(--fg);
}

.rv-mini {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex: none;
}

.rv-mini--black {
  background: radial-gradient(circle at 35% 30%, #4d4d59, #1c1c24 48%, #08080c);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.14);
}

.rv-mini--white {
  background: radial-gradient(circle at 35% 30%, #ffffff, #f2eee4 55%, #d3ccbc);
  box-shadow: inset 0 0 0 1px rgba(96, 84, 62, 0.5);
}

.rv-score--black.rv-score--you {
  border-color: rgba(201, 244, 77, 0.5);
}

.rv-score--white.rv-score--you {
  border-color: rgba(201, 244, 77, 0.5);
}

.rv-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  min-width: 4.25rem;
}

.rv-stat-label {
  font-size: 10px;
}

.rv-stat-value {
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--fg);
  transition: color 0.25s var(--ease);
}

.rv-stat-value[data-state="thinking"] {
  color: var(--muted);
}

.rv-stat-value[data-state="win"] {
  color: var(--accent);
}

.rv-stat-value[data-state="loss"] {
  color: #ff7a7a;
}

@media (min-width: 760px) {
  .rv-stat-status {
    margin-left: auto;
  }
}

.rv-notice {
  margin: -0.4rem 0 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.rv-notice[hidden] {
  display: none;
}

/* --- result panel ----------------------------------------------- */

.rv-result {
  display: grid;
  gap: 0.5rem;
  justify-items: start;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(201, 244, 77, 0.3);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  background: var(--bg-2);
}

.rv-result[hidden] {
  display: none;
}

.rv-result[data-result="loss"] {
  border-color: rgba(255, 122, 122, 0.3);
  border-left-color: #ff7a7a;
}

.rv-result[data-result="loss"] .rv-result-title {
  color: #ff7a7a;
}

.rv-result[data-result="draw"] {
  border-color: rgba(236, 236, 240, 0.2);
  border-left-color: var(--muted);
}

.rv-result.is-shown {
  animation: rv-result-in 240ms var(--ease) both;
}

.rv-result-title {
  font-size: 14px;
  letter-spacing: 0.22em;
  color: var(--accent);
}

.rv-result-counts {
  font-size: 15px;
  letter-spacing: 0.1em;
  color: var(--fg);
}

.rv-result-meta {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.rv-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

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

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

.rv-board-wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

/* Square the board without relying on aspect-ratio: the inner box is a
   square via the padding-ratio trick and the grid fills it absolutely.
   This keeps the board visible even where aspect-ratio is unsupported. */
.rv-board-square {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
}

.rv-board {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 2px;
  padding: 10px;
  background: #0e1216;
  border: 1px solid rgba(236, 236, 240, 0.12);
  border-radius: 10px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.rv-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 3px;
  background: linear-gradient(145deg, #237049, #1b5c3a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.rv-cell.is-legal {
  cursor: pointer;
  background: linear-gradient(145deg, #278055, #1f6a44);
}

.rv-cell.is-legal:hover {
  background: linear-gradient(145deg, #2d8c5e, #23744b);
}

.rv-cell:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* legal-move indicator: a small lime dot, never a disc */
.rv-cell.is-legal::after {
  content: "";
  position: absolute;
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(8, 24, 12, 0.5);
  pointer-events: none;
}

/* translucent ghost disc on hover (desktop only) */
.rv-cell.is-legal:hover::before {
  content: "";
  position: absolute;
  width: 66%;
  height: 66%;
  border-radius: 50%;
  opacity: 0.45;
  pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #4d4d59, #08080c 70%);
}

.rv-board[data-you="white"] .rv-cell.is-legal:hover::before {
  background: radial-gradient(circle at 35% 30%, #ffffff, #d3ccbc 72%);
  opacity: 0.55;
}

/* last-move marker: lime dot centred on the disc */
.rv-cell.is-last .rv-disc::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28%;
  height: 28%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(8, 20, 6, 0.65);
}

/* --- statistics panel ------------------------------------------- */

.rv-stats-panel {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg-2);
}

.rv-stats-panel[hidden] {
  display: none;
}

.rv-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1.25rem;
}

.rv-stats-block {
  display: grid;
  align-content: start;
  gap: 0.35rem;
}

.rv-stats-name {
  margin-bottom: 0.2rem;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.rv-stats-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.rv-stats-row span {
  font-size: 11px;
  color: var(--muted);
}

.rv-stats-row span:last-child {
  color: var(--fg);
}

.rv-stats-foot {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.rv-stats-reset {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.rv-stats-reset:hover {
  color: var(--fg);
  border-color: var(--muted);
}

.rv-stats-reset.is-confirming {
  color: #ff7a7a;
  border-color: rgba(255, 122, 122, 0.5);
}

.rv-help {
  display: grid;
  gap: 0.5rem;
}

.rv-help .para {
  margin: 0;
}

@media (max-width: 640px) {
  .rv-page {
    padding-left: 3vw;
    padding-right: 3vw;
  }

  .rv-controls {
    justify-content: flex-start;
  }

  .rv-hud {
    gap: 0.6rem 1rem;
  }

  .rv-score {
    min-width: 4.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv-side-btn,
  .rv-diff,
  .rv-btn,
  .rv-start,
  .rv-playagain,
  .rv-stats-reset,
  .rv-stat-value,
  .rv-disc {
    transition: none;
  }

  .rv-disc.is-placing,
  .rv-result.is-shown {
    animation: none !important;
  }

  .rv-disc.is-flipping {
    transform: none;
  }
}

/* ------------------------------------------------------------------
   Water Sort
   The page keeps the randolf.dev language; bottles and liquids carry
   their own brighter palette so every layer stays readable.
   ------------------------------------------------------------------ */

.ws [hidden] {
  display: none;
}

.ws-page .page-head {
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.ws-page .page-title {
  margin-bottom: 0.8rem;
}

.ws-rule {
  margin-top: 0.75rem;
  font-size: 10px;
  letter-spacing: 0.18em;
}

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

.ws-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.ws-hud {
  display: flex;
  gap: 1.75rem;
}

.ws-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 3.5rem;
}

.ws-stat-label {
  font-size: 10px;
}

.ws-stat-value {
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--fg);
}

.ws-controls-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ws-btn {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease),
    background 0.3s var(--ease), opacity 0.3s var(--ease);
}

.ws-btn:hover {
  color: var(--fg);
  border-color: var(--muted);
}

.ws-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.ws-btn:disabled:hover {
  color: var(--muted);
  border-color: var(--line);
}

.ws-btn.is-confirming {
  color: #ff7a7a;
  border-color: rgba(255, 122, 122, 0.5);
}

.ws-btn:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

.ws-hint {
  margin: 0 0 1rem;
  color: var(--accent);
  letter-spacing: 0.12em;
}

/* --- level selector ----------------------------------------------- */

.ws-levels-panel {
  margin-bottom: 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg-2);
}

.ws-levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 0.5rem;
}

.ws-level-btn {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.6rem 0;
  text-align: center;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.ws-level-btn:hover {
  border-color: var(--muted);
}

.ws-level-btn:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

.ws-level-btn.is-done {
  color: var(--accent);
  border-color: rgba(201, 244, 77, 0.4);
}

.ws-level-btn[aria-current="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.ws-level-btn[disabled] {
  opacity: 0.3;
  cursor: default;
}

.ws-level-btn[disabled]:hover {
  border-color: var(--line);
}

/* --- result panel -------------------------------------------------- */

.ws-result {
  display: grid;
  gap: 0.5rem;
  justify-items: start;
  margin-bottom: 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(201, 244, 77, 0.3);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  background: var(--bg-2);
  animation: ws-result-in 240ms var(--ease) both;
}

.ws-result-title {
  font-size: 14px;
  letter-spacing: 0.22em;
  color: var(--accent);
}

.ws-result-meta {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.ws-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.ws-playagain {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  transition: opacity 0.2s var(--ease);
}

.ws-playagain:hover {
  opacity: 0.85;
}

.ws-playagain:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

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

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

.ws-board-wrap {
  display: flex;
  justify-content: center;
  padding-top: 16px;
}

.ws-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 3.5vw, 28px);
  width: 100%;
  max-width: 560px;
  --ws-bw: clamp(48px, 15vw, 74px);
  --ws-gap: clamp(6px, 2.4vw, 20px);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.ws-row {
  display: flex;
  justify-content: center;
  gap: var(--ws-gap);
}

.ws-bottle {
  position: relative;
  display: block;
  width: var(--ws-bw);
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ws-bottle:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

.ws-bottle-inner {
  position: relative;
  display: block;
  transform-origin: 50% 4%;
  transition: transform 0.16s var(--ease);
  will-change: transform;
}

.ws-bottle.is-animating {
  z-index: 6;
}

.ws-bottle.is-selected .ws-bottle-inner {
  transform: translateY(-10px);
}

.ws-bottle.is-reject .ws-bottle-inner {
  animation: ws-shake 0.3s ease;
}

@keyframes ws-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  55% { transform: translateX(4px); }
  80% { transform: translateX(-2px); }
}

.ws-defs,
.ws-defs svg {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ws-bottle svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.ws-glass {
  fill: none;
  stroke: rgba(236, 236, 240, 0.32);
  stroke-width: 2;
  stroke-linecap: round;
  transition: stroke 0.2s var(--ease);
}

.ws-glass-fill {
  fill: rgba(255, 255, 255, 0.04);
}

.ws-shine {
  fill: rgba(255, 255, 255, 0.1);
}

.ws-liq-clip {
  transition: transform 200ms ease-in-out;
  will-change: transform;
}

.ws .no-trans,
.ws .no-trans * {
  transition: none !important;
}

.ws-bottle.is-done .ws-glass {
  stroke: rgba(236, 236, 240, 0.55);
}

.ws-bottle.is-done::after {
  content: "";
  position: absolute;
  left: 32%;
  right: 32%;
  bottom: -7px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
  opacity: 0.45;
}

.ws-bottle.is-selected .ws-glass {
  stroke: rgba(201, 244, 77, 0.85);
}

/* --- victory --------------------------------------------------------- */

.ws-board.is-won .ws-bottle.is-done .ws-bottle-inner {
  animation: ws-win-lift 600ms var(--ease) both;
  animation-delay: calc(var(--wi, 0) * 80ms);
}

.ws-board.is-won .ws-bottle.is-done .ws-glass {
  animation: ws-win-stroke 900ms var(--ease) both;
  animation-delay: calc(var(--wi, 0) * 80ms);
}

@keyframes ws-win-lift {
  0% { transform: translateY(0); }
  40% { transform: translateY(-8px); }
  100% { transform: translateY(0); }
}

@keyframes ws-win-stroke {
  0% { stroke: rgba(201, 244, 77, 0.9); }
  100% { stroke: rgba(236, 236, 240, 0.55); }
}

/* --- pour stream ------------------------------------------------------ */

.ws-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
}

.ws-stream {
  position: absolute;
  width: 4.5px;
  border-radius: 3px;
  transform-origin: top center;
  animation: ws-stream-in 110ms ease-out both;
}

.ws-stream.is-ending {
  opacity: 0;
  transition: opacity 130ms ease-in;
}

@keyframes ws-stream-in {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

/* --- help / a11y ------------------------------------------------------- */

.ws-help {
  display: grid;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.ws-help .para {
  margin: 0;
}

.ws-sr-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- responsive --------------------------------------------------------- */

@media (max-width: 640px) {
  .ws-page {
    padding-left: 3vw;
    padding-right: 3vw;
  }

  .ws-controls {
    justify-content: flex-start;
  }

  .ws-hud {
    gap: 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ws-btn,
  .ws-level-btn,
  .ws-bottle-inner,
  .ws-glass,
  .ws-liq-clip,
  .ws-playagain {
    transition: none;
  }

  .ws-bottle.is-reject .ws-bottle-inner,
  .ws-result,
  .ws-stream,
  .ws-board.is-won .ws-bottle.is-done .ws-bottle-inner,
  .ws-board.is-won .ws-bottle.is-done .ws-glass {
    animation: none !important;
  }

  .ws-stream {
    display: none;
  }

  .ws-bottle.is-selected .ws-bottle-inner {
    transform: none;
  }
}

/* ------------------------------------------------------------------
   Water Sort — V2 (modes, hint, sound)
   ------------------------------------------------------------------ */

.ws-modes {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.ws-mode-btn,
.ws-diff-btn {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease),
    background 0.3s var(--ease);
}

.ws-mode-btn:hover,
.ws-diff-btn:hover {
  color: var(--fg);
  border-color: var(--muted);
}

.ws-mode-btn[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.ws-diff {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.ws-diff[hidden] {
  display: none;
}

.ws-diff-btn {
  border-radius: 2px;
  font-size: 9px;
  padding: 0.35rem 0.7rem;
}

.ws-diff-btn[aria-pressed="true"] {
  color: var(--accent);
  border-color: rgba(201, 244, 77, 0.5);
  background: rgba(201, 244, 77, 0.07);
}

.ws-mode-btn:focus-visible,
.ws-diff-btn:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

.ws-hint-panel {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(201, 244, 77, 0.3);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  background: var(--bg-2);
}

.ws-hint-panel[hidden] {
  display: none;
}

.ws-hint-question {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--fg);
}

.ws-hint-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ws-hint-result {
  margin: 0 0 1rem;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.ws-hint-result[hidden] {
  display: none;
}

.ws-gen {
  margin: 2rem 0;
  text-align: center;
  letter-spacing: 0.22em;
  color: var(--muted);
  animation: ws-gen-pulse 1.4s ease-in-out infinite;
}

.ws-gen[hidden] {
  display: none;
}

@keyframes ws-gen-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

/* hint emphasis: motion + outline + lift, never color-only */

.ws-bottle.is-hint-src .ws-glass,
.ws-bottle.is-hint-dst .ws-glass {
  stroke: rgba(201, 244, 77, 0.9);
}

.ws-bottle.is-hint-src .ws-bottle-inner {
  animation: ws-hint-pulse 0.7s var(--ease) 2;
}

.ws-bottle.is-hint-dst .ws-bottle-inner {
  animation: ws-hint-drop 0.7s var(--ease) 2;
}

.ws-bottle.is-hint-dst::before {
  content: "↓";
  position: absolute;
  top: -1.15rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1;
  animation: ws-hint-arrow 0.7s var(--ease) 2;
}

@keyframes ws-hint-pulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes ws-hint-drop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

@keyframes ws-hint-arrow {
  0%, 100% { opacity: 0.4; transform: translateX(-50%) translateY(0); }
  50% { opacity: 1; transform: translateX(-50%) translateY(3px); }
}

@media (prefers-reduced-motion: reduce) {
  .ws-gen {
    animation: none;
  }

  .ws-bottle.is-hint-src .ws-bottle-inner,
  .ws-bottle.is-hint-dst .ws-bottle-inner,
  .ws-bottle.is-hint-dst::before {
    animation: none !important;
  }

  .ws-bottle.is-hint-src .ws-bottle-inner {
    transform: translateY(-8px);
  }

  .ws-bottle.is-hint-dst::before {
    content: "↓";
    opacity: 1;
  }
}

/* Keep the global navigation readable with the bead studio entry on phones. */
@media (max-width: 420px) {
  .site-header { padding-inline: 1rem; }
  .site-nav ul { gap: .8rem; }
  .site-nav a { letter-spacing: .08em; }
  .site-header .brand { letter-spacing: .16em; }
}
