/* =====================================================
   VŨ TRỤ VĂN HỌC TƯƠNG TÁC — style.css
   Dark cinematic interactive literature website
   ===================================================== */

/* ---- CSS VARIABLES ---- */
:root {
  --bg-base: #0a0a0f;
  --bg-surface: #111118;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;

  --text-primary: #e8e4d8;
  --text-secondary: #9a9483;
  --text-muted: #5a5648;

  --border: rgba(255,255,255,0.07);
  --border-active: rgba(255,255,255,0.15);

  /* Accent colors per work */
  --chi-pheo: #c0392b;
  --chi-pheo-glow: rgba(192, 57, 43, 0.35);
  --chi-pheo-soft: #8b1a1a;

  --vo-nhat: #c89b3c;
  --vo-nhat-glow: rgba(200, 155, 60, 0.35);
  --vo-nhat-soft: #8a6520;

  --nam-xuong: #2980b9;
  --nam-xuong-glow: rgba(41, 128, 185, 0.35);
  --nam-xuong-soft: #1a5f8a;

  --a-phu: #c97830;
  --a-phu-glow: rgba(201, 120, 48, 0.35);
  --a-phu-soft: #8a4f18;

  --gold: #c89b3c;
  --gold-light: #e8c56a;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;

  --transition: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-fast: 0.2s ease;
}

/* ---- RESET & BASE ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Be Vietnam Pro', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.7;
}

h1, h2, h3, h4 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  line-height: 1.2;
}

img { max-width: 100%; }
button { cursor: pointer; border: none; font-family: 'Be Vietnam Pro', sans-serif; }

/* ---- LOADING SCREEN ---- */
#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.loading-orb {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e8c56a, #c89b3c, #8a6520);
  box-shadow: 0 0 60px var(--vo-nhat-glow), 0 0 120px rgba(200,155,60,0.2);
  animation: orb-pulse 2s ease-in-out infinite;
}

@keyframes orb-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 60px var(--vo-nhat-glow); }
  50% { transform: scale(1.1); box-shadow: 0 0 100px var(--vo-nhat-glow), 0 0 200px rgba(200,155,60,0.15); }
}

.loading-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-style: italic;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.loading-bar {
  width: 280px;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.loading-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--chi-pheo), var(--vo-nhat), var(--nam-xuong), var(--a-phu));
  border-radius: 2px;
  animation: loading-progress 2s ease-out forwards;
}

@keyframes loading-progress {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* ---- NAVIGATION ---- */
#main-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 0 24px;
  height: 64px;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  transition: transform var(--transition);
}

#main-nav.hidden {
  transform: translateY(-100%);
}

.nav-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-home-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
  letter-spacing: 0.03em;
}

.nav-home-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
  background: var(--bg-card);
}

.nav-icon {
  font-size: 1.1rem;
  color: var(--gold);
}

.nav-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.nav-ai-btn {
  background: transparent;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(200,155,60,0.3);
  transition: all var(--transition-fast);
  letter-spacing: 0.03em;
}

.nav-ai-btn:hover {
  background: rgba(200,155,60,0.1);
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(200,155,60,0.15);
}

/* ---- SECTIONS ---- */


.section.active {
  display: block;
}

.section.visible {
  opacity: 1;
}
.section {
  min-height: 100vh;
  box-sizing: border-box;
  padding: 100px 24px 80px;
  display: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
/* ---- HOME SECTION ---- */
/* NOTE: display:flex is NOT set here — it must NOT override .section{display:none}.
   The active state below handles it via higher combined specificity. */
#section-home {
  position: relative;
  flex-direction: column;
  align-items: center;
  padding-top: 120px;
  overflow: visible; /* was: hidden — caused all content below fold to be clipped */
}
.home-scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  animation: bounce 2s ease-in-out infinite;
}

#section-home.active {
  display: flex; /* overrides .section.active{display:block} for home only */
}

/* Particle background */
.home-bg-particles {
  position: fixed; /* fixed so particles always fill viewport, not the tall section */
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: particle-float linear infinite;
}

@keyframes particle-float {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 0.5; }
  100% { transform: translateY(-20px) scale(1); opacity: 0; }
}

.home-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 900px;
  width: 100%;
}

.home-eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 32px;
  font-weight: 500;
  opacity: 0;
  animation: fade-up 0.8s ease 0.3s forwards;
}

.home-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-bottom: 40px;
}

.title-line-1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 300;
  font-style: italic;
  color: var(--text-secondary);
  letter-spacing: 0.15em;
  opacity: 0;
  animation: fade-up 0.8s ease 0.5s forwards;
}

.title-line-2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(4.5rem, 14vw, 10rem);
  font-weight: 700;
  line-height: 0.85;
  background: linear-gradient(135deg, #e8c56a 0%, #c89b3c 40%, #ff6b35 70%, #c0392b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0;
  animation: fade-up 0.8s ease 0.7s forwards;
  filter: drop-shadow(0 0 40px rgba(200, 155, 60, 0.3));
}

.title-line-3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 300;
  letter-spacing: 0.6em;
  color: var(--text-secondary);
  text-transform: uppercase;
  opacity: 0;
  animation: fade-up 0.8s ease 0.9s forwards;
}

.home-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-style: italic;
  line-height: 1.8;
  opacity: 0;
  animation: fade-up 0.8s ease 1.1s forwards;
}

.home-intro {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 48px;
  line-height: 1.9;
  opacity: 0;
  animation: fade-up 0.8s ease 1.3s forwards;
}

.home-cta-group {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 100px;
  opacity: 0;
  animation: fade-up 0.8s ease 1.5s forwards;
}

/* ---- BUTTONS ---- */
.btn-primary {
  position: relative;
  background: linear-gradient(135deg, #c89b3c, #e8c56a);
  color: #0a0a0f;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 16px 40px;
  border-radius: var(--radius-xl);
  letter-spacing: 0.05em;
  transition: all var(--transition-fast);
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 40px rgba(200, 155, 60, 0.4), 0 0 80px rgba(200, 155, 60, 0.2);
}

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

.btn-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.2) 100%);
  pointer-events: none;
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 16px 36px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-active);
  letter-spacing: 0.03em;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.05);
  transform: translateY(-1px);
}

/* ---- HOME INFO GRID ---- */
.home-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  text-align: left;
  opacity: 0;
  animation: fade-up 0.8s ease 1.8s forwards;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  transition: all var(--transition-fast);
}

.info-card:hover {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
}

.info-icon {
  font-size: 1.6rem;
  color: var(--gold);
  margin-bottom: 16px;
}

.info-card h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.info-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.8;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}

/* ---- SECTION HEADER SHARED ---- */
.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 64px;
}

.section-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 20px;
  font-weight: 500;
}

.section-title {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  margin-bottom: 20px;
  color: var(--text-primary);
}

.section-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ---- WORKS GRID ---- */
.works-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  max-width: 1100px;
  margin: 0 auto;
}

.work-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.work-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, var(--card-glow, rgba(200,155,60,0.1)) 0%, transparent 60%);
  pointer-events: none;
  transition: opacity 0.3s ease;
  opacity: 0;
}

.work-card:hover {
  transform: translateY(-6px);
  border-color: var(--card-accent, var(--gold));
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 40px var(--card-glow, rgba(200,155,60,0.15));
}

.work-card:hover::before {
  opacity: 1;
}

.work-card[data-work="chi-pheo"] {
  --card-accent: var(--chi-pheo);
  --card-glow: var(--chi-pheo-glow);
}
.work-card[data-work="vo-nhat"] {
  --card-accent: var(--vo-nhat);
  --card-glow: var(--vo-nhat-glow);
}
.work-card[data-work="nam-xuong"] {
  --card-accent: var(--nam-xuong);
  --card-glow: var(--nam-xuong-glow);
}
.work-card[data-work="a-phu"] {
  --card-accent: var(--a-phu);
  --card-glow: var(--a-phu-glow);
}

.work-card-accent-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--card-accent), transparent);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.work-card-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 3.5rem;
  font-weight: 300;
  color: var(--card-accent);
  opacity: 0.3;
  line-height: 1;
  position: absolute;
  top: 24px; right: 32px;
}

.work-card-author {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--card-accent);
  font-weight: 500;
}

.work-card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.work-card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  flex: 1;
}

.work-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--card-accent);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--card-accent);
  letter-spacing: 0.05em;
  transition: all var(--transition-fast);
  width: fit-content;
  margin-top: 8px;
  opacity: 0.85;
}

.work-card-btn:hover {
  background: var(--card-accent);
  color: var(--bg-base);
  box-shadow: 0 0 30px var(--card-glow);
  opacity: 1;
}

/* ---- STORY SECTION ---- */
.story-header {
  max-width: 900px;
  margin: 0 auto 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.story-work-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-style: italic;
  color: var(--story-accent, var(--gold));
  font-weight: 400;
}

.story-progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: flex-end;
}

.story-progress-bar {
  width: 200px;
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.story-progress-fill {
  height: 100%;
  background: var(--story-accent, var(--gold));
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 10px var(--story-glow, var(--vo-nhat-glow));
}

.story-step-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.story-container {
  max-width: 900px;
  margin: 0 auto;
}

/* ---- SCENE CARD ---- */
.scene-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  animation: scene-enter 0.5s ease forwards;
}

@keyframes scene-enter {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.scene-card.exiting {
  animation: scene-exit 0.3s ease forwards;
}

@keyframes scene-exit {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-20px); }
}

.scene-banner {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.scene-banner-inner {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 700;
  opacity: 0.12;
  color: white;
  letter-spacing: 0.1em;
  user-select: none;
  pointer-events: none;
}

.scene-banner-label {
  position: absolute;
  bottom: 16px; left: 28px;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--story-accent, var(--gold));
  font-weight: 600;
}

.scene-body {
  padding: 40px 48px;
}

.scene-location {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.scene-location::before {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: var(--story-accent, var(--gold));
}

.scene-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin-bottom: 24px;
  color: var(--text-primary);
  font-weight: 700;
}

.scene-text {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.95;
  margin-bottom: 40px;
  max-width: 700px;
}

.scene-text em {
  color: var(--story-accent, var(--gold));
  font-style: italic;
}

.scene-question {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 24px;
  font-style: italic;
  font-weight: 400;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.scene-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  text-align: left;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.choice-btn::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--story-accent, var(--gold));
  transform: scaleY(0);
  transition: transform 0.25s ease;
  border-radius: 3px 0 0 3px;
}

.choice-btn:hover {
  border-color: var(--story-accent, var(--gold));
  color: var(--text-primary);
  background: var(--bg-card-hover);
  transform: translateX(4px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3), 0 0 30px var(--story-glow, rgba(200,155,60,0.1));
}

.choice-btn:hover::before {
  transform: scaleY(1);
}

.choice-letter {
  display: inline-flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--story-accent, var(--gold));
  color: var(--story-accent, var(--gold));
  font-size: 0.7rem;
  font-weight: 700;
  margin-right: 12px;
  flex-shrink: 0;
  float: left;
  margin-top: 2px;
}

/* ---- ENDING SECTION ---- */
.ending-container {
  max-width: 900px;
  margin: 0 auto;
}

.ending-badge {
  text-align: center;
  margin-bottom: 40px;
}

.ending-type-label {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bg-base);
  background: var(--story-accent, var(--gold));
  padding: 6px 20px;
  border-radius: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

.ending-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  margin-bottom: 8px;
}

.ending-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px;
  margin-bottom: 24px;
  animation: scene-enter 0.6s ease forwards;
}

.ending-narrative {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 2;
  margin-bottom: 40px;
  font-style: italic;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.ending-analysis-section {
  margin-bottom: 32px;
}

.ending-analysis-section h3 {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--story-accent, var(--gold));
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ending-analysis-section h3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.ending-analysis-section p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.9;
}

.ending-lessons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
}

.lesson-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.lesson-item .lesson-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--story-accent, var(--gold));
  font-weight: 600;
  margin-bottom: 8px;
}

.lesson-item p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.ending-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 40px;
  flex-wrap: wrap;
}

/* ---- REFLECTION SECTION ---- */
.reflection-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 60px;
}

.comparison-table-wrap {
  max-width: 1200px;
  margin: 0 auto 60px;
  overflow-x: auto;
}

.comparison-table {
  min-width: 800px;
  border-collapse: collapse;
  width: 100%;
}

.comparison-table th,
.comparison-table td {
  padding: 16px 20px;
  border: 1px solid var(--border);
  font-size: 0.88rem;
  line-height: 1.6;
  vertical-align: top;
}

.comparison-table thead th {
  background: var(--bg-card);
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  font-family: 'Be Vietnam Pro', sans-serif;
}

.comparison-table thead th:first-child {
  border-radius: 0;
}

.comparison-table tbody tr {
  background: var(--bg-base);
  transition: background var(--transition-fast);
}

.comparison-table tbody tr:hover {
  background: var(--bg-card);
}

.comparison-table tbody tr th {
  background: var(--bg-card);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 160px;
}

.comparison-table td {
  color: var(--text-secondary);
}

.reflection-conclusions {
  max-width: 1000px;
  margin: 0 auto 60px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.conclusion-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
}

.conclusion-card h3 {
  font-size: 1.25rem;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.conclusion-card p {
  font-size: 0.93rem;
  color: var(--text-secondary);
  line-height: 1.9;
}

.reflection-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-xl);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 48px;
  position: relative;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.open .modal-box {
  transform: scale(1) translateY(0);
}

.modal-close {
  position: absolute;
  top: 20px; right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
  display: flex; align-items: center; justify-content: center;
}

.modal-close:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
}

.modal-header {
  text-align: center;
  margin-bottom: 40px;
}

.modal-icon {
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.modal-header p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.modal-body h3 {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 20px;
}

.ai-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 36px;
}

.ai-list li {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.ai-dot {
  color: var(--gold);
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.ai-list li div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-list li strong {
  font-size: 0.92rem;
  color: var(--text-primary);
  font-weight: 600;
}

.ai-list li span {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-ethics {
  background: var(--bg-card);
  border: 1px solid rgba(200,155,60,0.2);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.modal-ethics h3 {
  margin-bottom: 16px;
}

.modal-ethics ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-ethics ul li {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.modal-theme-tag {
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--text-muted);
  font-size: 1rem;
  letter-spacing: 0.1em;
}

/* ---- FOOTER ---- */
#main-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 40px 24px;
  text-align: center;
}

.footer-inner {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-theme {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-style: italic;
  color: var(--gold);
  letter-spacing: 0.1em;
}

.footer-works {
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.footer-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ---- ANIMATIONS ---- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---- WORK-SPECIFIC STORY THEMES ---- */
.theme-chi-pheo {
  --story-accent: var(--chi-pheo);
  --story-glow: var(--chi-pheo-glow);
}
.theme-chi-pheo .scene-banner {
  background: radial-gradient(ellipse at 60% 50%, rgba(139, 26, 26, 0.5) 0%, rgba(10,10,15,0) 70%),
              linear-gradient(180deg, #1a0505 0%, #0a0a0f 100%);
}

.theme-vo-nhat {
  --story-accent: var(--vo-nhat);
  --story-glow: var(--vo-nhat-glow);
}
.theme-vo-nhat .scene-banner {
  background: radial-gradient(ellipse at 60% 50%, rgba(138, 101, 32, 0.5) 0%, rgba(10,10,15,0) 70%),
              linear-gradient(180deg, #1a1205 0%, #0a0a0f 100%);
}

.theme-nam-xuong {
  --story-accent: var(--nam-xuong);
  --story-glow: var(--nam-xuong-glow);
}
.theme-nam-xuong .scene-banner {
  background: radial-gradient(ellipse at 60% 50%, rgba(26, 95, 138, 0.5) 0%, rgba(10,10,15,0) 70%),
              linear-gradient(180deg, #030f1a 0%, #0a0a0f 100%);
}

.theme-a-phu {
  --story-accent: var(--a-phu);
  --story-glow: var(--a-phu-glow);
}
.theme-a-phu .scene-banner {
  background: radial-gradient(ellipse at 60% 50%, rgba(138, 79, 24, 0.5) 0%, rgba(10,10,15,0) 70%),
              linear-gradient(180deg, #1a0d03 0%, #0a0a0f 100%);
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb {
  background: var(--border-active);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .works-grid {
    grid-template-columns: 1fr;
  }
  .home-info-grid {
    grid-template-columns: 1fr;
  }
  .reflection-conclusions {
    grid-template-columns: 1fr;
  }
  .ending-lessons-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .section { padding: 90px 16px 60px; }
  .scene-body { padding: 24px; }
  .ending-card { padding: 24px; }
  .modal-box { padding: 28px 20px; }
  .home-cta-group { flex-direction: column; align-items: center; }
  .story-header { flex-direction: column; align-items: flex-start; }
  .story-progress-wrap { width: 100%; justify-content: flex-start; }
  .story-progress-bar { flex: 1; }
  .nav-badge { display: none; }
}

/* ---- STORY INTRO SCENE ---- */
.intro-scene {
  text-align: center;
  padding: 60px 48px;
}

.intro-scene .work-big-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--story-accent, var(--gold));
}

.intro-scene .work-big-author {
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 36px;
}

.intro-scene .intro-separator {
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--story-accent, var(--gold)), transparent);
  margin: 0 auto 36px;
}

.intro-scene .intro-text {
  max-width: 600px;
  margin: 0 auto 48px;
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 2;
  font-style: italic;
}

/* ---- ENDING STAR RATING VISUAL ---- */
.ending-header-visual {
  text-align: center;
  padding: 48px 0 32px;
}

.ending-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 1.2rem;
  color: var(--story-accent, var(--gold));
}

/* =====================================================
   NÂNG CẤP — Theme màu cho tác phẩm mới
   ===================================================== */
:root {
  --lao-hac: #7d6b4f;
  --lao-hac-glow: rgba(125,107,79,0.35);

  --chiec-thuyen: #4a90a4;
  --chiec-thuyen-glow: rgba(74,144,164,0.35);

  --hon-truong-ba: #8b5cf6;
  --hon-truong-ba-glow: rgba(139,92,246,0.35);

  --hai-dua-tre: #b8860b;
  --hai-dua-tre-glow: rgba(184,134,11,0.35);
}

/* =====================================================
   SCORE PANEL — Bảng chấm điểm kết thúc trò chơi
   ===================================================== */
.score-panel {
  max-width: 680px;
  margin: 2rem auto;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 2rem;
}

.score-panel-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  color: var(--story-accent, var(--gold));
  text-align: center;
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
}

.score-total-wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.score-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid var(--story-accent, var(--gold));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  box-shadow: 0 0 20px var(--story-glow, rgba(201,169,110,0.3));
  flex-shrink: 0;
}

.score-number {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--story-accent, var(--gold));
  line-height: 1;
}

.score-max {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.score-rating {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 600;
  max-width: 280px;
  line-height: 1.4;
  text-align: left;
}

.rating-gold { color: #f1c40f; }
.rating-silver { color: #bdc3c7; }
.rating-bronze { color: #e67e22; }
.rating-base { color: var(--text-secondary); }

.score-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.score-dim {
  display: grid;
  grid-template-columns: 160px 1fr 48px;
  gap: 0.5rem;
  align-items: center;
}

.score-dim-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.score-bar-wrap {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}

.score-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--story-accent, var(--gold)), rgba(255,255,255,0.6));
  border-radius: 3px;
  transition: width 1s ease;
  min-width: 2px;
}

.score-dim-val {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--story-accent, var(--gold));
  text-align: right;
}

.score-dim-val span {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.score-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  line-height: 1.5;
}

/* Mobile */
@media (max-width: 600px) {
  .score-dim {
    grid-template-columns: 120px 1fr 44px;
    gap: 0.3rem;
  }
  .score-dim-label { font-size: 0.7rem; }
  .score-total-wrap { flex-direction: column; }
  .score-rating { text-align: center; }
}