/* ==========================================================================
   Design System — Editorial Dark
   Shared across all pages. Scoped to .app-refreshed
   Playfair Display + DM Sans · Warm gold accents · Refined depth
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;0,800;1,400;1,600;1,700&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700;9..40,800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

.app-refreshed {
  --bg-deep: #090807;
  --bg-surface: #141211;
  --bg-elevated: #1c1a18;
  --bg-elevated-hover: #242220;
  --bg-card: #1a1816;
  --bg-card-hover: #22201d;
  --text-primary: #ece6df;
  --text-secondary: #a69e95;
  --text-muted: #736b63;
  --accent-gold: #d4a373;
  --accent-gold-light: #e8c99b;
  --accent-gold-dim: #8a764a;
  --accent-gold-glow: rgba(212, 163, 115, 0.08);
  --accent-gold-glow-strong: rgba(212, 163, 115, 0.18);
  --accent-emerald: #3d8a6a;
  --accent-emerald-bg: rgba(61, 138, 106, 0.1);
  --accent-coral: #c4545a;
  --accent-coral-bg: rgba(196, 84, 90, 0.1);
  --accent-sky: #5a8fa8;
  --accent-sky-bg: rgba(90, 143, 168, 0.1);
  --accent-amber: #c99a4a;
  --border: #2a2724;
  --border-light: #3a3734;
  --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* ---- Legacy compat: resolve inline --md-sys-* vars from pages ---- */
  --md-sys-outline-variant: #2a2724;
  --md-sys-on-surface-variant: #a69e95;
  --md-sys-primary: #d4a373;
  --md-sys-primary-light: #e8c99b;
  --md-sys-surface-container: #1c1a18;
  --md-sys-shape-lg: 16px;
  --md-sys-outline: #3a3734;
  --md-sys-surface-container-high: #242220;
  --md-sys-error: #c4545a;
  --md-sys-on-surface: #ece6df;
  --md-sys-shape-sm: 6px;
  --md-sys-surface-container-low: #141211;
  --md-headline-sm: 1.5rem;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.6);
  --easing: cubic-bezier(0.16, 1, 0.3, 1);
  --duration: 0.35s;
}

/* ---- Base ---- */
.app-refreshed {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.app-refreshed h1, .app-refreshed h2, .app-refreshed h3,
.app-refreshed h4, .app-refreshed h5, .app-refreshed h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.app-refreshed ::selection {
  background: var(--accent-gold);
  color: var(--bg-deep);
}

.app-refreshed a {
  color: var(--accent-gold);
  text-decoration: none;
}

.app-refreshed a:hover {
  color: var(--accent-gold-light);
  text-decoration: underline;
}

/* ---- Background grain texture ---- */
.app-refreshed::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(212, 163, 115, 0.025) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(212, 163, 115, 0.015) 0%, transparent 70%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.006) 2px,
      rgba(255, 255, 255, 0.006) 4px
    );
  pointer-events: none;
  z-index: 0;
}

/* ---- Sidebar ---- */
.app-refreshed .sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  transition: width 0.3s var(--easing), padding 0.3s var(--easing);
  z-index: 100;
}

.app-refreshed .sidebar .logo h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.app-refreshed .sidebar .logo h2 span {
  color: var(--accent-gold);
  font-style: italic;
}

.app-refreshed .logo-icon {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-light));
  box-shadow: 0 0 16px rgba(212, 163, 115, 0.12);
  border-radius: var(--radius-sm);
}

.app-refreshed .sidebar-collapse-btn {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.app-refreshed .sidebar-collapse-btn:hover {
  background: var(--accent-gold);
  color: var(--bg-deep);
  border-color: var(--accent-gold);
}

.app-refreshed .nav-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
}

.app-refreshed .tab-item {
  color: var(--text-secondary);
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--easing);
}

.app-refreshed .tab-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.app-refreshed .tab-item.active {
  background: var(--accent-gold-glow);
  color: var(--accent-gold);
}

.app-refreshed .tab-item.active::before {
  background: var(--accent-gold);
  width: 2px;
  height: 16px;
  border-radius: 0 2px 2px 0;
}

.app-refreshed .tab-icon {
  opacity: 0.7;
  transition: transform var(--duration) var(--easing);
}

.app-refreshed .tab-item:hover .tab-icon {
  transform: translateX(2px);
  opacity: 1;
}

.app-refreshed .btn-daily,
.app-refreshed .btn-browse {
  border-color: var(--border);
  color: var(--text-primary);
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--easing);
}

.app-refreshed .btn-daily:hover,
.app-refreshed .btn-browse:hover {
  background: var(--bg-elevated);
  border-color: var(--border-light);
}

.app-refreshed .btn-daily svg,
.app-refreshed .btn-browse svg {
  color: var(--accent-gold);
}

.app-refreshed .daily-badge-dot {
  background: var(--accent-gold);
}

.app-refreshed .active-topic-info {
  background: var(--bg-elevated);
  border-color: var(--border);
  border-radius: var(--radius-sm);
}

.app-refreshed .active-topic-info .label {
  color: var(--text-muted);
  font-weight: 600;
}

.app-refreshed .active-topic-info .name {
  color: var(--text-primary);
}

/* ---- Stats Footer ---- */
.app-refreshed .stats-footer {
  border-top-color: var(--border);
}

.app-refreshed .stats-info span {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-primary);
}

.app-refreshed .stats-info p {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.app-refreshed .guest-stats {
  border-top-color: var(--border);
}

.app-refreshed .guest-stats span {
  color: var(--accent-gold);
  font-family: var(--font-heading);
}

/* ---- Top Nav ---- */
.app-refreshed .top-nav {
  background: rgba(9, 8, 7, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  height: 72px;
}

.app-refreshed .menu-toggle {
  border-color: var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
}

.app-refreshed .menu-toggle:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* ---- Search ---- */
.app-refreshed .search-wrap {
  background: var(--bg-surface);
  border-color: var(--border);
  border-radius: var(--radius-full);
}

.app-refreshed .search-wrap:focus-within {
  border-color: var(--accent-gold);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px rgba(212, 163, 115, 0.1);
}

.app-refreshed .search-wrap input {
  color: var(--text-primary);
  font-weight: 400;
}

.app-refreshed .search-wrap input::placeholder {
  color: var(--text-muted);
}

.app-refreshed .search-wrap svg {
  color: var(--text-muted);
}

/* ---- Buttons ---- */
.app-refreshed .btn-premium {
  background: var(--accent-gold);
  color: var(--bg-deep);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--duration) var(--easing);
  position: relative;
  overflow: hidden;
}

.app-refreshed .btn-premium::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background var(--duration) var(--easing);
}

.app-refreshed .btn-premium:hover::after {
  background: rgba(0,0,0,0.08);
}

.app-refreshed .btn-premium:hover {
  background: var(--accent-gold-light);
  box-shadow: 0 0 24px rgba(212, 163, 115, 0.15);
}

.app-refreshed .btn-premium:active {
  box-shadow: var(--shadow-sm);
}

/* Secondary button */
.app-refreshed .btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  box-shadow: none;
}

.app-refreshed .btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--border-light);
  color: var(--text-primary);
  box-shadow: none;
}

.app-refreshed .btn-secondary::after {
  display: none;
}

.app-refreshed .btn-danger-glow {
  background: var(--accent-coral) !important;
  box-shadow: 0 2px 12px rgba(196, 84, 90, 0.2);
  color: #fff;
}

.app-refreshed .btn-danger-glow:hover {
  background: #d65a60 !important;
  box-shadow: 0 4px 20px rgba(196, 84, 90, 0.3);
}

/* ---- User Pill ---- */
.app-refreshed .user-pill {
  background: var(--accent-gold);
  color: var(--bg-deep);
  font-weight: 700;
  border-radius: var(--radius-sm);
}

.app-refreshed .user-pill:hover {
  background: var(--accent-gold-light);
  box-shadow: 0 0 0 4px rgba(212, 163, 115, 0.15);
}

/* ---- Title Block ---- */
.app-refreshed .title-block h1 {
  font-family: var(--font-heading);
  font-weight: 700;
  background: none;
  -webkit-text-fill-color: var(--text-primary);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.app-refreshed .title-block p {
  color: var(--text-secondary);
  font-weight: 400;
}

/* ---- Cards ---- */
.app-refreshed .question-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration) var(--easing);
}

.app-refreshed .question-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.app-refreshed .question-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 28px;
  right: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-gold-dim), transparent);
  opacity: 0;
  transition: opacity var(--duration) var(--easing);
}

.app-refreshed .question-card:hover::before {
  opacity: 1;
}

/* ---- Badges ---- */
.app-refreshed .badge {
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.app-refreshed .badge-id {
  color: var(--accent-gold);
  border-color: rgba(212, 163, 115, 0.2);
  background: rgba(212, 163, 115, 0.08);
}

.app-refreshed .badge-year {
  color: var(--accent-sky);
  border-color: rgba(90, 143, 168, 0.2);
  background: var(--accent-sky-bg);
}

.app-refreshed .badge-accent {
  color: var(--accent-gold);
  border-color: rgba(212, 163, 115, 0.2);
  background: rgba(212, 163, 115, 0.08);
}

.app-refreshed .badge-completed {
  color: var(--accent-emerald);
  border-color: rgba(61, 138, 106, 0.2);
  background: var(--accent-emerald-bg);
}

/* ---- Options ---- */
.app-refreshed .option-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--easing);
}

.app-refreshed .option-item:hover {
  background: var(--bg-elevated-hover);
  border-color: var(--border-light);
}

.app-refreshed .option-marker {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  border-radius: 4px;
}

.app-refreshed .option-item.selected {
  background: rgba(212, 163, 115, 0.08);
  border-color: var(--accent-gold);
}

.app-refreshed .option-item.selected .option-marker {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--bg-deep);
}

.app-refreshed .option-item.correct {
  background: var(--accent-emerald-bg);
  border-color: var(--accent-emerald);
}

.app-refreshed .option-item.incorrect {
  background: var(--accent-coral-bg);
  border-color: var(--accent-coral);
}

.app-refreshed .option-item.correct .option-marker {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #fff;
}

.app-refreshed .option-item.incorrect .option-marker {
  background: var(--accent-coral);
  border-color: var(--accent-coral);
  color: #fff;
}

/* ---- TITA Input ---- */
.app-refreshed .tita-input {
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 500;
  transition: all var(--duration) var(--easing);
}

.app-refreshed .tita-input:focus {
  border-color: var(--accent-gold);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(212, 163, 115, 0.1);
}

.app-refreshed .tita-input.correct {
  border-color: var(--accent-emerald);
  background: rgba(61, 138, 106, 0.05);
}

.app-refreshed .tita-input.incorrect {
  border-color: var(--accent-coral);
  background: rgba(196, 84, 90, 0.05);
}

/* ---- Question Footer ---- */
.app-refreshed .q-footer {
  border-top-color: var(--border);
}

.app-refreshed .feedback-msg {
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.app-refreshed .feedback-msg.correct {
  background: var(--accent-emerald-bg);
  color: var(--accent-emerald);
  border: 1px solid rgba(61, 138, 106, 0.2);
}

.app-refreshed .feedback-msg.incorrect {
  background: var(--accent-coral-bg);
  color: var(--accent-coral);
  border: 1px solid rgba(196, 84, 90, 0.2);
}

.app-refreshed .ans-key-reveal {
  background: var(--bg-elevated);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
}

.app-refreshed .val-pill {
  color: var(--accent-gold);
  font-family: var(--font-mono);
}

.app-refreshed .solution-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.app-refreshed .sol-title {
  color: var(--accent-gold);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.app-refreshed .sol-text {
  color: var(--text-secondary);
}

/* ---- Loader ---- */
.app-refreshed .spinner {
  border-color: var(--border);
  border-top-color: var(--accent-gold);
}

.app-refreshed .loader-overlay p {
  color: var(--text-muted);
}

/* ---- Empty State ---- */
.app-refreshed .empty-state h1 {
  color: var(--text-primary);
}

.app-refreshed .empty-state p {
  color: var(--text-secondary);
}

/* ---- Modals ---- */
.app-refreshed .modal-overlay {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

.app-refreshed .modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}

.app-refreshed .modal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 32px;
  right: 32px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-gold-dim), var(--accent-gold), transparent);
}

.app-refreshed .modal-header h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-refreshed .close-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--easing);
}

.app-refreshed .close-btn:hover {
  background: var(--bg-elevated-hover);
  border-color: var(--border-light);
  color: var(--text-primary);
  transform: rotate(90deg);
}

/* ---- Topic Grid / Cards ---- */
.app-refreshed .topic-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--duration) var(--easing);
}

.app-refreshed .topic-card:hover {
  background: var(--bg-elevated-hover);
  border-color: var(--accent-gold-dim);
  box-shadow: var(--shadow-md);
}

.app-refreshed .topic-card .count {
  color: var(--accent-gold);
  background: rgba(212, 163, 115, 0.08);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.app-refreshed .year-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: all var(--duration) var(--easing);
}

.app-refreshed .year-item:hover {
  background: var(--bg-elevated-hover);
  border-color: var(--accent-gold-dim);
}

.app-refreshed .year-item.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--bg-deep);
}

/* ---- Passage / Group ---- */
.app-refreshed .passage-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.app-refreshed .passage-header {
  border-bottom-color: var(--border);
}

.app-refreshed .passage-content {
  color: var(--text-secondary);
}

/* ---- Daily Challenge Styles ---- */
.app-refreshed .daily-section-tabs {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.app-refreshed .daily-tab {
  color: var(--text-secondary);
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all var(--duration) var(--easing);
}

.app-refreshed .daily-tab.active {
  background: var(--accent-gold);
  color: var(--bg-deep);
}

.app-refreshed .daily-tab:hover:not(.active) {
  color: var(--text-primary);
}

.app-refreshed .btn-history {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-weight: 500;
  transition: all var(--duration) var(--easing);
}

.app-refreshed .btn-history:hover {
  background: var(--bg-elevated);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.app-refreshed .daily-date-badge {
  color: var(--accent-gold);
  background: rgba(212, 163, 115, 0.08);
  border: 1px solid rgba(212, 163, 115, 0.15);
  border-radius: var(--radius-full);
  font-weight: 600;
}

.app-refreshed .daily-section-divider {
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent-gold);
  border-radius: var(--radius-md);
}

/* ---- Mock Timer ---- */
.app-refreshed .mock-timer-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.app-refreshed .timer-timer {
  font-family: var(--font-mono);
  color: var(--accent-gold);
  font-weight: 600;
}

.app-refreshed .timer-progress {
  background: var(--border);
  border-radius: var(--radius-full);
}

.app-refreshed .progress-fill {
  background: var(--accent-gold);
}

/* ---- Mock Config / Analysis ---- */
.app-refreshed .mock-config-view {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.app-refreshed .topic-checkbox-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--easing);
}

.app-refreshed .topic-checkbox-item:hover {
  background: var(--bg-elevated-hover);
  border-color: var(--border-light);
}

.app-refreshed .topic-checkbox-item.checked {
  border-color: var(--accent-gold);
  background: rgba(212, 163, 115, 0.08);
}

.app-refreshed .checkbox-circle {
  border-color: var(--border-light);
}

.app-refreshed .topic-checkbox-item.checked .checkbox-circle {
  border-color: var(--accent-gold);
  background: var(--accent-gold);
}

.app-refreshed .mock-filter-bar {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.app-refreshed .mock-filter-label {
  color: var(--text-muted);
  font-weight: 600;
  border-right-color: var(--border);
}

.app-refreshed .mock-filter-option {
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-weight: 600;
  transition: all var(--duration) var(--easing);
}

.app-refreshed .mock-filter-option:hover:not(.disabled) {
  border-color: var(--border-light);
  color: var(--text-primary);
  background: var(--bg-elevated-hover);
}

.app-refreshed .mock-filter-option.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--bg-deep);
}

.app-refreshed .mock-filter-option.disabled {
  opacity: 0.35;
}

.app-refreshed .mock-analysis-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.app-refreshed .score-circle {
  border-color: var(--accent-gold-dim);
  background: rgba(212, 163, 115, 0.03);
}

.app-refreshed .score-val {
  font-family: var(--font-heading);
  color: var(--text-primary);
}

.app-refreshed .stats-mini-grid {
  gap: 12px;
}

.app-refreshed .stat-box-item {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}

.app-refreshed .stat-box-item .val {
  font-family: var(--font-heading);
  color: var(--text-primary);
}

.app-refreshed .stat-box-item.green {
  border-bottom: 3px solid var(--accent-emerald);
}

.app-refreshed .stat-box-item.red {
  border-bottom: 3px solid var(--accent-coral);
}

.app-refreshed .stat-box-item.gray {
  border-bottom: 3px solid var(--border-light);
}

.app-refreshed .analysis-footer-row {
  border-top-color: var(--border);
}

.app-refreshed .footer-stat {
  color: var(--text-secondary);
}

.app-refreshed .footer-stat strong {
  color: var(--text-primary);
}

/* ---- History List ---- */
.app-refreshed .history-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--duration) var(--easing);
}

.app-refreshed .history-item:hover {
  background: var(--bg-elevated-hover);
  border-color: var(--accent-gold-dim);
}

.app-refreshed .history-date {
  font-weight: 600;
  color: var(--text-primary);
}

.app-refreshed .history-count {
  color: var(--text-muted);
}

.app-refreshed .history-group-header {
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.08em;
}

/* ---- Year Pills ---- */
.app-refreshed .year-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-weight: 600;
  transition: all var(--duration) var(--easing);
}

.app-refreshed .year-pill.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--bg-deep);
}

/* ---- Dictionary Popup ---- */
.app-refreshed .dictionary-popup {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.app-refreshed .dict-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.app-refreshed .dict-word {
  font-family: var(--font-heading);
  color: var(--accent-gold);
  font-weight: 700;
}

/* ---- Toast ---- */
.app-refreshed .toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.app-refreshed .toast.success {
  border-left: 3px solid var(--accent-gold);
}

.app-refreshed .toast.error {
  border-left: 3px solid var(--accent-coral);
}

/* ---- Bookmark UI ---- */
.app-refreshed .bookmark-modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.app-refreshed .bookmark-group-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--easing);
}

.app-refreshed .bookmark-group-item:hover {
  background: var(--bg-elevated-hover);
  border-color: var(--accent-gold-dim);
}

.app-refreshed .bookmark-group-item.active {
  border-color: var(--accent-gold);
  background: rgba(212, 163, 115, 0.08);
}

/* ---- Vocab Layout ---- */
.app-refreshed .vocab-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
}

.app-refreshed .vocab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.app-refreshed .vocab-header h1 {
  margin: 0;
}

.app-refreshed .vocab-header p {
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.app-refreshed .vocab-stats {
  display: flex;
  gap: 2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.app-refreshed .vocab-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 50vh;
  text-align: center;
}

.app-refreshed .vocab-empty h2 {
  margin-bottom: 1rem;
  color: var(--accent-gold-light);
}

.app-refreshed .vocab-empty p {
  max-width: 400px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.app-refreshed .vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.app-refreshed .vocab-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-refreshed .vocab-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: 0.2s;
}

.app-refreshed .vocab-delete-btn:hover {
  color: var(--accent-coral);
  background: rgba(196, 84, 90, 0.1);
}

.app-refreshed .vocab-date {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

/* ---- Vocab UI ---- */
.app-refreshed .vocab-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration) var(--easing);
}

.app-refreshed .vocab-card:hover {
  border-color: rgba(212, 163, 115, 0.25);
  box-shadow: var(--shadow-md);
}

.app-refreshed .vocab-word {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-primary);
}

.app-refreshed .vocab-pos {
  background: rgba(212, 163, 115, 0.08);
  color: var(--accent-gold);
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.app-refreshed .vocab-def {
  color: var(--text-secondary);
}

.app-refreshed .vocab-ex {
  color: var(--text-muted);
  border-left-color: var(--border);
}

/* ---- Home Feature Cards ---- */
.app-refreshed .home-hero-title-block {
  text-align: center;
}

.app-refreshed .home-welcome-title {
  font-family: var(--font-heading);
  font-weight: 700;
  background: none;
  -webkit-text-fill-color: var(--text-primary);
  color: var(--text-primary);
}

.app-refreshed .home-hero-subtitle {
  color: var(--text-secondary);
  font-weight: 400;
}

.app-refreshed .feature-item {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.4s var(--easing);
}

.app-refreshed .feature-item::before {
  background: linear-gradient(90deg, var(--accent-gold-dim), var(--accent-gold)) !important;
  height: 2px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.app-refreshed .feature-item::after {
  border-color: var(--border);
}

.app-refreshed .feature-item:hover {
  box-shadow: 0 0 32px rgba(212, 163, 115, 0.08), var(--shadow-md) !important;
  border-color: rgba(212, 163, 115, 0.2);
  transform: translateY(-2px);
}

.app-refreshed .feature-icon {
  border-radius: var(--radius-sm);
}

.app-refreshed .feature-icon.qa {
  background: rgba(212, 163, 115, 0.12);
  border-color: rgba(212, 163, 115, 0.2);
  color: var(--accent-gold);
}

.app-refreshed .feature-icon.dilr {
  background: var(--accent-sky-bg);
  border-color: rgba(90, 143, 168, 0.2);
  color: var(--accent-sky);
}

.app-refreshed .feature-icon.varc {
  background: var(--accent-coral-bg);
  border-color: rgba(196, 84, 90, 0.2);
  color: var(--accent-coral);
}

.app-refreshed .feature-icon.dict {
  background: var(--accent-emerald-bg);
  border-color: rgba(61, 138, 106, 0.2);
  color: var(--accent-emerald);
}

.app-refreshed .feature-item h3 {
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--text-primary);
}

.app-refreshed .feature-item p {
  color: var(--text-secondary);
}

/* Extension card overrides */
.app-refreshed .feature-ext-link {
  color: var(--accent-gold) !important;
}
.app-refreshed .feature-ext-link:hover {
  color: var(--accent-gold-light) !important;
}

.app-refreshed .extension-banner {
  background: linear-gradient(135deg, #1a0f2e 0%, #0d1b2a 30%, #1b2838 60%, #162032 100%);
  border-color: rgba(139, 92, 246, 0.35);
}
.app-refreshed .extension-banner-icon {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(212, 163, 115, 0.2));
  border-color: rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
}
.app-refreshed .extension-banner-title-row strong {
  color: #f0eaff;
}
.app-refreshed .extension-banner-text > span {
  color: #b8b0c8;
}
.app-refreshed .extension-install-btn {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa) !important;
  color: #fff !important;
}
.app-refreshed .extension-install-btn:hover {
  background: linear-gradient(135deg, #7c3aed, #8b5cf6) !important;
}
.app-refreshed .extension-dismiss-btn {
  color: #8b8099;
}
.app-refreshed .extension-dismiss-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
}

/* ---- Dashboard Teaser ---- */
.app-refreshed .dashboard-teaser {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.app-refreshed .dashboard-teaser h2 {
  font-family: var(--font-heading);
  background: none;
  -webkit-text-fill-color: var(--text-primary);
  color: var(--text-primary);
}

.app-refreshed .teaser-visual {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.app-refreshed .teaser-bar {
  background: var(--border);
  border-radius: var(--radius-full);
}

.app-refreshed .teaser-bar-fill {
  background: linear-gradient(90deg, var(--accent-gold-dim), var(--accent-gold));
}

.app-refreshed .teaser-bar-label {
  color: var(--text-muted);
}

.app-refreshed .teaser-mock-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.app-refreshed .teaser-mock-score {
  font-family: var(--font-heading);
  color: var(--accent-gold);
  font-weight: 700;
}

.app-refreshed .teaser-mock-label {
  color: var(--text-muted);
}

.app-refreshed .teaser-bullet-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--duration) var(--easing);
}

.app-refreshed .teaser-bullet-item:hover {
  background: var(--bg-elevated-hover);
  border-color: var(--accent-gold-dim);
}

.app-refreshed .teaser-bullet-icon {
  background: rgba(212, 163, 115, 0.08);
  border: 1px solid rgba(212, 163, 115, 0.15);
  color: var(--accent-gold);
}

.app-refreshed .teaser-bullet-text {
  font-weight: 500;
}

/* ---- CTA Section ---- */
.app-refreshed .home-cta-section {
  background: var(--bg-surface);
  border: 1px solid var(--accent-gold-dim);
  border-radius: var(--radius-xl);
}

.app-refreshed .home-cta-section h2 {
  font-family: var(--font-heading);
}

.app-refreshed .home-cta-section p {
  color: var(--text-secondary);
}

/* ---- Start Practice Button ---- */
.app-refreshed .start-practice-btn {
  font-family: var(--font-body) !important;
  font-weight: 600 !important;
  border-radius: var(--radius-sm) !important;
}

.app-refreshed .start-practice-btn::before {
  background: linear-gradient(135deg, var(--accent-gold-dim), var(--accent-gold), var(--accent-gold-dim)) !important;
}

@keyframes ctaPulse {
  0% { box-shadow: 0 0 6px rgba(212, 163, 115, 0.1), 0 0 0 0 rgba(212, 163, 115, 0.05); }
  50% { box-shadow: 0 0 20px rgba(212, 163, 115, 0.15), 0 0 0 8px rgba(212, 163, 115, 0.03); }
  100% { box-shadow: 0 0 6px rgba(212, 163, 115, 0.1), 0 0 0 0 rgba(212, 163, 115, 0.05); }
}

/* ---- Nudge Modal ---- */
.app-refreshed .nudge-content h2 {
  font-family: var(--font-heading);
}

.app-refreshed .nudge-body {
  color: var(--text-secondary);
}

/* ---- Animations ---- */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.app-refreshed .animate-fade-in {
  animation: fadeIn 0.5s var(--easing) forwards;
}

/* ---- Scrollbar ---- */
.app-refreshed ::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.app-refreshed ::-webkit-scrollbar-track {
  background: transparent;
}

.app-refreshed ::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.app-refreshed ::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .app-refreshed .sidebar {
    position: fixed;
    left: -300px;
    transition: left 0.3s var(--easing);
    box-shadow: 20px 0 60px rgba(0,0,0,0.5);
  }

  .app-refreshed .sidebar.open {
    left: 0;
  }
}

/* ---- Guest Nudge style fixes ---- */
.app-refreshed #guest-nudge-modal .btn-premium {
  justify-content: center;
}

/* ---- Mock topic options grid style fix ---- */
.app-refreshed .topic-checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- Feedback Tab (clip-path concave left edge) ---- */
.feedback-tab {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 9999;
  cursor: pointer;
  user-select: none;
  width: 44px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  writing-mode: vertical-rl;
  padding-left: 14px;
  padding-right: 4px;
  color: #000000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.6px;
  background-color: var(--accent-gold);
  border: none;
  margin: 0;
  clip-path: path('M 44 0 Q 12 0 12 25 L 12 115 Q 12 140 44 140 Z');
  transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}
.feedback-tab:hover {
  transform: translateY(-50%) translateX(-4px);
}

/* ---- Feedback FAB (mobile only) ---- */
.feedback-fab {
  display: none;
}
@media (max-width: 768px) {
  .feedback-tab {
    display: none;
  }
  .feedback-fab {
    display: flex;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-gold);
    color: #000000;
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  }
  .feedback-fab:hover {
    transform: scale(1.08);
  }
}

.feedback-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.feedback-overlay.active {
  display: flex;
}
.feedback-dialog {
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  animation: feedbackSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes feedbackSlideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.feedback-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.feedback-dialog-header h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}
.feedback-close-btn {
  width: 30px;
  height: 30px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.feedback-close-btn:hover {
  background: var(--accent-coral-bg);
  border-color: rgba(196, 84, 90, 0.3);
  color: var(--accent-coral);
}
.feedback-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 6px 24px 0;
  line-height: 1.5;
}
.feedback-textarea {
  width: calc(100% - 48px);
  margin: 16px 24px 0;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.3s ease;
}
.feedback-textarea:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px var(--accent-gold-glow);
}
.feedback-textarea::placeholder {
  color: var(--text-muted);
}
.feedback-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px 20px;
}
.feedback-char-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.feedback-submit-btn {
  padding: 8px 24px;
  background: var(--accent-gold);
  color: var(--bg-deep);
  border: none;
  border-radius: 6px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.25s ease;
}
.feedback-submit-btn:hover {
  background: var(--accent-gold-light);
}
.feedback-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.app-refreshed .feedback-toast {
  position: fixed;
  bottom: 80px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 1001;
  animation: feedbackSlideUp 0.3s ease forwards;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.feedback-toast.success {
  background: var(--bg-surface);
  color: var(--accent-emerald);
  border: 1px solid rgba(61, 138, 106, 0.3);
}
.feedback-toast.error {
  background: var(--bg-surface);
  color: var(--accent-coral);
  border: 1px solid rgba(196, 84, 90, 0.3);
}
