:root {
  --bg: #030403;
  --panel: #090d0b;
  --panel-strong: #101712;
  --ink: #f2f8ef;
  --muted: #96a397;
  --line: rgba(201, 255, 47, 0.2);
  --neon: #c9ff2f;
  --green: #5dff8a;
  --cyan: #75f4ff;
  --pink: #ff4fd8;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(201, 255, 47, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(117, 244, 255, 0.035) 1px, transparent 1px),
    linear-gradient(135deg, #020302 0%, #080d0a 54%, #020302 100%);
  background-size: 44px 44px, 44px 44px, auto;
  color: var(--ink);
  font-family: Inter, "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button,
a,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

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

.page-shell {
  display: grid;
  min-height: 100vh;
  padding: clamp(18px, 3vw, 42px);
  place-items: center;
}

.studio-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: clamp(18px, 3vw, 34px);
  width: min(1500px, 100%);
  min-height: min(820px, calc(100vh - 84px));
  align-items: center;
}

.game-column {
  display: grid;
  gap: 20px;
  transform: translateX(-2vw);
}

.brand-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(201, 255, 47, 0.68);
  border-radius: 8px;
  background: var(--neon);
  color: #061005;
  font-weight: 900;
  box-shadow: 0 0 28px rgba(201, 255, 47, 0.34);
}

.brand strong,
.brand small {
  display: block;
}

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

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(9, 13, 11, 0.72);
  color: var(--neon);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 16px var(--neon);
}

.game-stage {
  overflow: hidden;
  border: 1px solid rgba(201, 255, 47, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(16, 23, 18, 0.88), rgba(4, 6, 5, 0.94)),
    var(--panel);
  box-shadow: var(--shadow), 0 0 60px rgba(201, 255, 47, 0.12);
}

.game-toolbar,
.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.game-toolbar {
  border-bottom: 1px solid var(--line);
}

.game-toolbar p,
.eyebrow {
  margin: 0 0 4px;
  color: var(--neon);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 5vw, 76px);
  line-height: 0.9;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1.02;
  letter-spacing: 0;
}

.preview-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 420px;
  background: #020302;
}

#gameCanvas,
#gamePreview {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #020302;
}

#gameCanvas[hidden],
#gamePreview[hidden] {
  display: none;
}

.game-hud {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.game-hud span {
  display: inline-flex;
  gap: 8px;
  align-items: baseline;
}

.game-hud strong {
  color: var(--neon);
  font-size: 18px;
}

.share-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid rgba(201, 255, 47, 0.22);
  border-radius: 8px;
  background: rgba(9, 13, 11, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.share-copy p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(116px, 0.65fr);
  gap: 12px;
}

.field-stack {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(201, 255, 47, 0.2);
  border-radius: 8px;
  background: rgba(3, 4, 3, 0.78);
  color: var(--ink);
  outline: none;
}

input {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 164px;
  padding: 12px;
  line-height: 1.55;
  resize: vertical;
  text-transform: none;
}

input:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(117, 244, 255, 0.12);
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.share-button,
.generate-button,
.ghost-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  border: 1px solid rgba(201, 255, 47, 0.28);
  border-radius: 8px;
  font-weight: 900;
}

.share-button,
.ghost-button {
  background: #0d130f;
  color: var(--ink);
}

.share-button:hover,
.ghost-button:hover {
  border-color: var(--cyan);
  background: rgba(117, 244, 255, 0.09);
}

.ghost-button {
  min-height: 40px;
  padding: 0 14px;
  color: var(--neon);
}

.button-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: rgba(201, 255, 47, 0.14);
  color: var(--neon);
  font-size: 13px;
}

.generate-button {
  border-color: var(--neon);
  background: var(--neon);
  color: #061005;
  box-shadow: 0 0 32px rgba(201, 255, 47, 0.28);
}

.generate-button:hover {
  filter: brightness(1.08);
}

.agent-log {
  display: block;
  min-height: 48px;
  padding: 12px;
  border: 1px solid rgba(255, 79, 216, 0.18);
  border-radius: 8px;
  background: rgba(255, 79, 216, 0.055);
  color: #f8dfff;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 1120px) {
  .studio-frame {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .game-column {
    transform: none;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 14px;
    place-items: start stretch;
  }

  .brand-row,
  .game-toolbar,
  .game-hud {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-pill {
    align-self: flex-start;
  }

  .preview-shell {
    min-height: 300px;
  }

  .field-grid,
  .share-actions {
    grid-template-columns: 1fr;
  }
}
