:root {
  --bg: #10100f;
  --panel: rgba(24, 24, 22, 0.88);
  --panel-soft: rgba(245, 241, 234, 0.08);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f3efe7;
  --muted: #a9a49b;
  --accent: #d7b47a;
  --accent-soft: #8fa08c;
  --danger: #ef6f43;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(143, 160, 140, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(239, 111, 67, 0.14), transparent 28%),
    linear-gradient(180deg, #151513 0%, #0c0c0b 100%);
  color: var(--text);
  font-family: "Syne", sans-serif;
}

body {
  padding: 24px;
}

.prototype-shell {
  max-width: 1440px;
  margin: 0 auto;
}

.prototype-header,
.prototype-intro,
.game-layout,
.notes-grid {
  position: relative;
  z-index: 1;
}

.prototype-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.eyebrow,
.panel-label,
.note-label,
.metric-label,
.intro-meta span,
.back-link,
.overlay-kicker {
  font-family: "DM Mono", monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--accent-soft);
  font-size: 12px;
  margin-bottom: 12px;
}

h1 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 0.94;
  font-weight: 700;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 16px;
  transition: color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.back-link:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.prototype-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
}

.intro-copy {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
}

.intro-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.intro-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 11px;
}

.game-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.side-panel,
.game-frame,
.note-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.side-panel {
  padding: 20px;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel-block {
  padding: 18px;
  border-radius: 22px;
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-label {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 12px;
}

.panel-value {
  font-size: 1rem;
  line-height: 1.55;
}

.panel-value-large {
  font-size: 1.1rem;
}

.stage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stage-chip {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.85rem;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.stage-chip.active {
  color: var(--text);
  border-color: rgba(215, 180, 122, 0.38);
  background: rgba(215, 180, 122, 0.08);
}

.stage-chip.done {
  color: var(--accent-soft);
  border-color: rgba(143, 160, 140, 0.34);
}

.game-frame {
  position: relative;
  border-radius: 32px;
  padding: 18px;
}

.frame-topbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.metric-value {
  font-size: 0.95rem;
}

.canvas-wrap {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    radial-gradient(circle at center top, rgba(255, 255, 255, 0.04), transparent 40%),
    #111110;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#gameCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 1280 / 820;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 10, 9, 0.48);
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
}

.overlay-visible {
  opacity: 1;
  pointer-events: auto;
}

.overlay-inner {
  width: min(520px, 100%);
  padding: 28px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(18, 18, 16, 0.9);
  text-align: center;
}

.overlay-kicker {
  color: var(--accent-soft);
  font-size: 11px;
  margin-bottom: 14px;
}

.overlay-inner h2 {
  margin: 0 0 12px;
  font-family: "Playfair Display", serif;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 700;
}

.overlay-inner p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.primary-btn {
  margin-top: 22px;
  min-width: 172px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(215, 180, 122, 0.42);
  background: linear-gradient(180deg, rgba(215, 180, 122, 0.18), rgba(215, 180, 122, 0.08));
  color: var(--text);
  font-family: "DM Mono", monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(215, 180, 122, 0.7);
  background: linear-gradient(180deg, rgba(215, 180, 122, 0.24), rgba(215, 180, 122, 0.12));
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.note-card {
  border-radius: 24px;
  padding: 18px 20px;
}

.note-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

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

  .side-panel {
    order: 2;
  }
}

@media (max-width: 720px) {
  body {
    padding: 14px;
  }

  .prototype-header,
  .prototype-intro {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .frame-topbar {
    flex-wrap: wrap;
  }

  .overlay-inner {
    padding: 22px 18px;
  }
}
