:root {
  --bg: #f3f0f5;
  --ink: #25425f;
  --ink-soft: #5e748c;
  --panel: #fffdf9;
  --panel-edge: rgba(49, 72, 92, 0.1);
  --mint: #9af170;
  --mint-deep: #61cb67;
  --blue: #56aeea;
  --blue-deep: #2c7fc4;
  --peach: #ffe7d5;
  --danger: #ef6c63;
  --shadow: 0 24px 60px rgba(26, 40, 58, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, #faf7ff 0%, #f1edf4 48%, #ece8f0 100%);
  color: var(--ink);
  font-family: Inter, ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  padding: 20px;
}

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

button {
  cursor: pointer;
}

code {
  font-size: 0.92em;
  background: rgba(86, 174, 234, 0.12);
  padding: 0.12rem 0.35rem;
  border-radius: 8px;
}

.app-shell {
  max-width: 1380px;
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.hero-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 28px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 252, 247, 0.96));
  border: 1px solid rgba(86, 126, 162, 0.12);
  box-shadow: var(--shadow);
}

.eyebrow,
.panel-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 800;
  color: #79a0ba;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.96;
}

.subhead {
  margin: 12px 0 0;
  max-width: 780px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.9fr);
  gap: 20px;
}

.stage-card,
.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 250, 244, 0.98));
  border-radius: 30px;
  border: 1px solid var(--panel-edge);
  box-shadow: var(--shadow);
}

.stage-card {
  padding: 18px;
}

.stage-shell {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  background: linear-gradient(180deg, #f7f4e5, #f5eddd);
  min-height: 620px;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 620px;
  touch-action: manipulation;
}

.stage-overlay {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.chip {
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(75, 109, 140, 0.14);
  font-weight: 800;
  color: var(--ink);
  box-shadow: 0 10px 26px rgba(32, 45, 63, 0.08);
}

.chip-live {
  background: rgba(154, 241, 112, 0.9);
}

.sidebar {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 22px 22px 20px;
}

.story-panel h2 {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 1.9rem);
  line-height: 1.12;
}

.story-panel p,
.notes-panel li {
  color: var(--ink-soft);
  line-height: 1.5;
}

.choice-row,
.button-grid {
  display: grid;
  gap: 12px;
}

.choice-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.button-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.primary-btn,
.ghost-btn,
.secondary-btn,
.emotion-choice {
  border: 0;
  border-radius: 18px;
  padding: 14px 16px;
  font-weight: 800;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.primary-btn,
.emotion-choice.is-selected,
.emotion-choice:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  background: linear-gradient(180deg, #6bd0ff, #3ca8e9);
  color: white;
  box-shadow: 0 14px 24px rgba(60, 168, 233, 0.28);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  border: 1px solid rgba(61, 94, 127, 0.14);
}

.secondary-btn,
.emotion-choice {
  background: #f4f8fc;
  color: var(--ink);
  border: 1px solid rgba(73, 110, 142, 0.12);
  box-shadow: 0 10px 24px rgba(28, 46, 65, 0.06);
}

.emotion-choice.is-selected {
  background: linear-gradient(180deg, #7fe17c, #67cf6d);
  color: #123116;
}

.feedback {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  font-weight: 700;
}

.feedback.is-good {
  background: rgba(125, 221, 118, 0.16);
  color: #26622e;
}

.feedback.is-bad {
  background: rgba(239, 108, 99, 0.14);
  color: #8a3029;
}

.notes-panel ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.notes-panel li + li {
  margin-top: 10px;
}

@media (max-width: 1040px) {
  body {
    padding: 16px;
  }

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

  .stage-shell,
  #gameCanvas {
    min-height: 540px;
  }
}

@media (max-width: 760px) {
  .hero-bar {
    padding: 20px;
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-actions {
    width: 100%;
    justify-content: stretch;
  }

  .hero-actions button {
    flex: 1 1 0;
  }

  .choice-row,
  .button-grid {
    grid-template-columns: 1fr;
  }

  .stage-shell,
  #gameCanvas {
    min-height: 480px;
  }

  .chip {
    padding: 10px 13px;
    font-size: 0.9rem;
  }
}
