﻿:root {
  --bg-top: #f4efe2;
  --bg-bottom: #dff3ec;
  --panel: rgba(255, 252, 246, 0.88);
  --panel-strong: #fffdf9;
  --line: rgba(24, 41, 54, 0.1);
  --text: #1c2c37;
  --muted: #5e6a73;
  --primary: #11795d;
  --primary-dark: #0a5844;
  --secondary: #ef8f34;
  --accent: #1f9ed3;
  --danger: #d9534f;
  --shadow: 0 22px 50px rgba(28, 44, 55, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Nunito", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(239, 143, 52, 0.2), transparent 26%),
    radial-gradient(circle at bottom right, rgba(31, 158, 211, 0.18), transparent 30%),
    linear-gradient(145deg, var(--bg-top), var(--bg-bottom));
}

button {
  font: inherit;
}

.page-shell {
  flex: 1;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0 12px;
}

.site-header .nav-wrap {
  min-height: 58px;
}

.site-header .logo-home {
  min-height: 58px;
}

.site-header .logo img {
  height: 52px;
}

.site-header .menu a {
  padding: 0.42rem 0.68rem;
  font-size: 0.88rem;
}

.hero,
.layout {
  display: grid;
  gap: 18px;
}

.hero {
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.8fr);
  margin-bottom: 14px;
}

.hero--compact {
  align-items: start;
}

.hero__copy,
.hero__card,
.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero__copy,
.hero__card,
.panel {
  padding: 22px;
}

.hero__copy {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(31, 158, 211, 0.2), transparent 36%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(240, 251, 246, 0.9));
}

.hero__copy::after {
  content: "";
  position: absolute;
  inset: auto -38px -44px auto;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(17, 121, 93, 0.18), rgba(17, 121, 93, 0));
  pointer-events: none;
}

.eyebrow,
.panel__eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  font-size: 0.83rem;
  color: var(--primary-dark);
}

.hero__copy .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.34rem 0.65rem;
  border-radius: 999px;
  background: rgba(17, 121, 93, 0.1);
  border: 1px solid rgba(17, 121, 93, 0.14);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Chakra Petch", sans-serif;
}

h1 {
  font-size: clamp(2rem, 3.2vw, 3.15rem);
  line-height: 0.98;
  max-width: 18ch;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.hero__copy h1 {
  margin-top: 0.45rem;
  color: #0f2f3c;
  text-shadow: 0 10px 24px rgba(17, 121, 93, 0.12);
}

.hero__text,
.instruction-list,
.info-block p,
.queue-empty {
  color: var(--muted);
  line-height: 1.65;
}

.hero__text {
  max-width: 58ch;
  margin-top: 0.65rem;
  font-size: 0.96rem;
  line-height: 1.45;
}

.instruction-list {
  margin: 10px 0 0;
  padding-left: 18px;
}

.instruction-list li + li {
  margin-top: 6px;
}

.hero__card--summary {
  align-self: start;
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(249, 255, 252, 0.98));
}

.rules-panel {
  margin-top: 24px;
  margin-bottom: 24px;
}

.rules-panel h2 {
  margin-bottom: 16px;
}

.instruction-list--columns {
  columns: 2;
  column-gap: 28px;
}

.instruction-list--columns li {
  break-inside: avoid;
}

.layout {
  grid-template-columns: minmax(0, 2fr) minmax(300px, 0.95fr);
  grid-template-areas:
    "game player"
    "game info";
  align-items: start;
}

.panel--game {
  grid-area: game;
  display: grid;
  grid-template-areas:
    "head"
    "game"
    "controls"
    "queue";
  padding-bottom: 24px;
}

.panel__head {
  grid-area: head;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 20px;
}

.stat-row {
  display: flex;
  gap: 12px;
}

.stat-card,
.info-block,
.queue-box {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.stat-card {
  min-width: 110px;
  padding: 14px 16px;
}

.stat-card span {
  display: block;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 1.5rem;
}

.game-frame {
  grid-area: game;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(11, 43, 62, 0.98) 0%, rgba(16, 63, 71, 0.98) 100%);
}

.game-frame canvas {
  display: block;
  width: 100%;
  height: auto;
}

.controls {
  grid-area: controls;
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.controls__group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.controls__group--actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.command-button,
.action-button {
  border: 0;
  border-radius: 16px;
  padding: 14px 12px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.command-button:hover,
.action-button:hover {
  transform: translateY(-2px);
}

.command-button {
  background: linear-gradient(135deg, #d9f2eb, #f7fbf4);
  color: var(--primary-dark);
  border: 1px solid rgba(17, 121, 93, 0.14);
}

.action-button--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 14px 26px rgba(17, 121, 93, 0.24);
}

.action-button--secondary {
  color: #fff;
  background: linear-gradient(135deg, #ef8f34, #d96b1b);
  box-shadow: 0 14px 26px rgba(239, 143, 52, 0.24);
}

.action-button--ghost {
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
}

.action-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.queue-box,
.info-block {
  padding: 18px;
}

.queue-box {
  grid-area: queue;
  margin-top: 18px;
}

.queue-box__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.queue-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 52px;
}

.queue-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(31, 158, 211, 0.12);
  color: #125b79;
  font-weight: 800;
}

.queue-chip button {
  border: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(18, 91, 121, 0.14);
  color: inherit;
  cursor: pointer;
  font-weight: 800;
}

.panel--info {
  grid-area: info;
  display: grid;
  gap: 16px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
  color: var(--primary-dark);
}

.player-box--gate {
  grid-area: player;
  padding: 18px;
  border: 2px solid rgba(239, 143, 52, 0.42);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 247, 234, 0.98), rgba(242, 255, 250, 0.98));
  box-shadow: 0 14px 30px rgba(239, 143, 52, 0.14);
}

.player-box--gate .field-label {
  font-size: 1rem;
}

.player-box__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.text-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
  font-weight: 700;
}

.text-input:focus {
  outline: 3px solid rgba(31, 158, 211, 0.2);
  border-color: rgba(31, 158, 211, 0.6);
}

.player-box--gate .text-input {
  min-height: 52px;
  border-color: rgba(239, 143, 52, 0.55);
  font-size: 1.02rem;
  background: #fff;
}

.player-box--gate .text-input:focus {
  outline: 4px solid rgba(239, 143, 52, 0.22);
  border-color: rgba(239, 143, 52, 0.9);
}

.player-gate-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  color: #8f3f12;
  background: rgba(239, 143, 52, 0.16);
  font-weight: 900;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.player-gate-badge.is-ready {
  color: #ffffff;
  background: var(--primary);
}

.helper-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.ranking-box__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.ranking-box__head .panel__eyebrow {
  margin-bottom: 6px;
}

.mini-button {
  border: 1px solid rgba(17, 121, 93, 0.18);
  border-radius: 12px;
  padding: 9px 12px;
  cursor: pointer;
  color: var(--primary-dark);
  background: rgba(17, 121, 93, 0.08);
  font-weight: 800;
  transition: transform 180ms ease, background 180ms ease;
}

.mini-button:hover {
  transform: translateY(-1px);
  background: rgba(17, 121, 93, 0.13);
}

.leaderboard-list {
  display: grid;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.leaderboard-item,
.leaderboard-empty {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: rgba(17, 121, 93, 0.06);
  border: 1px solid rgba(17, 121, 93, 0.08);
}

.leaderboard-empty {
  grid-template-columns: 1fr;
  color: var(--muted);
}

.leaderboard-rank {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
}

.leaderboard-player {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.leaderboard-meta {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.leaderboard-score {
  font-family: "Chakra Petch", sans-serif;
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.site-footer {
  margin-top: 0;
}

@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "player"
      "game"
      "info";
  }

  .instruction-list--columns {
    columns: 1;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    padding-top: 10px;
    padding-bottom: 8px;
  }

  .hero__copy,
  .hero__card,
  .panel {
    padding: 20px;
  }

  .panel__head,
  .queue-box__head {
    flex-direction: column;
    align-items: start;
  }

  .stat-row,
  .controls__group,
  .controls__group--actions {
    grid-template-columns: 1fr 1fr;
  }

  h1 {
    font-size: 1.9rem;
    max-width: 100%;
  }
}


.game-frame {
  width: 100%;
  max-width: 100%;
  min-height: 240px;
  padding: 12px;
}

.game-frame canvas {
  max-width: 100%;
  width: 100% !important;
  height: auto !important;
}

.game-frame > canvas,
.game-frame > div {
  max-width: 100%;
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 16px, 100%);
    padding-top: 10px;
  }

  .hero__copy,
  .hero__card,
  .panel,
  .queue-box,
  .info-block {
    padding: 16px;
  }

  .panel__head {
    gap: 14px;
  }

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

  .stat-card {
    min-width: 0;
  }

  .game-frame {
    min-height: 0;
    padding: 8px;
    border-radius: 18px;
  }

  .controls__group {
    grid-template-columns: 1fr 1fr;
  }

  .controls__group--actions {
    grid-template-columns: 1fr;
  }

  .command-button,
  .action-button {
    min-height: 52px;
    padding: 12px 10px;
    font-size: 0.95rem;
  }

  .player-box__row {
    grid-template-columns: 1fr;
  }

  .player-gate-badge {
    width: 100%;
  }

  h1 {
    font-size: 1.9rem;
  }
}

@media (max-width: 480px) {
  .page-shell {
    width: min(100% - 12px, 100%);
  }

  .hero__copy,
  .hero__card,
  .panel,
  .queue-box,
  .info-block {
    padding: 14px;
  }

  .controls__group {
    grid-template-columns: 1fr;
  }

  .game-frame {
    padding: 6px;
  }

  h1 {
    font-size: 1.65rem;
  }
}

.hero__card--summary {
  position: relative;
  overflow: hidden;
}

.hero__card--summary::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--secondary), var(--accent), var(--primary));
}

.hero__card--summary h2 {
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  color: #103543;
  margin-bottom: 0.55rem;
}

.hero__card--summary .instruction-list {
  margin-top: 0;
  padding-left: 1.1rem;
}

.hero__card--summary .instruction-list li {
  color: #47606c;
}

@media (max-width: 720px) {
  .hero__card--summary {
    padding-top: 18px;
  }

  .hero__card--summary h2 {
    margin-bottom: 0.75rem;
  }
}

.page-shell > .hero.hero--compact {
  position: relative;
  min-height: 0;
  height: auto;
  display: grid;
  align-items: stretch;
  overflow: visible;
  padding: 0;
}

.page-shell > .hero.hero--compact .hero__copy,
.page-shell > .hero.hero--compact .hero__card {
  min-width: 0;
}

.page-shell > .hero.hero--compact h1 {
  color: #0f2f3c;
  text-shadow: 0 10px 24px rgba(17, 121, 93, 0.12);
}

@media (max-width: 720px) {
  .page-shell > .hero.hero--compact {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 12px;
  }

  .page-shell > .hero.hero--compact .hero__copy,
  .page-shell > .hero.hero--compact .hero__card {
    width: 100%;
    border-radius: 18px;
  }

  .page-shell > .hero.hero--compact .hero__copy {
    padding: 12px 14px;
  }

  .page-shell > .hero.hero--compact .hero__card.hero__card--summary {
    padding: 12px 14px;
  }

  .page-shell > .hero.hero--compact .hero__copy .eyebrow {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    padding: 0.3rem 0.55rem;
  }

  .page-shell > .hero.hero--compact h1 {
    margin-top: 0.4rem;
    font-size: 1.7rem;
    line-height: 1;
    max-width: 100%;
  }

  .page-shell > .hero.hero--compact .hero__text {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
    max-width: 100%;
  }

  .page-shell > .hero.hero--compact .hero__card--summary h2 {
    font-size: 1.05rem;
    margin-bottom: 0.35rem;
  }

  .page-shell > .hero.hero--compact .hero__card--summary .instruction-list {
    padding-left: 1rem;
  }

  .page-shell > .hero.hero--compact .hero__card--summary .instruction-list li {
    margin-top: 0;
  }

  .page-shell > .hero.hero--compact .hero__card--summary .instruction-list li + li {
    margin-top: 0.28rem;
  }
}

@media (max-width: 480px) {
  .page-shell > .hero.hero--compact {
    gap: 12px;
  }

  .page-shell > .hero.hero--compact .hero__copy,
  .page-shell > .hero.hero--compact .hero__card.hero__card--summary {
    padding-left: 14px;
    padding-right: 14px;
  }

  .page-shell > .hero.hero--compact h1 {
    font-size: 1.55rem;
  }

  .page-shell > .hero.hero--compact .hero__text {
    font-size: 0.86rem;
  }
}
