:root {
  /* Material 3 Base Palette (Default: Blue) */
  --md-sys-color-primary: #0060a9;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #d3e4ff;
  --md-sys-color-on-primary-container: #001c37;
  --md-sys-color-secondary: #545f71;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-surface: #fdfbff;
  --md-sys-color-on-surface: #1a1c1e;
  --md-sys-color-surface-variant: #e0e2ec;
  --md-sys-color-on-surface-variant: #43474e;
  --md-sys-color-outline: #74777f;
  --md-sys-color-error: #ba1a1a;
}

/* Material You Dynamic Tone Override (Greenish/Magical) */
.m3-theme {
  --md-sys-color-primary: #006b5d;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #76f8e2;
  --md-sys-color-on-primary-container: #00201a;
  --md-sys-color-secondary: #4a635d;
  --md-sys-color-surface: #fbfdf9;
  --md-sys-color-on-surface: #191c1b;
  --md-sys-color-surface-container: #f0f1ef;
}

/* Dark Mode (Preferred for "AetherExplorer") */
body {
  margin: 0;
  padding: 0;
  background-color: #111; 
  color: #eee;
  font-family: 'Roboto', sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* M3 App Bar */
.m3-app-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background-color: #1a1c1e;
  border-bottom: 1px solid #333;
  color: #e0e2ec;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  font-size: 2.5rem;
  color: #d3e4ff;
}

.title-group h1 {
  font-size: 1.25rem;
  margin: 0;
  font-weight: 500;
}

.title-group p {
  font-size: 0.75rem;
  margin: 0;
  opacity: 0.7;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.m3-chip {
  padding: 0.4rem 1rem;
  background: #2b2d30;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
  border: 1px solid #444;
}

.timer-settings {
  min-width: 200px;
}

#interval-slider {
  flex: 1;
  height: 4px;
  accent-color: var(--md-sys-color-primary);
  cursor: pointer;
}

#interval-display {
  font-size: 0.85rem;
  min-width: 40px;
  color: var(--md-sys-color-primary);
}

.timer-chip {
  font-family: monospace;
  font-size: 1rem;
  color: #ff9800;
}

/* Projector Mode (Immersive View) - 50/50 SPLIT */
#app {
  transition: background 1.5s ease-in-out;
  background: #000;
  position: relative;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#app::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: var(--current-bg-image, none);
  background-size: cover;
  background-position: center;
  filter: blur(100px) brightness(0.3);
  opacity: 0.7;
  z-index: 0;
  transition: background 2s ease-in-out;
}

/* Base Layout */
.m3-layout {
  display: grid;
  grid-template-columns: 450px 1fr 300px;
  height: calc(100vh - 64px);
  position: relative;
  z-index: 10;
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

#app.hud-hidden header,
#app.hud-hidden .sidebar {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

#app.hud-hidden .m3-layout {
  grid-template-columns: 1fr;
  height: 100vh;
  top: 0;
}

#active-adventure-step {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* CINEMATIC DUO CARD */
.m3-card-filled {
  width: 90vw;
  height: 80vh;
  background: rgba(20, 20, 20, 0.6);
  backdrop-filter: blur(30px);
  border-radius: 40px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 50px 100px rgba(0,0,0,0.9);
  display: flex !important;
  flex-direction: row !important; /* Side by side */
  overflow: hidden;
  transition: all 0.8s ease;
}

.hero-image-box {
  flex: 1.2;
  height: 100%;
  background: #000;
}

.hero-image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-text-box {
  flex: 1;
  padding: 4vh 5vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.hero-text-box h2 {
  font-size: 1rem;
  color: var(--md-sys-color-primary);
  margin-bottom: 2vh;
}

.segment-text {
  font-size: clamp(1.2rem, 2.5vh, 2.2rem); /* Dynamic sizing to prevent overflow */
  line-height: 1.6;
  color: #fff;
  font-weight: 300;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  max-height: 100%;
  overflow: hidden;
}

.rail-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  color: #d3e4ff;
}

.rail-section {
  margin-bottom: 3rem;
}

.rail-divider {
  height: 1px;
  background: #333;
  margin: 2rem 0;
}

/* Adventure Feed & Auto-scrolling */
.adventure-feed {
  padding: 2.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  scroll-behavior: smooth;
}

.scene-preview {
  margin-top: 1rem;
  width: 100%;
  border-radius: 24px;
  overflow: hidden;
  border: 4px solid #333;
  background: #000;
  min-height: 350px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.scene-preview img {
  width: 100%;
  border-radius: 16px;
  display: block;
}

#active-adventure-step {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Unified Hero Card */
.m3-card-filled {
  background: rgba(28, 28, 28, 0.4);
  backdrop-filter: blur(40px);
  padding: 0;
  border-radius: 40px;
  border: 1px solid rgba(255,255,255,0.1);
  color: #eee;
  box-shadow: 0 40px 100px rgba(0,0,0,0.8);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hero-image-box {
  width: 100%;
  min-height: 450px;
  max-height: 70vh;
  background: #000;
  overflow: hidden;
  position: relative;
}

.hero-image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-text-box {
  padding: 3.5rem 4rem;
  background: linear-gradient(180deg, rgba(28,28,28,0) 0%, rgba(28,28,28,0.9) 100%);
}

.hero-text-box h2 {
  font-size: 1.2rem;
  text-transform: uppercase;
  color: var(--md-sys-color-primary);
  margin-bottom: 1.5rem;
  letter-spacing: 2px;
}

.segment-text {
  font-size: 1.7rem;
  line-height: 1.8;
  color: #fff;
  font-weight: 300;
  text-shadow: 0 4px 8px rgba(0,0,0,0.6);
}

.manifesting-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-style: italic;
  font-size: 1.2rem;
  color: var(--md-sys-color-primary);
}

.adventure-segment {
  animation: slideIn 0.5s ease-out;
}

.segment-text {
  font-size: 1.15rem;
  line-height: 1.8;
  color: #e2e8f0;
}

.segment-visual {
  width: 100%;
  margin-top: 1.5rem;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid #444;
  background: #1a1a1a;
  min-height: 300px;
}

.segment-visual img {
  width: 100%;
  display: block;
  object-fit: cover;
}

/* Loading Effects */
.manifesting {
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: italic;
  color: #888;
  background: linear-gradient(90deg, #111, #222, #111);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* Modal / Dialog */
md-dialog {
  min-width: 400px;
}

md-outlined-text-field {
  width: 100%;
}

.spacer-v {
  height: 1.5rem;
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.summary-box {
  background: #1a1c1e;
  padding: 1.25rem;
  border-radius: 16px;
  border: 1px solid #333;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #c4c7c5;
}

.summary-box h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--md-sys-color-primary);
  margin-bottom: 0.75rem;
  letter-spacing: 1px;
}

#adventure-summary {
  font-style: italic;
}

.inventory-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.m3-chip-item {
  background: #333;
  color: #d3e4ff;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

/* Animations */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
