:root {
  color-scheme: dark;
  --bg: #111315;
  --surface: #1b1f23;
  --surface-strong: #232a30;
  --text: #f5f1e7;
  --muted: #b5b0a4;
  --line: #363c42;
  --gold: #f1d35b;
  --mint: #4ac7a5;
  --coral: #ff6f61;
  --sky: #6ba8ff;
  --leaf: #6fd18d;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.3);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 280px),
    linear-gradient(135deg, #111315 0%, #172018 38%, #211918 72%, #141719 100%);
  color: var(--text);
}

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

.site-header {
  width: min(1180px, calc(100% - 32px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(241, 211, 91, 0.38);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gold), #f6a84b);
  color: #15110a;
  display: grid;
  place-items: center;
  font-weight: 950;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.1;
}

.brand strong {
  font-size: 16px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.auth-panel {
  min-height: 38px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 31, 35, 0.72);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.auth-panel span {
  max-width: 150px;
  padding: 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-panel button,
.auth-link {
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.auth-panel button:hover,
.auth-panel button:focus-visible,
.auth-link:hover,
.auth-link:focus-visible {
  border-color: rgba(241, 211, 91, 0.38);
  outline: none;
}

.auth-panel button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

#googleLoginButton {
  background: var(--gold);
  color: #15110a;
}

nav a {
  min-height: 36px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

nav a:hover,
nav a:focus-visible {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  outline: none;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.hero {
  min-height: min(520px, calc(100vh - 118px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.72fr);
  align-items: center;
  gap: 44px;
}

.hero-copy {
  max-width: 740px;
}

.eyebrow,
.game-kicker {
  margin: 0;
  color: var(--mint);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 760px;
  margin-top: 12px;
  font-size: clamp(42px, 8vw, 86px);
  line-height: 0.98;
  letter-spacing: 0;
  word-break: keep-all;
}

.hero-copy > p:last-child {
  max-width: 620px;
  margin-top: 20px;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.7;
  word-break: keep-all;
}

.hero-board {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 340px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 74px 74px,
    linear-gradient(180deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 74px 74px,
    linear-gradient(135deg, #24292d, #16241d 50%, #312122);
  box-shadow: var(--shadow);
}

.tile {
  position: absolute;
  width: 72px;
  height: 72px;
  border: 1px solid rgba(12, 14, 15, 0.36);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #15110a;
  font-size: 35px;
  font-weight: 950;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 14px 24px rgba(0, 0, 0, 0.26);
}

.tile-yellow {
  left: 14%;
  top: 18%;
  background: var(--gold);
}

.tile-green {
  right: 14%;
  top: 34%;
  background: var(--mint);
}

.tile-red {
  left: 24%;
  bottom: 18%;
  background: var(--coral);
}

.track-line {
  position: absolute;
  left: 50%;
  top: 10%;
  bottom: 10%;
  width: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  transform: translateX(-50%);
}

.player-dot {
  position: absolute;
  left: 50%;
  bottom: 24%;
  width: 48px;
  height: 48px;
  border: 6px solid #15110a;
  border-radius: 50%;
  background: var(--sky);
  transform: translateX(-50%);
  box-shadow: 0 0 0 8px rgba(107, 168, 255, 0.18);
}

.games-section {
  padding-top: 26px;
}

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

h2 {
  margin-top: 6px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.game-card {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  display: grid;
  grid-template-rows: auto 1fr;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.game-card:hover,
.game-card:focus-within {
  border-color: rgba(241, 211, 91, 0.46);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.game-media {
  position: relative;
  aspect-ratio: 4 / 3;
  min-height: 0;
  overflow: hidden;
  background: #23282d;
}

.image-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.portrait-media img {
  object-fit: cover;
  object-position: center 68%;
  background: #0f1317;
}

.reversi-media {
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 38%),
    #20282d;
}

.reversi-preview {
  position: relative;
  width: min(88%, 330px);
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(13, 18, 17, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(5, 16, 11, 0.58) 1px, transparent 1px) 0 0 / 12.5% 12.5%,
    linear-gradient(180deg, rgba(5, 16, 11, 0.58) 1px, transparent 1px) 0 0 / 12.5% 12.5%,
    linear-gradient(135deg, #287a57, #1e684d);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 20px 36px rgba(0, 0, 0, 0.25);
}

.preview-piece,
.preview-move,
.preview-block {
  position: absolute;
  width: 9.2%;
  height: 9.2%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.preview-piece {
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.22),
    inset 0 -4px 7px rgba(0, 0, 0, 0.35),
    0 7px 12px rgba(0, 0, 0, 0.22);
}

.preview-white {
  background: radial-gradient(circle at 34% 28%, #ffffff, #e6ded0 62%, #aaa194);
}

.preview-black {
  background: radial-gradient(circle at 35% 28%, #596066, #121518 58%, #050607);
}

.preview-move {
  border: 2px solid rgba(241, 211, 91, 0.78);
  background: rgba(241, 211, 91, 0.15);
}

.preview-block {
  border-radius: 5px;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0 5px, transparent 5px 10px),
    #27333b;
}

.p1 {
  left: 43.75%;
  top: 43.75%;
}

.p2 {
  left: 56.25%;
  top: 43.75%;
}

.p3 {
  left: 43.75%;
  top: 56.25%;
}

.p4 {
  left: 56.25%;
  top: 56.25%;
}

.m1 {
  left: 43.75%;
  top: 31.25%;
}

.m2 {
  left: 68.75%;
  top: 56.25%;
}

.b1 {
  left: 81.25%;
  top: 31.25%;
}

.image-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 54%, rgba(17, 19, 21, 0.7));
}

.game-content {
  padding: 20px;
  display: grid;
  gap: 18px;
}

.game-content h3 {
  margin-top: 7px;
  font-size: clamp(25px, 4vw, 38px);
  line-height: 1.05;
  word-break: keep-all;
}

.game-content p:not(.game-kicker) {
  margin-top: 11px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  word-break: keep-all;
}

.play-button {
  position: relative;
  z-index: 2;
  width: fit-content;
  min-height: 42px;
  padding: 11px 14px;
  border: 1px solid rgba(241, 211, 91, 0.36);
  border-radius: 8px;
  background: var(--gold);
  color: #15110a;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 950;
}

.play-button:hover,
.play-button:focus-visible {
  filter: brightness(1.06);
  outline: none;
}

@media (max-width: 900px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 0;
  }

  .header-actions {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .auth-panel {
    max-width: 100%;
    overflow-x: auto;
  }

  main {
    padding-top: 18px;
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .hero-board {
    min-height: 280px;
    max-height: 380px;
  }

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

@media (max-width: 560px) {
  .site-header,
  main {
    width: min(100% - 20px, 1180px);
  }

  h1 {
    font-size: 40px;
  }

  .hero-copy > p:last-child {
    font-size: 15px;
  }

  .hero-board {
    min-height: 240px;
  }

  .tile {
    width: 58px;
    height: 58px;
    font-size: 28px;
  }

  .game-card {
    min-height: 0;
  }

  .game-content {
    padding: 16px;
  }
}
