/* OwlForge Luxury Edition v2 — Full-App SaaS Polish, 3D Studio, Constellation Mind Map & Conversion */
:root {
  --of-lux-gold: #e7c272;
  --of-lux-gold-bright: #f7dc94;
  --of-lux-gold-deep: #b88d3d;
  --of-lux-navy: #070c17;
  --of-lux-navy-card: rgba(15, 23, 42, 0.76);
  --of-lux-border: rgba(231, 194, 114, 0.24);
  --of-lux-border-strong: rgba(231, 194, 114, 0.48);
  --of-lux-glow: rgba(231, 194, 114, 0.16);
}

/* ---------- 1. AMBIENT AURORA & CONSTELLATION DOT-GRID (ENTIRE SITE) ---------- */
body,
body.auth-locked,
html[data-theme="dark"] body:not(.auth-locked),
html[data-theme="light"] body:not(.auth-locked) {
  background:
    radial-gradient(950px circle at 10% 8%, rgba(231, 194, 114, 0.12), transparent 52%),
    radial-gradient(850px circle at 90% 15%, rgba(56, 189, 248, 0.09), transparent 52%),
    radial-gradient(750px circle at 50% 96%, rgba(231, 194, 114, 0.07), transparent 58%),
    #070c17 !important;
  background-attachment: fixed !important;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
  z-index: 0;
}

html[data-theme="light"] body.auth-locked {
  background:
    radial-gradient(900px circle at 15% 10%, rgba(192, 163, 109, 0.16), transparent 55%),
    radial-gradient(800px circle at 85% 20%, rgba(14, 165, 233, 0.08), transparent 55%),
    #f5f7fb !important;
}

/* ---------- 2. LANDING / ACCESS SCREEN REFINEMENTS ---------- */
/* Hide duplicate basic demo injected by premium.js so only the rich 3D sandbox shows */
#premiumHeroDemo,
#authScreen .access-copy,
#authScreen .access-plans {
  display: none !important;
}

#authScreen.access-screen {
  position: relative;
  z-index: 1;
  max-width: 1320px !important;
  margin: 0 auto !important;
  padding: clamp(64px, 7vh, 88px) clamp(18px, 3vw, 36px) 56px !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1.32fr) minmax(350px, 0.88fr) !important;
  gap: clamp(24px, 3.5vw, 48px) !important;
  align-items: start !important;
  min-width: 0;
}

#authScreen[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  #authScreen.access-screen {
    grid-template-columns: 1fr !important;
    padding-top: 72px !important;
  }
}

#authScreen .access-hero {
  min-width: 0;
  overflow: visible !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.of-landing-showcase {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.of-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(231, 194, 114, 0.12);
  border: 1px solid rgba(231, 194, 114, 0.35);
  color: var(--of-lux-gold-bright);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 0 24px rgba(231, 194, 114, 0.15);
}

html[data-theme="light"] .of-pill-badge {
  color: #7c5817;
  background: rgba(192, 163, 109, 0.18);
}

.of-pill-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #f2ca48;
  box-shadow: 0 0 10px #f2ca48;
  animation: ofPulseDot 2s infinite ease-in-out;
}

@keyframes ofPulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.45); opacity: 0.65; }
}

/* Fix headline wrapping so it never clips on the right */
.of-hero-headline {
  margin: 0 !important;
  font-size: clamp(1.85rem, 3.1vw, 2.85rem) !important;
  line-height: 1.12 !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-wrap: break-word !important;
  max-width: 100% !important;
  color: #f8fafc;
}

html[data-theme="light"] .of-hero-headline {
  color: #0f172a;
}

.of-hero-headline span.of-gold-gradient {
  background: linear-gradient(120deg, #f9e3a3 0%, #d4af37 48%, #f5d076 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

html[data-theme="light"] .of-hero-headline span.of-gold-gradient {
  background: linear-gradient(120deg, #9a6e1f 0%, #c6922c 50%, #7d5510 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.of-hero-sub {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.6;
  color: #cbd5e1;
  max-width: 62ch;
}

html[data-theme="light"] .of-hero-sub {
  color: #334155;
}

/* Interactive Live Sandbox Widget on Landing */
.of-live-sandbox {
  background: var(--of-lux-navy-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--of-lux-border);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 28px 60px -15px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html[data-theme="light"] .of-live-sandbox {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 22px 45px -15px rgba(15, 23, 42, 0.14);
}

.of-sandbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.of-sandbox-tabs {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

html[data-theme="light"] .of-sandbox-tabs {
  background: #e2e8f0;
}

.of-sandbox-tab {
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 13px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.of-sandbox-tab.is-active {
  background: linear-gradient(135deg, #e7c272, #c69b46);
  color: #0b1324;
  box-shadow: 0 4px 14px rgba(231, 194, 114, 0.35);
}

.of-sandbox-voice-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 10px;
  border: 1px solid rgba(231, 194, 114, 0.35);
  background: rgba(231, 194, 114, 0.1);
  color: #f7dc94;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

html[data-theme="light"] .of-sandbox-voice-btn {
  color: #7c5817;
  background: rgba(192, 163, 109, 0.16);
}

.of-demo-3d-stage { perspective: 1400px; min-height: 220px; cursor: pointer; }

.of-demo-3d-card {
  position: relative;
  min-height: 220px;
  border-radius: 18px;
  padding: 24px 26px;
  background: radial-gradient(circle at 22% 18%, #e5c685 0%, #c8a258 48%, #9e7834 100%);
  color: #101726;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.55);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
  overflow: hidden;
  user-select: none;
}

.of-demo-3d-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(450px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.34), transparent 45%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.of-demo-3d-card:hover::after { opacity: 1; }

.of-demo-3d-card.is-flipped {
  background: radial-gradient(circle at 80% 20%, #1e293b 0%, #0f172a 65%, #090e1a 100%);
  color: #f8fafc;
  border: 1px solid rgba(231, 194, 114, 0.45);
}

.of-demo-card-top {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.78;
}

.of-demo-card-body { font-size: clamp(1.1rem, 1.65vw, 1.35rem); font-weight: 800; line-height: 1.38; text-align: center; margin: 14px 0; }
.of-demo-card-footer { display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; font-weight: 700; opacity: 0.85; }

.of-demo-srs-pills { display: flex; gap: 8px; margin-top: 12px; justify-content: center; flex-wrap: wrap; }
.of-demo-srs-pills button {
  border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(15, 23, 42, 0.75);
  color: #e2e8f0; font-size: 0.78rem; font-weight: 700; padding: 7px 14px; border-radius: 10px; cursor: pointer;
}
html[data-theme="light"] .of-demo-srs-pills button { background: #f1f5f9; color: #0f172a; border-color: #cbd5e1; }

.of-demo-mindmap-view {
  min-height: 220px; border-radius: 18px; padding: 18px;
  background: radial-gradient(rgba(231, 194, 114, 0.16) 1px, transparent 1px), #0b1221;
  background-size: 20px 20px; border: 1px solid rgba(231, 194, 114, 0.25);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.of-demo-mindmap-view[hidden] { display: none !important; }
.of-mm-tree { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.of-mm-root {
  background: linear-gradient(135deg, #e7c272, #b88d3d); color: #0b1324;
  font-weight: 800; font-size: 0.9rem; padding: 10px 16px; border-radius: 12px;
}
.of-mm-branches { display: flex; flex-direction: column; gap: 9px; }
.of-mm-node {
  background: rgba(30, 41, 59, 0.9); border: 1px solid rgba(231, 194, 114, 0.35);
  color: #f8fafc; font-size: 0.82rem; font-weight: 600; padding: 8px 14px; border-radius: 10px;
}

.of-value-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 680px) { .of-value-grid { grid-template-columns: 1fr; } }
.of-value-card {
  background: rgba(15, 23, 42, 0.62); border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 16px; padding: 14px 16px;
}
html[data-theme="light"] .of-value-card { background: rgba(255, 255, 255, 0.85); border-color: rgba(15, 23, 42, 0.1); }
.of-value-card h3 { margin: 6px 0 4px; font-size: 0.92rem; font-weight: 800; color: #f8fafc; }
html[data-theme="light"] .of-value-card h3 { color: #0f172a; }
.of-value-card p { margin: 0; font-size: 0.8rem; line-height: 1.45; color: #94a3b8; }
html[data-theme="light"] .of-value-card p { color: #475569; }

.of-pricing-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .of-pricing-strip { grid-template-columns: 1fr; } }
.of-plan-box {
  border-radius: 16px; padding: 15px 17px; background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.18); cursor: pointer;
}
html[data-theme="light"] .of-plan-box { background: rgba(255, 255, 255, 0.88); }
.of-plan-box.is-pro {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(231, 194, 114, 0.5);
}
html[data-theme="light"] .of-plan-box.is-pro { background: linear-gradient(145deg, #fffdf7, #fef6e4); }
.of-plan-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.of-plan-name { font-weight: 800; font-size: 0.95rem; color: #f8fafc; }
html[data-theme="light"] .of-plan-name { color: #0f172a; }
.of-plan-tag { font-size: 0.72rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: rgba(231, 194, 114, 0.2); color: #f7dc94; }
html[data-theme="light"] .of-plan-tag { color: #7c5817; }
.of-plan-list { margin: 0; padding-left: 16px; font-size: 0.79rem; line-height: 1.5; color: #cbd5e1; }
html[data-theme="light"] .of-plan-list { color: #334155; }

#authScreen .access-panel {
  background: rgba(15, 23, 42, 0.84) !important;
  backdrop-filter: blur(22px) !important;
  -webkit-backdrop-filter: blur(22px) !important;
  border: 1px solid rgba(231, 194, 114, 0.32) !important;
  border-radius: 24px !important;
  padding: 28px !important;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7) !important;
  position: sticky;
  top: 74px;
}
html[data-theme="light"] #authScreen .access-panel { background: rgba(255, 255, 255, 0.95) !important; }

#authScreen .access-form button.primary {
  background: linear-gradient(135deg, #f3d283 0%, #c89d47 100%) !important;
  color: #0a1120 !important;
  font-weight: 800 !important;
  border: none !important;
  box-shadow: 0 10px 25px rgba(212, 175, 55, 0.32);
}

/* ---------- 3. FULL PREMIUM WORKSPACE & STUDY STUDIO (#appShell) ---------- */
#appShell {
  position: relative;
  z-index: 1;
}

/* Main Study Pane & Right Sidebar Glassmorphic Containers */
#appShell .study-pane,
#appShell .deck-pane.of-workspace {
  background: rgba(15, 23, 42, 0.74) !important;
  backdrop-filter: blur(22px) !important;
  -webkit-backdrop-filter: blur(22px) !important;
  border: 1px solid rgba(231, 194, 114, 0.22) !important;
  border-radius: 24px !important;
  box-shadow:
    0 28px 65px rgba(0, 0, 0, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

html[data-theme="light"] #appShell .study-pane,
html[data-theme="light"] #appShell .deck-pane.of-workspace {
  background: rgba(255, 255, 255, 0.92) !important;
  border-color: rgba(192, 163, 109, 0.32) !important;
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.12) !important;
}

/* Sticky Glass Topbar inside Study Pane */
#appShell .study-pane .topbar {
  background: rgba(11, 17, 32, 0.72) !important;
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.07) !important;
  border-radius: 18px !important;
  padding: 12px 16px !important;
}

html[data-theme="light"] #appShell .study-pane .topbar {
  background: rgba(248, 250, 252, 0.88) !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
}

/* Quick Nav Pills (Mind Map, Results, Games) */
#appShell .of-quicknav {
  gap: 9px !important;
}

#appShell .of-quick-action {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.92)) !important;
  border: 1px solid rgba(231, 194, 114, 0.28) !important;
  border-radius: 12px !important;
  padding: 8px 14px !important;
  color: #f8fafc !important;
  font-weight: 700 !important;
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease !important;
}

html[data-theme="light"] #appShell .of-quick-action {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: rgba(192, 163, 109, 0.45) !important;
}

#appShell .of-quick-action:hover {
  transform: translateY(-2px);
  border-color: #f7dc94 !important;
  box-shadow: 0 8px 20px rgba(231, 194, 114, 0.22) !important;
}

#appShell .of-quick-action:first-child {
  background: linear-gradient(135deg, rgba(231, 194, 114, 0.22), rgba(184, 141, 61, 0.14)) !important;
  color: #f7dc94 !important;
  border-color: rgba(231, 194, 114, 0.5) !important;
}

html[data-theme="light"] #appShell .of-quick-action:first-child {
  color: #7c5817 !important;
}

/* Premium KPI Metric Cards (Cards, Mastered, Score, Streak) */
#appShell .stats {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

@media (max-width: 640px) {
  #appShell .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

#appShell .stats > span {
  position: relative;
  overflow: hidden;
  background: linear-gradient(155deg, rgba(30, 41, 59, 0.72), rgba(15, 23, 42, 0.88)) !important;
  border: 1px solid rgba(231, 194, 114, 0.2) !important;
  border-radius: 15px !important;
  padding: 11px 12px !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease !important;
}

html[data-theme="light"] #appShell .stats > span {
  background: linear-gradient(155deg, #ffffff, #f8fafc) !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
}

#appShell .stats > span::after {
  content: "";
  position: absolute;
  top: 0;
  left: 16%;
  right: 16%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(231, 194, 114, 0.65), transparent);
}

#appShell .stats > span:hover {
  transform: translateY(-2px);
  border-color: rgba(231, 194, 114, 0.48) !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3) !important;
}

#appShell .stats strong {
  font-size: clamp(1.15rem, 1.9vw, 1.55rem) !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #ffffff 0%, #e2e8f0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
}

html[data-theme="light"] #appShell .stats strong {
  background: none;
  color: #0f172a !important;
}

/* Session Card & Upgrade Pill */
#appShell .session-card {
  background: rgba(15, 23, 42, 0.8) !important;
  border: 1px solid rgba(231, 194, 114, 0.26) !important;
  border-radius: 14px !important;
  padding: 10px 12px !important;
}

html[data-theme="light"] #appShell .session-card {
  background: #ffffff !important;
}

.of-pro-upsell-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f3d283 0%, #c89d47 100%);
  border: none;
  color: #0a1120;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.32);
  transition: transform 0.18s ease, box-shadow 0.2s ease;
}

.of-pro-upsell-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.48);
}

/* Study Tools & Appearance Disclosure Pills */
#appShell .of-disclosure-summary,
#appShell .of-appearance-trigger {
  background: rgba(15, 23, 42, 0.75) !important;
  border: 1px solid rgba(231, 194, 114, 0.25) !important;
  border-radius: 11px !important;
  padding: 7px 14px !important;
  transition: border-color 0.2s ease, background 0.2s ease !important;
}

html[data-theme="light"] #appShell .of-disclosure-summary,
html[data-theme="light"] #appShell .of-appearance-trigger {
  background: #ffffff !important;
}

#appShell .of-disclosure-summary:hover,
#appShell .of-appearance-trigger:hover {
  border-color: #f7dc94 !important;
}

/* ---------- 4. 3D SPECULAR HOLO-FOIL MAIN FLASHCARD ---------- */
#appShell .flashcard {
  position: relative;
  border-radius: 24px !important;
  transform-style: preserve-3d;
  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.35s ease,
    border-color 0.35s ease !important;
  box-shadow:
    0 30px 65px -15px rgba(0, 0, 0, 0.72),
    0 0 38px rgba(212, 175, 55, 0.16),
    inset 0 1px 1px rgba(255, 255, 255, 0.35) !important;
  border: 1.5px solid rgba(255, 226, 145, 0.45) !important;
  overflow: hidden;
}

#appShell .flashcard::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    680px circle at var(--card-mx, 50%) var(--card-my, 50%),
    rgba(255, 255, 255, 0.28),
    transparent 42%
  );
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
  z-index: 2;
}

#appShell .flashcard:hover::before {
  opacity: 1;
}

#appShell .flashcard:hover {
  box-shadow:
    0 36px 75px -14px rgba(0, 0, 0, 0.8),
    0 0 48px rgba(231, 194, 114, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.45) !important;
}

/* Corner Badge Pills inside Flashcard */
#appShell .flashcard .card-label,
#appShell .flashcard .card-title {
  background: rgba(10, 16, 30, 0.16);
  backdrop-filter: blur(6px);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.74rem !important;
  letter-spacing: 0.08em;
}

#appShell .flashcard .card-hint {
  background: rgba(10, 16, 30, 0.16);
  backdrop-filter: blur(6px);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.74rem !important;
}

/* Tactile Micro-interactions on SRS Rating Buttons */
.premium-srs-controls button {
  border-radius: 13px !important;
  font-weight: 800 !important;
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease, filter 0.2s ease !important;
}

.premium-srs-controls button:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28) !important;
}

.premium-srs-controls button:active {
  transform: scale(0.96);
}

/* Spaced Repetition Strip & Progress Bar */
#appShell .premium-review-strip {
  background: rgba(15, 23, 42, 0.65) !important;
  border: 1px solid rgba(231, 194, 114, 0.2) !important;
  border-radius: 13px !important;
  padding: 6px 12px !important;
}

html[data-theme="light"] #appShell .premium-review-strip {
  background: rgba(241, 245, 249, 0.9) !important;
}

#appShell .progress-bar {
  height: 9px !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* ---------- 5. RIGHT SIDEBAR WORKSPACE POLISH ---------- */
#appShell .of-tabs {
  background: rgba(10, 16, 30, 0.75) !important;
  border: 1px solid rgba(231, 194, 114, 0.22) !important;
  border-radius: 14px !important;
  padding: 5px !important;
}

html[data-theme="light"] #appShell .of-tabs {
  background: #e2e8f0 !important;
}

#appShell .of-tab.is-active {
  background: linear-gradient(135deg, #f3d283 0%, #c89d47 100%) !important;
  color: #0a1120 !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.32) !important;
}

#appShell .of-project-item,
#appShell .deck-item {
  background: rgba(20, 29, 49, 0.75) !important;
  border: 1px solid rgba(148, 163, 184, 0.16) !important;
  border-radius: 13px !important;
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease !important;
}

html[data-theme="light"] #appShell .of-project-item,
html[data-theme="light"] #appShell .deck-item {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
}

#appShell .of-project-item:hover,
#appShell .of-project-item.is-selected,
#appShell .deck-item:hover,
#appShell .deck-item.active {
  border-color: #e7c272 !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28) !important;
}

#appShell button.primary,
#appShell .primary {
  background: linear-gradient(135deg, #f3d283 0%, #c89d47 100%) !important;
  color: #0a1120 !important;
  font-weight: 800 !important;
  border: none !important;
  box-shadow: 0 6px 18px rgba(212, 175, 55, 0.28) !important;
}

#appShell button.primary:hover,
#appShell .primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

/* ---------- 6. STUDENT DASHBOARD (#studentDashboard) LUXURY UPGRADE ---------- */
#studentDashboard.student-dashboard.dashboard-dark {
  background:
    radial-gradient(900px circle at 12% 8%, rgba(231, 194, 114, 0.12), transparent 50%),
    radial-gradient(800px circle at 88% 15%, rgba(56, 189, 248, 0.10), transparent 50%),
    #070c17 !important;
}

#studentDashboard .dashboard-hero,
#studentDashboard .dashboard-panel,
#studentDashboard .dashboard-metrics article:not(:first-child),
#studentDashboard .dashboard-encouragement {
  background: rgba(15, 23, 42, 0.78) !important;
  backdrop-filter: blur(18px) !important;
  -webkit-backdrop-filter: blur(18px) !important;
  border: 1px solid rgba(231, 194, 114, 0.24) !important;
  border-radius: 20px !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme="light"] #studentDashboard .dashboard-hero,
html[data-theme="light"] #studentDashboard .dashboard-panel,
html[data-theme="light"] #studentDashboard .dashboard-metrics article:not(:first-child),
html[data-theme="light"] #studentDashboard .dashboard-encouragement {
  background: rgba(255, 255, 255, 0.94) !important;
  border-color: rgba(192, 163, 109, 0.35) !important;
}

#studentDashboard .dashboard-metrics article:first-child {
  background: linear-gradient(135deg, #e7c272 0%, #b88d3d 100%) !important;
  border: 1px solid #f7dc94 !important;
  border-radius: 20px !important;
  box-shadow: 0 16px 36px rgba(212, 175, 55, 0.28) !important;
}

#studentDashboard .dashboard-metrics article:first-child span,
#studentDashboard .dashboard-metrics article:first-child strong {
  color: #0a1120 !important;
}

/* ---------- 7. MODALS (MIND MAP PREVIEW, EDITOR, TERMS, PRO UPSELL) ---------- */
.preview-modal,
.editor-modal,
.terms-modal,
.of-pro-modal {
  background: rgba(4, 8, 17, 0.82) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
}

.preview-dialog,
.editor-dialog,
.terms-dialog,
.of-pro-dialog {
  background: #0f172a !important;
  border: 1px solid rgba(231, 194, 114, 0.38) !important;
  border-radius: 22px !important;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.8), 0 0 45px rgba(231, 194, 114, 0.14) !important;
}

html[data-theme="light"] .preview-dialog,
html[data-theme="light"] .editor-dialog,
html[data-theme="light"] .terms-dialog {
  background: #ffffff !important;
}

.preview-header,
.editor-header,
.terms-header {
  background: rgba(15, 23, 42, 0.96) !important;
  border-bottom: 1px solid rgba(231, 194, 114, 0.2) !important;
}

html[data-theme="light"] .preview-header,
html[data-theme="light"] .editor-header,
html[data-theme="light"] .terms-header {
  background: #f8fafc !important;
}

.of-pro-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.of-pro-modal[hidden] { display: none !important; }

.of-pro-dialog {
  width: min(760px, 100%);
  padding: 28px;
  color: #f8fafc;
}

.of-pro-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.of-pro-dialog-head h2 {
  margin: 4px 0 0;
  font-size: 1.55rem;
  font-weight: 800;
}

.of-pro-tiers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 18px 0;
}

@media (max-width: 640px) {
  .of-pro-tiers { grid-template-columns: 1fr; }
}

.of-tier-card {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.of-tier-card.is-featured {
  background: linear-gradient(155deg, rgba(231, 194, 114, 0.16), rgba(15, 23, 42, 0.92));
  border: 1.5px solid #e7c272;
  box-shadow: 0 14px 35px rgba(231, 194, 114, 0.16);
}

.of-tier-price {
  font-size: 1.9rem;
  font-weight: 800;
  color: #f7dc94;
}

.of-tier-price small {
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
}

@media (prefers-reduced-motion: reduce) {
  #appShell .flashcard,
  .of-demo-3d-card,
  .of-pill-dot {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- 8. SIGNATURE 3D CARD FLIP & DUAL-FACE TRANSITION EFFECTS ---------- */
/* Smooth 3D flip on the landing sandbox card (matches the user's preferred transition) */
.of-demo-3d-stage {
  perspective: 1600px !important;
}

.of-demo-3d-card {
  transform-style: preserve-3d;
  transition:
    transform 0.62s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.45s ease,
    color 0.35s ease,
    border-color 0.45s ease,
    box-shadow 0.45s ease !important;
}

.of-demo-3d-card.is-flipping-kick {
  transform: perspective(1600px) rotateY(90deg) scale(0.95) !important;
  filter: brightness(1.18);
}

/* Specular Light Sweep across the card during flip */
#appShell .flashcard::after {
  transition: opacity 0.35s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

#appShell .flashcard.is-flipping-active {
  box-shadow:
    0 40px 85px -12px rgba(0, 0, 0, 0.85),
    0 0 60px rgba(247, 220, 148, 0.38) !important;
}

/* Transition Selector Row inside Card Appearance Panel */
.of-transition-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid rgba(231, 194, 114, 0.18);
}

.of-transition-bar span {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-secondary);
}

.of-transition-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.of-transition-pill {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 9px;
  cursor: pointer;
  min-height: 31px !important;
  transition: all 0.18s ease;
}

.of-transition-pill:hover {
  border-color: var(--of-lux-gold);
}

.of-transition-pill.is-active {
  background: linear-gradient(135deg, #f3d283 0%, #c89d47 100%) !important;
  color: #0a1120 !important;
  border-color: transparent !important;
  font-weight: 800 !important;
}

/* ---------- 9. TOPBAR KPI STATS IN CENTER BLANK ZONE & VERTICAL DESIGN ACCORDIONS ---------- */
#appShell .study-pane .topbar.of-topbar-unified {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  grid-template-areas:
    "brand stats account"
    "quick quick account" !important;
  align-items: center !important;
  gap: 10px 18px !important;
  padding: 14px 18px !important;
}

#appShell .study-pane .topbar.of-topbar-unified .brand-lockup {
  grid-area: brand !important;
}

#appShell .study-pane .topbar.of-topbar-unified .stats {
  grid-area: stats !important;
  grid-column: auto !important;
  order: 0 !important;
  width: 100% !important;
  max-width: 680px;
  justify-self: center;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

#appShell .study-pane .topbar.of-topbar-unified .stats > span {
  padding: 8px 10px !important;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#appShell .study-pane .topbar.of-topbar-unified .session-card {
  grid-area: account !important;
  justify-self: end !important;
}

#appShell .study-pane .topbar.of-topbar-unified .of-quicknav {
  grid-area: quick !important;
  margin-top: 2px !important;
}

@media (max-width: 1180px) {
  #appShell .study-pane .topbar.of-topbar-unified {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "brand account"
      "stats stats"
      "quick quick" !important;
  }
  #appShell .study-pane .topbar.of-topbar-unified .stats {
    max-width: 100%;
  }
}

@media (max-width: 620px) {
  #appShell .study-pane .topbar.of-topbar-unified .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Give the main flashcard slightly more vertical breathing room now that bottom appearance panel moved to sidebar */
@media (min-width: 1101px) {
  .app-shell:not(.panel-collapsed) .flashcard:not(.is-card-fullscreen) {
    min-height: clamp(400px, 54vh, 610px) !important;
  }
}

/* 5-Tab Workspace Navigation (Project | Cards | Create | Import | Design) */
#appShell .of-tabs {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 4px !important;
  padding: 4px !important;
}

#appShell .of-tab {
  font-size: 0.72rem !important;
  padding: 9px 2px !important;
  letter-spacing: -0.01em;
}

/* Vertical Collapsible Accordions inside #of-design */
.of-design-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.of-design-pane[hidden] {
  display: none !important;
}

.of-design-accordion {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(231, 194, 114, 0.22);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

html[data-theme="light"] .of-design-accordion {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
}

.of-design-accordion[open] {
  border-color: rgba(231, 194, 114, 0.48);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.28);
}

.of-design-acc-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 800;
  color: #f8fafc;
  user-select: none;
}

html[data-theme="light"] .of-design-acc-summary {
  color: #0f172a;
}

.of-design-acc-summary::-webkit-details-marker {
  display: none;
}

.of-acc-chevron {
  color: var(--of-lux-gold);
  font-size: 1rem;
  transition: transform 0.22s ease;
}

.of-design-accordion[open] .of-acc-chevron {
  transform: rotate(180deg);
}

.of-design-acc-body {
  padding: 4px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Vertical layout for Palettes inside Sidebar Accordion */
.of-design-acc-body .palette-panel {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

.of-design-acc-body .palette-panel > p {
  display: none !important;
}

.of-design-acc-body .palette-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  max-height: 240px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  gap: 7px !important;
  padding-right: 4px !important;
}

.of-design-acc-body .palette-option {
  flex: none !important;
  width: 100% !important;
  min-height: 54px !important;
  padding: 6px 8px !important;
}

/* Vertical layout for Typography & Colors inside Sidebar Accordion */
.of-design-acc-body .style-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 9px !important;
}

.of-design-acc-body .style-grid > label:first-child {
  grid-column: 1 / -1;
}

/* Vertical layout for 3D Transitions inside Sidebar Accordion */
.of-transition-pills-vertical {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding-top: 6px;
}

.of-transition-pills-vertical .of-transition-pill {
  width: 100%;
  text-align: center;
  padding: 8px 6px !important;
}

/* Vertical layout for Voice & Speech inside Sidebar Accordion */
.of-design-acc-body .speech-tools {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  padding-top: 4px;
}

/* Vertical layout for Study & View Controls inside Sidebar Accordion */
.of-design-acc-body .study-actions {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 7px !important;
  padding-top: 4px;
}

.of-design-acc-body .study-actions > button {
  width: 100% !important;
  min-height: 36px !important;
  font-size: 0.76rem !important;
  padding: 7px 8px !important;
}

/* ---------- 10. TOPBAR LOWERED STATS ALIGNMENT, LOGO COMPANION TEXT, WORKSPACE TOGGLE & 1-BY-1 REVEAL ---------- */
/* Companion text badge right next to the OwlForge logo */
.of-brand-companion {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  border-radius: 11px;
  background: rgba(231, 194, 114, 0.1);
  border: 1px solid rgba(231, 194, 114, 0.28);
  color: #f7dc94;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
  max-width: 300px;
  cursor: text;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

html[data-theme="light"] .of-brand-companion {
  background: rgba(192, 163, 109, 0.14);
  color: #6b4c14;
  border-color: rgba(192, 163, 109, 0.42);
}

.of-brand-companion:hover,
.of-brand-companion:focus {
  outline: none;
  border-color: #f7dc94;
  background: rgba(231, 194, 114, 0.16);
  box-shadow: 0 0 0 3px rgba(231, 194, 114, 0.14);
}

/* Lowered KPI stats aligned horizontally on the same level as Quick Nav (Mind map | Results | Games) */
#appShell .study-pane .topbar.of-topbar-v5 {
  display: grid !important;
  grid-template-columns: auto auto minmax(0, 1fr) auto !important;
  grid-template-areas: "brand quick stats account" !important;
  align-items: center !important;
  gap: 8px 12px !important;
  padding: 10px 14px !important;
}

#appShell .study-pane .topbar.of-topbar-v5 .brand-lockup {
  grid-area: brand !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-wrap: nowrap;
}

#appShell .study-pane .topbar.of-topbar-v5 .brand-logo-horizontal-study {
  width: clamp(210px, 19vw, 270px) !important;
  max-width: 270px !important;
  height: auto !important;
}

#appShell .study-pane .topbar.of-topbar-v5 .of-quicknav {
  grid-area: quick !important;
  justify-self: start !important;
  align-self: center !important;
  margin-top: 0 !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
}

#appShell .study-pane .topbar.of-topbar-v5 .of-quick-action {
  padding: 7px 11px !important;
  font-size: 0.78rem !important;
  white-space: nowrap !important;
}

#appShell .study-pane .topbar.of-topbar-v5 .stats {
  grid-area: stats !important;
  justify-self: center !important;
  align-self: center !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 430px !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 6px !important;
}

#appShell .study-pane .topbar.of-topbar-v5 .stats > span {
  padding: 6px 6px !important;
  min-height: 44px !important;
  font-size: 0.7rem !important;
}

#appShell .study-pane .topbar.of-topbar-v5 .stats > span strong {
  font-size: 0.96rem !important;
}

#appShell .study-pane .topbar.of-topbar-v5 .session-card {
  grid-area: account !important;
  justify-self: end !important;
  padding: 7px 11px !important;
}

@media (max-width: 1320px) {
  #appShell .study-pane .topbar.of-topbar-v5 {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "brand account"
      "quick stats" !important;
  }
  #appShell .study-pane .topbar.of-topbar-v5 .stats {
    justify-self: end !important;
    max-width: 460px !important;
  }
}

@media (max-width: 960px) {
  #appShell .study-pane .topbar.of-topbar-v5 {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "brand account"
      "quick quick"
      "stats stats" !important;
  }
  #appShell .study-pane .topbar.of-topbar-v5 .of-quicknav {
    flex-wrap: wrap !important;
  }
  #appShell .study-pane .topbar.of-topbar-v5 .stats {
    max-width: 100% !important;
  }
}

/* Hide / Show "Your study workspace" button inside workspace header + floating restore pill */
.of-collapse-ws-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 10px;
  background: rgba(231, 194, 114, 0.12);
  border: 1px solid rgba(231, 194, 114, 0.34);
  color: #f7dc94;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  min-height: 32px !important;
  transition: all 0.18s ease;
}

html[data-theme="light"] .of-collapse-ws-btn {
  background: rgba(192, 163, 109, 0.18);
  color: #6b4c14;
}

.of-collapse-ws-btn:hover {
  background: linear-gradient(135deg, #f3d283 0%, #c89d47 100%);
  color: #0a1120;
  border-color: transparent;
}

.of-restore-ws-btn {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%) translateX(120%);
  z-index: 95;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border-radius: 14px 0 0 14px;
  background: linear-gradient(135deg, #f3d283 0%, #c89d47 100%);
  border: 1px solid #fff3c4;
  color: #0a1120;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: -8px 12px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

.of-restore-ws-btn.is-visible {
  transform: translateY(-50%) translateX(16px);
  opacity: 1;
  pointer-events: auto;
}

.of-restore-ws-btn:hover {
  transform: translateY(-50%) translateX(10px);
}

/* Smooth full-width expansion when sidebar workspace is collapsed */
#appShell.panel-collapsed {
  grid-template-columns: minmax(0, 1fr) !important;
}

#appShell.panel-collapsed .deck-pane.of-workspace {
  display: none !important;
}

/* 1-by-1 Progressive Bullet / Item Reveal on Back of Flashcard */
.of-step-hidden {
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none !important;
}

.of-step-revealed {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  transition:
    opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.of-step-toggle-btn {
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px !important;
  border-radius: 10px;
  border: 1px solid rgba(231, 194, 114, 0.32);
  background: rgba(15, 23, 42, 0.7);
  color: #cbd5e1;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  min-height: 34px !important;
  transition: all 0.18s ease;
}

html[data-theme="light"] .of-step-toggle-btn {
  background: #f1f5f9;
  color: #1e293b;
}

.of-step-toggle-btn.is-active {
  background: rgba(231, 194, 114, 0.18);
  border-color: #e7c272;
  color: #f7dc94;
}

html[data-theme="light"] .of-step-toggle-btn.is-active {
  background: rgba(192, 163, 109, 0.22);
  color: #6b4c14;
}
