:root {
  color-scheme: dark;
  --bg: #18201b;
  --panel: #f2eee4;
  --panel-strong: #fffaf0;
  --ink: #18201b;
  --muted: #6f766e;
  --line: rgba(24, 32, 27, 0.16);
  --green: #0b7d48;
  --green-deep: #075f38;
  --gold: #d8ae44;
  --red: #c85a4a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background:
    radial-gradient(circle at 18% 18%, rgba(216, 174, 68, 0.12), transparent 24rem),
    linear-gradient(135deg, #10261b, #1e2520 48%, #131815);
  color: var(--panel);
}

button {
  font: inherit;
}

.app {
  width: min(100%, 1240px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 90px clamp(18px, 4vw, 40px) clamp(18px, 4vw, 40px);
  display: grid;
  gap: 22px;
  justify-items: center;
  align-content: start;
}

.hidden {
  display: none !important;
}

.start-screen,
.game-screen,
.game-info {
  width: min(100%, 560px);
}

.play-layout {
  width: 100%;
  display: grid;
  grid-template-columns: 160px minmax(0, 560px) 160px;
  gap: 100px;
  justify-content: center;
  align-items: start;
}

.screen-column {
  width: min(100%, 560px);
}

.side-rail {
  width: 160px;
  min-height: 600px;
}

.rail-frame {
  width: 160px;
  height: 600px;
  overflow: hidden;
}

.start-screen {
  display: grid;
  gap: 24px;
}

.brand {
  display: grid;
  gap: 10px;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
.lead {
  margin: 0;
}

h1 {
  font-size: clamp(2.4rem, 9vw, 4.9rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(1.7rem, 5vw, 2.5rem);
  letter-spacing: 0;
}

.lead {
  max-width: 32rem;
  color: rgba(242, 238, 228, 0.76);
  font-size: 1rem;
  line-height: 1.75;
}

.difficulty-panel {
  display: grid;
  gap: 10px;
}

.difficulty,
.primary-button,
.icon-button {
  border: 0;
  cursor: pointer;
}

.difficulty {
  width: 100%;
  min-height: 82px;
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 14px;
  text-align: left;
  color: var(--ink);
  background: rgba(242, 238, 228, 0.94);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.difficulty:hover {
  transform: none;
  background: rgba(242, 238, 228, 0.94);
}

.difficulty.selected {
  background: var(--panel-strong);
  box-shadow: inset 0 0 0 3px var(--gold), var(--shadow);
}

.level {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--green-deep);
  font-weight: 900;
  font-size: 1.35rem;
}

.difficulty strong,
.difficulty small {
  display: block;
}

.difficulty strong {
  font-size: 1.05rem;
}

.difficulty small {
  margin-top: 4px;
  color: var(--muted);
}

.primary-button {
  min-height: 56px;
  border-radius: 8px;
  color: #171b17;
  background: var(--gold);
  font-weight: 900;
  box-shadow: var(--shadow);
}

.primary-button:hover {
  filter: brightness(1.06);
}

.game-screen {
  color: var(--ink);
  background: var(--panel);
  border-radius: 8px;
  padding: clamp(14px, 4vw, 24px);
  box-shadow: var(--shadow);
}

.game-info {
  overflow-x: hidden;
}

.game-info a {
  color: var(--gold);
}

.game-info table {
  max-width: 100%;
}

.game-info td {
  max-width: 100%;
}

.game-info img {
  max-width: 100%;
  height: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.topbar .eyebrow {
  color: var(--red);
  font-size: 0.94rem;
}

.actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: var(--panel);
  background: var(--green-deep);
  font-size: 1.45rem;
  line-height: 1;
}

.scoreboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.score {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.38);
}

.score.active {
  color: var(--ink);
  border-color: rgba(11, 125, 72, 0.45);
  background: rgba(11, 125, 72, 0.09);
}

.score strong {
  font-size: 1.5rem;
}

.disc {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-block;
}

.disc.black {
  background: #111;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.14);
}

.disc.white {
  background: #f8f8f1;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 -2px 5px rgba(0, 0, 0, 0.12);
}

.status {
  min-height: 28px;
  margin: 0 0 14px;
  color: #354035;
  font-weight: 700;
  line-height: 1.45;
}

.pass-button {
  min-width: 96px;
  min-height: 42px;
  margin: 0;
  border: 0;
  border-radius: 8px;
  color: #171b17;
  background: var(--gold);
  cursor: pointer;
  font-weight: 900;
}

.pass-button:hover {
  filter: brightness(1.08);
}

.board-wrap {
  position: relative;
  width: min(100%, 520px);
  margin: 0 auto;
}

.board {
  width: 100%;
  aspect-ratio: 1;
  margin: 0;
  padding: 8px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 4px;
  background: #063c27;
  box-shadow: inset 0 0 0 3px #052719, 0 12px 28px rgba(0, 0, 0, 0.18);
}

.pass-dialog {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.42);
}

.pass-card {
  width: min(78%, 310px);
  min-height: 132px;
  padding: 22px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  gap: 18px;
  text-align: center;
  color: var(--panel);
  background: rgba(0, 0, 0, 0.76);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

.pass-card p {
  margin: 0;
  font-size: clamp(1.05rem, 4vw, 1.35rem);
  font-weight: 900;
  line-height: 1.45;
}

.result-effect {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 18px;
  pointer-events: none;
}

.result-effect img {
  width: min(88%, 440px);
  height: auto;
  opacity: 0;
  transform: scale(0.96);
}

.result-effect.show img {
  opacity: 1;
  transform: scale(1);
  transition: opacity 300ms ease, transform 300ms ease;
}

.cell {
  position: relative;
  border: 0;
  border-radius: 4px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  background: var(--green);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  cursor: default;
}

.cell.playable {
  cursor: pointer;
}

.cell.playable::before {
  content: "";
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(216, 174, 68, 0.78);
  box-shadow: 0 0 0 5px rgba(216, 174, 68, 0.14);
}

.cell.playable:hover::before {
  width: 36%;
  height: 36%;
}

.piece {
  width: clamp(30px, 78%, 58px);
  aspect-ratio: 1;
  border-radius: 50%;
}

.piece.black {
  background: radial-gradient(circle at 35% 28%, #3c3c3a, #050505 62%);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.28);
}

.piece.white {
  background: radial-gradient(circle at 34% 24%, #ffffff, #d9d6cc 72%);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.22), inset 0 0 0 1px rgba(0, 0, 0, 0.14);
}

@media (max-width: 560px) {
  .app {
    align-items: start;
  }

  .scoreboard {
    grid-template-columns: 1fr;
  }

  .board {
    gap: 3px;
    padding: 6px;
  }
}

@media (max-width: 1139px) {
  .play-layout {
    grid-template-columns: minmax(0, 560px);
    gap: 0;
  }

  .side-rail {
    display: none;
  }
}
