/* JUNYSAM ENGLISH — Modern Commercial EdTech Style Suite */

:root {
      --font-scale: 1.0;
      --font-base: calc(15px * var(--font-scale));
      
      /* 2026 Modern Commercial EdTech Palette */
      --primary: #4338ca;
      --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
      --primary-light: #eef2ff;
      --secondary: #d97706;
      --accent: #059669;
      --accent-gradient: linear-gradient(135deg, #10b981 0%, #047857 100%);
      --coral: #e11d48;
      --dark: #0f172a;
      --slate: #334155;
      --muted: #64748b;
      --light-bg: #f8fafc;
      --card-bg: #ffffff;
      --border: #e2e8f0;
      
      --shadow-sm: 0 1px 4px rgba(15, 23, 42, 0.05);
      --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
      --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.1);
      --shadow-hover: 0 16px 36px rgba(67, 56, 202, 0.16);
      
      --radius-sm: 8px;
      --radius-md: 14px;
      --radius-lg: 20px;
    }

    /* Font Scale Classes */
    html.font-sm { --font-scale: 0.9; }
    html.font-md { --font-scale: 1.0; }
    html.font-lg { --font-scale: 1.15; }
    html.font-xl { --font-scale: 1.3; }

    * { box-sizing: border-box; margin: 0; padding: 0; }
    body {
      font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
      background: var(--light-bg);
      color: var(--dark);
      font-size: var(--font-base);
      line-height: 1.5;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      -webkit-font-smoothing: antialiased;
    }

    /* Header (Natural Scrolling, Non-Sticky for Vertical Real Estate) */
    header {
      background: #ffffff;
      border-bottom: 1px solid var(--border);
      position: relative;
      z-index: 10;
      box-shadow: var(--shadow-sm);
    }
    .header-inner {
      max-width: 1240px;
      margin: 0 auto;
      padding: 14px 20px 10px 20px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .header-top-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
    }
    .header-nav-row {
      width: 100%;
      border-top: 1px solid #f1f5f9;
      padding-top: 8px;
    }
    .brand {
      display: flex;
      align-items: center;
      gap: 12px;
      text-decoration: none;
      color: inherit;
      cursor: pointer;
    }
    .brand-icon {
      width: 42px;
      height: 42px;
      background: var(--primary-gradient);
      color: #ffffff;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 4px 10px rgba(67, 56, 202, 0.25);
      transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .brand:hover .brand-icon {
      transform: scale(1.05);
    }
    .brand-text h1 {
      font-size: calc(18px * var(--font-scale));
      font-weight: 900;
      color: var(--dark);
      letter-spacing: -0.4px;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .brand-text p {
      font-size: calc(12px * var(--font-scale));
      color: var(--muted);
      font-weight: 600;
    }

    /* Font Size Widget in Controls Toolbar */
    .font-size-widget {
      background: #f1f5f9;
      padding: 3px 4px;
      border-radius: var(--radius-sm);
      display: flex;
      align-items: center;
      gap: 2px;
      margin-left: auto;
    }
    .font-size-widget span.label {
      font-size: 11px;
      font-weight: 700;
      color: var(--muted);
      padding: 0 6px;
    }
    .font-btn {
      padding: 4px 8px;
      font-size: 12px;
      font-weight: 700;
      border: none;
      background: transparent;
      color: var(--slate);
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .font-btn:hover { background: #e2e8f0; }
    .font-btn.active {
      background: #ffffff;
      color: var(--primary);
      box-shadow: var(--shadow-sm);
    }

    /* Course Navigation Tabs */
    .nav-tabs {
      display: flex;
      gap: 8px;
      background: #f1f5f9;
      padding: 5px;
      border-radius: var(--radius-md);
      overflow-x: auto;
      width: 100%;
    }
    .nav-tab-btn {
      padding: 9px 16px;
      font-size: calc(13px * var(--font-scale));
      font-weight: 800;
      border: none;
      background: transparent;
      color: var(--slate);
      border-radius: var(--radius-sm);
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .nav-tab-btn:hover {
      background: rgba(255, 255, 255, 0.7);
      color: var(--primary);
      transform: translateY(-1px);
    }
    .nav-tab-btn.active {
      background: #ffffff;
      color: var(--primary);
      box-shadow: var(--shadow-sm);
      transform: translateY(-1px);
    }
    .nav-tab-btn .badge-num {
      font-size: 10px;
      background: #e2e8f0;
      padding: 2px 6px;
      border-radius: 10px;
      font-weight: 800;
    }
    .nav-tab-btn.active .badge-num {
      background: var(--primary-light);
      color: var(--primary);
    }

    /* Main Container */
    main {
      flex: 1;
      max-width: 1240px;
      width: 100%;
      margin: 0 auto;
      padding: 24px 20px 60px 20px;
    }

    /* Hero Banner (Trendy Gradient & Glass Cards) */
    .course-hero {
      background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
      color: #ffffff;
      border-radius: var(--radius-lg);
      padding: 26px 32px;
      margin-bottom: 24px;
      box-shadow: var(--shadow-md);
      position: relative;
      overflow: hidden;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 20px;
    }
    .hero-text h2 {
      font-size: calc(24px * var(--font-scale));
      font-weight: 900;
      letter-spacing: -0.5px;
      margin-bottom: 6px;
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .hero-text p {
      font-size: calc(14px * var(--font-scale));
      opacity: 0.92;
      max-width: 650px;
      margin-bottom: 16px;
      line-height: 1.6;
    }
    .hero-stats {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
    }
    .stat-pill {
      background: rgba(255, 255, 255, 0.16);
      backdrop-filter: blur(8px);
      padding: 8px 16px;
      border-radius: 12px;
      font-size: calc(13px * var(--font-scale));
      font-weight: 600;
      border: 1px solid rgba(255, 255, 255, 0.2);
    }
    .stat-pill strong {
      font-size: calc(15px * var(--font-scale));
      font-weight: 900;
      margin-left: 4px;
      color: #fef08a;
    }

    /* Print Quick Launcher Card */
    .print-launcher-box {
      background: rgba(255, 255, 255, 0.18);
      backdrop-filter: blur(12px);
      border: 1px solid rgba(255, 255, 255, 0.3);
      padding: 16px 20px;
      border-radius: var(--radius-md);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      text-align: center;
      box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    .btn-open-print {
      background: #fef08a;
      color: #854d0e;
      border: none;
      padding: 10px 18px;
      font-size: calc(14px * var(--font-scale));
      font-weight: 800;
      border-radius: 12px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 8px;
      box-shadow: 0 4px 12px rgba(234, 179, 8, 0.3);
      transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .btn-open-print:hover {
      transform: translateY(-2px) scale(1.03);
      background: #ffffff;
      color: #4f46e5;
    }

    /* Controls Bar: Day Selector & Modern Mode Switchers */
    .controls-wrapper {
      background: #ffffff;
      border-radius: var(--radius-md);
      border: 1px solid var(--border);
      padding: 16px 20px;
      margin-bottom: 24px;
      box-shadow: var(--shadow-sm);
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 16px;
    }
    .day-selector-group {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .day-selector-group label {
      font-size: calc(13px * var(--font-scale));
      font-weight: 800;
      color: var(--slate);
    }
    .day-select {
      padding: 9px 14px;
      border-radius: var(--radius-sm);
      border: 1.5px solid var(--border);
      font-size: calc(14px * var(--font-scale));
      font-weight: 800;
      background: #ffffff;
      color: var(--dark);
      outline: none;
      cursor: pointer;
      transition: border-color 0.15s;
    }
    .day-select:focus { border-color: var(--primary); }
    .day-nav-btn {
      width: 36px;
      height: 36px;
      border-radius: var(--radius-sm);
      border: 1.5px solid var(--border);
      background: #ffffff;
      color: var(--slate);
      font-size: 16px;
      font-weight: 800;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.15s;
    }
    .day-nav-btn:hover {
      background: #f1f5f9;
      color: var(--primary);
      border-color: var(--primary);
    }

    /* Mode Pill Buttons */
    .mode-btn-group {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }
    .mode-btn {
      padding: 9px 16px;
      border-radius: var(--radius-sm);
      border: 1.5px solid var(--border);
      background: #f8fafc;
      font-size: calc(13px * var(--font-scale));
      font-weight: 800;
      color: var(--slate);
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .mode-btn:hover {
      background: #ffffff;
      border-color: var(--primary);
      color: var(--primary);
      transform: translateY(-1px);
    }
    .mode-btn.active {
      background: var(--primary-gradient);
      border-color: transparent;
      color: #ffffff;
      box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
      transform: translateY(-1px);
    }

    /* Content Area */
    .mode-container {
      display: none;
    }
    .mode-container.active {
      display: block;
      animation: fadeIn 0.25s ease-in-out;
    }
    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(8px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* ------------------------------------------------------------- */
    /* MODE 1: FLASHCARDS (3D Interactive Cards)                    */
    /* ------------------------------------------------------------- */
    .flashcard-wrapper {
      display: flex;
      flex-direction: column;
      align-items: center;
      max-width: 680px;
      margin: 0 auto;
    }
    .card-meta-bar {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 12px;
      font-size: calc(13px * var(--font-scale));
      color: var(--muted);
      font-weight: 700;
    }
    .card-scene {
      width: 100%;
      height: 380px;
      perspective: 1200px;
      cursor: pointer;
      user-select: none;
    }
    .flashcard {
      width: 100%;
      height: 100%;
      position: relative;
      transform-style: preserve-3d;
      transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-lg);
    }
    .flashcard.is-flipped {
      transform: rotateY(180deg);
    }
    .card-face {
      position: absolute;
      width: 100%;
      height: 100%;
      backface-visibility: hidden;
      border-radius: var(--radius-lg);
      padding: 36px 32px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      align-items: center;
      background: #ffffff;
      border: 2px solid var(--border);
      text-align: center;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .card-face:hover {
      border-color: #c7d2fe;
      box-shadow: var(--shadow-hover);
    }
    .card-face-back {
      transform: rotateY(180deg);
      background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
      border-color: #86efac;
    }

    .pos-badge {
      background: var(--primary-light);
      color: var(--primary);
      padding: 4px 10px;
      border-radius: 8px;
      font-size: calc(12px * var(--font-scale));
      font-weight: 800;
      white-space: nowrap !important;
      display: inline-block;
    }
    .word-main {
      font-size: calc(44px * var(--font-scale));
      font-weight: 900;
      color: var(--dark);
      letter-spacing: -0.8px;
      margin: 12px 0 6px 0;
    }
    .pronounce-btn {
      background: #f1f5f9;
      border: 1px solid var(--border);
      padding: 8px 16px;
      border-radius: 20px;
      font-size: calc(13px * var(--font-scale));
      font-weight: 700;
      color: var(--slate);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: all 0.2s;
    }
    .pronounce-btn:hover {
      background: var(--primary-light);
      color: var(--primary);
      transform: scale(1.04);
    }
    .flip-hint {
      font-size: calc(13px * var(--font-scale));
      color: var(--muted);
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .meaning-main {
      font-size: calc(34px * var(--font-scale));
      font-weight: 900;
      color: #15803d;
      margin-bottom: 14px;
    }
    .example-box {
      background: rgba(255, 255, 255, 0.9);
      border: 1.5px solid #bbf7d0;
      padding: 16px 20px;
      border-radius: 14px;
      width: 100%;
      text-align: left;
      box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    }
    .example-en {
      font-size: calc(16px * var(--font-scale));
      font-weight: 700;
      color: var(--dark);
      margin-bottom: 6px;
      line-height: 1.4;
    }
    .example-ko {
      font-size: calc(14px * var(--font-scale));
      color: var(--slate);
      font-weight: 600;
    }
    .relation-tag {
      margin-top: 10px;
      font-size: calc(12px * var(--font-scale));
      color: var(--primary);
      font-weight: 800;
    }

    /* Card Actions */
    .card-actions {
      display: flex;
      gap: 12px;
      margin-top: 20px;
      width: 100%;
    }
    .btn-action {
      flex: 1;
      padding: 14px 18px;
      border-radius: 14px;
      border: none;
      font-size: calc(15px * var(--font-scale));
      font-weight: 800;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .btn-wrong {
      background: #fee2e2;
      color: #b91c1c;
    }
    .btn-wrong:hover {
      background: #fca5a5;
      color: #991b1b;
      transform: translateY(-2px);
    }
    .btn-know {
      background: #dcfce7;
      color: #15803d;
    }
    .btn-know:hover {
      background: #86efac;
      color: #14532d;
      transform: translateY(-2px);
    }
    .btn-nav-round {
      width: 52px;
      border-radius: 14px;
      background: #ffffff;
      border: 1.5px solid var(--border);
      color: var(--slate);
      font-size: 18px;
      font-weight: 800;
      cursor: pointer;
      transition: all 0.15s;
    }
    .btn-nav-round:hover {
      background: #f1f5f9;
      color: var(--primary);
      border-color: var(--primary);
    }

    /* ------------------------------------------------------------- */
    /* MODE 2: SPEED OX (Game Feel)                                 */
    /* ------------------------------------------------------------- */
    .ox-wrapper {
      max-width: 600px;
      margin: 0 auto;
      text-align: center;
    }
    .ox-card {
      background: #ffffff;
      border: 2px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 44px 28px;
      box-shadow: var(--shadow-md);
      margin-bottom: 24px;
    }
    .ox-word {
      font-size: calc(42px * var(--font-scale));
      font-weight: 900;
      color: var(--dark);
      margin-bottom: 12px;
    }
    .ox-question {
      font-size: calc(15px * var(--font-scale));
      color: var(--muted);
      font-weight: 700;
      margin-bottom: 16px;
    }
    .ox-meaning-proposal {
      font-size: calc(28px * var(--font-scale));
      font-weight: 900;
      color: var(--primary);
      padding: 14px 24px;
      background: var(--primary-light);
      border-radius: 14px;
      display: inline-block;
      box-shadow: 0 4px 10px rgba(79, 70, 229, 0.1);
    }
    .ox-btn-group {
      display: flex;
      gap: 20px;
      justify-content: center;
    }
    .btn-ox {
      width: 150px;
      height: 96px;
      border-radius: 20px;
      border: 3px solid;
      font-size: 38px;
      font-weight: 900;
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }
    .btn-ox span {
      font-size: calc(14px * var(--font-scale));
      font-weight: 800;
      margin-top: 4px;
    }
    .btn-ox-o {
      background: #f0fdf4;
      border-color: #22c55e;
      color: #16a34a;
    }
    .btn-ox-o:hover {
      background: #22c55e;
      color: #ffffff;
      transform: translateY(-4px) scale(1.04);
      box-shadow: 0 10px 20px rgba(34, 197, 94, 0.3);
    }
    .btn-ox-x {
      background: #fef2f2;
      border-color: #ef4444;
      color: #dc2626;
    }
    .btn-ox-x:hover {
      background: #ef4444;
      color: #ffffff;
      transform: translateY(-4px) scale(1.04);
      box-shadow: 0 10px 20px rgba(239, 68, 68, 0.3);
    }

    /* ------------------------------------------------------------- */
    /* MODE 3: 4-CHOICE QUIZ (Quizlet Style)                        */
    /* ------------------------------------------------------------- */
    .quiz-wrapper {
      max-width: 680px;
      margin: 0 auto;
    }
    .quiz-card {
      background: #ffffff;
      border: 2px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 34px 30px;
      box-shadow: var(--shadow-md);
      margin-bottom: 20px;
    }
    .quiz-q-num {
      font-size: calc(13px * var(--font-scale));
      font-weight: 800;
      color: var(--primary);
      margin-bottom: 8px;
    }
    .quiz-q-title {
      font-size: calc(20px * var(--font-scale));
      font-weight: 800;
      color: var(--dark);
      margin-bottom: 20px;
    }
    .quiz-target-word {
      font-size: calc(38px * var(--font-scale));
      font-weight: 900;
      color: #1e3a8a;
      text-align: center;
      padding: 18px;
      background: #f8fafc;
      border-radius: 16px;
      margin-bottom: 24px;
      border: 1px solid var(--border);
    }
    .quiz-options {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .quiz-opt-btn {
      padding: 16px 22px;
      border-radius: 14px;
      border: 2px solid var(--border);
      background: #ffffff;
      font-size: calc(16px * var(--font-scale));
      font-weight: 700;
      text-align: left;
      cursor: pointer;
      transition: all 0.15s ease;
      display: flex;
      align-items: center;
      gap: 14px;
    }
    .quiz-opt-btn:hover {
      border-color: var(--primary);
      background: var(--primary-light);
      transform: translateX(4px);
    }
    .quiz-opt-btn.correct {
      background: #dcfce7 !important;
      border-color: #22c55e !important;
      color: #15803d !important;
    }
    .quiz-opt-btn.wrong {
      background: #fee2e2 !important;
      border-color: #ef4444 !important;
      color: #b91c1c !important;
    }
    .quiz-feedback-box {
      margin-top: 20px;
      padding: 16px;
      border-radius: 14px;
      font-size: calc(14px * var(--font-scale));
      display: none;
      line-height: 1.5;
    }
    .quiz-next-btn {
      width: 100%;
      padding: 15px;
      background: var(--primary-gradient);
      color: #ffffff;
      border: none;
      border-radius: 14px;
      font-size: calc(16px * var(--font-scale));
      font-weight: 800;
      cursor: pointer;
      margin-top: 16px;
      display: none;
      box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
      transition: transform 0.2s;
    }
    .quiz-next-btn:hover { transform: translateY(-2px); }

    /* ------------------------------------------------------------- */
    /* MODE 4: TYPING DRILL                                         */
    /* ------------------------------------------------------------- */
    .typing-wrapper {
      max-width: 600px;
      margin: 0 auto;
      text-align: center;
    }
    .typing-card {
      background: #ffffff;
      border: 2px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 44px 30px;
      box-shadow: var(--shadow-md);
    }
    .typing-meaning {
      font-size: calc(30px * var(--font-scale));
      font-weight: 900;
      color: var(--dark);
      margin-bottom: 8px;
    }
    .typing-hint {
      font-size: calc(16px * var(--font-scale));
      color: var(--muted);
      font-weight: 700;
      margin-bottom: 24px;
      font-family: monospace;
      letter-spacing: 2px;
    }
    .typing-input {
      width: 100%;
      padding: 16px 20px;
      font-size: calc(26px * var(--font-scale));
      font-weight: 900;
      text-align: center;
      border: 2.5px solid var(--border);
      border-radius: 16px;
      outline: none;
      letter-spacing: 3px;
      margin-bottom: 16px;
      transition: border-color 0.2s;
    }
    .typing-input:focus { border-color: var(--primary); }
    .typing-feedback {
      font-size: calc(15px * var(--font-scale));
      font-weight: 800;
      min-height: 24px;
      margin-bottom: 16px;
    }

    /* ------------------------------------------------------------- */
    /* MODE 5: WORD LIST & SEARCH                                   */
    /* ------------------------------------------------------------- */
    .list-wrapper {
      background: #ffffff;
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 24px;
      box-shadow: var(--shadow-sm);
    }
    .list-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
      flex-wrap: wrap;
      gap: 12px;
    }
    .search-input-box {
      position: relative;
      flex: 1;
      max-width: 400px;
    }
    .search-input-box input {
      width: 100%;
      padding: 11px 16px 11px 40px;
      border-radius: 12px;
      border: 1.5px solid var(--border);
      font-size: calc(14px * var(--font-scale));
      outline: none;
      transition: border-color 0.15s;
    }
    .search-input-box input:focus { border-color: var(--primary); }
    .search-input-box .search-icon {
      position: absolute;
      left: 14px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--muted);
    }
    .word-table {
      width: 100%;
      border-collapse: collapse;
      font-size: calc(14px * var(--font-scale));
    }
    .word-table th {
      background: #f8fafc;
      padding: 12px 14px;
      font-weight: 800;
      color: var(--slate);
      text-align: left;
      border-bottom: 2px solid var(--border);
    }
    .word-table td {
      padding: 12px 14px;
      border-bottom: 1px solid var(--border);
      vertical-align: middle;
    }
    .word-table tr:hover { background: #f8fafc; }
    .btn-mini-star {
      background: transparent;
      border: none;
      font-size: 20px;
      cursor: pointer;
      color: #cbd5e1;
      transition: transform 0.2s;
    }
    .btn-mini-star:hover { transform: scale(1.2); }
    .btn-mini-star.active { color: #f59e0b; }

    /* ------------------------------------------------------------- */
    /* STUDENT PROFILE & CUSTOMIZED LEARNING SYSTEM                  */
    /* ------------------------------------------------------------- */
    .btn-student-profile {
      background: #f1f5f9;
      border: 1.5px solid var(--border);
      padding: 7px 14px;
      border-radius: var(--radius-sm);
      font-size: calc(13px * var(--font-scale));
      font-weight: 800;
      color: var(--slate);
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: all 0.2s;
    }
    .btn-student-profile:hover {
      background: var(--primary-light);
      color: var(--primary);
      border-color: var(--primary);
      transform: translateY(-1px);
    }

    /* ------------------------------------------------------------- */
    /* DEDICATED PRINT STUDIO MODAL (A4 1-PAGE EXCLUSIVE)           */
    /* ------------------------------------------------------------- */
    .modal-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.6);
      backdrop-filter: blur(4px);
      z-index: 1000;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }
    .modal-backdrop.open { display: flex; }
    .modal-box {
      background: #ffffff;
      width: 100%;
      max-width: 960px;
      max-height: 92vh;
      border-radius: var(--radius-lg);
      box-shadow: 0 25px 50px rgba(0,0,0,0.25);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .modal-header {
      padding: 18px 24px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: #f8fafc;
    }
    .modal-header h3 {
      font-size: 18px;
      font-weight: 900;
      color: var(--dark);
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .modal-close-btn {
      background: transparent;
      border: none;
      font-size: 24px;
      color: var(--muted);
      cursor: pointer;
      line-height: 1;
    }
    .modal-body {
      padding: 20px 24px;
      overflow-y: auto;
      flex: 1;
    }
    .print-options-bar {
      display: flex;
      gap: 12px;
      margin-bottom: 20px;
      flex-wrap: wrap;
      align-items: center;
    }
    .print-type-btn {
      padding: 9px 15px;
      border-radius: 10px;
      border: 1.5px solid var(--border);
      background: #ffffff;
      font-size: 13px;
      font-weight: 800;
      color: var(--slate);
      cursor: pointer;
      transition: all 0.15s;
    }
    .print-type-btn:hover { border-color: var(--primary); color: var(--primary); }
    .print-type-btn.active {
      background: var(--primary-light);
      border-color: var(--primary);
      color: var(--primary);
    }

    /* A4 Preview Container (Strictly 1-Page Layout) */
    .a4-preview-card {
      background: #ffffff !important;
      background-image: none !important;
      border: 1.5px solid #cbd5e1;
      box-shadow: 0 4px 14px rgba(0,0,0,0.06);
      width: 100%;
      max-width: 820px;
      padding: 24px 28px;
      margin: 0 auto;
      border-radius: 8px;
      font-size: 13px;
      color: #000000;
      line-height: 1.35;
    }
    .sheet-header {
      border-bottom: 2.5px solid #0f172a;
      padding-bottom: 12px;
      margin-bottom: 16px;
      display: flex;
      justify-content: space-between;
      align-items: flex-end;
    }
    .sheet-header .title-block h4 {
      font-size: 20px;
      font-weight: 900;
      color: #0f172a;
      letter-spacing: -0.5px;
      margin-bottom: 4px;
    }
    .sheet-header .title-block p {
      font-size: 12px;
      color: #475569;
      font-weight: 600;
    }
    .sheet-header .score-block {
      border: 1.5px solid #0f172a;
      border-radius: 6px;
      padding: 6px 14px;
      font-size: 13px;
      font-weight: 700;
      text-align: right;
      background: #f8fafc;
      min-width: 160px;
    }

    /* 2-Column Balanced Grid for 20 Words */
    .sheet-two-columns {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 20px;
    }
    .sheet-col-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 12px;
    }
    .sheet-col-table th {
      background: #f1f5f9;
      border: 1.5px solid #475569;
      padding: 8px 10px;
      font-weight: 900;
      text-align: left;
      font-size: 12px;
      color: #0f172a;
    }
    .sheet-col-table td {
      border: 1px solid #cbd5e1;
      padding: 8px 10px;
      vertical-align: middle;
      height: 52px; /* Generous row height for filling A4 page (20 items) */
      overflow: hidden;
    }
    .sheet-col-table.ten-items td {
      height: 95px; /* Optimal row height for 10 items (5 rows per column) */
      padding: 12px 12px;
    }
    .sheet-blank-line {
      display: block;
      width: 100%;
      height: 36px;
      border-bottom: 1.5px dashed #94a3b8;
    }
    .sheet-blank-line.ten-items {
      height: 58px;
    }

    /* Footer */
    footer {
      background: #ffffff;
      border-top: 1px solid var(--border);
      padding: 24px 20px;
      text-align: center;
      font-size: calc(13px * var(--font-scale));
      color: var(--muted);
    }
    footer strong { color: var(--slate); }

    /* ============================================================= */
    /* STRICT PRINT MEDIA STYLES (EXACTLY 1 A4 PAGE GUARANTEE)       */
    /* ============================================================= */
    @page {
      size: A4 portrait;
      margin: 8mm 10mm 8mm 10mm;
    }
    @media print {
      * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        background-image: none !important;
        box-shadow: none !important;
        text-shadow: none !important;
        filter: none !important;
        backdrop-filter: none !important;
      }
      html, body {
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        background-image: none !important;
        overflow: visible !important;
      }
      /* Hide all non-printable elements to eliminate blank pages & secondary modals */
      header, main, footer, .font-size-widget, .modal-header, .print-options-bar, .modal-close-btn, #fontSizeWidget, #modalStudentProfile {
        display: none !important;
      }
      #modalStudentProfile,
      .modal-backdrop#modalStudentProfile {
        display: none !important;
      }
      .modal-backdrop {
        position: static !important;
        display: block !important;
        background: #ffffff !important;
        background-image: none !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
      }
      .modal-box {
        position: static !important;
        display: block !important;
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        box-shadow: none !important;
        border: none !important;
        background: #ffffff !important;
        background-image: none !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
      }
      .modal-body {
        padding: 0 !important;
        margin: 0 !important;
        background: #ffffff !important;
        background-image: none !important;
        overflow: visible !important;
      }
      #printSheetArea {
        position: static !important;
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        background: #ffffff !important;
        background-image: none !important;
        border: 2px solid #0f172a !important;
        border-radius: 0 !important;
        padding: 12mm 10mm 10mm 10mm !important;
        margin: 0 auto !important;
        box-shadow: none !important;
        page-break-after: avoid !important;
        page-break-before: avoid !important;
        page-break-inside: avoid !important;
      }
      .sheet-header {
        border-bottom: 2px solid #000 !important;
        margin-bottom: 12px !important;
        padding-bottom: 8px !important;
      }
      .sheet-col-table th {
        background: #f1f5f9 !important;
        border: 1px solid #000000 !important;
        color: #000000 !important;
        padding: 6px 8px !important;
      }
      .sheet-col-table td {
        border: 1px solid #475569 !important;
        height: 52px !important;
        padding: 6px 8px !important;
      }
      .sheet-col-table.ten-items td {
        height: 95px !important;
        padding: 8px 10px !important;
      }
      .sheet-blank-line.ten-items {
        height: 56px !important;
      }
    }
