:root { --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

/* Light Theme */
.light {
  --bg: #FAF9F7; --bg2: #FFFFFF; --bg3: #F5F4F2; --bg-hover: #EEEEED;
  --text: #1A1915; --text2: #6B6B6B; --text3: #9A9A9A;
  --border: #E5E4E2;
  --accent: #D97706; --accent-hover: #B45309; --accent-bg: rgba(217,119,6,.1);
  --success: #059669; --success-bg: rgba(5,150,105,.15);
  --error: #DC2626; --error-bg: rgba(220,38,38,.15);
  --shadow: 0 2px 8px rgba(0,0,0,.04);
}

/* Dark Theme */
.dark {
  --bg: #1A1915; --bg2: #262620; --bg3: #2D2D26; --bg-hover: #3D3D35;
  --text: #ECECEC; --text2: #A3A3A3; --text3: #6B6B6B;
  --border: #3D3D35;
  --accent: #F59E0B; --accent-hover: #D97706; --accent-bg: rgba(245,158,11,.15);
  --success: #10B981; --success-bg: rgba(16,185,129,.2);
  --error: #EF4444; --error-bg: rgba(239,68,68,.2);
  --shadow: 0 2px 12px rgba(0,0,0,.3);
}

/* Base */
[x-cloak] { display: none !important; }
body { font-family: var(--font); background: var(--bg); color: var(--text); margin: 0; }
.brand-title { color: var(--accent) !important; font-weight: 700; }
.text-secondary { color: var(--text2) !important; }

/* Bulma Overrides */
.title, .subtitle, .label { color: var(--text) !important; }
.box { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.input, .textarea, .select select {
  background: var(--bg3) !important; border-color: var(--border) !important;
  color: var(--text) !important; border-radius: 8px;
}
.input:focus, .select select:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 2px var(--accent-bg) !important; }
.input::placeholder { color: var(--text3) !important; }

.button { border-radius: 8px; font-weight: 500; transition: .2s; }
.button.is-primary { background: var(--accent) !important; border-color: var(--accent) !important; }
.button.is-primary:hover { background: var(--accent-hover) !important; }
.button.is-light, .button:not(.is-primary):not(.is-danger):not(.is-success) {
  background: var(--bg3) !important; border-color: var(--border) !important; color: var(--text) !important;
}
.button.is-light:hover { background: var(--bg-hover) !important; }

.progress { background: var(--bg3); border-radius: 6px; height: 8px; }
.progress::-webkit-progress-value { background: linear-gradient(90deg, var(--success), var(--accent)); border-radius: 6px; }
.progress::-moz-progress-bar { background: linear-gradient(90deg, var(--success), var(--accent)); }

.tabs.is-toggle a { background: var(--bg3); border-color: var(--border); color: var(--text2); }
.tabs.is-toggle li.is-active a { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag { border-radius: 6px; }
.tag.is-success.is-light { background: var(--success-bg); color: var(--success); }
.tag.is-danger.is-light { background: var(--error-bg); color: var(--error); }

.modal-card { background: var(--bg2); border-radius: 12px; }
.modal-card-head, .modal-card-foot { background: var(--bg3); border-color: var(--border); }
.modal-card-title { color: var(--text); }
.modal-card-body { background: var(--bg2); }

/* Navbar */
.navbar, .app-navbar, .test-navbar { background: var(--bg2) !important; border-bottom: 1px solid var(--border); }
.navbar-item, .navbar-link { color: var(--text) !important; }
.navbar-burger span { background-color: var(--text) !important; }
.navbar.is-fixed-top + .columns { padding-top: 52px; }

/* Sidebar */
.sidebar { background: var(--bg2); border-right: 1px solid var(--border); min-height: calc(100vh - 52px); display: flex; flex-direction: column; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); }
.menu-list a {
  color: var(--text); border-radius: 8px; padding: 12px 16px;
  border-left: 3px solid transparent; margin-bottom: 4px; display: flex; align-items: center; gap: 10px;
}
.menu-list a:hover { background: var(--bg-hover); color: var(--text); }
.menu-list a.is-active { background: var(--accent-bg); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

/* Layout */
.app-layout { min-height: 100vh; }
.main-content { min-height: calc(100vh - 52px); }
.content-area { background: var(--bg); padding-bottom: 80px; }

/* Mobile Nav */
.mobile-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: 60px;
  background: var(--bg2); border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: center; z-index: 30;
}
.mobile-nav a { font-size: 24px; padding: 10px 20px; opacity: .6; }
.mobile-nav a.is-active { opacity: 1; }

/* Login */
.hero { background: var(--bg) !important; }
.login-box { padding: 40px; max-width: 400px; margin: 0 auto; }
.control .icon { color: var(--text3) !important; }

/* Module Cards */
.module-card { transition: .2s; }
.module-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.general-test { background: var(--accent-bg) !important; border: 2px solid var(--accent) !important; }
.stat-card { padding: 32px; }

/* Test Layout */
.test-layout { min-height: 100vh; background: var(--bg); }
.test-navbar { position: fixed !important; top: 0; left: 0; right: 0; z-index: 40; }
.test-navbar .timer { font-size: 1.25rem; font-weight: 700; color: var(--accent); }
.test-navbar .timer.is-danger { color: var(--error); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* Question Bar */
.question-bar {
  position: fixed; top: 52px; left: 0; right: 0; z-index: 35;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 8px 12px;
}
.question-numbers { display: flex; gap: 6px; overflow-x: auto; flex: 1; padding: 4px 0; }
.q-num {
  min-width: 34px; height: 34px; border-radius: 8px;
  background: var(--bg3); border: none; color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer; flex-shrink: 0;
}
.q-num:hover { background: var(--bg-hover); }
.q-num.is-current { background: var(--accent); color: #fff; }
.q-num.is-correct { background: var(--success); color: #fff; }
.q-num.is-wrong { background: var(--error); color: #fff; }
.q-counter { color: var(--text2); font-size: 14px; margin-left: 12px; white-space: nowrap; }

/* Test Content */
.test-content { padding-top: 110px; min-height: 100vh; }
.question-media { background: var(--bg3); }
.question-panel { background: var(--bg2); }
.question-image { border-radius: 12px; max-width: 75%; background: var(--bg); }

.star { cursor: pointer; opacity: .5; transition: .2s; }
.star:hover, .star.is-active { opacity: 1; color: gold; }

/* Options */
.option-card {
  background: var(--bg3); border: 1px solid var(--border);
  padding: 14px 16px; border-radius: 8px; margin-bottom: 10px;
  cursor: pointer; transition: .2s; display: flex; align-items: flex-start; gap: 12px;
}
.option-card:hover:not(.is-correct):not(.is-wrong) { background: var(--bg-hover); }
.option-card.is-selected { background: var(--accent-bg); border-color: var(--accent); }
.option-card.is-correct { background: var(--success-bg); border: 2px solid var(--success); cursor: default; }
.option-card.is-wrong { background: var(--error-bg); border: 2px solid var(--error); cursor: default; }
.option-num { font-weight: 600; color: var(--text2); min-width: 20px; }

/* Note */
.note-box { background: var(--bg3); border-left: 4px solid var(--accent); border-radius: 8px; padding: 16px; }

/* Rules */
.rules-content { line-height: 1.8; }
.rules-content .content { color: var(--text2); }
.rules-menu .menu-list a { padding: 8px 12px; font-size: 14px; }

/* Video */
.video-js { border-radius: 12px; overflow: hidden; }
.question-video, .note-video {
  width: 100%;
  border-radius: 12px;
  background: var(--bg);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg3); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Responsive */
@media (max-width: 768px) {
  .test-content .columns { flex-direction: column; }
  .question-media, .question-panel { padding: 12px !important; }
  .module-header .level { flex-direction: column; gap: 12px; align-items: flex-start; }
  .tabs.is-toggle ul { flex-wrap: wrap; }
  .content-area { padding: 12px !important; }
}