:root {
  color-scheme: light;
  --bg: #f7f8f8;
  --paper: #ffffff;
  --paper-soft: rgba(255, 255, 255, 0.78);
  --ink: #121820;
  --muted: #66717c;
  --quiet: #8d949d;
  --line: rgba(18, 24, 32, 0.13);
  --line-strong: rgba(18, 24, 32, 0.22);
  --gold: #b28a46;
  --gold-soft: rgba(178, 138, 70, 0.14);
  --teal: #1e6a78;
  --teal-bright: #20b2aa;
  --teal-soft: rgba(32, 178, 170, 0.13);
  --green: #287d54;
  --red: #b64c50;
  --shadow: 0 24px 70px rgba(18, 24, 32, 0.09);
  --max: 1180px;
  --radius: 8px;
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, #ffffff 0%, var(--bg) 52%, #eef4f3 100%);
  color: var(--ink);
}

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

button {
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

svg {
  display: block;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
.game-shell,
.site-footer {
  width: min(var(--max), calc(100% - 44px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
}

.brand,
.site-nav {
  display: flex;
  align-items: center;
}

.brand {
  gap: 14px;
  font-size: 18px;
  font-weight: 560;
}

.brand-mark {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 2px solid var(--gold);
  border-radius: 999px;
  background: linear-gradient(145deg, #ffffff, rgba(178, 138, 70, 0.08));
  box-shadow: inset 0 0 0 7px rgba(255, 255, 255, 0.72);
}

.site-nav {
  gap: 34px;
  color: var(--muted);
  font-size: 14px;
}

.site-nav a {
  position: relative;
  display: inline-flex;
  min-height: 38px;
  align-items: center;
}

.site-nav a::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: var(--gold);
  content: "";
  opacity: 0;
  transform: scaleX(0.4);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

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

.site-nav a[aria-current="page"]::after {
  opacity: 1;
  transform: scaleX(1);
}

.game-shell {
  display: grid;
  gap: 14px;
  padding: clamp(18px, 3vw, 36px) 0 42px;
}

.intro-panel,
.control-panel,
.scoreboard,
.play-panel,
.moves-panel,
.rules-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-soft);
  box-shadow: var(--shadow);
}

.intro-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  gap: 28px;
  align-items: end;
  padding: clamp(20px, 3vw, 32px);
}

.intro-panel > * {
  min-width: 0;
}

.back-link {
  display: inline-flex;
  margin-bottom: 20px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 650;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 760px;
  color: var(--ink);
  font-size: clamp(36px, 4.8vw, 60px);
  font-weight: 590;
  letter-spacing: 0;
  line-height: 1.02;
  overflow-wrap: anywhere;
}

h1 span {
  display: inline;
}

.intro-panel p {
  max-width: 650px;
  margin-top: 16px;
  color: var(--muted);
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.55;
  overflow-wrap: break-word;
}

.sponsor-slot {
  display: grid;
  min-height: 86px;
  align-content: center;
  gap: 6px;
  padding: 18px;
  border: 1px dashed rgba(30, 106, 120, 0.32);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(32, 178, 170, 0.07), rgba(178, 138, 70, 0.06)),
    rgba(255, 255, 255, 0.62);
}

.sponsor-slot span,
.control-label {
  color: var(--gold);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sponsor-slot strong {
  font-size: 15px;
  font-weight: 680;
}

.sponsor-slot small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.control-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
}

.control-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
}

.segment,
.reset-button {
  min-height: 40px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 680;
}

.segment {
  min-width: 94px;
  padding: 0 16px;
  background: transparent;
  color: var(--muted);
  transition:
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.segment:hover,
.segment.is-active {
  background: var(--teal-soft);
  color: var(--teal);
  box-shadow: inset 0 0 0 1px rgba(32, 178, 170, 0.16);
}

.reset-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 0 15px;
  border: 1px solid rgba(178, 138, 70, 0.24);
  background: var(--gold-soft);
  color: #6e5428;
}

.reset-button svg {
  width: 17px;
}

.reset-button path,
.rules-panel path,
.move-icon path,
.move-icon circle,
.move-icon rect,
.result-icon path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.scoreboard article {
  display: grid;
  min-height: 88px;
  place-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.86);
}

.scoreboard span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.scoreboard strong {
  color: var(--ink);
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 610;
  line-height: 1;
}

.play-panel {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(190px, 0.7fr) minmax(190px, 1fr);
  gap: 18px;
  align-items: center;
  padding: clamp(16px, 2.4vw, 24px);
}

.choice-display {
  display: grid;
  min-height: 228px;
  place-items: center;
  align-content: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(247, 248, 248, 0.72));
}

.display-label {
  color: var(--quiet);
  font-size: 13px;
  font-weight: 720;
  text-transform: uppercase;
}

.choice-token {
  display: grid;
  width: clamp(96px, 11vw, 124px);
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(178, 138, 70, 0.36);
  border-radius: 999px;
  background:
    linear-gradient(145deg, #ffffff, rgba(32, 178, 170, 0.08)),
    var(--paper);
  color: var(--teal);
  box-shadow:
    0 18px 44px rgba(18, 24, 32, 0.08),
    0 0 0 12px rgba(178, 138, 70, 0.055);
}

.choice-token svg {
  width: 52%;
}

.token-icon {
  color: var(--quiet);
  font-size: 42px;
  font-weight: 520;
}

.choice-display strong {
  min-height: 28px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 620;
}

.round-center {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.round-count {
  color: var(--gold);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.versus-mark {
  display: grid;
  width: 82px;
  height: 82px;
  place-items: center;
  border: 1px solid rgba(30, 106, 120, 0.22);
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 20px;
  font-weight: 760;
}

.round-message {
  max-width: 260px;
  min-height: 58px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.round-message.win {
  color: var(--green);
}

.round-message.loss {
  color: var(--red);
}

.round-message.draw {
  color: var(--teal);
}

.moves-panel {
  display: grid;
  gap: 20px;
  padding: clamp(18px, 3vw, 28px);
}

.moves-heading {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
}

.moves-heading h2 {
  margin-top: 5px;
  font-size: 24px;
  font-weight: 610;
}

.moves-heading p {
  max-width: 430px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.move-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.move-button {
  display: grid;
  min-height: 132px;
  place-items: center;
  gap: 8px;
  padding: 16px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms var(--ease);
}

.move-button:hover,
.move-button:focus-visible,
.move-button.is-selected {
  border-color: rgba(32, 178, 170, 0.42);
  box-shadow: 0 18px 34px rgba(18, 24, 32, 0.1);
  outline: none;
  transform: translateY(-2px);
}

.move-button[disabled] {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
}

.move-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgba(178, 138, 70, 0.28);
  border-radius: 999px;
  background: rgba(32, 178, 170, 0.08);
  color: var(--teal);
}

.move-icon svg {
  width: 31px;
  height: 31px;
}

.move-name {
  font-size: 16px;
  font-weight: 680;
}

.move-note {
  min-height: 32px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}

.rules-panel {
  overflow: hidden;
}

.rules-panel details {
  background: rgba(255, 255, 255, 0.72);
}

.rules-panel summary {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 3vw, 28px);
  cursor: pointer;
  font-weight: 680;
  list-style: none;
}

.rules-panel summary::-webkit-details-marker {
  display: none;
}

.rules-panel summary svg {
  width: 18px;
  color: var(--gold);
  transition: transform 160ms ease;
}

.rules-panel details[open] summary svg {
  transform: rotate(180deg);
}

.rules-content {
  display: grid;
  gap: 16px;
  padding: 0 clamp(18px, 3vw, 28px) 24px;
}

.rules-content p {
  max-width: 760px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.rules-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules-list li {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.rules-list strong {
  color: var(--ink);
}

.site-footer {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--quiet);
  font-size: 13px;
}

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 520ms ease,
    transform 520ms var(--ease);
}

.js .reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

.play-panel.is-resolving .choice-token {
  animation: token-pop 420ms var(--ease);
}

.play-panel.is-resolving .versus-mark {
  animation: pulse-ring 480ms var(--ease);
}

.result-win [data-side="player"] .choice-token,
.result-loss [data-side="opponent"] .choice-token,
.result-draw .choice-token {
  border-color: rgba(32, 178, 170, 0.5);
  box-shadow:
    0 18px 44px rgba(18, 24, 32, 0.08),
    0 0 0 12px rgba(32, 178, 170, 0.1);
}

@keyframes token-pop {
  0% {
    transform: scale(0.92);
  }
  55% {
    transform: scale(1.07);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(32, 178, 170, 0.18);
  }
  100% {
    box-shadow: 0 0 0 20px rgba(32, 178, 170, 0);
  }
}

@media (max-width: 980px) {
  .intro-panel,
  .play-panel {
    grid-template-columns: 1fr;
  }

  .play-panel {
    gap: 12px;
  }

  .round-center {
    order: -1;
  }

  .choice-display {
    min-height: 188px;
  }

  .move-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .site-header,
  .game-shell,
  .site-footer {
    width: min(100% - 28px, var(--max));
  }

  .site-header {
    min-height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 0 14px;
  }

  .brand {
    font-size: 16px;
  }

  .site-nav {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 16px;
    font-size: 13px;
  }

  .intro-panel,
  .control-panel,
  .moves-panel {
    padding: 18px;
  }

  h1 {
    font-size: clamp(34px, 10vw, 40px);
    line-height: 1.06;
  }

  h1 span {
    display: block;
  }

  .intro-panel p {
    max-width: 280px;
    font-size: 16px;
  }

  .moves-heading p {
    max-width: 280px;
  }

  .control-panel,
  .control-group,
  .moves-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented,
  .reset-button {
    width: 100%;
  }

  .segment {
    min-width: 0;
    flex: 1;
    padding-inline: 10px;
  }

  .scoreboard {
    grid-template-columns: repeat(2, 1fr);
  }

  .scoreboard article {
    min-height: 92px;
  }

  .move-grid,
  .rules-list {
    grid-template-columns: 1fr;
  }

  .moves-panel {
    order: 1;
  }

  .scoreboard {
    order: 2;
  }

  .play-panel {
    order: 3;
  }

  .rules-panel {
    order: 4;
  }

  .move-button {
    min-height: 96px;
    grid-template-columns: 58px minmax(0, 1fr);
    justify-items: start;
    text-align: left;
  }

  .move-note {
    min-height: 0;
    text-align: left;
  }

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

  .site-footer {
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
