:root {
  --bg: #07130d;
  --panel: #132219;
  --paper: #f4ecd8;
  --text: #fff8e8;
  --muted: #d8c9a8;
  --gold: #f4d06f;
  --line: rgba(244, 208, 111, .22);
  --green: #91d99b;
  --red: #ff9e90;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(145, 217, 155, .08), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(100% - 24px, 1080px);
  margin: 0 auto;
  padding: 18px 0 44px;
}

.hero,
.panel,
.intent-card,
.score-summary {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px;
  background: rgba(19,34,25,.96);
  box-shadow: 0 18px 50px rgba(0,0,0,.24);
}

.hero {
  padding: 24px;
  margin-bottom: 16px;
}

.hero-top,
.action-row,
.identity-panel,
.score-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  color: var(--gold);
  font-size: 1.7rem;
  font-weight: 900;
  text-decoration: none;
}

.quick-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.quick-links a,
a {
  color: var(--text);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-family: system-ui, sans-serif;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1 {
  margin: 12px 0 8px;
  font-size: clamp(2.4rem, 7vw, 4.8rem);
  line-height: .94;
}

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

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.notice,
.dev-banner {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.18);
}

.dev-banner {
  border-color: rgba(145, 217, 155, .42);
  background: rgba(145, 217, 155, .09);
  color: var(--green);
  font-family: system-ui, sans-serif;
  font-weight: 800;
}

.view {
  margin-top: 16px;
}

.intent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
}

.intent-card,
.panel {
  padding: 18px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.16);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: var(--gold);
  color: #142318;
  font-weight: 900;
}

.button.danger {
  border-color: rgba(255, 158, 144, .45);
  color: var(--red);
}

.button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.field,
.identity-controls label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: .9rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.24);
  color: var(--text);
}

.identity-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.identity-controls label {
  min-width: 220px;
}

.round-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.round-tab {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0,0,0,.18);
  color: var(--text);
  cursor: pointer;
}

.round-tab.active {
  background: var(--paper);
  color: #142318;
  font-weight: 900;
}

.answer-sheet {
  display: grid;
  gap: 12px;
}

.round-section {
  display: grid;
  gap: 12px;
}

.answer-row,
.bonus-row {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  background: rgba(0,0,0,.18);
  padding: 14px;
}

.question-main {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
}

.question-number {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--paper);
  color: #142318;
  font-weight: 900;
}

.question-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.answer-input {
  margin-top: 6px;
}

.question-tools,
.mark-tools,
.choice-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.tool-button,
.mark-button,
.choice-button {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,.16);
  color: var(--text);
  cursor: pointer;
}

.mark-button.active,
.choice-button.active {
  background: var(--gold);
  color: #142318;
  font-weight: 900;
}

.question-status,
.choice-warning {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: .86rem;
}

.score-summary {
  padding: 16px;
  margin: 16px 0;
}

.score-stat span {
  display: block;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: .86rem;
}

.score-stat strong {
  display: block;
  margin-top: 5px;
  font-size: 2rem;
}

.sync-message {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
}

.sync-message.error {
  border-color: rgba(255,158,144,.45);
  color: var(--red);
}

.dev-payload {
  display: block;
  max-height: 260px;
  overflow: auto;
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(0,0,0,.32);
  color: var(--muted);
  white-space: pre-wrap;
  font-size: .82rem;
}

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

  .question-main {
    grid-template-columns: 1fr;
  }

  .score-summary {
    display: grid;
    grid-template-columns: 1fr;
  }
}