/* Gamified Law — immersive exercise UI */
:root {
  --gl-bg: #0f172a;
  --gl-card: #1e293b;
  --gl-border: #334155;
  --gl-text: #f1f5f9;
  --gl-muted: #94a3b8;
  --gl-accent: #ec4899;
  --gl-radius: 16px;
}

body.gl-body {
  background: var(--gl-bg);
  color: var(--gl-text);
  min-height: 100vh;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.gl-hero {
  text-align: center;
  padding: 2rem 1.25rem 1.5rem;
  background: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(236, 72, 153, 0.25), transparent);
}
.gl-hero h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  margin: 0.5rem 0;
}
.gl-hero p { color: var(--gl-muted); max-width: 36rem; margin: 0 auto; line-height: 1.6; }

.gl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  padding: 0 1.25rem 2.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.gl-card {
  position: relative;
  background: var(--gl-card);
  border: 1px solid var(--gl-border);
  border-radius: var(--gl-radius);
  padding: 1.35rem;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}
.gl-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--gl-card-color, var(--gl-accent));
}
.gl-card:hover {
  transform: translateY(-4px);
  border-color: var(--gl-card-color, var(--gl-accent));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.gl-card-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  background: var(--gl-card-color, var(--gl-accent));
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--gl-card-color, var(--gl-accent)) 40%, transparent);
}
.gl-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.35;
}
.gl-card p {
  font-size: 0.8125rem;
  color: var(--gl-muted);
  line-height: 1.55;
  margin-bottom: 0.85rem;
}
.gl-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.6875rem;
}
.gl-tag {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--gl-border);
  color: var(--gl-muted);
}
.gl-xp {
  margin-left: auto;
  color: #fbbf24;
  font-weight: 600;
}
.gl-card-arrow {
  position: absolute;
  bottom: 1.2rem;
  right: 1.2rem;
  color: var(--gl-card-color, var(--gl-accent));
  opacity: 0.7;
}

/* Exercise shell */
.gl-exercise {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}
.gl-panel {
  background: var(--gl-card);
  border: 1px solid var(--gl-border);
  border-radius: var(--gl-radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.gl-panel h2 {
  font-family: Georgia, serif;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}
.gl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
}
.gl-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.gl-btn-primary { background: linear-gradient(135deg, #ec4899, #8b5cf6); color: #fff; }
.gl-btn-ghost {
  background: transparent;
  border: 1px solid var(--gl-border);
  color: var(--gl-text);
  text-decoration: none;
}
.gl-btn-group { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }

.gl-choice-grid {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}
.gl-choice {
  text-align: left;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--gl-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--gl-text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.gl-choice:hover { border-color: var(--gl-accent); background: rgba(236, 72, 153, 0.08); }
.gl-choice.selected { border-color: #ec4899; background: rgba(236, 72, 153, 0.15); }

.gl-feedback {
  margin-top: 1rem;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  border-left: 4px solid #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
  font-size: 0.9rem;
  line-height: 1.6;
}
.gl-feedback.success { border-left-color: #10b981; background: rgba(16, 185, 129, 0.1); }
.gl-feedback.warn { border-left-color: #f59e0b; background: rgba(245, 158, 11, 0.1); }

.gl-textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--gl-border);
  background: #0f172a;
  color: var(--gl-text);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  margin-top: 0.75rem;
}

/* Timeline */
.gl-timeline-track {
  position: relative;
  padding: 1rem 0 2rem;
}
.gl-timeline-slider {
  width: 100%;
  accent-color: #06b6d4;
  margin: 1rem 0;
}
.gl-era-card {
  padding: 1.25rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(139, 92, 246, 0.08));
  border: 1px solid var(--gl-border);
}
.gl-era-year {
  font-size: 2rem;
  font-weight: 800;
  color: #06b6d4;
  line-height: 1;
}

/* Law tree map */
.gl-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}
.gl-tree-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }
.gl-tree-node {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 2px solid var(--gl-border);
  background: var(--gl-card);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all 0.2s;
  min-width: 120px;
  text-align: center;
}
.gl-tree-node:hover, .gl-tree-node.active {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  transform: scale(1.03);
}
.gl-tree-detail {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Fusion matching */
.gl-fusion-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.gl-fusion-item {
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--gl-border);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s;
}
.gl-fusion-item.matched { border-color: #10b981; background: rgba(16, 185, 129, 0.15); opacity: 0.7; }
.gl-fusion-item.selected { border-color: #f43f5e; background: rgba(244, 63, 94, 0.12); }
.gl-score-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--gl-border);
  overflow: hidden;
  margin-top: 0.5rem;
}
.gl-score-fill {
  height: 100%;
  background: linear-gradient(90deg, #ec4899, #8b5cf6);
  transition: width 0.3s ease;
}

/* Homepage exercise list in CaseQuest hub */
.cq-gamified-exercises {
  list-style: none;
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
}
.cq-gamified-exercises li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--cq-border);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.cq-gamified-exercises li a:hover {
  border-color: var(--section-color, #ec4899);
  background: color-mix(in srgb, var(--section-color, #ec4899) 8%, transparent);
  transform: translateX(4px);
}
.cq-gamified-ex-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}
.cq-gamified-ex-text { flex: 1; min-width: 0; }
.cq-gamified-ex-text strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}
.cq-gamified-ex-text span {
  font-size: 11px;
  color: var(--cq-muted);
  line-height: 1.4;
}

/* Hub banner & stats */
.gl-hub-hero-banner {
  background: radial-gradient(ellipse 70% 55% at 50% -15%, rgba(236, 72, 153, 0.22), transparent);
}
.gl-hub-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
}
.gl-stat {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--cq-border, var(--gl-border));
  font-size: 0.8125rem;
  color: var(--cq-muted, var(--gl-muted));
}
.gl-stat strong { color: #ec4899; margin-right: 0.25rem; }

/* Hub exercise cards */
.gl-exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.gl-exercise-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--cq-card, var(--gl-card));
  border: 1px solid var(--cq-border, var(--gl-border));
  border-radius: var(--gl-radius);
  padding: 1.35rem 1.35rem 3rem;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}
.gl-exercise-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--gl-accent, #ec4899);
}
.gl-exercise-card:hover {
  transform: translateY(-4px);
  border-color: var(--gl-accent, #ec4899);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.gl-card-num {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--gl-accent, #ec4899);
  opacity: 0.7;
}
.gl-exercise-card .gl-card-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  background: var(--gl-accent, #ec4899);
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--gl-accent, #ec4899) 40%, transparent);
}
.gl-exercise-card h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.35;
}
.gl-exercise-card p {
  font-size: 0.8125rem;
  color: var(--cq-muted, var(--gl-muted));
  line-height: 1.55;
  margin-bottom: 0.85rem;
  flex: 1;
}
.gl-card-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.75rem; }
.gl-card-cta {
  position: absolute;
  bottom: 1.2rem;
  right: 1.2rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gl-accent, #ec4899);
}

/* Exercise page shell */
.gl-exercise-hero {
  text-align: center;
  padding: 1.5rem 1.25rem 1rem;
  background: radial-gradient(ellipse 80% 60% at 50% -20%, color-mix(in srgb, var(--gl-accent, #ec4899) 25%, transparent), transparent);
}
.gl-exercise-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--gl-accent, #ec4899) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--gl-accent, #ec4899) 35%, transparent);
  color: var(--gl-accent, #ec4899);
  margin-bottom: 0.75rem;
}
.gl-exercise-hero h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin: 0.25rem 0;
}
.gl-exercise-hero p { color: var(--gl-muted); font-size: 0.875rem; }
.gl-exercise-wide { max-width: 960px; }
.gl-muted-label { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gl-muted); margin: 1rem 0 0.35rem; }
.gl-facts-block { font-size: 0.9rem; line-height: 1.65; padding: 0.85rem 1rem; border-radius: 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--gl-border); }
.gl-prompt-block { font-size: 0.875rem; color: #c4b5fd; font-style: italic; }
.gl-role-row { display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; }
.gl-select {
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--gl-border);
  background: #0f172a;
  color: var(--gl-text);
  font-size: 0.875rem;
}
.gl-xp-line { margin-top: 1rem; font-size: 0.8125rem; color: #fbbf24; font-weight: 600; }
.gl-tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.gl-law-statute { margin-top: 1rem; font-size: 0.875rem; color: #a5f3fc; }

/* Verdict panel */
.gl-verdict-panel {
  padding: 1.25rem;
  border-radius: var(--gl-radius);
  border: 1px solid var(--gl-border);
  background: var(--gl-card);
}
.gl-verdict-good { border-color: #10b981; background: rgba(16, 185, 129, 0.08); }
.gl-verdict-mid { border-color: #f59e0b; background: rgba(245, 158, 11, 0.08); }
.gl-verdict-low { border-color: #ef4444; background: rgba(239, 68, 68, 0.08); }
.gl-verdict-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; font-weight: 700; }
.gl-score-pill { padding: 0.25rem 0.65rem; border-radius: 999px; background: rgba(0,0,0,0.25); font-size: 0.8125rem; }
.gl-verdict-list { margin: 0; padding-left: 1.1rem; font-size: 0.875rem; line-height: 1.6; }

/* Timeline extras */
.ltc-progress-wrap { height: 6px; background: var(--gl-border); border-radius: 999px; margin: 1rem 0 0.5rem; overflow: hidden; }
.ltc-progress-bar { height: 100%; background: linear-gradient(90deg, #06b6d4, #8b5cf6); transition: width 0.3s; }
.ltc-dots { display: flex; justify-content: space-between; margin: 0.5rem 0 1rem; }
.ltc-era-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--gl-border);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
}
.ltc-era-dot.visited { border-color: #06b6d4; background: rgba(6, 182, 212, 0.3); }
.ltc-era-dot.active { border-color: #06b6d4; background: #06b6d4; transform: scale(1.2); }
.gl-era-tag { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 999px; font-size: 0.6875rem; background: rgba(6,182,212,0.15); color: #67e8f9; margin-bottom: 0.75rem; }
.ltc-quiz-prompt { margin: 1rem 0; font-size: 0.9rem; }
.ltc-quiz-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ltc-quiz-result { margin-top: 0.75rem; font-weight: 600; }
.ltc-correct { color: #10b981; }
.ltc-wrong { color: #f87171; }

/* Family tree SVG */
.ftm-map-panel { padding: 1rem; }
.ftm-svg { width: 100%; height: 380px; display: block; }
.ftm-edge { stroke: #334155; stroke-width: 2; }
.ftm-node { fill: #1e293b; stroke: #475569; stroke-width: 2; cursor: pointer; transition: all 0.2s; }
.ftm-node-discovered { stroke: #10b981; }
.ftm-node-active { fill: rgba(16, 185, 129, 0.25); stroke: #10b981; stroke-width: 3; }
.ftm-label { fill: #94a3b8; font-size: 11px; text-anchor: middle; pointer-events: none; }
.ftm-discovery { font-size: 0.8125rem; color: var(--gl-muted); margin: 0.75rem 0; }

/* Conscience dilemma */
.cd-meters { display: grid; gap: 0.75rem; }
.cd-meter { display: grid; grid-template-columns: 80px 1fr 36px; align-items: center; gap: 0.5rem; font-size: 0.8125rem; }
.cd-choices { display: grid; gap: 0.65rem; margin-top: 1rem; }
.cd-choice {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  text-align: left;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--gl-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--gl-text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.cd-choice:hover { border-color: #f59e0b; background: rgba(245, 158, 11, 0.08); }
.cd-choice-letter {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}
.gl-summary-panel { text-align: center; background: linear-gradient(135deg, rgba(245,158,11,0.1), rgba(236,72,153,0.08)); }

/* Cross-law fusion */
.clf-stats { display: flex; gap: 1.5rem; font-size: 0.875rem; margin-bottom: 0.75rem; color: var(--gl-muted); }
.clf-flash { min-height: 1.5rem; font-weight: 600; font-size: 0.875rem; margin-bottom: 0.75rem; }
.clf-flash-ok { color: #10b981; }
.clf-flash-bad { color: #f87171; }
.clf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.clf-card {
  text-align: left;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--gl-border);
  background: rgba(255,255,255,0.03);
  color: var(--gl-text);
  cursor: pointer;
  transition: all 0.15s;
  min-height: 90px;
}
.clf-card-left { border-left: 3px solid #8b5cf6; }
.clf-card-right { border-left: 3px solid #f43f5e; }
.clf-card-selected { border-color: #ec4899; background: rgba(236, 72, 153, 0.12); transform: scale(1.02); }
.clf-card-side { display: block; font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gl-muted); margin-bottom: 0.35rem; }
.gl-win-panel { text-align: center; border-color: #fbbf24; background: rgba(251, 191, 36, 0.08); }

/* How to Play — shared across Gamified Law exercises */
.gl-how-to-play {
  margin: 0 auto 1.25rem;
  max-width: 640px;
  padding: 1rem 1.15rem;
  border-radius: var(--gl-radius);
  border: 1px solid var(--gl-border, #334155);
  background: rgba(255, 255, 255, 0.03);
}
.gl-how-to-play h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--gl-text, #e8eef7);
}
.gl-how-to-play h2 i { color: var(--gl-how-accent, #ec4899); font-size: 0.9rem; }
.gl-how-steps {
  margin: 0;
  padding-left: 1.35rem;
  display: grid;
  gap: 0.55rem;
}
.gl-how-steps li {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--gl-muted, #94a3b8);
  padding-left: 0.15rem;
}
.gl-how-steps li::marker {
  color: var(--gl-how-accent, #ec4899);
  font-weight: 700;
}
.gl-how-steps strong { color: var(--gl-text, #e8eef7); font-weight: 600; }
.gl-exercise > .gl-how-to-play,
.gl-exercise-wide > .gl-how-to-play {
  margin-bottom: 1rem;
}