@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Playfair+Display:wght@600;700;800&display=swap');

* {
  box-sizing: border-box;
}

:root {
  --bg: #101018;
  --text: #fff7ed;
  --muted: rgba(255, 247, 237, 0.72);
  --line: rgba(255, 255, 255, 0.16);
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.13);
  --honest: #8bd3ff;
  --protect: #ffb3d9;
  --gold: #f6d365;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(139, 211, 255, 0.35), transparent 24rem),
    radial-gradient(circle at 85% 20%, rgba(255, 179, 217, 0.28), transparent 26rem),
    radial-gradient(circle at 50% 95%, rgba(246, 211, 101, 0.16), transparent 28rem),
    linear-gradient(135deg, #0e1020 0%, #211827 50%, #111827 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}

button {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.app {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 26px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.7rem, 6.3vw, 6.2rem);
  line-height: 0.9;
  letter-spacing: -0.055em;
}

h2 {
  margin: 0 0 10px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.35rem, 2.1vw, 1.9rem);
  letter-spacing: -0.03em;
}

h3 {
  margin: 0 0 8px;
}

p {
  line-height: 1.65;
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.intro-strip {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.075);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  margin-bottom: 16px;
}

.intro-strip p {
  margin: 0;
  color: var(--muted);
}

.intro-strip strong {
  color: var(--text);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) 370px;
  gap: 16px;
  align-items: stretch;
}

.scene-card,
.choice-card,
.scenario-strip,
.history-panel,
.info-accordion details {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.scene-card {
  overflow: hidden;
  min-height: 620px;
}

.scene-image-wrap {
  width: 100%;
  height: 390px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(139, 211, 255, 0.16), rgba(255, 179, 217, 0.12)),
    rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--line);
}

.scene-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scene-copy {
  padding: 22px 24px;
}

.scene-number {
  margin: 0 0 7px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.scene-place {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.scene-prompt {
  margin-bottom: 0;
  font-size: 1.04rem;
  color: rgba(255, 247, 237, 0.88);
}

.choice-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 620px;
}

.meter-card,
.progress-box {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.24);
  padding: 16px;
}

.meter-top,
.progress-top {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.88rem;
}

.meter-track,
.mini-progress-track {
  height: 14px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
}

.meter-fill {
  width: 50%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--honest), var(--gold), var(--protect));
  transition: width 160ms ease;
}

.mini-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--protect));
  transition: width 260ms ease;
}

#meterCaption,
.choice-question p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.choice-btn {
  width: 100%;
  border: 0;
  border-radius: 23px;
  color: #111827;
  cursor: pointer;
  padding: 17px 18px;
  text-align: left;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.25);
  transition: transform 160ms ease, filter 160ms ease;
}

.choice-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.choice-btn:active {
  transform: translateY(0);
}

.choice-btn.honest {
  background: linear-gradient(135deg, #e0f2fe, var(--honest));
}

.choice-btn.protect {
  background: linear-gradient(135deg, #fce7f3, var(--protect));
}

.choice-label {
  display: block;
  font-weight: 900;
  font-size: 1.03rem;
}

.choice-sub {
  display: block;
  margin-top: 4px;
  opacity: 0.75;
  font-size: 0.9rem;
}

.mini-actions,
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ghost-btn {
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.085);
  padding: 11px 13px;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.scenario-strip {
  margin-top: 16px;
  padding: 14px;
}

.scenario-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.scenario-card {
  min-height: 102px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.scenario-card:hover,
.scenario-card.active {
  transform: translateY(-2px);
  background: var(--panel-strong);
  border-color: rgba(255, 255, 255, 0.4);
}

.scenario-card.done {
  border-color: rgba(246, 211, 101, 0.62);
}

.scenario-card span {
  display: block;
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scenario-card strong {
  display: block;
  margin: 6px 0;
  font-size: 0.95rem;
}

.scenario-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.history-panel {
  margin-top: 16px;
  padding: 20px;
}

.hidden {
  display: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}

.stats-grid > div,
.summary-score > div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.22);
}

.stats-grid span,
.summary-score span {
  display: block;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 2.25rem;
  font-weight: 900;
}

.stats-grid p,
.summary-score p {
  margin: 2px 0 0;
  color: var(--muted);
}

.history-list,
.summary-history div {
  display: grid;
  gap: 10px;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
  padding: 13px;
}

.history-item strong {
  color: var(--gold);
}

.history-item p {
  margin: 4px 0 0;
  color: var(--muted);
}

.info-accordion {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.info-accordion details {
  padding: 14px 16px;
}

.info-accordion summary {
  cursor: pointer;
  color: var(--gold);
  font-weight: 900;
}

.info-accordion p {
  color: var(--muted);
  font-size: 0.93rem;
}

.footer {
  padding: 22px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.86rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.7);
}

.modal.show {
  display: grid;
}

.modal-card {
  position: relative;
  width: min(760px, 100%);
  max-height: min(92vh, 1100px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at top left, rgba(139, 211, 255, 0.2), transparent 18rem),
    radial-gradient(circle at bottom right, rgba(255, 179, 217, 0.14), transparent 20rem),
    linear-gradient(135deg, #191b24, #241928);
  padding: 28px;
  box-shadow: var(--shadow);
}

.close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  border: 0;
  color: var(--text);
  background: transparent;
  font-size: 2rem;
  cursor: pointer;
}

.result-tag {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.result-image-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--line);
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.05);
}

.result-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cost-box,
.reflection-box,
.summary-message,
.summary-history {
  margin: 14px 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.cost-box p,
.reflection-box p,
.summary-message p {
  margin: 6px 0 0;
  color: var(--muted);
}

.choice-btn.small {
  text-align: center;
}

.summary-score {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.summary-modal-card {
  width: min(820px, 100%);
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .scene-card,
  .choice-card {
    min-height: auto;
  }

  .scenario-cards,
  .info-accordion {
    grid-template-columns: repeat(2, 1fr);
  }

  .scene-image-wrap {
    height: 330px;
  }
}

@media (max-width: 620px) {
  .app {
    width: min(100% - 20px, 1180px);
    padding-top: 20px;
  }

  .scenario-cards,
  .info-accordion,
  .stats-grid,
  .summary-score,
  .mini-actions,
  .modal-actions {
    grid-template-columns: 1fr;
  }

  .scene-image-wrap {
    height: 260px;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions .ghost-btn {
    flex: 1;
  }
}