/* ==========================================================================
   STOA POIKILE 3D SANCTUARY — STOICISME 3D WORLD
   Classical Greco-Roman & Modern Dark Marble Aesthetic
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;900&family=IBM+Plex+Mono:ital,wght@0,400;0,600;1,400&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #07090e;
  --bg-surface: rgba(15, 23, 42, 0.75);
  --bg-surface-elevated: rgba(30, 41, 59, 0.85);
  --border-subtle: rgba(148, 163, 184, 0.18);
  --border-gold: rgba(245, 158, 11, 0.4);
  --border-cyan: rgba(56, 189, 248, 0.4);
  
  --gold: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.25);
  --cyan: #38bdf8;
  --cyan-glow: rgba(56, 189, 248, 0.25);
  --emerald: #10b981;
  --purple: #a855f7;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-serif: 'Cinzel', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  
  --hud-radius: 12px;
  --hud-blur: blur(16px);
  --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ==========================================================================
   HUD & UI LAYER
   ========================================================================== */

#hud-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  transition: opacity 0.4s ease;
}

#hud-layer.zen-mode {
  opacity: 0;
  pointer-events: none !important;
}

.interactive-ui {
  pointer-events: auto;
}

/* Top Navigation Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--bg-surface);
  backdrop-filter: var(--hud-blur);
  -webkit-backdrop-filter: var(--hud-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--hud-radius);
  padding: 10px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-emblem {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px var(--gold-glow));
}

.brand-text h1 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
}

.brand-text p {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

/* Control Pills / Mode Toggles */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-smooth);
}

.btn-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: var(--text-muted);
}

.btn-pill.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
}

.btn-pill.gold.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
}

/* Atmosphere Selector */
.atmosphere-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.atmo-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.atmo-btn:hover {
  color: var(--text-main);
}

.atmo-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
}

/* Left HUD: Minimap & Status */
.left-hud {
  position: absolute;
  top: 90px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.minimap-card {
  width: 170px;
  height: 170px;
  background: var(--bg-surface);
  backdrop-filter: var(--hud-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--hud-radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.minimap-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

#minimap-canvas {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: #090d16;
  border: 1px solid var(--border-subtle);
}

.status-badge {
  background: var(--bg-surface);
  backdrop-filter: var(--hud-blur);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Right HUD: Quick Action Tools */
.right-hud {
  position: absolute;
  top: 90px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tool-card-btn {
  background: var(--bg-surface);
  backdrop-filter: var(--hud-blur);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  text-align: left;
}

.tool-card-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--cyan);
  transform: translateX(-4px);
}

.tool-icon {
  font-size: 1.2rem;
}

/* Tour Caption Bar */
.tour-caption-bar {
  align-self: center;
  max-width: 650px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: var(--hud-blur);
  border: 1px solid var(--border-gold);
  border-radius: var(--hud-radius);
  padding: 14px 24px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  margin-bottom: 12px;
  display: none;
  animation: fadeIn 0.4s ease;
}

.tour-caption-bar h3 {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.tour-caption-bar p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Bottom Fast-Travel Bar */
.bottom-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  backdrop-filter: var(--hud-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--hud-radius);
  padding: 8px 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  overflow-x: auto;
}

.travel-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 90px;
  transition: var(--transition-smooth);
}

.travel-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: var(--text-muted);
}

.travel-btn.active {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.12);
  color: var(--gold);
}

.travel-icon {
  font-size: 1.1rem;
}

.travel-name {
  font-size: 0.75rem;
  font-weight: 600;
}

.travel-key {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-dim);
}

/* ==========================================================================
   MODAL DIALOGS & INTERACTIVE OVERLAYS
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 8, 15, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #0d1322;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  max-width: 720px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(56, 189, 248, 0.1);
  position: relative;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition-smooth);
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.modal-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
}

.modal-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
  display: block;
}

.modal-header h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: #fff;
  letter-spacing: 0.05em;
}

.modal-greek {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  margin-top: 2px;
}

/* Tab Navigation inside Modals */
.modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.modal-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.modal-tab-btn:hover {
  color: #fff;
}

.modal-tab-btn.active {
  background: rgba(56, 189, 248, 0.12);
  color: var(--cyan);
}

/* Quote Card Component */
.quote-card {
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  margin: 16px 0;
  position: relative;
}

.quote-card p {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.5;
  color: #f1f5f9;
  font-style: italic;
}

.quote-author {
  display: block;
  margin-top: 8px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--gold);
  font-style: normal;
  font-weight: 600;
}

.quote-source {
  color: var(--text-dim);
  font-size: 0.75rem;
}

/* Dichotomy of Control Game UI */
.dichotomy-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dichotomy-card-pool {
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.current-scenario-text {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 16px;
  line-height: 1.4;
}

.dichotomy-choice-btns {
  display: flex;
  gap: 16px;
  width: 100%;
}

.dichotomy-btn {
  flex: 1;
  padding: 14px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: var(--transition-smooth);
}

.dichotomy-btn.in-control {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
}

.dichotomy-btn.outside-control {
  background: linear-gradient(135deg, #64748b, #475569);
  color: #fff;
}

.dichotomy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.dichotomy-feedback {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 14px;
  font-size: 0.85rem;
  line-height: 1.45;
  display: none;
}

/* Amor Fati Crucible Forge UI */
.forge-container {
  text-align: center;
  padding: 20px 0;
}

.forge-textarea {
  width: 100%;
  height: 100px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: #fff;
  padding: 14px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  resize: none;
  margin: 16px 0;
}

.forge-textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.btn-forge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #050811;
  font-weight: 800;
  border: none;
  padding: 14px 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: var(--transition-smooth);
}

.btn-forge:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--gold-glow);
}

.forge-result {
  margin-top: 20px;
  padding: 16px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid var(--gold);
  border-radius: 10px;
  display: none;
  text-align: left;
}

/* Memento Mori Calculator UI */
.memento-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.life-grid-preview {
  display: grid;
  grid-template-columns: repeat(52, 1fr);
  gap: 2px;
  max-height: 160px;
  overflow-y: auto;
  padding: 10px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.life-week-box {
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.life-week-box.lived {
  background: var(--gold);
}

/* Evening Examen Journal UI */
.examen-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.examen-question-group label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  display: block;
  margin-bottom: 4px;
}

.examen-question-group .hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.examen-textarea {
  width: 100%;
  height: 70px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: #fff;
  padding: 10px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  resize: vertical;
}

.examen-textarea:focus {
  outline: none;
  border-color: var(--cyan);
}

/* Key Helpers Toast */
#key-helper-toast {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: var(--hud-blur);
  border: 1px solid var(--border-subtle);
  border-radius: 99px;
  padding: 6px 18px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 14px;
  align-items: center;
  pointer-events: none;
}

.key-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
  font-weight: 600;
}

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

/* Mobile Responsiveness */
@media (max-width: 768px) {
  #hud-layer {
    padding: 10px;
  }
  
  .brand-text h1 {
    font-size: 0.9rem;
  }
  
  .brand-text p {
    display: none;
  }
  
  .left-hud, .right-hud {
    display: none;
  }
  
  .bottom-bar {
    width: 100%;
    justify-content: flex-start;
  }
  
  .travel-btn {
    min-width: 72px;
    padding: 6px 8px;
  }
  
  .modal-content {
    padding: 20px;
  }
}
