/* =============================================
   TOEFL PREP HUB - Global Stylesheet
   ============================================= */

   :root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #818cf8;
    --secondary: #06b6d4;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface2: #f1f5f9;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.14);
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  }
  
  * { box-sizing: border-box; margin: 0; padding: 0; }
  
  html { scroll-behavior: smooth; }
  
  body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
  }
  
  /* ---- NAVBAR ---- */
  .navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  }
  
  .nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
  }
  
  .nav-logo span { color: var(--text); }
  
  .nav-links {
    display: flex;
    gap: 8px;
    list-style: none;
  }
  
  .nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0.95rem;
  }
  
  .nav-links a:hover, .nav-links a.active {
    background: var(--primary);
    color: white;
  }
  
  .nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
  }
  
  /* ---- AD BANNER ---- */
  .ad-banner {
    background: linear-gradient(135deg, #e0e7ff, #f0fdfa);
    border: 1px dashed var(--primary-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  
  .ad-banner-top {
    width: 100%;
    height: 90px;
    margin-bottom: 16px;
  }
  
  .ad-banner-sidebar {
    width: 100%;
    height: 250px;
    margin-bottom: 16px;
  }
  
  /* ---- VIDEO AD OVERLAY ---- */
  .video-ad-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 24px;
  }
  
  .video-ad-box {
    background: #111;
    border-radius: var(--radius);
    width: min(640px, 95vw);
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
  }
  
  .video-ad-label {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
  }
  
  .video-ad-placeholder {
    text-align: center;
    color: #aaa;
  }
  
  .video-ad-placeholder .ad-icon { font-size: 3rem; margin-bottom: 8px; }
  .video-ad-placeholder p { font-size: 0.85rem; }
  
  .video-ad-timer {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .skip-btn {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 10px 28px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
    display: none;
  }
  
  .skip-btn:hover { background: rgba(255,255,255,0.25); }
  .skip-btn.visible { display: inline-block; }
  
  /* ---- BUTTONS ---- */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
  }
  
  .btn-primary {
    background: var(--primary);
    color: white;
  }
  .btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(79,70,229,0.35); }
  
  .btn-secondary {
    background: var(--surface);
    color: var(--primary);
    border: 2px solid var(--primary);
  }
  .btn-secondary:hover { background: var(--primary); color: white; }
  
  .btn-success {
    background: var(--success);
    color: white;
  }
  .btn-success:hover { background: #059669; }
  
  .btn-sm { padding: 8px 18px; font-size: 0.875rem; }
  .btn-lg { padding: 16px 40px; font-size: 1.1rem; }
  
  /* ---- CARDS ---- */
  .card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    border: 1px solid var(--border);
  }
  
  .card-hover {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
  }
  .card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
  
  /* ---- PROGRESS BAR ---- */
  .progress-bar-wrap {
    background: var(--border);
    border-radius: 99px;
    height: 8px;
    overflow: hidden;
  }
  
  .progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 99px;
    transition: width 0.4s ease;
  }
  
  /* ---- TIMER ---- */
  .timer-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--text);
    color: white;
    padding: 8px 20px;
    border-radius: 99px;
    font-size: 1.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }
  
  .timer-display.warning { background: var(--warning); }
  .timer-display.danger { background: var(--danger); animation: pulse 1s infinite; }
  
  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
  }
  
  /* ---- TIP BOX ---- */
  .tip-box {
    background: linear-gradient(135deg, #eff6ff, #f0fdf4);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 20px 24px;
    margin: 20px 0;
  }
  
  .tip-box h3 { color: var(--primary); margin-bottom: 10px; font-size: 1rem; }
  .tip-box ul { padding-left: 20px; }
  .tip-box li { margin-bottom: 6px; font-size: 0.92rem; color: var(--text-muted); }
  
  /* ---- SECTION INTRO ---- */
  .section-intro {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border-radius: var(--radius);
    padding: 36px 40px;
    margin-bottom: 28px;
  }
  
  .section-intro h1 { font-size: 1.9rem; margin-bottom: 10px; }
  .section-intro p { opacity: 0.9; font-size: 1rem; max-width: 600px; }
  
  .section-intro .badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
  
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 5px 14px;
    border-radius: 99px;
    font-size: 0.82rem;
    font-weight: 600;
  }
  
  /* ---- QUESTION CARD ---- */
  .question-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
  }
  
  .question-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 14px;
  }
  
  .question-text { font-size: 1.05rem; font-weight: 500; margin-bottom: 20px; line-height: 1.7; }
  
  /* ---- ANSWER OPTIONS ---- */
  .options-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
  
  .option-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.18s;
    font-size: 0.97rem;
  }
  
  .option-item:hover { border-color: var(--primary-light); background: #f5f3ff; }
  .option-item.selected { border-color: var(--primary); background: #ede9fe; }
  .option-item.correct { border-color: var(--success); background: #d1fae5; }
  .option-item.incorrect { border-color: var(--danger); background: #fee2e2; }
  
  .option-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 50%;
    background: var(--border);
    font-weight: 700;
    font-size: 0.8rem;
    transition: all 0.18s;
  }
  
  .option-item.selected .option-letter { background: var(--primary); color: white; }
  .option-item.correct .option-letter { background: var(--success); color: white; }
  .option-item.incorrect .option-letter { background: var(--danger); color: white; }
  
  /* ---- FEEDBACK ---- */
  .feedback-panel {
    border-radius: var(--radius-sm);
    padding: 20px 24px;
    margin-top: 16px;
    display: none;
  }
  
  .feedback-panel.show { display: block; }
  .feedback-panel.correct { background: #d1fae5; border-left: 4px solid var(--success); }
  .feedback-panel.incorrect { background: #fee2e2; border-left: 4px solid var(--danger); }
  .feedback-panel.partial { background: #fef3c7; border-left: 4px solid var(--warning); }
  
  .feedback-panel h4 { margin-bottom: 6px; font-size: 1rem; }
  .feedback-panel p { font-size: 0.92rem; color: var(--text-muted); }
  
  /* ---- WRITING AREA ---- */
  .writing-area {
    width: 100%;
    min-height: 200px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.7;
    resize: vertical;
    transition: border-color 0.2s;
    color: var(--text);
    background: var(--surface);
  }
  
  .writing-area:focus { outline: none; border-color: var(--primary); }
  
  .word-count-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
  }
  
  .word-count-num { font-weight: 700; color: var(--primary); }
  
  /* ---- DRAG & DROP (Build a Sentence) ---- */
  .sentence-context {
    background: var(--surface2);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 18px;
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.95rem;
    border-left: 3px solid var(--secondary);
  }
  
  .drop-zone {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 56px;
    background: var(--surface2);
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 18px;
    align-items: center;
    transition: border-color 0.2s;
  }
  
  .drop-zone.drag-over { border-color: var(--primary); background: #ede9fe; }
  
  .word-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
  }
  
  .word-chip {
    background: var(--primary);
    color: white;
    padding: 7px 16px;
    border-radius: 99px;
    cursor: grab;
    font-size: 0.9rem;
    font-weight: 500;
    user-select: none;
    transition: all 0.15s;
    border: 2px solid transparent;
  }
  
  .word-chip:hover { background: var(--primary-dark); transform: translateY(-1px); }
  .word-chip.placed { background: var(--surface); color: var(--primary); border: 2px solid var(--primary); }
  .word-chip.extra { background: var(--text-muted); }
  .word-chip:active { cursor: grabbing; }
  
  /* ---- COMPLETE THE WORDS ---- */
  .cloze-text { font-size: 1.05rem; line-height: 2.2; }
  
  .cloze-input {
    display: inline-block;
    border: none;
    border-bottom: 2px solid var(--primary);
    background: transparent;
    font-family: var(--font);
    font-size: 1rem;
    color: var(--primary);
    font-weight: 600;
    text-align: center;
    padding: 0 4px;
    min-width: 60px;
    transition: border-color 0.2s;
  }
  
  .cloze-input:focus { outline: none; border-bottom-color: var(--secondary); }
  .cloze-input.correct-ans { border-bottom-color: var(--success); color: var(--success); }
  .cloze-input.wrong-ans { border-bottom-color: var(--danger); color: var(--danger); }
  
  /* ---- SCORE DISPLAY ---- */
  .score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) 0%, var(--surface2) 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0 auto 24px;
  }
  
  .score-inner {
    width: 110px;
    height: 110px;
    background: var(--surface);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  
  .score-num { font-size: 2rem; font-weight: 800; color: var(--primary); }
  .score-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
  
  /* ---- LAYOUT ---- */
  .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
  }
  
  .page-wrap { padding: 32px 0; }
  
  .two-col {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 28px;
    align-items: start;
  }
  
  .sidebar { display: flex; flex-direction: column; gap: 16px; }
  
  /* ---- STEP NAV ---- */
  .step-nav {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 28px;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  
  .step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--text-muted);
    background: var(--surface2);
    border: 1px solid var(--border);
  }
  
  .step + .step { margin-left: 4px; }
  .step.active { background: var(--primary); color: white; border-color: var(--primary); }
  .step.done { background: var(--success); color: white; border-color: var(--success); }
  
  /* ---- INTRO MODAL ---- */
  .intro-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  
  .intro-modal {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 620px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
  }
  
  .intro-modal h2 { font-size: 1.5rem; color: var(--primary); margin-bottom: 12px; }
  .intro-modal .task-type-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 4px 14px;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 20px;
  }
  
  .intro-checklist { list-style: none; margin: 16px 0; }
  .intro-checklist li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.93rem;
  }
  .intro-checklist li:last-child { border: none; }
  .intro-checklist .check-icon { color: var(--success); font-size: 1rem; margin-top: 1px; flex-shrink: 0; }
  
  /* ---- FOOTER ---- */
  footer {
    background: var(--text);
    color: #cbd5e1;
    text-align: center;
    padding: 24px;
    font-size: 0.85rem;
    margin-top: 60px;
  }
  
  footer a { color: var(--primary-light); text-decoration: none; }
  
  /* ---- HERO (index.html) ---- */
  .hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--secondary) 100%);
    color: white;
    padding: 80px 20px;
    text-align: center;
  }
  
  .hero h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; margin-bottom: 16px; }
  .hero p { font-size: 1.15rem; opacity: 0.9; max-width: 600px; margin: 0 auto 32px; }
  .hero .btn-group { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
  
  .hero-btn-white {
    background: white;
    color: var(--primary);
    font-weight: 700;
    padding: 14px 36px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
  .hero-btn-white:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.2); }
  
  .hero-btn-outline {
    background: transparent;
    color: white;
    border: 2px solid rgba(255,255,255,0.6);
    font-weight: 600;
    padding: 14px 36px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
  .hero-btn-outline:hover { background: rgba(255,255,255,0.15); border-color: white; }
  
  /* ---- SECTION CARDS (index) ---- */
  .sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    padding: 48px 20px;
    max-width: 1200px;
    margin: 0 auto;
  }
  
  .section-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px 28px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    display: block;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
  }
  
  .section-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
  }
  
  .section-card.reading::before { background: linear-gradient(90deg, #4f46e5, #818cf8); }
  .section-card.writing::before { background: linear-gradient(90deg, #06b6d4, #67e8f9); }
  .section-card.mock::before { background: linear-gradient(90deg, #f59e0b, #fcd34d); }
  
  .section-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
  
  .section-card .icon { font-size: 2.5rem; margin-bottom: 16px; }
  .section-card h2 { font-size: 1.3rem; margin-bottom: 8px; }
  .section-card p { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 20px; }
  .section-card .meta { display: flex; gap: 12px; flex-wrap: wrap; }
  .section-card .meta span {
    background: var(--surface2);
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
  }
  
  /* ---- STATS BAR ---- */
  .stats-bar {
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 24px 20px;
    display: flex;
    justify-content: center;
    gap: 60px;
    flex-wrap: wrap;
  }
  
  .stat { text-align: center; }
  .stat .num { font-size: 2rem; font-weight: 800; color: var(--primary); }
  .stat .lbl { font-size: 0.82rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
  
  /* ---- RESPONSIVE ---- */
  @media (max-width: 768px) {
    .nav-links { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px; gap: 4px; }
    .nav-links.open { display: flex; }
    .nav-toggle { display: block; }
    .two-col { grid-template-columns: 1fr; }
    .sidebar { order: -1; }
    .stats-bar { gap: 32px; }
    .section-intro { padding: 24px 20px; }
    .section-intro h1 { font-size: 1.5rem; }
    .intro-modal { padding: 24px; }
    .hero { padding: 48px 20px; }
    .question-card { padding: 20px; }
  }
  
  @media (max-width: 480px) {
    .step-nav { gap: 4px; }
    .step { padding: 8px 12px; font-size: 0.78rem; }
  }