:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --ink: #101522;
  --muted: #5d6575;
  --line: #dcded7;
  --panel: #ffffff;
  --charcoal: #0c111d;
  --blue: #2758ff;
  --green: #15a078;
  --amber: #f2b84b;
  --red: #e95c4a;
  --shadow: 0 22px 70px rgba(16, 21, 34, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(39, 88, 255, 0.12), transparent 34rem),
    linear-gradient(135deg, rgba(21, 160, 120, 0.08), transparent 32rem),
    var(--bg);
  color: var(--ink);
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 760;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand-mark rect {
  fill: var(--charcoal);
}

.brand-mark path {
  fill: #ffffff;
}

.brand-mark .stripe {
  fill: var(--amber);
  opacity: 0.9;
}

nav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 620;
}

nav a:hover {
  color: var(--ink);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 48px;
  align-items: center;
  width: min(1120px, calc(100% - 32px));
  min-height: calc(100vh - 92px);
  margin: 0 auto;
  padding: 54px 0 84px;
}

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

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

h1 {
  max-width: 820px;
  font-size: clamp(44px, 7vw, 86px);
  font-weight: 820;
  line-height: 0.96;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 650px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.55;
}

.contact-box {
  display: grid;
  gap: 8px;
  width: min(100%, 360px);
  margin-top: 34px;
  border-color: var(--line);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 18px;
}

.contact-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.contact-box a {
  font-size: 20px;
  font-weight: 820;
}

.game-card {
  border: 1px solid rgba(12, 17, 29, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  padding: 18px;
}

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

.game-heading h2 {
  font-size: 20px;
  line-height: 1.1;
}

.game-heading p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.game-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.game-meta span {
  min-width: 0;
}

.mini-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 720;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(var(--board-size, 9), 1fr);
  gap: 1px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid #cfd2cb;
  border-radius: 8px;
  background: #cfd2cb;
  outline: none;
}

.cell {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  background: #eef0ea;
  color: var(--ink);
  font-size: clamp(11px, 2vw, 18px);
  font-weight: 820;
}

.cell.wall {
  background: var(--charcoal);
}

.cell.reverse {
  background: rgba(242, 184, 75, 0.42);
}

.cell.rotate-left {
  background: rgba(39, 88, 255, 0.18);
}

.cell.rotate-right {
  background: rgba(21, 160, 120, 0.22);
}

.cell.mirror-h {
  background: rgba(233, 92, 74, 0.2);
}

.cell.mirror-v {
  background: rgba(98, 72, 210, 0.18);
}

.cell.drift {
  background:
    linear-gradient(135deg, rgba(242, 184, 75, 0.45), rgba(39, 88, 255, 0.2)),
    #eef0ea;
}

.cell.exit {
  background: rgba(21, 160, 120, 0.24);
}

.cell.player {
  box-shadow: inset 0 0 0 3px var(--charcoal);
  color: var(--charcoal);
}

.player-mark {
  z-index: 2;
  display: grid;
  width: 62%;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 5px 16px rgba(12, 17, 29, 0.24);
}

.player-mark::before {
  content: "T";
}

.cell-signal,
.cell-exit {
  z-index: 1;
  font-weight: 900;
}

.cell-exit {
  content: "EXIT";
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0;
}

.game-legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
}

.game-legend span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.game-legend b {
  color: var(--ink);
}

.game-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.game-controls button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
  font-weight: 820;
}

.game-controls button {
  position: relative;
}

.game-controls button::after {
  position: absolute;
  right: 6px;
  bottom: 4px;
  color: var(--muted);
  content: attr(data-effective);
  font-size: 9px;
  font-weight: 860;
}

.game-controls button:hover,
.mini-button:hover {
  border-color: rgba(39, 88, 255, 0.45);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

@media (max-width: 900px) {
  .site-header {
    align-items: flex-start;
    gap: 20px;
  }

  nav {
    gap: 14px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 36px;
    min-height: auto;
    padding-top: 40px;
  }

  .game-card {
    max-width: 430px;
  }

}

@media (max-width: 560px) {
  .site-header,
  .site-footer {
    flex-direction: column;
  }

  nav {
    width: 100%;
    justify-content: space-between;
  }

  h1 {
    font-size: 42px;
  }

  .hero-copy p {
    font-size: 17px;
  }

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
