:root {
  --plum: #30205e;
  --ink: #20183d;
  --paper: #fff9ed;
  --butter: #f6df86;
  --pink: #f45f91;
  --coral: #fb815f;
  --aqua: #36b9b2;
  --sky: #8ed7ef;
  --line: rgba(48, 32, 94, 0.22);
  --soft-line: rgba(255, 249, 237, 0.3);
}

* { box-sizing: border-box; }
html { background: var(--butter); scroll-behavior: smooth; }
body {
  background: var(--butter);
  color: var(--ink);
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
  margin: 0;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; text-decoration: none; }

.site-shell {
  background:
    radial-gradient(circle at 13px 13px, rgba(48, 32, 94, .09) 1.5px, transparent 1.8px) 0 0 / 26px 26px,
    var(--butter);
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}
.site-shell::after {
  background: var(--pink);
  border: 4px solid var(--ink);
  border-radius: 50%;
  box-shadow: 10px 10px 0 rgba(48, 32, 94, .16);
  content: "";
  height: clamp(90px, 14vw, 210px);
  pointer-events: none;
  position: absolute;
  right: clamp(-48px, -2vw, -14px);
  top: 115px;
  transform: rotate(-17deg);
  width: clamp(90px, 14vw, 210px);
}

.topbar {
  align-items: center;
  background: var(--paper);
  border-bottom: 4px solid var(--ink);
  display: flex;
  justify-content: space-between;
  min-height: 84px;
  padding: 0 clamp(18px, 4vw, 72px);
  position: relative;
  z-index: 2;
}
.brand { align-items: center; display: inline-flex; font-size: 15px; font-weight: 900; gap: 12px; letter-spacing: -.02em; }
.brand b { color: var(--pink); font-size: 22px; font-weight: 900; line-height: 0; }
.brand-mark { display: grid; gap: 3px; grid-template-columns: repeat(2, 10px); transform: rotate(-8deg); }
.brand-mark i { background: var(--plum); border-radius: 3px; display: block; height: 10px; }
.brand-mark i:nth-child(2) { background: var(--pink); border-radius: 50% 50% 3px 3px; }
.brand-mark i:nth-child(3) { background: var(--aqua); }
.brand-mark i:nth-child(4) { background: var(--coral); border-radius: 50%; }
.release-mark {
  align-items: center;
  color: var(--plum);
  display: flex;
  font-family: "Courier New", monospace;
  font-size: 10px;
  font-weight: 700;
  gap: 7px;
  letter-spacing: .07em;
}
.release-mark span { background: var(--aqua); border: 2px solid var(--ink); border-radius: 50%; display: inline-block; height: 10px; width: 10px; }

.hero {
  align-items: center;
  display: grid;
  gap: clamp(36px, 7vw, 120px);
  grid-template-columns: minmax(255px, .8fr) minmax(590px, 1.2fr);
  margin: 0 auto;
  max-width: 1480px;
  padding: clamp(72px, 9vw, 138px) clamp(20px, 5vw, 84px) clamp(76px, 8vw, 130px);
  position: relative;
  z-index: 1;
}
.intro-copy { align-self: center; position: relative; }
.intro-copy::before {
  background: var(--aqua);
  border: 4px solid var(--ink);
  border-radius: 50%;
  content: "";
  height: 17px;
  left: -11px;
  position: absolute;
  top: -30px;
  width: 17px;
}
.eyebrow {
  background: var(--ink);
  border-radius: 99px;
  color: var(--butter);
  display: inline-block;
  font-family: "Courier New", monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  margin: 0 0 24px;
  padding: 8px 13px 7px;
}
.intro-copy h1 {
  color: var(--ink);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(72px, 8vw, 136px);
  font-weight: 900;
  letter-spacing: -.055em;
  line-height: .78;
  margin: 0;
  text-transform: uppercase;
}
.intro-copy h1 em {
  color: var(--pink);
  font-style: normal;
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
}
.intro-text { font-size: 17px; font-weight: 700; line-height: 1.48; margin: 40px 0 0; max-width: 396px; }
.key-hints { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 31px; }
.key-hints span {
  align-items: center;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 4px 4px 0 var(--ink);
  display: inline-flex;
  font-family: "Courier New", monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 6px 9px;
}
kbd { background: var(--butter); border: 1px solid var(--ink); border-radius: 3px; font-family: inherit; font-size: 9px; margin-right: 3px; padding: 2px 4px; }

.game-unit { min-width: 0; position: relative; }
.game-unit::before {
  background: var(--coral);
  border: 4px solid var(--ink);
  border-radius: 50%;
  content: "";
  height: 28px;
  left: -18px;
  position: absolute;
  top: 39%;
  width: 28px;
  z-index: -1;
}
.game-frame {
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 28px;
  box-shadow: 13px 14px 0 var(--ink);
  overflow: hidden;
}
.frame-topline {
  align-items: center;
  background: var(--plum);
  color: var(--paper);
  display: flex;
  font-family: "Courier New", monospace;
  font-size: 10px;
  font-weight: 700;
  justify-content: space-between;
  letter-spacing: .09em;
  min-height: 47px;
  padding: 0 19px;
}
.status-line { color: var(--butter); }
.play-area { display: grid; grid-template-columns: minmax(0, 1fr) 176px; }
.canvas-wrap {
  align-items: center;
  background:
    radial-gradient(circle at 12px 12px, rgba(255,255,255,.12) 1.5px, transparent 1.8px) 0 0 / 24px 24px,
    var(--aqua);
  border-right: 4px solid var(--ink);
  display: flex;
  justify-content: center;
  min-height: 560px;
  overflow: hidden;
  padding: 22px;
  position: relative;
}
.canvas-wrap::before, .canvas-wrap::after { border: 4px solid var(--ink); border-radius: 50%; content: ""; height: 16px; position: absolute; width: 16px; }
.canvas-wrap::before { background: var(--butter); left: 21px; top: 20px; }
.canvas-wrap::after { background: var(--pink); bottom: 22px; right: 21px; }
#board {
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 7px 8px 0 rgba(32, 24, 61, .32);
  display: block;
  height: min(638px, 72vh);
  max-width: 100%;
  position: relative;
  width: auto;
  z-index: 1;
}
.screen-message {
  align-items: center;
  background: rgba(32, 24, 61, .87);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 10px;
  inset: 0;
  justify-content: center;
  position: absolute;
  text-align: center;
  transition: opacity .18s ease, visibility .18s ease;
  z-index: 2;
}
.screen-message.is-hidden { opacity: 0; pointer-events: none; visibility: hidden; }
.screen-message strong { color: var(--butter); font-family: Impact, "Arial Black", sans-serif; font-size: 37px; letter-spacing: .02em; }
.screen-message span { font-family: "Courier New", monospace; font-size: 10px; font-weight: 700; letter-spacing: .04em; max-width: 220px; }

.side-console { background: var(--paper); display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto 1fr; }
.metric { border-bottom: 3px solid var(--ink); display: flex; flex-direction: column; gap: 5px; justify-content: center; min-height: 80px; padding: 11px 13px; }
.metric.large { background: var(--butter); grid-column: 1 / -1; min-height: 98px; }
.metric.split:first-of-type { border-right: 3px solid var(--ink); }
.metric span, .preview-block > span { color: var(--plum); font-family: "Courier New", monospace; font-size: 8px; font-weight: 700; letter-spacing: .11em; }
.metric strong { color: var(--ink); font-family: Impact, "Arial Black", sans-serif; font-size: 22px; font-weight: 400; letter-spacing: .02em; }
.metric.large strong { color: var(--pink); font-size: 36px; -webkit-text-stroke: 1px var(--ink); paint-order: stroke fill; }
.preview-block { align-items: center; border-bottom: 3px solid var(--ink); display: flex; flex-direction: column; gap: 4px; grid-column: 1 / -1; justify-content: center; min-height: 132px; padding: 10px; }
.preview-block:first-of-type { background: #dceef5; }
.preview-block canvas { background: transparent; height: 85px; width: 85px; }
.game-actions { background: var(--paper); border-top: 4px solid var(--ink); display: grid; grid-template-columns: auto auto 1fr; min-height: 65px; }
.game-actions button { border: 0; border-right: 3px solid var(--ink); cursor: pointer; font-size: 12px; font-weight: 900; height: 61px; letter-spacing: .04em; padding: 0 20px; transition: transform .12s ease, filter .12s ease; }
.game-actions .solid-action { background: var(--pink); color: var(--ink); }
.game-actions button:hover { filter: brightness(1.05); }
.game-actions button:active { transform: translate(2px, 2px); }
.solid-action b { font-size: 20px; margin-left: 9px; }
.line-action { background: var(--butter); color: var(--ink); }
.line-action span { background: var(--paper); border: 1px solid var(--ink); border-radius: 3px; font-family: "Courier New", monospace; font-size: 9px; margin-left: 7px; padding: 2px 4px; }
.game-actions p { align-self: center; color: var(--plum); font-family: "Courier New", monospace; font-size: 9px; font-weight: 700; letter-spacing: .06em; margin: 0; overflow: hidden; padding: 0 16px; text-overflow: ellipsis; white-space: nowrap; }
.touch-controls { display: grid; gap: 10px; grid-template-columns: repeat(6, 1fr); margin-top: 22px; }
.touch-controls button {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  color: var(--ink);
  cursor: pointer;
  font-size: 23px;
  font-weight: 900;
  height: 55px;
  transition: box-shadow .12s ease, transform .12s ease;
}
.touch-controls button:nth-child(2n) { background: var(--sky); }
.touch-controls button:nth-child(3n) { background: var(--pink); }
.touch-controls button:active { box-shadow: 1px 1px 0 var(--ink); transform: translate(3px, 3px); }

.rules {
  display: grid;
  gap: clamp(16px, 2.4vw, 34px);
  grid-template-columns: repeat(3, 1fr);
  margin: 0 auto;
  max-width: 1480px;
  padding: 0 clamp(20px, 5vw, 84px) 115px;
}
.rules article {
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 20px;
  box-shadow: 7px 8px 0 var(--ink);
  min-height: 250px;
  padding: 28px clamp(22px, 3vw, 42px);
  position: relative;
}
.rules article:nth-child(2) { background: var(--sky); transform: translateY(20px); }
.rules article:nth-child(3) { background: var(--pink); }
.rules article > span { align-items: center; background: var(--ink); border-radius: 50%; color: var(--butter); display: flex; font-family: Impact, "Arial Black", sans-serif; font-size: 18px; height: 38px; justify-content: center; letter-spacing: .03em; width: 38px; }
.rules h2 { font-family: Impact, "Arial Black", sans-serif; font-size: 31px; font-weight: 400; letter-spacing: -.01em; line-height: .95; margin: 46px 0 13px; text-transform: uppercase; }
.rules p { font-size: 14px; font-weight: 700; line-height: 1.48; margin: 0; max-width: 310px; }
footer {
  align-items: center;
  background: var(--ink);
  border-top: 4px solid var(--ink);
  color: var(--paper);
  display: grid;
  font-family: "Courier New", monospace;
  font-size: 9px;
  font-weight: 700;
  grid-template-columns: 1fr 1fr 1fr;
  letter-spacing: .08em;
  min-height: 94px;
  padding: 0 clamp(20px, 5vw, 84px);
}
footer span:nth-child(2) { color: var(--butter); text-align: center; }
footer a { border-bottom: 2px solid var(--pink); justify-self: end; padding-bottom: 3px; }

@media (max-width: 1020px) {
  .hero { grid-template-columns: 1fr; max-width: 780px; }
  .intro-copy { max-width: 550px; }
  .site-shell::after { top: 520px; }
  .rules { grid-template-columns: 1fr; max-width: 780px; }
  .rules article:nth-child(2) { transform: none; }
}

@media (max-width: 620px) {
  .topbar { min-height: 68px; padding-inline: 19px; }
  .brand { font-size: 12px; gap: 9px; }
  .brand-mark { grid-template-columns: repeat(2, 8px); }
  .brand-mark i { height: 8px; }
  .release-mark { font-size: 8px; }
  .hero { gap: 42px; padding: 68px 20px 80px; }
  .intro-copy h1 { font-size: clamp(65px, 19vw, 92px); }
  .intro-copy h1 em { -webkit-text-stroke-width: 1.5px; }
  .intro-text { font-size: 15px; margin-top: 31px; }
  .key-hints { gap: 7px; margin-top: 24px; }
  .game-frame { border-radius: 20px; box-shadow: 8px 9px 0 var(--ink); }
  .frame-topline { font-size: 8px; min-height: 43px; padding-inline: 13px; }
  .play-area { grid-template-columns: 1fr; }
  .canvas-wrap { border-bottom: 4px solid var(--ink); border-right: 0; min-height: 0; padding: 18px; }
  #board { height: auto; width: min(100%, 320px); }
  .side-console { grid-template-columns: repeat(4, 1fr); }
  .metric { min-height: 71px; padding: 9px 8px; }
  .metric.large { grid-column: span 2; }
  .metric.split { grid-column: span 1; }
  .metric.split:first-of-type { border-right: 3px solid var(--ink); }
  .metric strong { font-size: 17px; }
  .metric.large strong { font-size: 30px; }
  .preview-block { border-bottom: 0; grid-column: span 2; min-height: 102px; }
  .preview-block canvas { height: 64px; width: 64px; }
  .game-actions { grid-template-columns: 1fr 1fr; }
  .game-actions button { font-size: 11px; padding: 0 7px; }
  .game-actions p { border-top: 3px solid var(--ink); grid-column: 1 / -1; line-height: 42px; padding: 0 11px; }
  .touch-controls { gap: 8px; grid-template-columns: repeat(3, 1fr); margin-top: 18px; }
  .rules { gap: 18px; padding: 0 20px 75px; }
  .rules article { border-radius: 16px; min-height: 0; padding: 23px 25px 28px; }
  .rules h2 { font-size: 28px; margin-top: 34px; }
  footer { gap: 15px; grid-template-columns: 1fr; padding-block: 25px; }
  footer span:nth-child(2), footer a { justify-self: start; text-align: left; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
