/* ============================================================
   ORACULUM DECISION ORACLE — Stylesheet
   Realistic 3D Spherization, Shakes, Parallax, and Glassmorphism
   ============================================================ */

:root {
  --color-bg:              #FAF5EB;
  --color-bg-2:            #FFFFFF;
  --color-surface:         rgba(255, 255, 255, 0.85);
  --color-surface-2:       #F5EFEB;
  --color-border:          rgba(12, 35, 64, 0.08);
  --color-border-hover:    rgba(12, 35, 64, 0.22);

  --color-primary:         #0C2340;
  --color-primary-glow:    rgba(12, 35, 64, 0.15);
  --color-primary-dim:     rgba(12, 35, 64, 0.05);
  --color-secondary:       #0D5C3A;
  --color-secondary-glow:  rgba(13, 92, 58, 0.12);
  --color-accent:          #B45309;
  --color-amber:           #D97706;

  --color-text:            #0F172A;
  --color-text-muted:      #475569;
  --color-text-subtle:     #94A3B8;

  --font-display: 'Outfit', sans-serif;
  --font-body:    'Inter', sans-serif;

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

  --transition-fast:   150ms ease;
  --transition-base:   280ms ease;
  --transition-slow:   450ms ease;
  --transition-spring: 420ms cubic-bezier(0.34, 1.56, 0.64, 1);

  --shadow-card:       0 12px 32px rgba(0,0,0,0.5);
  --shadow-card-hover: 0 16px 48px rgba(0,0,0,0.7), 0 0 0 1px var(--color-border-hover);
}

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

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

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: transparent;
  color: inherit;
  outline: none;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--color-primary);
  color: #fff;
  padding: .5rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: .9rem;
  z-index: 9999;
  transition: top var(--transition-fast);
}
.skip-link:focus {
  top: 1rem;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   AMBIENT GLOWS
   ============================================================ */
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}
.bg-glow-1 {
  width: 500px;
  height: 500px;
  background: rgba(12, 35, 64, 0.08);
  top: -100px;
  left: -100px;
}
.bg-glow-2 {
  width: 400px;
  height: 400px;
  background: rgba(13, 92, 58, 0.05);
  bottom: 50px;
  right: -50px;
}

/* ============================================================
   APPLICATION LAYOUT
   ============================================================ */
.app-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 2.2rem;
  animation: float 4s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(6deg); }
}

.logo-text-group h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.logo-sub {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.nav-back-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
  text-decoration: none;
}
.nav-back-link:hover {
  color: var(--color-primary);
}

/* Main Grid Workspace */
.main-content {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 4rem;
  flex: 1;
  align-items: center;
  margin-bottom: 3rem;
}

/* ============================================================
   MAGIC 8-BALL PANEL (LEFT COLUMN)
   ============================================================ */
.oracle-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
  perspective: 1000px; /* Crucial for 3D cursor-parallax tilt */
}

.oracle-container {
  position: relative;
  width: 100%;
  max-width: 410px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 3D Realistic Magic 8-Ball Sphere */
.oracle-ball {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #30375a 0%, #111424 55%, #05060c 100%);
  box-shadow: 
    0 32px 70px rgba(0, 0, 0, 0.75), 
    inset 0 10px 24px rgba(255, 255, 255, 0.12),
    inset 0 -20px 48px rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  cursor: pointer;
  
  /* Transform values updated dynamically by JS */
  transform-style: preserve-3d;
  transition: transform 120ms ease-out;
}

/* Shading Layer overlay */
.ball-shading {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, transparent 60%, rgba(0,0,0,0.6) 100%);
  pointer-events: none;
  z-index: 3;
}

/* Reflection overlay glare */
.ball-glare {
  position: absolute;
  width: 70%;
  height: 70%;
  top: 4%;
  left: 6%;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 60%);
  pointer-events: none;
  z-index: 4;
}

/* Ball shadow below */
.ball-shadow {
  position: absolute;
  width: 76%;
  height: 24px;
  left: 12%;
  bottom: -24px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  filter: blur(10px);
  z-index: 1;
  pointer-events: none;
}

/* Front billiard-face '8' */
.face-eight {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #e2e8f0 75%, #cbd5e1 100%);
  box-shadow: 
    0 8px 16px rgba(0,0,0,0.5), 
    inset 0 4px 8px rgba(255,255,255,0.8),
    inset 0 -6px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backface-visibility: hidden;
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.eight-text {
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 900;
  color: #0d111d;
  line-height: 1;
  user-select: none;
}

/* Inner Liquid Chamber Window */
.liquid-viewport {
  position: absolute;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: #020409;
  border: 7px solid #1b1e32;
  box-shadow: 
    0 8px 24px rgba(0,0,0,0.6), 
    inset 0 0 32px rgba(0, 217, 177, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 10;
  backface-visibility: hidden;
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.viewport-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, rgba(13, 20, 48, 0.8) 0%, #030409 100%);
}

/* Floating Triangular Board */
.answer-triangle {
  position: relative;
  width: 150px;
  height: 130px;
  background: linear-gradient(135deg, #111a36 0%, #080d1a 100%);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* Initial hidden state, animations trigger on shake stop */
  opacity: 0;
  transform: scale(0.6) translateY(20px);
}

.answer-triangle::after {
  content: '';
  position: absolute;
  inset: 1px;
  background: linear-gradient(135deg, #090e1f 0%, #04060c 100%);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  z-index: 1;
}

.triangle-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 1rem 1.1rem; /* Anchor text to the wide bottom of the triangle */
}

.answer-text {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 12px var(--color-glow);
  text-align: center;
  line-height: 1.25;
  letter-spacing: 0.03em;
  word-break: break-word;
  max-width: 100px;
  width: 100%;
}

/* Custom Answer Glow Colors based on category */
.glow-affirmative { --color-glow: var(--color-secondary); color: var(--color-secondary) !important; }
.glow-neutral     { --color-glow: var(--color-amber); color: var(--color-amber) !important; }
.glow-negative    { --color-glow: var(--color-accent); color: var(--color-accent) !important; }

/* Dynamic Animations triggers */
.oracle-ball.shaking {
  animation: shake 1.2s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  10% { transform: translate(-8px, 5px) rotate(-3deg); }
  20% { transform: translate(8px, -5px) rotate(3deg); }
  30% { transform: translate(-6px, -3px) rotate(-1.5deg); }
  40% { transform: translate(6px, 3px) rotate(1.5deg); }
  50% { transform: translate(-4px, 5px) rotate(-1deg); }
  60% { transform: translate(4px, -3px) rotate(1deg); }
  70% { transform: translate(-3px, -2px) rotate(-0.5deg); }
  80% { transform: translate(3px, 2px) rotate(0.5deg); }
  90% { transform: translate(-1px, -1px) rotate(-0.2deg); }
}

/* Floating Answer rises up */
.answer-triangle.rising {
  animation: float-up 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes float-up {
  0% { 
    opacity: 0; 
    transform: scale(0.6) translateY(24px) rotate(-3deg); 
    filter: blur(4px); 
  }
  60% {
    filter: blur(0);
  }
  100% { 
    opacity: 1; 
    transform: scale(1) translateY(0) rotate(0.5deg); 
  }
}

.hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ============================================================
   ORACLE SIDEBAR & LEDGER (RIGHT COLUMN)
   ============================================================ */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: 100%;
}

.glass-card {
  background: var(--color-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.glass-card:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-card-hover);
}

.card-header {
  margin-bottom: 1.25rem;
}

.card-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
  background: var(--color-primary-dim);
  border: 1px solid rgba(108,99,255,0.22);
  padding: 0.2rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.4rem;
}

.card-header h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
}

/* Form structures */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.question-input {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.85rem 1.1rem;
  width: 100%;
  outline: none;
  min-height: 50px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.question-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: var(--radius-full);
  min-height: 48px;
  padding: 0 1.5rem;
  transition: all var(--transition-spring);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, #8B7FFF 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(108, 99, 255, 0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(108, 99, 255, 0.55);
}
.btn-primary:disabled {
  opacity: 0.65;
  pointer-events: none;
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-dim);
  transform: translateY(-1px);
}

.btn-ghost {
  font-size: 0.8rem;
  color: var(--color-text-subtle);
  min-height: 32px;
  padding: 0 0.75rem;
  border-radius: var(--radius-sm);
}
.btn-ghost:hover {
  color: var(--color-accent);
  background: rgba(255, 107, 107, 0.06);
}

.btn-sm {
  min-height: 32px;
  padding: 0 0.85rem;
  font-size: 0.75rem;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Journal of Truth Ledger lists */
.ledger-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  flex: 1;
  padding-right: 0.5rem;
}

/* Custom Scrollbars */
.ledger-container::-webkit-scrollbar {
  width: 4px;
}
.ledger-container::-webkit-scrollbar-track {
  background: transparent;
}
.ledger-container::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

.ledger-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--color-text-subtle);
  font-size: 0.82rem;
  height: 100%;
  min-height: 180px;
  text-align: center;
  padding: 1rem;
}
.ledger-placeholder span {
  font-size: 2.2rem;
  opacity: 0.45;
}

/* Individual journal entry item */
.ledger-item {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  animation: slide-in 0.3s ease;
}
@keyframes slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ledger-question {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.ledger-answer-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
}
.ledger-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.dot-affirmative { background: var(--color-secondary); box-shadow: 0 0 8px var(--color-secondary); }
.dot-neutral     { background: var(--color-amber); box-shadow: 0 0 8px var(--color-amber); }
.dot-negative    { background: var(--color-accent); box-shadow: 0 0 8px var(--color-accent); }

/* Settings sliders controls */
.settings-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.settings-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
}
.settings-value {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-primary);
  font-size: 0.8rem;
}
.custom-range {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--color-surface-2);
  border-radius: var(--radius-full);
  outline: none;
}
.custom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary-glow);
  cursor: pointer;
  transition: transform var(--transition-fast);
}
.custom-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* ============================================================
   FOOTER STYLING
   ============================================================ */
.app-footer {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.app-footer p {
  font-size: 0.8rem;
  color: var(--color-text-subtle);
  font-weight: 500;
}

/* ============================================================
   RESPONSIVE DESIGN Breakpoints
   ============================================================ */
@media (max-width: 980px) {
  .main-content {
    grid-template-columns: 1fr;
    gap: 3.5rem;
  }
  .oracle-panel {
    order: 1;
  }
  .sidebar-panel {
    order: 2;
  }
}

@media (max-width: 600px) {
  .app-wrapper {
    padding: 0 1rem;
  }
  .app-header {
    height: 70px;
    margin-bottom: 1.5rem;
  }
  .logo-icon {
    font-size: 1.8rem;
  }
  .logo-text-group h1 {
    font-size: 1.3rem;
  }
  .main-content {
    margin-bottom: 2rem;
    gap: 2.5rem;
  }
  .oracle-container {
    max-width: 320px;
  }
  .face-eight {
    width: 110px;
    height: 110px;
  }
  .eight-text {
    font-size: 4rem;
  }
  .liquid-viewport {
    width: 155px;
    height: 155px;
  }
  .answer-triangle {
    width: 118px;
    height: 103px;
  }
  .triangle-inner {
    padding: 0 0.75rem 0.85rem;
  }
  .answer-text {
    font-size: 0.57rem;
    max-width: 82px;
  }
  .glass-card {
    padding: 1.25rem;
  }
}
