:root {
  --orange: #FF6B00;
  --orange-light: #FF8533;
  --orange-hover: #E65A00;
  --orange-bg: rgba(255, 107, 0, 0.12);
  --orange-glow: 0 0 16px rgba(255, 107, 0, 0.3);
  
  --black: #09090B;
  --black-surface: #141418;
  --black-secondary: #1E1E24;
  --black-border: #2E2E38;
  
  --green: #10B981;
  --green-bg: rgba(16, 185, 129, 0.12);
  --red: #EF4444;
  --red-bg: rgba(239, 68, 68, 0.12);
  --yellow: #F59E0B;
  
  --bg: #09090B;
  --surface: #141418;
  --surface-secondary: #1C1C22;
  --border: #2A2A34;
  --border-focus: #FF6B00;
  
  --text: #F4F4F5;
  --text-muted: #A1A1AA;
  --text-inverse: #09090B;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --max-w: 720px;
}

[data-theme="light"] {
  --bg: #F8F9FA;
  --surface: #FFFFFF;
  --surface-secondary: #F1F3F5;
  --border: #E5E7EB;
  --border-focus: #FF6B00;
  
  --text: #09090B;
  --text-muted: #6B7280;
  --text-inverse: #FFFFFF;
}

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

html, body {
  height: 100%;
  height: 100dvh;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Header & Navbar (Directory Only) */
.app-navbar {
  background: #09090B;
  color: white;
  border-bottom: 2px solid var(--orange);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.nav-brand { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.nav-logo { font-size: 1.5rem; }
.brand-text { display: flex; flex-direction: column; }
.brand-title { font-weight: 900; font-size: 1.05rem; color: #FFFFFF; }
.brand-tagline { font-size: 0.68rem; color: var(--orange); text-transform: uppercase; font-weight: 700; }

.icon-btn {
  background: var(--black-secondary);
  border: 1px solid var(--black-border);
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

/* App Main Container */
.app-content {
  flex: 1;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 10px 12px 14px;
  display: flex;
  flex-direction: column;
}

.view-panel {
  display: none;
  width: 100%;
  height: 100%;
  animation: fadeIn 0.15s ease-out;
}

.view-panel.active { display: flex; flex-direction: column; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 14px;
}

/* ========================================== */
/* VIEW 1: APPS DIRECTORY                     */
/* ========================================== */
.directory-hero { text-align: center; margin-bottom: 20px; }
.directory-hero h1 { font-size: 1.8rem; font-weight: 900; color: var(--text); margin-bottom: 4px; }
.directory-hero .subtitle { color: var(--text-muted); font-size: 0.9rem; max-width: 540px; margin: 0 auto 16px; }

.directory-search-wrapper { position: relative; max-width: 520px; margin: 0 auto; }
.directory-search-wrapper .search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--orange); }
.directory-search-wrapper input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  font-size: 0.95rem;
  border: 2px solid var(--border);
  border-radius: 25px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.directory-search-wrapper input:focus { border-color: var(--orange); }

.featured-section { margin-bottom: 24px; }
.section-label { font-size: 0.72rem; font-weight: 900; letter-spacing: 1px; color: var(--orange); margin-bottom: 6px; }

.featured-card {
  display: flex;
  align-items: center;
  gap: 16px;
  border-left: 5px solid var(--orange);
  cursor: pointer;
}

.featured-icon {
  font-size: 2.8rem;
  background: var(--surface-secondary);
  width: 65px;
  height: 65px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.featured-content { flex: 1; }
.featured-badges { display: flex; gap: 6px; margin-bottom: 4px; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 16px; font-size: 0.72rem; font-weight: 800; }
.badge-live { background: var(--green-bg); color: var(--green); }
.badge-category { background: var(--orange-bg); color: var(--orange); }

.featured-title { font-size: 1.15rem; font-weight: 900; margin-bottom: 4px; }
.featured-desc { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 8px; }
.app-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { background: var(--surface-secondary); border: 1px solid var(--border); color: var(--text-muted); padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 700; }

.all-apps-section { margin-bottom: 28px; }
.section-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-header-row h2 { font-size: 1.15rem; font-weight: 900; }
.apps-count { font-size: 0.8rem; color: var(--orange); font-weight: 700; }

.apps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
.app-card:hover { border-color: var(--orange); }
.app-card-header { display: flex; justify-content: space-between; margin-bottom: 8px; }
.app-card-icon { font-size: 1.8rem; }
.app-status-badge { font-size: 0.7rem; font-weight: 800; padding: 2px 6px; border-radius: 10px; }
.app-status-live { background: var(--green-bg); color: var(--green); }
.app-status-active { background: var(--orange-bg); color: var(--orange); }
.app-status-soon { background: rgba(128,128,128,0.15); color: var(--text-muted); }
.app-card-title { font-size: 1.05rem; font-weight: 900; margin-bottom: 2px; }
.app-card-tagline { font-size: 0.75rem; font-weight: 700; color: var(--orange); margin-bottom: 6px; }
.app-card-desc { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px; flex: 1; }
.app-card-footer { display: flex; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--border); font-size: 0.75rem; font-weight: 700; }
.app-card-cta { color: var(--orange); font-weight: 800; }

.directory-footer { text-align: center; padding: 18px 0 6px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.8rem; }
.directory-footer a { color: var(--orange); text-decoration: none; font-weight: 700; }
.footer-links { display: flex; justify-content: center; gap: 14px; margin-top: 6px; }

.btn-primary {
  background: var(--orange);
  color: #09090B;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--orange-glow);
}

/* ======================================================= */
/* VIEW 2: ULTRA-COMPRESSED ZERO-SCROLL MOBILE SUBVIEWS    */
/* ======================================================= */
#view-dmv {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dmv-mobile-subview {
  display: none;
  flex: 1;
  width: 100%;
  flex-direction: column;
  justify-content: space-between;
}

.dmv-mobile-subview.active {
  display: flex;
}

/* Top Status Bars (Super Compact) */
.compact-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 6px;
  flex-shrink: 0;
}

.btn-back-minimal {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-back-minimal:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.accuracy-score-pill {
  background: var(--surface);
  border: 1.5px solid var(--orange);
  box-shadow: var(--orange-glow);
  padding: 4px 10px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.accuracy-label { font-size: 0.7rem; font-weight: 800; color: var(--text-muted); }
.accuracy-val { font-size: 0.92rem; font-weight: 900; color: var(--orange); }
.accuracy-sub { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); }

.minimal-q-progress {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
}

/* Compact Question Box */
.compact-question-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
  margin-bottom: 8px;
}

.adaptive-badge {
  display: inline-flex;
  align-self: flex-start;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.adaptive-badge.mistake { background: var(--red-bg); border: 1px solid var(--red); color: #FF5A5A; }
.adaptive-badge.reddit { background: var(--orange-bg); border: 1px solid var(--orange); color: var(--orange); }

.q-illustration-box {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.q-illustration-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  max-width: 100%;
}

.q-svg-sign, .q-svg-diagram {
  max-width: 190px;
  width: 100%;
  height: 95px;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.4));
}

.compact-q-title {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: 10px;
}

/* Compact Options Grid */
.compact-options-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-btn {
  width: 100%;
  text-align: left;
  background: var(--surface-secondary);
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.option-btn:hover:not(:disabled), .option-btn:active {
  border-color: var(--orange);
  background: rgba(255, 107, 0, 0.08);
}

.opt-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--orange);
  flex-shrink: 0;
}

.compact-bottom-nav {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-compact-nav {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ======================================================= */
/* ULTRA-COMPACT FEEDBACK SCREEN STYLES (SCREEN 2)         */
/* ======================================================= */
.compact-feedback-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* Compact Status Banner */
.compact-status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.compact-status-banner.fb-hero-correct {
  background: var(--green-bg);
  border: 1.5px solid var(--green);
}

.compact-status-banner.fb-hero-wrong {
  background: var(--red-bg);
  border: 1.5px solid var(--red);
}

.compact-hero-icon { font-size: 1.6rem; flex-shrink: 0; }
.compact-hero-text { display: flex; flex-direction: column; }
.compact-status-title { font-size: 1.15rem; font-weight: 900; line-height: 1.1; }
.fb-hero-correct .compact-status-title { color: var(--green); }
.fb-hero-wrong .compact-status-title { color: var(--red); }
.compact-status-sub { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }

/* Compact Breakdown */
.compact-answer-breakdown {
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 8px;
}

.compact-q-summary {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}

.compact-choice-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 5px;
}

.compact-tag-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 65px;
}

.compact-choice-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  flex: 1;
}

.fb-opt-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 900;
  flex-shrink: 0;
}

.fb-opt-box.box-correct {
  background: var(--green);
  color: #FFFFFF;
}

.fb-opt-box.box-wrong {
  background: var(--red);
  color: #FFFFFF;
}

.fb-opt-text-val {
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.3;
}

.compact-choice-row.user-wrong {
  border: 1px solid var(--red);
  color: var(--red);
}

.compact-choice-row.user-correct, .compact-choice-row.correct-row {
  border: 1px solid var(--green);
  color: var(--green);
}

/* Compact Explanation */
.compact-explanation-box {
  background: var(--surface-secondary);
  border-left: 3px solid var(--orange);
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 6px;
}

.compact-exp-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--orange);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.compact-exp-body {
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--text);
}

.compact-reddit-box {
  background: rgba(255, 107, 0, 0.08);
  border-left: 3px solid var(--orange);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 0.78rem;
  color: var(--orange);
  font-weight: 700;
  line-height: 1.35;
}

/* Feedback Action Sticky Bottom Bar */
.compact-feedback-action-bar {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-compact-retry {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  flex: 1;
}

.btn-compact-next {
  background: var(--orange);
  color: #09090B;
  border: none;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--orange-glow);
  flex: 2.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Radical FX Keyframes */
@keyframes correctPulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.03); box-shadow: 0 0 25px rgba(16, 185, 129, 0.7); }
  100% { transform: scale(1); }
}

/* 🚀 FLY UPWARD (ON CORRECT) */
@keyframes flyUpwardStagger {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  25% { transform: translateY(10px) scale(0.97); opacity: 1; }
  100% { transform: translateY(-130vh) rotate(-4deg) scale(0.8); opacity: 0; }
}

.fx-fly-up-0 { animation: flyUpwardStagger 0.48s cubic-bezier(0.5, 0, 0.75, 0) 0.0s forwards !important; }
.fx-fly-up-1 { animation: flyUpwardStagger 0.48s cubic-bezier(0.5, 0, 0.75, 0) 0.06s forwards !important; }
.fx-fly-up-2 { animation: flyUpwardStagger 0.48s cubic-bezier(0.5, 0, 0.75, 0) 0.12s forwards !important; }
.fx-fly-up-3 { animation: flyUpwardStagger 0.48s cubic-bezier(0.5, 0, 0.75, 0) 0.18s forwards !important; }
.fx-fly-up-card { animation: flyUpwardStagger 0.48s cubic-bezier(0.5, 0, 0.75, 0) 0.10s forwards !important; }

/* 💥 UNSYNCHRONIZED CHAOTIC SHAKE & FALL (ON WRONG) */
@keyframes chaoticShakeFall0 {
  0% { transform: translate(0, 0) rotate(0deg); }
  12% { transform: translate(-10px, 3px) rotate(-6deg); }
  24% { transform: translate(11px, -3px) rotate(5deg); }
  36% { transform: translate(-12px, 2px) rotate(-5deg); }
  48% { transform: translate(9px, -2px) rotate(4deg); }
  60% { transform: translate(-6px, 1px) rotate(-2deg); opacity: 1; }
  100% { transform: translateY(130vh) rotate(35deg) scale(0.7); opacity: 0; }
}

@keyframes chaoticShakeFall1 {
  0% { transform: translate(0, 0) rotate(0deg); }
  15% { transform: translate(12px, -4px) rotate(7deg); }
  28% { transform: translate(-11px, 3px) rotate(-6deg); }
  42% { transform: translate(10px, -2px) rotate(5deg); }
  55% { transform: translate(-8px, 2px) rotate(-3deg); }
  65% { transform: translate(5px, 0) rotate(2deg); opacity: 1; }
  100% { transform: translateY(130vh) rotate(-40deg) scale(0.7); opacity: 0; }
}

@keyframes chaoticShakeFall2 {
  0% { transform: translate(0, 0) rotate(0deg); }
  10% { transform: translate(-13px, -3px) rotate(-7deg); }
  25% { transform: translate(12px, 4px) rotate(6deg); }
  40% { transform: translate(-10px, -2px) rotate(-5deg); }
  52% { transform: translate(9px, 3px) rotate(4deg); }
  65% { transform: translate(-6px, 0) rotate(-2deg); opacity: 1; }
  100% { transform: translateY(130vh) rotate(45deg) scale(0.7); opacity: 0; }
}

@keyframes chaoticShakeFall3 {
  0% { transform: translate(0, 0) rotate(0deg); }
  18% { transform: translate(10px, 4px) rotate(5deg); }
  32% { transform: translate(-12px, -3px) rotate(-7deg); }
  46% { transform: translate(11px, 2px) rotate(5deg); }
  58% { transform: translate(-9px, -2px) rotate(-4deg); }
  68% { transform: translate(6px, 1px) rotate(2deg); opacity: 1; }
  100% { transform: translateY(130vh) rotate(-35deg) scale(0.7); opacity: 0; }
}

.fx-shake-fall-0 { animation: chaoticShakeFall0 0.65s cubic-bezier(0.2, 0.8, 0.4, 1) 0.0s forwards !important; }
.fx-shake-fall-1 { animation: chaoticShakeFall1 0.68s cubic-bezier(0.2, 0.8, 0.4, 1) 0.05s forwards !important; }
.fx-shake-fall-2 { animation: chaoticShakeFall2 0.66s cubic-bezier(0.2, 0.8, 0.4, 1) 0.09s forwards !important; }
.fx-shake-fall-3 { animation: chaoticShakeFall3 0.70s cubic-bezier(0.2, 0.8, 0.4, 1) 0.03s forwards !important; }
