:root {
  --ink: #0e1726;
  --ink-soft: #293349;
  --paper: #f3f4f6;
  --panel: rgba(255, 255, 255, 0.84);
  --line: #cfd8e7;
  --accent: #006d77;
  --accent-2: #e76f51;
  --focus: #0d9488;
  --good: #15803d;
  --bad: #b42318;
  --shadow: 0 15px 45px rgba(14, 23, 38, 0.13);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(80rem 40rem at 7% -15%, #d6f4ef 0, transparent 60%),
    radial-gradient(56rem 32rem at 95% 10%, #fde8d8 0, transparent 65%),
    linear-gradient(155deg, #f7fafc 0%, #ecf2ff 45%, #f2f8fb 100%);
}

.page-glow {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.15) 1px, transparent 1px);
  background-size: 24px 24px;
  mix-blend-mode: soft-light;
  pointer-events: none;
  z-index: -1;
}

.wrap {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.site-header {
  padding: 1.2rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.brand svg {
  width: 46px;
  height: 46px;
}

.logo-frame {
  fill: #ffffff;
  stroke: #b3c3de;
  stroke-width: 2;
}

.logo-grid {
  stroke: #7588a8;
  stroke-width: 2.3;
  stroke-linecap: round;
}

.logo-core {
  fill: var(--accent);
}

.brand strong {
  display: block;
  font-family: "Fraunces", serif;
  font-size: 1.35rem;
  line-height: 1;
}

.brand small {
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.layout {
  display: grid;
  grid-template-columns: 2.1fr 1fr;
  gap: 1rem;
  padding-bottom: 2rem;
}

.hero,
.game-card,
.panel {
  animation: rise-in 520ms ease both;
}

.game-card {
  animation-delay: 90ms;
}

.sidebar .panel:nth-child(1) {
  animation-delay: 120ms;
}

.sidebar .panel:nth-child(2) {
  animation-delay: 180ms;
}

.sidebar .panel:nth-child(3) {
  animation-delay: 240ms;
}

.hero,
.game-card,
.panel {
  background: var(--panel);
  border: 1px solid rgba(170, 186, 212, 0.5);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.hero {
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 700;
  margin: 0;
  font-size: 0.82rem;
}

.hero h1 {
  font-family: "Fraunces", serif;
  margin: 0.3rem 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.hero p {
  margin: 0.5rem 0;
  color: var(--ink-soft);
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.75rem;
}

.hero-meta div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.75);
}

.hero-meta label {
  display: block;
  color: #5e6d85;
  font-size: 0.75rem;
}

.hero-meta strong {
  font-size: 1.05rem;
}

.game-card {
  padding: 1rem;
}

.game-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

h2,
h3 {
  margin: 0;
}

.status-pills {
  display: flex;
  gap: 0.6rem;
}

.pill {
  background: #f9fbff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
}

.pill label {
  color: #5d6d88;
  font-size: 0.72rem;
}

.boards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-top: 0.85rem;
}

.board-wrap {
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem;
}

.board {
  margin-top: 0.65rem;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.34rem;
  max-width: 320px;
}

.cell {
  width: min(12vw, 56px);
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid #cad6ea;
  background: #ffffff;
  box-shadow: inset 0 -2px 0 rgba(30, 45, 70, 0.08);
  cursor: pointer;
  transition: transform 140ms ease, background 180ms ease, box-shadow 180ms ease;
}

.cell:hover {
  transform: translateY(-1px);
}

.cell.on {
  background: linear-gradient(165deg, #0f7f8c, #0a5d68);
  border-color: #064c54;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.board-target .cell {
  cursor: default;
}

.board-target .cell.on {
  background: linear-gradient(165deg, #e9896f, #d96e4f);
  border-color: #ad563d;
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.56rem 0.95rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible,
.cell:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
}

.btn-ghost.is-active {
  border-color: #8ca2c8;
  background: #eef4ff;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: #ffffff;
  border-color: var(--line);
}

.message {
  margin: 0.8rem 0 0;
  min-height: 1.2rem;
  color: #4f5f79;
  font-size: 0.95rem;
}

.message.good {
  color: var(--good);
  font-weight: 600;
}

.message.bad {
  color: var(--bad);
}

.sidebar {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.panel {
  padding: 0.9rem;
}

.panel h3 {
  margin-bottom: 0.45rem;
}

.panel ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--ink-soft);
}

.panel p {
  margin: 0.3rem 0;
  color: var(--ink-soft);
}

.ad-slot {
  border: 1px dashed #95a9ca;
  border-radius: 12px;
  min-height: 130px;
  display: block;
  background: linear-gradient(145deg, #f7faff, #f0f5fb);
  color: #66799a;
  padding: 0.85rem;
}

.ad-slot .adsbygoogle {
  width: 100%;
  min-height: 250px;
}

.win-dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: var(--shadow);
  width: min(420px, 90vw);
}

.win-dialog::backdrop {
  background: rgba(13, 19, 32, 0.4);
}

.win-dialog h2 {
  font-family: "Fraunces", serif;
}

.win-dialog menu {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0;
}

.site-footer {
  padding: 0.3rem 0 1.4rem;
  display: flex;
  justify-content: space-between;
  color: #5d6d88;
  font-size: 0.9rem;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

  .hero-meta {
    grid-template-columns: 1fr;
  }

  .board {
    max-width: 100%;
  }

  .cell {
    width: 100%;
  }

  .site-footer {
    flex-direction: column;
    gap: 0.25rem;
  }
}
