:root {
  --bg: #f6f7fb;
  --primary: #2e5cb8;
  --primary-dark: #1c3c6b;
  --accent: #f0c94c;
  --card: rgba(255, 255, 255, 0.85);
  --shadow: 0 18px 40px rgba(29, 51, 103, 0.12);
  --radius: 18px;
  --text-main: #1d2433;
  --text-sub: #5f6b86;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  background-image: url('images/backgound.png');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  font-family: 'Noto Sans KR', sans-serif;
  margin: 0;
  padding: 32px 16px 48px;
  color: var(--text-main);
}

.hidden {
  display: none !important;
}

.app-shell {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  text-align: center;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: 2.3rem;
  color: var(--primary-dark);
}

.hero p {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-sub);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel {
  background: transparent;
}

.intro-text {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 24px;
  color: var(--text-main);
  text-align: center;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

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

.progress-block {
  display: grid;
  gap: 8px;
}

.progress-label {
  font-size: 0.95rem;
  color: var(--text-sub);
}

.progress-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(46, 92, 184, 0.12);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), #4f91ff);
  border-radius: inherit;
  transition: width 0.5s ease;
}

.progress-info {
  font-size: 0.95rem;
  color: var(--primary-dark);
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: inset 0 0 0 1px rgba(46, 92, 184, 0.12);
  display: grid;
  gap: 10px;
}

.stat-title {
  font-weight: 700;
  color: var(--primary-dark);
}

.stat-meter {
  height: 12px;
  border-radius: 999px;
  background: rgba(46, 92, 184, 0.12);
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  width: 50%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(46, 92, 184, 0.85), rgba(240, 201, 76, 0.85));
  transition: width 0.5s ease;
}

.stat-value {
  font-size: 0.95rem;
  color: var(--text-sub);
  font-weight: 600;
}

#story-panel {
  min-height: 88px;
}

#story-text {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-main);
}

.session-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.status-chip {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(46, 92, 184, 0.12);
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: inset 0 0 0 1px rgba(46, 92, 184, 0.18);
}

.perk-badges {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.item-bar {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.item-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(90, 214, 139, 0.22);
  color: #187a48;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 10px 18px rgba(24, 122, 72, 0.18);
}

.item-chip svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.perk-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(240, 201, 76, 0.22);
  color: #8c6c0a;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 10px 18px rgba(140, 108, 10, 0.18);
}

.perk-badge svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.domain-help {
  margin: 0 0 16px;
  font-size: 0.95rem;
  color: var(--text-sub);
}

#path-area h2,
#action-area h2 {
  margin: 0 0 16px;
  font-size: 1.3rem;
  color: var(--primary-dark);
}

.module-track {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.module-tile {
  position: relative;
  border-radius: var(--radius);
  padding: 16px 18px 16px 52px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 0 0 2px rgba(46, 92, 184, 0.14);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.module-tile::before {
  content: attr(data-index);
  position: absolute;
  left: 18px;
  top: 18px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(46, 92, 184, 0.14);
  color: var(--primary-dark);
}

.module-tile.current {
  box-shadow: 0 16px 32px rgba(46, 92, 184, 0.20);
  transform: translateY(-2px);
  border: 2px solid var(--primary);
}

.module-tile.completed {
  box-shadow: inset 0 0 0 2px rgba(46, 92, 184, 0.06);
  opacity: 0.9;
}

.module-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary-dark);
}

.module-status {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 600;
  color: #4f91ff;
}

.module-desc {
  margin-top: 6px;
  font-size: 0.92rem;
  color: var(--text-sub);
  line-height: 1.5;
}

.question-header {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: rgba(46, 92, 184, 0.12);
  color: var(--primary-dark);
  font-weight: 600;
  border-radius: 999px;
  font-size: 0.85rem;
}

.badge.secondary {
  background: rgba(240, 201, 76, 0.18);
  color: #8c6c0a;
}

.question-text {
  font-size: 1.15rem;
  line-height: 1.6;
  margin-bottom: 16px;
}

.choice-list {
  display: grid;
  gap: 12px;
}

.choice-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 1rem;
  text-align: left;
  background: rgba(46, 92, 184, 0.12);
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.choice-btn:hover:enabled {
  background: rgba(46, 92, 184, 0.18);
  transform: translateY(-2px);
}

.choice-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.feedback {
  min-height: 24px;
  margin: 18px 0 12px;
  font-size: 1rem;
  font-weight: 600;
}

.primary,
.secondary {
  border-radius: 999px;
  border: none;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.primary {
  background: linear-gradient(135deg, var(--primary), #4f91ff);
  color: #fff;
  box-shadow: 0 12px 24px rgba(46, 92, 184, 0.26);
}

.primary:hover {
  transform: translateY(-2px);
}

.secondary {
  background: rgba(46, 92, 184, 0.1);
  color: var(--primary-dark);
  box-shadow: 0 12px 20px rgba(29, 51, 103, 0.08);
}

.secondary:hover {
  transform: translateY(-2px);
}

.ending-story {
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 12px 0 20px;
}

.ending-stats {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
  color: var(--text-sub);
  margin-bottom: 24px;
}

.summary-meta {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--text-sub);
  font-weight: 600;
}

.footer {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-sub);
}

@media (max-width: 640px) {
  body {
    padding: 24px 12px 32px;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .card {
    padding: 20px;
  }

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