/* ─── DESIGN TOKENS (LYST OG RENT TEMA) ─── */
:root {
  --bg: #f4f4f0;
  --surface: #ffffff;
  --surface2: #f9f9f9;
  --surface3: #e0e0e0;
  --text-main: #1a1a1a;
  --text-muted: #666666;
  --border: #cccccc;
  --border-bright: #aaaaaa;
  --highlight: #e0e0e0;
  --accent: #1a1a1a;
  --accent-dim: #e0e0e0;
  --success: #2e7d32;
  --logo: #44214c;
  --danger: #d32f2f;
  --warn: #f57c00;
  --corruption-color: #8e24aa;
  --info: #1976d2;
  --font-ui: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --radius: 4px;
  --radius-lg: 8px;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  background: var(--bg);
}
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text-main);
  height: 100dvh;
  overflow: hidden;
  display: flex;
  justify-content: center;
}
#app {
  width: 100%;
  max-width: 600px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.screen {
  display: none;
  height: 100%;
  flex-direction: column;
  position: relative;
  z-index: 2;
}
.screen.active {
  display: flex;
}
#toast {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  background: var(--text-main);
  color: var(--surface);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s;
  white-space: nowrap;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#title-screen {
  padding: 40px 20px;
  overflow-y: auto;
  text-align: center;
}
.title-hero {
  margin-bottom: 20px;
}
.title-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 30px;
}
.title-main {
  font-family: var(--font-mono);
  font-size: 2rem;
  margin-bottom: 10px;
  letter-spacing: -1px;
}
.title-sub {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 30px;
}
.title-body {
  text-align: left;
  line-height: 1.7;
  color: var(--text-main);
  margin-bottom: 30px;
}
.title-body p {
  margin-bottom: 15px;
}
.title-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--text-main);
  color: var(--surface);
  border: none;
  padding: 16px 32px;
  font-family: var(--font-mono);
  font-size: 1rem;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: var(--radius);
  transition: opacity 0.2s;
  width: 100%;
}
.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--text-main);
  border: 2px solid var(--text-main);
  padding: 16px 32px;
  font-family: var(--font-mono);
  font-size: 1rem;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.2s, color 0.2s;
  width: 100%;
}
.btn-secondary:hover {
  background: var(--text-main);
  color: var(--surface);
}
.btn-ghost {
  background: var(--highlight);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 5px;
}
.btn-ghost:hover {
  background: var(--border);
}

header {
  flex: 0 0 auto;
  padding: 16px;
  border-bottom: 2px solid var(--text-main);
  background: var(--surface);
  z-index: 5;
}
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
#ui-epoch-counter {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.header-btns {
  display: flex;
  gap: 8px;
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}
.stat-box {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
}
.stat-label {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.stat-val {
  color: var(--text-main);
  font-weight: bold;
}
.progress-track {
  height: 4px;
  background: var(--border);
  width: 100%;
}
.progress-fill {
  height: 100%;
  background: var(--text-main);
  transition: width 0.3s ease;
}
.progress-fill.corruption {
  background: var(--corruption-color);
}

.skills-row {
  display: flex;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.skill-pip {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}
.skill-pip:hover {
  color: var(--text-main);
}
.skill-pip i {
  font-size: 1rem;
  color: var(--text-main);
}
.skill-pip.mastered {
  color: var(--success);
  font-weight: bold;
}
.skill-pip.mastered i {
  color: var(--success);
}
.skill-pip.grand {
  color: var(--warn);
  font-weight: bold;
}
.skill-pip.grand i {
  color: var(--warn);
}
#timeline-route-badge {
  display: none;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  margin-top: 8px;
  font-weight: bold;
}

main {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px 20px;
  background: var(--bg);
  transition: opacity 0.2s;
}
main.fade-out {
  opacity: 0;
}
.scenario-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 2px dashed var(--border);
  padding-bottom: 12px;
}
.epoch-badge {
  background: var(--text-main);
  color: var(--surface);
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
}
#scenario-icon {
  font-size: 2.5rem;
  color: var(--text-muted);
}
.scenario-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.2;
}
.scenario-desc {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 24px;
}

footer {
  flex: 0 0 auto;
  padding: 16px 20px 24px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.03);
}
.choices-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 45vh;
  overflow-y: auto;
}
.choice-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 0.95rem;
}
.choice-btn:hover:not(:disabled) {
  background: var(--highlight);
  border-color: var(--text-main);
}
.choice-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--surface);
}
.choice-icon-wrap {
  font-size: 1.5rem;
  width: 30px;
  text-align: center;
  flex-shrink: 0;
}
.choice-body {
  flex: 1;
}
.choice-text {
  line-height: 1.4;
}
.choice-meta {
  display: flex;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: bold;
  margin-top: 6px;
}
.energy-cost {
  color: var(--text-main);
}

.tags-container {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.tag-req {
  background: var(--text-main);
  color: var(--surface);
}
.tag-warn {
  background: rgba(211, 47, 47, 0.1);
  color: var(--danger);
  border: 1px solid var(--danger);
}
.tag-info {
  background: rgba(25, 118, 210, 0.1);
  color: var(--info);
  border: 1px solid var(--info);
}
.tag-corrupt {
  background: rgba(142, 36, 170, 0.1);
  color: var(--corruption-color);
  border: 1px solid var(--corruption-color);
}
.tag-clean {
  background: rgba(46, 125, 50, 0.1);
  color: var(--success);
  border: 1px solid var(--success);
}
.tag-echo {
  background: var(--text-main);
  color: var(--surface);
  border: 1px solid var(--border-bright);
  font-weight: bold;
}
.choice-teaser {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 6px;
  opacity: 0.8;
}
.flag-preview {
  font-size: 0.75rem;
  color: var(--info);
  font-style: italic;
  margin-top: 4px;
  opacity: 0.9;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(244, 244, 240, 0.98);
  z-index: 30;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s, visibility 0.3s;
  overflow-y: auto;
  outline: none;
  text-align: center;
}
.overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}
.overlay-icon-big {
  font-size: 4rem;
  margin-bottom: 20px;
}
.overlay-title {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.overlay-body {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.overlay-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.outcome-delta {
  font-family: var(--font-mono);
  font-weight: bold;
  margin-bottom: 10px;
}
#out-bonus {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--success);
  margin-bottom: 15px;
}
#out-flag {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-main);
  margin-bottom: 30px;
}

.skill-meter {
  width: 100%;
  background: var(--surface3);
  height: 4px;
  margin: 10px 0 4px;
}
.skill-meter-fill {
  height: 100%;
  background: var(--text-main);
  transition: width 0.4s;
}
.mastery-box {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  margin-bottom: 30px;
  text-align: left;
}
.mastery-box.locked {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.mastery-box.active {
  background: rgba(46, 125, 50, 0.1);
  color: var(--success);
  border: 1px solid var(--success);
}
.mastery-box.grand {
  background: rgba(245, 124, 0, 0.1);
  color: var(--warn);
  border: 1px solid var(--warn);
}

.epoch-transition-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.epoch-arrow {
  font-size: 1.5rem;
  color: var(--text-main);
}

.log-container {
  width: 100%;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 20px;
  text-align: left;
}
.log-entry {
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px dashed var(--highlight);
}
.log-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.log-epoch-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
}
.log-scenario {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.log-choice {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.log-meta {
  display: flex;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

#timeline-vis {
  width: 100%;
  margin-bottom: 20px;
  text-align: left;
}
.timeline-epoch {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.timeline-dot {
  width: 30px;
  height: 30px;
  background: var(--surface2);
  border: 1px solid var(--text-main);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-main);
  flex-shrink: 0;
}
.timeline-content {
  padding-top: 4px;
  padding-bottom: 4px;
  width: 100%;
}
.timeline-name {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: bold;
  margin-bottom: 4px;
}
.timeline-flag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--surface);
  background: var(--text-main);
  padding: 2px 8px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 4px;
  margin-bottom: 4px;
}
.timeline-missed-flag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--surface3);
  padding: 2px 8px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 4px;
  margin-bottom: 4px;
  opacity: 0.6;
  border: 1px dashed var(--border-bright);
}
.timeline-connector {
  width: 2px;
  height: 20px;
  background: var(--border);
  margin-left: 14px;
}

.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 20px;
}
.tut-progress-bar {
  height: 4px;
  background: var(--border);
  width: 100%;
  margin-bottom: 20px;
}
.tut-progress-fill {
  height: 100%;
  background: var(--text-main);
  transition: width 0.3s;
}
.tut-content-box {
  text-align: left;
  margin-bottom: 30px;
  flex: 1;
  width: 100%;
}
.tut-content-box p {
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 15px;
}
.tut-nav {
  display: flex;
  gap: 10px;
  width: 100%;
}

/* --- INLINE IKONER I TEKST --- */
.inline-icon {
  font-size: 1.2rem; /* Lidt større end teksten */
  color: var(--text-main);
  vertical-align: middle; /* Centrerer ikonet i forhold til teksten */
  margin: 0 4px; /* Giver lidt luft omkring ikonet */
}

/* --- IKON DER STÅR ALENE I MIDTEN --- */
.center-icon-block {
  display: block; /* Tvinger ikonet over på sin egen linje */
  text-align: center; /* Centrerer ikonet horisontalt */
  font-size: 6rem; /* Gør det dejligt stort */
  margin: 15px 0; /* Giver luft i toppen og bunden */
}

.special-overlay-banner {
  background: var(--text-main);
  color: var(--surface);
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  width: 100%;
  text-align: center;
  margin-bottom: 20px;
  text-transform: uppercase;
}
.special-overlay-banner.danger {
  background: rgba(211, 47, 47, 0.1);
  color: var(--danger);
  border: 1px solid var(--danger);
}
.anomaly-choices {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.achievement {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--surface);
}
.achievement.earned {
  background: rgba(46, 125, 50, 0.05);
  border-color: var(--success);
}
.achievement.locked {
  background: var(--surface2);
  opacity: 0.6;
}
.achievement i {
  font-size: 1.5rem;
  color: var(--text-muted);
}
.achievement.earned i {
  color: var(--success);
}
.ach-name {
  font-weight: bold;
  font-size: 0.9rem;
  color: var(--text-main);
}
.ach-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

#end-screen {
  padding: 40px 20px;
  overflow-y: auto;
  background: var(--surface);
  text-align: center;
}
.end-icon {
  font-size: 4rem;
  margin-bottom: 10px;
  color: var(--text-main);
}
#end-verdict {
  font-family: var(--font-mono);
  font-size: 2rem;
  margin-bottom: 15px;
  letter-spacing: -1px;
}
#end-story {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 30px;
  text-align: left;
}

.end-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 30px;
  text-align: left;
}
.end-stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 16px 10px;
  border-radius: var(--radius);
  text-align: center;
}
.end-stat-val {
  font-size: 1.2rem;
  font-weight: bold;
  font-family: var(--font-mono);
}
.end-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.end-section {
  margin-bottom: 24px;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius);
}
.end-section-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-main);
  text-transform: uppercase;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.final-skill-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}
.final-skill-row:last-child {
  border-bottom: none;
}
.master-text {
  color: var(--success);
  font-weight: bold;
}
.grand-text {
  color: var(--warn);
  font-weight: bold;
}

.end-flags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.end-flag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--text-main);
  color: var(--surface);
  padding: 4px 8px;
  border-radius: 3px;
}

#end-timeline-route {
  display: none;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-bottom: 20px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ending-guide-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.ending-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-mono);
  color: var(--text-main);
}
.ending-chip:hover {
  background: var(--highlight);
}
.ending-chip.active {
  background: var(--text-main);
  color: var(--surface);
  border-color: var(--text-main);
}
.ending-guide-details {
  background: var(--surface2);
  border: 1px dashed var(--border);
  padding: 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-main);
}
.ending-req-list {
  list-style: none;
  margin-top: 8px;
  padding-left: 0;
}
.ending-req-list li {
  margin-bottom: 4px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--text-main);
}
.ending-req-list i {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: -2px;
}

.tree-container {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.tree-node {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
}
.tree-epoch {
  font-weight: bold;
  background: var(--text-main);
  color: var(--surface);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.tree-scenario {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 4px;
  margin-left: 5px;
}
.tree-line {
  width: 2px;
  height: 16px;
  background: var(--border);
  margin-left: 15px;
  margin-bottom: 4px;
}
.tree-choice {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  margin-left: 10px;
  border-left: 4px solid var(--text-main);
  color: var(--text-main);
  font-weight: 600;
  margin-bottom: 4px;
  width: 90%;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tree-choice i {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.typing-cursor::after {
  content: "█";
  animation: blink 1s step-start infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* --- LOGO ANIMATION --- */
@keyframes slowSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

#game-logo {
  display: inline-block; /* Vigtigt for at 'transform' virker på ikoner */
  animation: slowSpin 12s linear infinite;
  color: var(--text-main);
}
