/* ═══════════════════════════════════════════════════════════════════
   STUDYVAULT — Global Platform CSS
   Extracted from StudyVault_v7.html for modular architecture
═══════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────
   TOP STATS BAR
───────────────────────────────────────────────────────────────────── */
:root {
  --topbar-h: 0px;
}


/* ─────────────────────────────────────────────────────────────────
   COLOR SCHEME & THEME VARIABLES
───────────────────────────────────────────────────────────────────── */
:root {
  /* DARK MODE (Default) */
  --plat-bg: #0d1118;
  --plat-nav-bg: rgba(13, 17, 24, 0.78);
  --plat-surface: #151c27;
  --plat-surf2: #1b2433;
  --plat-surf3: #253044;
  --plat-border: rgba(211, 224, 255, 0.12);
  --plat-text: #f4f7ff;
  --plat-muted: #b4c1db;
  --plat-accent: #8ea8ff;
  --plat-accent2: #78d7ff;
  --plat-green: #3ecf8e;
  --shadow-card: 0 8px 28px rgba(5, 8, 14, 0.28), 0 2px 6px rgba(5, 8, 14, 0.18);
  --shadow-hover: 0 18px 44px rgba(5, 8, 14, 0.34), 0 6px 16px rgba(5, 8, 14, 0.2);
  --overlay-op: 0.18;
  --plat-nav-h: 64px;
  --plat-r: 18px;
  --plat-r-sm: 12px;
}

html[data-theme="light"] {
  /* LIGHT MODE */
  --plat-bg: #f4f6f9;
  --plat-nav-bg: rgba(255, 255, 255, 0.85);
  --plat-surface: #ffffff;
  --plat-surf2: #e9ecef;
  --plat-surf3: #dee2e6;
  --plat-border: rgba(0, 0, 0, 0.08);
  --plat-text: #111319;
  --plat-muted: #5a657c;
  --plat-accent: #4f75f0;
  --plat-accent2: #8a58f0;
  --plat-green: #15803d;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 12px 30px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
  --overlay-op: 0.15;
}

/* ─────────────────────────────────────────────────────────────────
   GLOBAL BASE STYLES
───────────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(142, 168, 255, 0.11), transparent 28%),
    radial-gradient(circle at top right, rgba(120, 215, 255, 0.08), transparent 24%),
    linear-gradient(180deg, #0d1118 0%, #0b0f15 100%);
  color: var(--plat-text);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
video,
iframe,
svg {
  max-width: 100%;
  height: auto;
}

button,
.card-btn,
.nav-btn,
.theme-btn,
.sd-next-btn,
.sd-restart-btn {
  min-height: 42px;
}

/* Grain overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  opacity: var(--overlay-op);
  transition: opacity 0.3s;
}

a,
button,
input,
textarea {
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─────────────────────────────────────────────────────────────────
   PLATFORM NAVIGATION
───────────────────────────────────────────────────────────────────── */
#plat-nav {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  z-index: 9000;
  height: var(--plat-nav-h);
  background: var(--plat-nav-bg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--plat-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 20px;
  transition: all 0.3s;
}

.plat-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Clash Display', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--plat-text);
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: -0.3px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--plat-accent), var(--plat-accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(108, 143, 245, 0.35);
  color: #fff;
}

.brand-name span {
  color: var(--plat-accent);
}

.plat-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--plat-muted);
  flex: 1;
  overflow: hidden;
}

.plat-breadcrumb .sep {
  opacity: 0.4;
}

.plat-breadcrumb .crumb-subject {
  color: var(--plat-text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plat-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.mobile-menu-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--plat-text);
  background: var(--plat-surface);
  border: 1px solid var(--plat-border);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset;
}

.nav-btn-home {
  background: var(--plat-surf2);
  color: var(--plat-muted);
  border: 1px solid var(--plat-border);
}

.nav-btn-home:hover {
  color: var(--plat-text);
  background: var(--plat-surf3);
  border-color: var(--plat-accent);
}

.nav-btn-theme {
  background: var(--plat-surface);
  color: var(--plat-text);
  border: 1px solid var(--plat-border);
  font-size: 14px;
  padding: 7px 10px;
}

.nav-btn-theme:hover {
  border-color: var(--plat-accent);
  transform: scale(1.05);
}

.nav-btn-admin {
  background: rgba(139, 92, 246, 0.14);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.35);
  text-decoration: none;
}

.nav-btn-admin:hover {
  background: rgba(139, 92, 246, 0.24);
  border-color: rgba(139, 92, 246, 0.6);
  color: #ddd6fe;
}

.nav-btn-telegram {
  background: rgba(0, 136, 204, 0.14);
  color: #8ed7ff;
  border: 1px solid rgba(0, 136, 204, 0.35);
  text-decoration: none;
}

.nav-btn-telegram:hover {
  background: rgba(0, 136, 204, 0.24);
  border-color: rgba(0, 136, 204, 0.6);
  color: #b8e9ff;
}

/* ─────────────────────────────────────────────────────────────────
   VIEWS
───────────────────────────────────────────────────────────────────── */
#view-home {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding-top: calc(var(--topbar-h) + var(--plat-nav-h) + 40px);
  padding-bottom: 60px;
}

#view-subject {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding-top: calc(var(--topbar-h) + var(--plat-nav-h));
  display: none;
}

/* ─────────────────────────────────────────────────────────────────
   SCROLLBAR STYLING
───────────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--plat-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--plat-surf3);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--plat-muted);
}

/* ─────────────────────────────────────────────────────────────────
   DYNAMIC SUBJECT QUIZ UI
───────────────────────────────────────────────────────────────────── */
#quiz-guide #dyn-qroot {
  width: min(100%, 1100px);
  margin: 0 auto;
}

#quiz-guide .ml-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

#quiz-guide .ml-tab {
  border: 1px solid var(--plat-border);
  background: var(--plat-surf2);
  color: var(--plat-text);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

#quiz-guide .ml-tab.active {
  background: linear-gradient(135deg, rgba(142, 168, 255, 0.28), rgba(120, 215, 255, 0.2));
  border-color: rgba(142, 168, 255, 0.5);
}

#quiz-guide .ml-cnt {
  opacity: 0.9;
}

#quiz-guide .aq-score {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--plat-surface);
  border: 1px solid var(--plat-border);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 10px;
}

#quiz-guide .aq-score-val {
  font-weight: 800;
  color: var(--plat-accent2);
}

#quiz-guide .aq-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--plat-surf2);
  overflow: hidden;
  border: 1px solid var(--plat-border);
  margin-bottom: 14px;
}

#quiz-guide .aq-progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--plat-accent), var(--plat-accent2));
  transition: width 0.25s ease;
}

#quiz-guide .aq-card {
  background: var(--plat-surface);
  border: 1px solid var(--plat-border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

#quiz-guide .aq-head {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

#quiz-guide .aq-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--plat-surf2);
  border: 1px solid var(--plat-border);
  font-weight: 800;
}

#quiz-guide .aq-q {
  font-size: 18px;
  line-height: 1.45;
  font-weight: 700;
  overflow-wrap: anywhere;
}

#quiz-guide .aq-opts,
#quiz-guide .aq-tf {
  display: grid;
  gap: 8px;
}

#quiz-guide .aq-opt,
#quiz-guide .aq-tfb {
  width: 100%;
  display: block;
  text-align: start;
  border: 1px solid var(--plat-border);
  background: var(--plat-surf2);
  color: var(--plat-text);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: all 0.2s ease;
}

#quiz-guide .aq-opt:hover,
#quiz-guide .aq-tfb:hover {
  border-color: rgba(142, 168, 255, 0.45);
  transform: translateY(-1px);
}

#quiz-guide .aq-opt.correct,
#quiz-guide .aq-tfb.correct {
  border-color: rgba(62, 207, 142, 0.45);
  background: rgba(62, 207, 142, 0.14);
  color: #78e7b0;
}

#quiz-guide .aq-opt.wrong,
#quiz-guide .aq-tfb.wrong {
  border-color: rgba(240, 107, 107, 0.5);
  background: rgba(240, 107, 107, 0.12);
  color: #ffb6b6;
}

#quiz-guide .aq-exp {
  margin-top: 10px;
  background: var(--plat-surf2);
  border: 1px solid var(--plat-border);
  border-radius: 10px;
  padding: 10px 12px;
  display: none;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

#quiz-guide .aq-exp.show {
  display: block;
}

@media (max-width: 768px) {
  #quiz-guide .aq-card {
    padding: 12px;
  }

  #quiz-guide .aq-q {
    font-size: 16px;
  }

  #quiz-guide .aq-opt,
  #quiz-guide .aq-tfb {
    font-size: 14px;
  }
}

/* ─────────────────────────────────────────────────────────────────
   RESPONSIVE 
───────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #view-home {
    padding-top: calc(var(--topbar-h) + var(--plat-nav-h) + 28px);
  }
}

@media (max-width: 600px) {
  #plat-nav {
    padding: 0 16px;
  }
}

@media (max-width: 520px) {
  #plat-nav {
    gap: 10px;
    padding: 0 12px;
  }

  .brand-name {
    display: none;
  }

  .plat-breadcrumb {
    display: none !important;
  }

  .nav-btn-home {
    padding: 7px 10px;
    font-size: 12px;
  }

  .nav-btn-theme {
    min-width: 42px;
    justify-content: center;
    padding: 7px;
  }

  .nav-btn-admin,
  .nav-btn-telegram {
    padding: 7px 10px;
    font-size: 12px;
  }
}
