:root {
      --bg: #FAF6F0;
      --surface: #FFFFFF;
      --accent: #C86D51;
      --accent-hover: #B25B40;
      --sage: #6B7F6E;
      --sage-light: #EFF3EF;
      --amber-light: #FDF6EC;
      --text: #3A322D;
      --muted: #786D65;
      --border: #EAE2D7;
      --shadow-soft: 0 12px 32px rgba(58, 50, 45, 0.055);
      --shadow-hover: 0 16px 36px rgba(58, 50, 45, 0.09);
    }

    * { box-sizing: border-box; margin: 0; padding: 0; }
    html { scroll-behavior: smooth; }

    body {
      font-family: 'Plus Jakarta Sans', sans-serif;
      background-color: var(--bg);
      background-image: radial-gradient(circle at 50% -10%, rgba(200, 109, 81, 0.08), transparent 48%),
                        radial-gradient(circle at 90% 25%, rgba(107, 127, 110, 0.06), transparent 40%);
      color: var(--text);
      line-height: 1.65;
      -webkit-font-smoothing: antialiased;
    }

    h1, h2, h3, .logo { font-family: 'Lora', serif; font-weight: 600; letter-spacing: -0.015em; }

    .container { max-width: 980px; margin: 0 auto; padding: 0 24px; }

    header {
      padding: 18px 0;
      border-bottom: 1px solid rgba(234, 226, 215, 0.85);
      background: rgba(250, 246, 240, 0.88);
      position: sticky;
      top: 0;
      z-index: 100;
      backdrop-filter: blur(12px);
    }

    nav {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 14px;
    }

    .logo {
      display: inline-flex;
      align-items: center;
      gap: 11px;
      font-size: 1.3rem;
      color: var(--text);
      text-decoration: none;
      transition: transform 0.2s ease, opacity 0.2s ease;
    }
    .logo:hover { transform: translateY(-1px); opacity: 0.92; }
    .logo-mark {
      width: 34px;
      height: 34px;
      border-radius: 9px;
      object-fit: cover;
      box-shadow: 0 4px 12px rgba(200, 109, 81, 0.22);
      border: 1px solid rgba(200, 109, 81, 0.2);
      flex-shrink: 0;
    }
    .nav-links { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
    .nav-links a {
      position: relative;
      text-decoration: none;
      color: var(--muted);
      font-size: 0.91rem;
      font-weight: 500;
      padding: 4px 2px;
      transition: color 0.22s ease;
    }
    .nav-links a:not(.nav-portal-cta)::after {
      content: '';
      position: absolute;
      left: 0;
      right: 0;
      bottom: -2px;
      height: 2px;
      border-radius: 99px;
      background: var(--accent);
      transform: scaleX(0);
      transform-origin: left center;
      transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease, height 0.2s ease;
      opacity: 0.85;
    }
    .nav-links a:not(.nav-portal-cta):hover { color: var(--text); }
    .nav-links a:not(.nav-portal-cta):hover::after {
      transform: scaleX(1);
      opacity: 1;
    }
    /* Важные ссылки с модным постоянным акцентом-подчеркиванием */
    .nav-links a.nav-featured {
      color: var(--text);
      font-weight: 600;
    }
    .nav-links a.nav-featured::after {
      transform: scaleX(1);
      background: linear-gradient(90deg, var(--accent) 0%, rgba(200, 109, 81, 0.38) 100%);
      opacity: 0.78;
    }
    .nav-links a.nav-featured:hover { color: var(--accent); }
    .nav-links a.nav-featured:hover::after {
      background: var(--accent);
      opacity: 1;
      height: 2.5px;
    }
    /* Главная акцентная кнопка-ссылка в шапке (Student Portal / Book Lesson) */
    .nav-links a.nav-portal-cta {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: #FFF6EE;
      border: 1.5px solid #E6C7B1;
      color: var(--accent);
      font-weight: 700;
      padding: 6px 14px;
      border-radius: 99px;
      box-shadow: 0 3px 10px rgba(200, 109, 81, 0.09);
      transition: all 0.2s ease;
    }
    .nav-links a.nav-portal-cta span.cta-text {
      background-image: linear-gradient(currentColor, currentColor);
      background-position: 0 100%;
      background-repeat: no-repeat;
      background-size: 0% 1.5px;
      transition: background-size 0.25s ease;
    }
    .nav-links a.nav-portal-cta:hover {
      background: var(--accent);
      border-color: var(--accent);
      color: #FFFFFF;
      transform: translateY(-1px);
      box-shadow: 0 6px 16px rgba(200, 109, 81, 0.22);
    }
    .nav-links a.nav-portal-cta:hover span.cta-text {
      background-size: 100% 1.5px;
    }

    /* Чистый режим кабинета ученика (скрывает все гостевые блоки лендинга после входа) */
    .student-nav-links { display: none; }
    body.student-mode .public-nav-links { display: none !important; }
    body.student-mode .student-nav-links { display: flex !important; }
    body.student-mode .hero,
    body.student-mode #about,
    body.student-mode #free-pdf,
    body.student-mode #quiz,
    body.student-mode #new-students,
    body.student-mode #reviews,
    body.student-mode #faq,
    body.student-mode #portal > .section-header {
      display: none !important;
    }
    body.student-mode #portal {
      padding-top: 28px;
      border-top: none;
    }

    .hero { padding: 80px 0 56px; text-align: center; }

    .badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: #FFF9F0;
      border: 1px solid #EBD8BE;
      color: var(--accent);
      padding: 7px 18px;
      border-radius: 99px;
      font-size: 0.85rem;
      font-weight: 600;
      margin-bottom: 20px;
      box-shadow: 0 4px 12px rgba(200, 109, 81, 0.06);
    }

    .hero h1 { font-size: 2.95rem; line-height: 1.16; margin-bottom: 20px; }
    .hero p { font-size: 1.12rem; color: var(--muted); max-width: 630px; margin: 0 auto 30px; }

    .btn-group { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      background: var(--accent);
      color: #fff;
      padding: 13px 24px;
      border-radius: 12px;
      text-decoration: none;
      font-weight: 600;
      border: none;
      cursor: pointer;
      font-size: 0.95rem;
      font-family: inherit;
      transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    }
    .btn:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(200, 109, 81, 0.22); }
    .btn:disabled { opacity: 0.65; cursor: wait; transform: none; box-shadow: none; }
    .btn-sage { background: var(--sage); }
    .btn-sage:hover { background: #586A5B; box-shadow: 0 6px 18px rgba(107, 127, 110, 0.22); }
    .btn-outline { background: rgba(255,255,255,0.6); color: var(--text); border: 1px solid var(--border); }
    .btn-outline:hover { background: #EFE7DC; box-shadow: none; }
    .btn-sm { padding: 8px 15px; font-size: 0.85rem; border-radius: 9px; }

    @keyframes spin { to { transform: rotate(360deg); } }
    .spinner {
      width: 16px; height: 16px;
      border: 2.5px solid rgba(255,255,255,0.35);
      border-top-color: #fff;
      border-radius: 50%;
      animation: spin 0.75s linear infinite;
      display: inline-block;
    }
    .spinner-dark {
      width: 22px; height: 22px;
      border: 2.5px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin 0.75s linear infinite;
      margin: 0 auto 10px;
    }

    section { padding: 62px 0; border-top: 1px solid var(--border); }
    .section-header { text-align: center; margin-bottom: 34px; }
    .section-header h2 { font-size: 2.1rem; margin-bottom: 8px; }
    .section-header p { color: var(--muted); }

    .card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 22px;
      padding: 34px;
      box-shadow: var(--shadow-soft);
    }

    /* Видео-визитка и О себе */
    .about-grid {
      display: grid;
      grid-template-columns: 1.15fr 1fr;
      gap: 30px;
      align-items: center;
    }
    .video-wrap {
      position: relative;
      padding-bottom: 56.25%;
      height: 0;
      border-radius: 16px;
      overflow: hidden;
      border: 1px solid var(--border);
      background: #1C1815;
      box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
    }
    .video-wrap iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
    .video-poster {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #1C1815;
      border: none;
      padding: 0;
    }
    .video-poster img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      transition: transform 0.35s ease, filter 0.35s ease;
    }
    .video-poster:hover img { transform: scale(1.03); filter: brightness(0.92); }
    .video-play-btn {
      position: absolute;
      width: 68px;
      height: 68px;
      border-radius: 50%;
      background: rgba(200, 109, 81, 0.94);
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
      transition: transform 0.2s ease, background 0.2s ease;
    }
    .video-poster:hover .video-play-btn { transform: scale(1.08); background: var(--accent-hover); }
    .video-play-btn svg { width: 26px; height: 26px; margin-left: 3px; fill: currentColor; }
    .video-fallback-note { margin-top: 8px; font-size: 0.8rem; color: var(--muted); text-align: center; }
    .video-fallback-note a { color: var(--accent); text-decoration: none; }
    .video-fallback-note a:hover { text-decoration: underline; }

    /* Лид-магнит PDF со сбором email */
    .lead-banner {
      background: linear-gradient(135deg, #FDF6EC 0%, #EFF3EF 100%);
      border: 1px solid var(--border);
      border-radius: 22px;
      padding: 32px;
      box-shadow: var(--shadow-soft);
      display: grid;
      grid-template-columns: 1.2fr 1fr;
      gap: 24px;
      align-items: center;
    }
    .lead-form { display: flex; flex-direction: column; gap: 10px; }
    .lead-success {
      display: none;
      background: #FFFFFF;
      border: 1px solid #D5E0D6;
      border-radius: 14px;
      padding: 18px;
      text-align: center;
    }

    /* Мини-тест уровня русского */
    .quiz-card { max-width: 680px; margin: 0 auto; }
    .quiz-progress { font-size: 0.84rem; color: var(--accent); font-weight: 600; margin-bottom: 10px; }
    .quiz-question { font-family: 'Lora', serif; font-size: 1.35rem; margin-bottom: 18px; }
    .quiz-options { display: flex; flex-direction: column; gap: 10px; }
    .quiz-opt {
      text-align: left;
      padding: 13px 16px;
      border-radius: 12px;
      border: 1.5px solid var(--border);
      background: var(--bg);
      cursor: pointer;
      font-size: 0.95rem;
      font-family: inherit;
      color: var(--text);
      transition: all 0.18s;
    }
    .quiz-opt:hover { border-color: var(--accent); background: #FFF9F5; }
    .quiz-result { display: none; text-align: center; padding: 12px 0; }
    .quiz-level-badge {
      display: inline-block;
      background: var(--sage);
      color: #fff;
      padding: 6px 18px;
      border-radius: 99px;
      font-weight: 700;
      font-size: 0.92rem;
      margin-bottom: 12px;
    }

    /* Отзывы */
    .reviews-summary-pill {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      background: #FFF9F0;
      border: 1px solid #EBD8BE;
      padding: 6px 16px;
      border-radius: 99px;
      font-size: 0.88rem;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 14px;
    }
    .reviews-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 18px; }
    .review-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 22px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      gap: 14px;
      transition: transform 0.2s, box-shadow 0.2s;
    }
    .review-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
    .review-card.extra-review { display: none; }
    .reviews-grid.expanded .review-card.extra-review { display: flex; }
    .stars { color: #E29B38; font-size: 0.92rem; letter-spacing: 2px; }
    .review-text { font-size: 0.92rem; color: var(--text); line-height: 1.6; }
    .review-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; color: var(--muted); }
    .review-author { font-weight: 600; color: var(--text); }

    /* Портал студента */
    .portal-loading-box { display: none; max-width: 420px; margin: 0 auto; padding: 36px 20px; text-align: center; color: var(--muted); }
    .portal-login { max-width: 420px; margin: 0 auto; text-align: center; }
    .input-field {
      width: 100%;
      padding: 13px 16px;
      border: 1px solid var(--border);
      border-radius: 10px;
      font-size: 0.96rem;
      margin-bottom: 12px;
      background: var(--bg);
      font-family: inherit;
    }
    .input-field:focus { outline: none; border-color: var(--accent); background: #fff; }

    .student-dashboard { display: none; }

    .status-banner {
      background: var(--sage-light);
      border: 1px solid #D5E0D6;
      border-radius: 16px;
      padding: 20px 24px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 14px;
      margin-bottom: 16px;
    }
    .pills-wrap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
    .balance-pill { background: var(--sage); color: #fff; padding: 6px 14px; border-radius: 99px; font-weight: 600; font-size: 0.86rem; }
    .unbooked-pill { background: #FFF; color: var(--accent); border: 1px solid var(--accent); padding: 5px 13px; border-radius: 99px; font-weight: 600; font-size: 0.85rem; }
    .unbooked-pill.all-booked { background: var(--sage-light); color: var(--sage); border-color: #B8CBB9; }

    .low-balance-banner {
      display: none;
      background: #FFF7EB;
      border: 1.5px solid #F0CFA3;
      border-radius: 14px;
      padding: 15px 20px;
      margin-bottom: 16px;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 12px;
    }

    .next-lesson-card {
      background: #FFF9F5;
      border: 1.5px solid #EBD5C8;
      border-radius: 16px;
      padding: 18px 22px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 14px;
      margin-bottom: 16px;
    }

    .referral-banner {
      background: linear-gradient(135deg, #F6F1EA 0%, #EFF3EF 100%);
      border: 1px dashed #C7B9A6;
      border-radius: 14px;
      padding: 15px 20px;
      margin-bottom: 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 12px;
    }

    .sub-manage-box {
      background: #FDFBF8;
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 14px 20px;
      margin-bottom: 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 12px;
    }

    /* === DUOLINGO-STYLE СТРАЙКИ ДО 300+ ДНЕЙ === */
    .streak-hub-card {
      background: linear-gradient(135deg, #FFF7EC 0%, #FFFFFF 55%, #EFF5F0 100%);
      border: 1.5px solid #EAD8C3;
      border-radius: 18px;
      padding: 20px 24px;
      margin-bottom: 18px;
      box-shadow: 0 8px 24px rgba(200, 109, 81, 0.06);
    }
    .streak-hub-top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 14px;
      margin-bottom: 14px;
    }
    .streak-flame-big {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .streak-number-badge {
      font-family: 'Lora', serif;
      font-size: 2.15rem;
      font-weight: 700;
      color: var(--accent);
      line-height: 1;
    }
    .streak-rank-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: #FFFFFF;
      border: 1px solid #E5D4C0;
      border-radius: 99px;
      padding: 4px 12px;
      font-size: 0.81rem;
      font-weight: 700;
      color: var(--text);
    }
    .streak-week-strip {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 6px;
      background: rgba(255, 255, 255, 0.78);
      border: 1px solid var(--border);
      border-radius: 13px;
      padding: 10px 12px;
      margin-bottom: 14px;
      text-align: center;
    }
    .streak-day-col {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 5px;
      font-size: 0.73rem;
      font-weight: 600;
      color: var(--muted);
    }
    .streak-day-circle {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.88rem;
      background: #F2ECE3;
      border: 1.5px solid #E2D8C9;
      color: var(--muted);
    }
    .streak-day-circle.visited {
      background: #FFF0E2;
      border-color: var(--accent);
      color: var(--accent);
      font-weight: 700;
      box-shadow: 0 3px 8px rgba(200, 109, 81, 0.16);
    }
    .streak-day-circle.frozen {
      background: #EAF4FB;
      border-color: #7DB8DE;
      color: #2E77A6;
    }
    .streak-day-col.is-today span {
      color: var(--text);
      font-weight: 700;
    }
    .streak-300-bar-wrap { margin-bottom: 12px; }
    .streak-300-track {
      width: 100%;
      height: 10px;
      background: #E8DFD2;
      border-radius: 99px;
      overflow: hidden;
      margin: 6px 0 10px;
    }
    .streak-300-fill {
      height: 100%;
      width: 3%;
      background: linear-gradient(90deg, #E29B38 0%, var(--accent) 55%, var(--sage) 100%);
      border-radius: 99px;
      transition: width 0.7s ease;
    }
    .streak-checkpoints {
      display: flex;
      justify-content: space-between;
      gap: 6px;
      flex-wrap: wrap;
    }
    .streak-cp-chip {
      font-size: 0.74rem;
      font-weight: 600;
      padding: 3px 9px;
      border-radius: 99px;
      background: rgba(255,255,255,0.75);
      border: 1px solid var(--border);
      color: var(--muted);
    }
    .streak-cp-chip.unlocked {
      background: var(--sage-light);
      border-color: #BDD0BF;
      color: #3E5241;
      font-weight: 700;
    }
    .streak-cp-chip.next-goal {
      background: #FFF5EA;
      border-color: #E8C1A0;
      color: var(--accent);
      font-weight: 700;
    }
    .streak-footer-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
      padding-top: 10px;
      border-top: 1px dashed #E5DBD0;
      font-size: 0.81rem;
      color: var(--muted);
    }
    .streak-freeze-toast {
      display: none;
      background: #EAF4FB;
      border: 1px solid #B5D7EE;
      color: #245E85;
      border-radius: 10px;
      padding: 8px 12px;
      margin-bottom: 12px;
      font-size: 0.82rem;
      font-weight: 600;
    }

    /* === ЗАПИСЬ ГОЛОСА, ОЦЕНКА ПРОИЗНОШЕНИЯ AZURE И SHADOWING STUDIO === */
    .btn-mic-rec {
      position: relative;
      overflow: hidden;
      isolation: isolate;
      background: #FFF5F0;
      color: var(--accent);
      border: 1.5px solid #E5BFA8;
      transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.07s linear;
    }
    .btn-mic-rec:hover {
      background: var(--accent);
      color: #FFF;
      border-color: var(--accent);
    }
    /* Живая подсветка кнопки от громкости голоса в микрофоне */
    .btn-mic-rec.is-recording {
      background: #681E1E !important;
      border-color: #FF6B4A !important;
      color: #FFFFFF !important;
      box-shadow:
        0 0 0 var(--mic-ring, 2px) rgba(255, 107, 74, 0.30),
        0 4px calc(10px + var(--mic-halo, 2px)) rgba(224, 79, 62, 0.48) !important;
    }
    .btn-mic-rec.is-recording::before {
      content: '';
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      width: var(--mic-level, 8%);
      background: linear-gradient(90deg, #D94334 0%, #FF6B4A 58%, #FFA45B 100%);
      opacity: var(--mic-opacity, 0.45);
      z-index: -1;
      transition: width 0.055s linear, opacity 0.06s linear;
      pointer-events: none;
    }
    .mic-live-bars {
      display: inline-flex;
      align-items: center;
      gap: 2.5px;
      height: 14px;
      margin-right: 6px;
      vertical-align: middle;
    }
    .mic-live-bars i {
      display: block;
      width: 3px;
      border-radius: 99px;
      background: #FFFFFF;
      transition: height 0.055s linear;
    }
    .mic-live-bars i:nth-child(1) { height: var(--b1, 4px); }
    .mic-live-bars i:nth-child(2) { height: var(--b2, 7px); }
    .mic-live-bars i:nth-child(3) { height: var(--b3, 5px); }
    .mic-live-bars i:nth-child(4) { height: var(--b4, 4px); }

    .live-voice-meter-wrap {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-top: 8px;
    }
    .live-voice-meter-track {
      flex: 1;
      height: 7px;
      background: #EFE4DC;
      border-radius: 99px;
      overflow: hidden;
    }
    .live-voice-meter-fill {
      height: 100%;
      width: var(--mic-level, 4%);
      background: linear-gradient(90deg, var(--sage) 0%, var(--accent) 60%, #FF6B4A 100%);
      border-radius: 99px;
      transition: width 0.055s linear;
    }

    .btn-delete-rec {
      background: #FFF7F6;
      color: #A63A22;
      border: 1px solid #E8C5C0;
    }
    .btn-delete-rec:hover {
      background: #FEE8E5;
      color: #8C2712;
      border-color: #D96B5C;
    }
    .pron-actions-bar {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      align-items: center;
    }
    .pron-retry-callout {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
      background: #FFF6EE;
      border: 1px solid #EED0B7;
      border-radius: 10px;
      padding: 9px 12px;
      margin-top: 10px;
      font-size: 0.83rem;
      color: #7D4427;
    }
    .pron-feedback-box {
      background: #FDFBF8;
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 14px 16px;
      margin: 10px 0 14px;
    }
    .pron-top-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
      margin-bottom: 10px;
    }
    .pron-overall-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-weight: 700;
      font-size: 0.9rem;
      padding: 5px 13px;
      border-radius: 99px;
    }
    .pron-grade-high { background: var(--sage-light); color: #35523A; border: 1px solid #B9CEBC; }
    .pron-grade-mid { background: #FFF6E6; color: #9A5B13; border: 1px solid #EBD0A4; }
    .pron-grade-low { background: #FFF0ED; color: #A63A22; border: 1px solid #EABDB3; }
    .pron-metrics-row {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      font-size: 0.8rem;
      color: var(--muted);
      margin-bottom: 10px;
    }
    .pron-words-wrap {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      align-items: center;
    }
    .pron-word-chip {
      display: inline-flex;
      align-items: baseline;
      gap: 4px;
      padding: 4px 10px;
      border-radius: 8px;
      font-size: 0.9rem;
      font-weight: 600;
      border: 1px solid transparent;
    }
    .pron-word-chip small { font-size: 0.72rem; opacity: 0.82; font-weight: 700; }
    .pw-good { background: #ECF5ED; color: #2F5233; border-color: #C4DBC6; }
    .pw-warn { background: #FFF6E5; color: #8F5410; border-color: #ECD09E; }
    .pw-bad { background: #FFEFEC; color: #9E3520; border-color: #EBBAB0; text-decoration: underline wavy #D4654E; }

    .shadowing-section {
      border-top: 1px solid var(--border);
      padding-top: 28px;
      margin-bottom: 32px;
    }
    .shadow-list { display: flex; flex-direction: column; gap: 13px; }
    .shadow-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 18px 20px;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .shadow-card.shadow-done {
      border-color: #C4D6C6;
      background: #FAFCFA;
    }
    .shadow-phrase-ru {
      font-family: 'Lora', serif;
      font-size: 1.24rem;
      color: var(--text);
      margin: 6px 0 4px;
      line-height: 1.45;
    }
    .shadow-tip-bar {
      font-size: 0.82rem;
      color: var(--muted);
      background: var(--bg);
      border-left: 3px solid var(--accent);
      padding: 7px 11px;
      border-radius: 7px;
      margin: 8px 0 12px;
    }
    .shadow-pacing-track {
      display: none;
      width: 100%;
      height: 6px;
      background: #EFE6DA;
      border-radius: 99px;
      overflow: hidden;
      margin-bottom: 10px;
    }
    .shadow-pacing-fill {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, var(--accent), var(--sage));
      transition: width 0.12s linear;
    }

    .progress-card {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 20px 24px;
      margin-bottom: 28px;
    }
    .progress-top { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
    .progress-stats { display: flex; gap: 14px; font-size: 0.86rem; color: var(--muted); font-weight: 500; }
    .progress-track { width: 100%; height: 12px; background: #E6DDD1; border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
    .progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--sage), var(--accent)); border-radius: 99px; transition: width 0.8s ease; }
    .milestone-hint { font-size: 0.85rem; color: var(--muted); }

    /* Облачный словарик + Фильтры повторения */
    .vocab-section { border-top: 1px solid var(--border); padding-top: 28px; margin-bottom: 32px; }
    .vocab-filter-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 12px;
    }
    .vocab-pills { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 99px; padding: 3px; gap: 2px; }
    .vocab-pill-btn {
      border: none;
      background: transparent;
      padding: 5px 13px;
      border-radius: 99px;
      font-size: 0.81rem;
      font-weight: 600;
      color: var(--muted);
      cursor: pointer;
      font-family: inherit;
    }
    .vocab-pill-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 2px 6px rgba(58,50,45,0.08); }
    .flashcard-stage {
      position: relative;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 38px 24px 32px;
      text-align: center;
      cursor: pointer;
      user-select: none;
      margin: 14px 0;
      min-height: 170px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .flashcard-stage:hover { border-color: var(--accent); box-shadow: 0 8px 20px rgba(200, 109, 81, 0.07); }
    .flashcard-status-tag {
      position: absolute;
      top: 14px;
      left: 14px;
      font-size: 0.76rem;
      font-weight: 600;
      padding: 4px 11px;
      border-radius: 99px;
      background: #EFE7DC;
      color: var(--muted);
    }
    .flashcard-status-tag.mastered {
      background: var(--sage-light);
      color: var(--sage);
      border: 1px solid #C9D8CB;
    }
    .flashcard-audio-group {
      position: absolute;
      top: 12px;
      right: 12px;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      z-index: 2;
    }
    .flashcard-speed-btn {
      background: #FDFBF8;
      border: 1px solid var(--border);
      border-radius: 99px;
      padding: 6px 11px;
      font-size: 0.79rem;
      font-weight: 700;
      color: var(--muted);
      cursor: pointer;
      font-family: inherit;
      transition: all 0.2s;
    }
    .flashcard-speed-btn:hover { border-color: var(--accent); color: var(--text); }
    .flashcard-speed-btn.slow-active {
      background: #FFF4E8;
      border-color: var(--accent);
      color: var(--accent);
    }
    .flashcard-audio-btn {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 99px;
      padding: 6px 13px;
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--text);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-family: inherit;
      transition: all 0.2s;
    }
    .flashcard-audio-btn:hover { border-color: var(--accent); color: var(--accent); }
    .streak-pill {
      display: none;
      align-items: center;
      gap: 5px;
      background: #FFF6EA;
      border: 1px solid #EBD4B4;
      color: #B45D3E;
      padding: 4px 11px;
      border-radius: 99px;
      font-size: 0.78rem;
      font-weight: 700;
    }
    .daily5-banner {
      display: none;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
      background: linear-gradient(135deg, #FFF9F2 0%, #EFF4EF 100%);
      border: 1px solid #E5DACB;
      border-radius: 12px;
      padding: 10px 14px;
      margin-top: 12px;
      font-size: 0.84rem;
    }
    .daily5-dots {
      display: inline-flex;
      gap: 5px;
      align-items: center;
    }
    .daily5-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: #E2D8CA;
      transition: background 0.25s, transform 0.25s;
    }
    .daily5-dot.done {
      background: var(--sage);
      transform: scale(1.1);
    }
    .resched-slot-item {
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 14px 16px;
      margin-bottom: 10px;
      background: var(--bg);
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 12px;
    }
    .resched-badge-ok {
      display: inline-block;
      font-size: 0.75rem;
      font-weight: 700;
      color: var(--sage);
      background: var(--sage-light);
      border: 1px solid #C6D6C8;
      padding: 2px 9px;
      border-radius: 99px;
      margin-top: 4px;
    }
    .resched-badge-lock {
      display: inline-block;
      font-size: 0.75rem;
      font-weight: 700;
      color: #B45D3E;
      background: #FFF3E6;
      border: 1px solid #ECCBA8;
      padding: 2px 9px;
      border-radius: 99px;
      margin-top: 4px;
    }
    .flashcard-word { font-family: 'Lora', serif; font-size: 1.75rem; color: var(--text); margin-bottom: 6px; }
    .flashcard-hint { font-size: 0.82rem; color: var(--muted); }
    .flashcard-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
    .add-word-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }

    /* Раздел Грамматики, Правил («Система Калинка» 1–4 + Разговорный) и Интерактивных Упражнений */
    .grammar-section {
      border-top: 1px solid var(--border);
      padding-top: 28px;
      margin-bottom: 32px;
    }
    .grammar-track-banner {
      background: linear-gradient(135deg, #FDF6EC 0%, #EFF3EF 100%);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 14px 18px;
      margin: 12px 0 14px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
      font-size: 0.87rem;
    }
    .grammar-tabs {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      margin-bottom: 16px;
    }
    .grammar-tab-btn {
      border: 1px solid var(--border);
      background: var(--bg);
      padding: 7px 13px;
      border-radius: 99px;
      font-size: 0.82rem;
      font-weight: 600;
      color: var(--muted);
      cursor: pointer;
      font-family: inherit;
      transition: all 0.18s ease;
    }
    .grammar-tab-btn:hover { border-color: var(--accent); color: var(--text); }
    .grammar-tab-btn.active {
      background: var(--text);
      border-color: var(--text);
      color: #FFFFFF;
      box-shadow: 0 3px 10px rgba(58, 50, 45, 0.14);
    }
    .grammar-list { display: flex; flex-direction: column; gap: 11px; }
    details.grammar-card {
      border: 1px solid var(--border);
      border-radius: 15px;
      background: var(--surface);
      overflow: hidden;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    details.grammar-card.current-module {
      border: 1.5px solid var(--accent);
      box-shadow: 0 8px 22px rgba(200, 109, 81, 0.08);
    }
    details.grammar-card summary {
      padding: 14px 18px;
      cursor: pointer;
      list-style: none;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
      font-weight: 600;
      background: var(--surface);
    }
    details.grammar-card summary::-webkit-details-marker { display: none; }
    .g-status-pill {
      font-size: 0.76rem;
      font-weight: 700;
      padding: 4px 11px;
      border-radius: 99px;
      white-space: nowrap;
    }
    .g-status-covered { background: var(--sage-light); color: var(--sage); border: 1px solid #C8D7CA; }
    .g-status-current { background: #FFF3E8; color: var(--accent); border: 1px solid #ECC7AE; }
    .g-status-upcoming { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
    .grammar-card-body {
      padding: 18px;
      border-top: 1px solid var(--border);
      background: #FDFBF8;
      display: flex;
      flex-direction: column;
      gap: 14px;
    }
    .grammar-rule-box {
      background: var(--surface);
      border: 1px solid var(--border);
      border-left: 3.5px solid var(--sage);
      border-radius: 11px;
      padding: 13px 15px;
      font-size: 0.91rem;
    }
    .grammar-formula-strip {
      margin-top: 9px;
      padding: 8px 11px;
      background: var(--bg);
      border-radius: 8px;
      font-size: 0.83rem;
      font-weight: 600;
      color: var(--text);
      border: 1px dashed #DFD4C6;
    }
    .grammar-example-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
      background: #FFF9F3;
      border: 1px solid #EDE0D1;
      border-radius: 11px;
      padding: 11px 14px;
    }
    .g-quiz-list { display: flex; flex-direction: column; gap: 12px; }
    .g-quiz-item {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 13px 15px;
    }
    .g-quiz-q { font-size: 0.9rem; font-weight: 600; margin-bottom: 9px; color: var(--text); }
    .g-quiz-opts { display: flex; gap: 8px; flex-wrap: wrap; }
    .g-opt-btn {
      padding: 7px 13px;
      border-radius: 9px;
      border: 1.5px solid var(--border);
      background: var(--bg);
      color: var(--text);
      font-size: 0.86rem;
      font-weight: 500;
      cursor: pointer;
      font-family: inherit;
      transition: all 0.16s ease;
    }
    .g-opt-btn:hover { border-color: var(--accent); background: #FFF9F5; }
    .g-opt-btn.correct-pick {
      background: var(--sage-light);
      border-color: var(--sage);
      color: #3E5241;
      font-weight: 700;
    }
    .g-opt-btn.wrong-pick {
      background: #FFF2ED;
      border-color: #DF8C73;
      color: #9E4329;
    }
    .g-quiz-why {
      display: none;
      margin-top: 8px;
      font-size: 0.83rem;
      color: var(--muted);
      padding: 7px 10px;
      background: var(--bg);
      border-radius: 8px;
    }
    .mistake-drill-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 16px 18px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .mistake-drill-card.fixed-card {
      border-color: #C8D7CA;
      background: #FAFCFA;
    }

    /* Дневник уроков */
    .lesson-list { display: flex; flex-direction: column; gap: 12px; margin: 16px 0 32px; }
    details.lesson-item { border: 1px solid var(--border); border-radius: 14px; background: #FDFBF8; overflow: hidden; }
    details.lesson-item summary {
      padding: 15px 18px; cursor: pointer; font-weight: 600;
      display: flex; justify-content: space-between; align-items: center;
      list-style: none; background: var(--surface);
    }
    details.lesson-item summary::-webkit-details-marker { display: none; }
    .lesson-date-tag { font-size: 0.82rem; color: var(--accent); background: #F6ECE6; padding: 4px 12px; border-radius: 99px; font-weight: 600; }
    .lesson-body { padding: 18px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; }
    .lesson-block h4 { font-size: 0.94rem; margin-bottom: 6px; }
    .lesson-block p { font-size: 0.92rem; color: var(--muted); }
    .mistakes-box { background: var(--amber-light); border-left: 3px solid var(--accent); padding: 12px 16px; border-radius: 8px; font-size: 0.9rem; }
    .mistakes-box li { margin-left: 18px; margin-bottom: 4px; }
    .hw-checklist { list-style: none; display: flex; flex-direction: column; gap: 8px; }
    .hw-checklist label {
      display: flex; align-items: flex-start; gap: 10px; font-size: 0.92rem; cursor: pointer;
      padding: 8px 10px; background: var(--surface); border-radius: 8px; border: 1px solid var(--border);
    }
    .hw-checklist input[type="checkbox"] { margin-top: 4px; accent-color: var(--sage); width: 16px; height: 16px; }
    .hw-done { text-decoration: line-through; color: var(--muted); }
    .doc-links { display: flex; gap: 10px; flex-wrap: wrap; }

    /* Пакеты, Пробный урок и PayPal */
    .checkout-box { max-width: 560px; margin: 0 auto; }
    .plan-mode-switch {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      background: var(--bg);
      padding: 5px;
      border-radius: 14px;
      border: 1px solid var(--border);
      margin-bottom: 18px;
    }
    .mode-tab-btn {
      border: none;
      background: transparent;
      padding: 10px 12px;
      border-radius: 10px;
      font-size: 0.88rem;
      font-weight: 600;
      color: var(--muted);
      cursor: pointer;
      font-family: inherit;
      transition: all 0.18s;
    }
    .mode-tab-btn.active {
      background: var(--surface);
      color: var(--text);
      box-shadow: 0 3px 10px rgba(58,50,45,0.08);
    }
    .trial-perks-box {
      background: #FFF9F5;
      border: 1px solid #EBD5C8;
      border-radius: 14px;
      padding: 16px 18px;
      margin-bottom: 14px;
      font-size: 0.89rem;
      color: var(--text);
    }
    .trial-perks-box ul { margin: 8px 0 0 18px; color: var(--muted); }
    .trial-inputs-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin-bottom: 14px;
    }

    .currency-toggle-wrap { display: flex; justify-content: center; margin-bottom: 16px; }
    .currency-toggle { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 99px; padding: 3px; }
    .cur-btn {
      border: none; background: transparent; padding: 6px 16px; border-radius: 99px;
      font-size: 0.84rem; font-weight: 600; color: var(--muted); cursor: pointer; font-family: inherit;
    }
    .cur-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 2px 6px rgba(58,50,45,0.08); }

    .pack-selector { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0 12px; }
    .pack-btn {
      padding: 12px 8px; border: 1.5px solid var(--border); border-radius: 12px;
      background: var(--bg); cursor: pointer; text-align: center; font-family: inherit;
    }
    .pack-btn strong { display: block; font-size: 0.96rem; color: var(--text); }
    .pack-btn span { font-size: 0.76rem; color: var(--muted); }
    .pack-btn.active { border-color: var(--accent); background: #FFF9F6; box-shadow: 0 0 0 2px rgba(200,109,81,0.15); }

    .custom-qty-row {
      display: flex; align-items: center; justify-content: space-between; gap: 12px;
      background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
      padding: 12px 16px; margin-bottom: 12px; flex-wrap: wrap;
    }
    .qty-input {
      width: 82px; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 9px;
      font-size: 1rem; font-weight: 600; text-align: center; background: var(--surface); font-family: inherit;
    }
    .discount-tiers-box {
      font-size: 0.8rem; color: var(--muted); background: #FDFBF8;
      border: 1px dashed var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px;
    }
    .checkout-summary {
      background: var(--bg); border-radius: 14px; padding: 16px 20px; margin-bottom: 18px;
      display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
    }
    .total-amount { font-family: 'Lora', serif; font-size: 1.85rem; color: var(--accent); font-weight: 600; }
    .fee-note { font-size: 0.83rem; color: var(--muted); }
    .paypal-status-msg {
      text-align: center; font-size: 0.86rem; color: var(--muted); padding: 14px;
      background: var(--bg); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 10px;
    }

    /* FAQ */
    .faq-list { display: flex; flex-direction: column; gap: 12px; max-width: 780px; margin: 0 auto; }
    details.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 20px; }
    details.faq-item summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
    details.faq-item summary::-webkit-details-marker { display: none; }
    details.faq-item p { margin-top: 10px; font-size: 0.93rem; color: var(--muted); }

    /* Модальные окна */
    .modal-backdrop {
      display: none; position: fixed; inset: 0; background: rgba(58,50,45,0.55);
      z-index: 999; align-items: center; justify-content: center; padding: 20px;
    }
    .modal-box {
      background: var(--surface); border-radius: 20px; max-width: 680px; width: 100%;
      max-height: 82vh; overflow-y: auto; padding: 30px; border: 1px solid var(--border);
    }
    .modal-box h3 { margin-bottom: 14px; }
    .modal-box h4 { margin: 16px 0 6px; font-size: 0.98rem; }
    .modal-box p, .modal-box li { font-size: 0.9rem; color: var(--muted); margin-bottom: 6px; }
    .modal-box ul { margin-left: 18px; }

    .calendar-wrapper { width: 100%; border-radius: 12px; overflow: hidden; background: #FFF; }
    .error-msg { color: #C94A4A; font-size: 0.9rem; margin-top: 10px; display: none; }

    footer { text-align: center; padding: 40px 0; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--border); }
    footer a { color: var(--accent); text-decoration: none; }
    footer a:hover { text-decoration: underline; }

    @media (max-width: 780px) {
      .hero h1 { font-size: 2.15rem; }
      .about-grid, .lead-banner, .trial-inputs-grid { grid-template-columns: 1fr; }
      .pack-selector { grid-template-columns: repeat(2, 1fr); }
      .add-word-row { grid-template-columns: 1fr; }
      .card { padding: 22px 18px; }
    }

/* ==========================================================================
       V11 REDESIGN: UNCLUTTERED PUBLIC SITE + 6-TAB STUDENT APP WORKSPACE
       ========================================================================== */

    .container { max-width: 1040px; margin: 0 auto; padding: 0 24px; }

    /* 1. Clean Single-Row Header */
    header {
      padding: 14px 0;
      border-bottom: 1px solid rgba(234, 226, 215, 0.9);
      background: rgba(250, 246, 240, 0.93);
      position: sticky;
      top: 0;
      z-index: 200;
      backdrop-filter: blur(14px);
    }
    nav {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: nowrap;
      gap: 16px;
    }
    .public-header-right {
      display: flex;
      align-items: center;
      gap: 22px;
    }
    .public-nav-links {
      display: flex;
      align-items: center;
      gap: 20px;
      flex-wrap: nowrap;
    }
    .mobile-header-actions {
      display: none;
      align-items: center;
      gap: 8px;
    }
    .mobile-menu-btn {
      width: 38px;
      height: 38px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: var(--surface);
      color: var(--text);
      font-size: 1.15rem;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .mobile-public-menu {
      display: none;
      flex-direction: column;
      gap: 6px;
      padding: 14px 0 6px;
      margin-top: 12px;
      border-top: 1px solid var(--border);
    }
    .mobile-public-menu.open { display: flex; }
    .mobile-public-menu a {
      text-decoration: none;
      color: var(--text);
      font-weight: 600;
      font-size: 0.95rem;
      padding: 9px 12px;
      border-radius: 10px;
      transition: background 0.15s;
    }
    .mobile-public-menu a:hover { background: #EFE7DC; color: var(--accent); }

    /* Public 2-Column Free Tools Section (PDF + Quick Quiz) */
    .free-tools-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 24px;
      align-items: stretch;
    }
    .free-tool-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 22px;
      padding: 30px 28px;
      box-shadow: var(--shadow-soft);
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }
    .free-tool-card.pdf-highlight {
      background: linear-gradient(145deg, #FDF6EC 0%, #FFFFFF 60%, #EFF3EF 100%);
    }

    /* 2. Student Mode Visibility Rules */
    .student-header-bar { display: none; align-items: center; gap: 8px; flex-wrap: wrap; }
    body.student-mode .public-header-right,
    body.student-mode .mobile-header-actions,
    body.student-mode .mobile-public-menu,
    body.student-mode .public-only-section {
      display: none !important;
    }
    body.student-mode .student-header-bar {
      display: flex !important;
    }
    /* Shared Google Calendar #book shows on public page, and in Student Mode ONLY on the 'book' tab */
    body.student-mode #book {
      display: none !important;
    }
    body.student-mode[data-portal-tab="book"] #book {
      display: block !important;
      padding-top: 0;
      padding-bottom: 40px;
      border-top: none;
    }
    body.student-mode #book > .section-header {
      display: none !important;
    }

    /* 3. Student Workspace Shell & 6-Tab Bar */
    .student-workspace-wrap {
      display: none;
      padding: 24px 0 28px;
    }
    body.student-mode[data-portal-tab="book"] .student-workspace-wrap {
      padding-bottom: 10px;
    }
    body.student-mode .student-workspace-wrap {
      display: block;
    }
    .workspace-welcome-strip {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 12px;
      margin-bottom: 18px;
    }
    .workspace-tabs-bar {
      display: flex;
      gap: 6px;
      background: #F2EBE1;
      border: 1px solid var(--border);
      padding: 6px;
      border-radius: 16px;
      margin-bottom: 24px;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    .workspace-tabs-bar::-webkit-scrollbar { display: none; }
    .portal-tab-btn {
      flex: 1 0 auto;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 7px;
      border: none;
      background: transparent;
      color: var(--muted);
      font-family: inherit;
      font-size: 0.89rem;
      font-weight: 600;
      padding: 10px 15px;
      border-radius: 11px;
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.18s ease;
    }
    .portal-tab-btn:hover {
      color: var(--text);
      background: rgba(255, 255, 255, 0.55);
    }
    .portal-tab-btn.active {
      background: var(--surface);
      color: var(--text);
      font-weight: 700;
      box-shadow: 0 4px 12px rgba(58, 50, 45, 0.08);
    }
    .tab-count-badge {
      font-size: 0.73rem;
      font-weight: 700;
      padding: 1px 7px;
      border-radius: 99px;
      background: #EFE7DC;
      color: var(--text);
    }
    .portal-tab-btn.active .tab-count-badge {
      background: #FFF2E8;
      color: var(--accent);
    }

    .portal-tab-panel { display: none; }
    .portal-tab-panel.active {
      display: block;
      animation: fadeTabIn 0.2s ease;
    }
    @keyframes fadeTabIn {
      from { opacity: 0; transform: translateY(4px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* 4. Overview Bento Layout */
    .overview-bento-grid {
      display: grid;
      grid-template-columns: 1.15fr 0.85fr;
      gap: 18px;
      margin-bottom: 18px;
      align-items: stretch;
    }
    .overview-bento-grid .streak-hub-card,
    .overview-bento-grid .progress-card {
      margin-bottom: 0;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }
    .quick-shortcuts-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin-top: 14px;
    }
    .shortcut-tile-btn {
      text-align: left;
      padding: 10px 12px;
      border-radius: 11px;
      border: 1px solid var(--border);
      background: var(--surface);
      color: var(--text);
      font-family: inherit;
      font-size: 0.82rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.18s ease;
    }
    .shortcut-tile-btn:hover {
      border-color: var(--accent);
      background: #FFF9F4;
      transform: translateY(-1px);
    }
    .home-latest-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 22px 24px;
      box-shadow: var(--shadow-soft);
    }

    /* 5. Clean Panel Cards & Practice Mode Switcher */
    .panel-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 28px;
      box-shadow: var(--shadow-soft);
    }
    .practice-mode-switch {
      display: inline-flex;
      gap: 6px;
      background: var(--bg);
      border: 1px solid var(--border);
      padding: 5px;
      border-radius: 13px;
      margin-bottom: 20px;
      flex-wrap: wrap;
    }
    .practice-sub-btn {
      border: none;
      background: transparent;
      padding: 9px 18px;
      border-radius: 9px;
      font-family: inherit;
      font-size: 0.88rem;
      font-weight: 600;
      color: var(--muted);
      cursor: pointer;
      transition: all 0.18s;
    }
    .practice-sub-btn.active {
      background: var(--surface);
      color: var(--text);
      font-weight: 700;
      box-shadow: 0 2px 8px rgba(58, 50, 45, 0.08);
    }
    .vocab-section, .shadowing-section, .grammar-section {
      border-top: none !important;
      padding-top: 0 !important;
      margin-bottom: 0 !important;
    }

    .student-book-summary-bar {
      background: #FFF9F5;
      border: 1px solid #EBD5C8;
      border-radius: 16px;
      padding: 15px 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 12px;
      font-size: 0.9rem;
    }

    .perks-side-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
      margin-top: 24px;
    }
    .perk-card-box {
      background: linear-gradient(135deg, #F6F1EA 0%, #EFF3EF 100%);
      border: 1px dashed #C7B9A6;
      border-radius: 16px;
      padding: 18px 20px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      gap: 12px;
    }

    @media (max-width: 860px) {
      .public-header-right { display: none; }
      .mobile-header-actions { display: inline-flex; }
      .free-tools-grid,
      .overview-bento-grid,
      .perks-side-grid {
        grid-template-columns: 1fr;
      }
      .panel-card { padding: 20px 16px; }
      .portal-tab-btn { padding: 9px 13px; font-size: 0.84rem; }
    }

    /* ==========================================================================
       V14 ADDITIONS: PUBLIC PORTAL SHOWCASE + FIRST-TIME STUDENT ONBOARDING TOUR
       ========================================================================== */

    /* Public "What You Unlock After Joining" Showcase (#portal-preview) */
    .portal-showcase-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 18px;
      margin-bottom: 22px;
    }
    .portal-feature-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 22px 22px 20px;
      box-shadow: var(--shadow-soft);
      display: flex;
      flex-direction: column;
      gap: 10px;
      transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    }
    .portal-feature-card:hover {
      transform: translateY(-3px);
      border-color: #DFC3AE;
      box-shadow: var(--shadow-hover);
    }
    .pf-top-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
    }
    .pf-icon-box {
      width: 42px;
      height: 42px;
      border-radius: 12px;
      background: linear-gradient(135deg, #FFF5EB 0%, #F3ECE2 100%);
      border: 1px solid #EBD7C5;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.28rem;
      flex-shrink: 0;
    }
    .pf-tag {
      font-size: 0.72rem;
      font-weight: 700;
      padding: 4px 10px;
      border-radius: 99px;
      background: var(--sage-light);
      color: var(--sage);
      border: 1px solid #C9D8CB;
      white-space: nowrap;
    }
    .portal-feature-card h3 {
      font-size: 1.08rem;
      line-height: 1.32;
      color: var(--text);
    }
    .portal-feature-card p {
      font-size: 0.88rem;
      color: var(--muted);
      line-height: 1.58;
    }
    .portal-showcase-cta-strip {
      background: linear-gradient(135deg, #FFF7EC 0%, #FFFFFF 55%, #EFF4EF 100%);
      border: 1.5px solid #E6D5C1;
      border-radius: 20px;
      padding: 22px 26px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 16px;
      box-shadow: 0 8px 24px rgba(200, 109, 81, 0.06);
    }

    /* First-Time Student Step-by-Step Onboarding Guide Modal (#studentTourModal) */
    .tour-modal-box {
      max-width: 540px;
      padding: 26px 26px 22px;
    }
    .tour-top-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      margin-bottom: 12px;
    }
    .tour-step-pill {
      font-size: 0.76rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--accent);
      background: #FFF4EA;
      border: 1px solid #ECCBB2;
      padding: 4px 11px;
      border-radius: 99px;
    }
    .tour-skip-btn {
      background: none;
      border: none;
      color: var(--muted);
      font-family: inherit;
      font-size: 0.84rem;
      font-weight: 600;
      cursor: pointer;
      padding: 4px 8px;
      border-radius: 8px;
      transition: background 0.15s, color 0.15s;
    }
    .tour-skip-btn:hover { background: var(--bg); color: var(--text); }

    .tour-progress-track {
      width: 100%;
      height: 6px;
      background: #ECE3D7;
      border-radius: 99px;
      overflow: hidden;
      margin-bottom: 18px;
    }
    .tour-progress-fill {
      height: 100%;
      width: 20%;
      background: linear-gradient(90deg, var(--accent), var(--sage));
      border-radius: 99px;
      transition: width 0.28s ease;
    }
    .tour-stage-card {
      background: linear-gradient(145deg, #FDF9F4 0%, #FFFFFF 65%, #F2F6F2 100%);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 20px 20px 18px;
      margin-bottom: 18px;
    }
    .tour-tab-chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 0.76rem;
      font-weight: 700;
      color: #3E5241;
      background: var(--sage-light);
      border: 1px solid #C5D5C7;
      padding: 3px 10px;
      border-radius: 99px;
      margin-bottom: 10px;
    }
    .tour-points-list {
      list-style: none;
      padding: 0;
      margin: 12px 0 0;
      display: flex;
      flex-direction: column;
      gap: 9px;
    }
    .tour-points-list li {
      display: flex;
      align-items: flex-start;
      gap: 9px;
      font-size: 0.89rem;
      color: var(--text);
      line-height: 1.5;
    }
    .tour-points-list li span.tp-bullet {
      flex-shrink: 0;
      margin-top: 1px;
    }
    .tour-quick-jumps {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 14px;
      padding-top: 12px;
      border-top: 1px dashed #E4DACD;
    }
    .tour-footer-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
    }
    .tour-dots {
      display: inline-flex;
      align-items: center;
      gap: 7px;
    }
    .tour-dot {
      width: 9px;
      height: 9px;
      border-radius: 99px;
      border: none;
      background: #DFD5C7;
      cursor: pointer;
      padding: 0;
      transition: all 0.2s ease;
    }
    .tour-dot.active {
      width: 22px;
      background: var(--accent);
    }

    @media (max-width: 920px) {
      .portal-showcase-grid {
        grid-template-columns: repeat(2, 1fr);
      }
    }
    @media (max-width: 620px) {
      .portal-showcase-grid {
        grid-template-columns: 1fr;
      }
      .tour-modal-box { padding: 20px 18px 18px; }
    }

    .tour-dont-show-btn {
      background: transparent;
      border: 1px dashed #CDBFB0;
      color: var(--muted);
      font-family: inherit;
      font-size: 0.8rem;
      font-weight: 600;
      padding: 7px 12px;
      border-radius: 10px;
      cursor: pointer;
      transition: all 0.16s ease;
    }
    .tour-dont-show-btn:hover {
      background: #FFF2ED;
      border-color: #DF9E8B;
      border-style: solid;
      color: #9E4329;
    }
    .g-pages-badge {
      font-size: 0.75rem;
      font-weight: 600;
      color: var(--muted);
      background: var(--bg);
      border: 1px solid var(--border);
      padding: 2px 8px;
      border-radius: 99px;
      margin-left: 6px;
    }

    .grammar-picker-bar {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      background: #FFF9F3;
      border: 1px solid #E8D5C2;
      border-radius: 14px;
      padding: 12px 16px;
      margin-bottom: 14px;
    }
    .grammar-mod-select {
      flex: 1 1 240px;
      padding: 8px 12px;
      border-radius: 10px;
      border: 1.5px solid var(--border);
      background: #FFFFFF;
      font-family: inherit;
      font-size: 0.85rem;
      color: var(--text);
      font-weight: 600;
    }
    .grammar-tab-btn.book-completed:not(.active) {
      background: var(--sage-light);
      border-color: #C4D6C6;
      color: #3B523E;
    }

    /* ==========================================================================
       V17 ADDITIONS: INTERACTIVE STREAK MODAL (10 RANKS) & ASK ARTEM MODAL
       ========================================================================== */

    .streak-btn-interactive {
      font-family: inherit;
      cursor: pointer;
      transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
    }
    .streak-btn-interactive:hover {
      background: #FFF3E4;
      border-color: var(--accent);
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(200, 109, 81, 0.18);
    }

    .streak-modal-hero {
      background: linear-gradient(135deg, #FFF6E9 0%, #FFFFFF 55%, #EFF5F0 100%);
      border: 1.5px solid #EAD6BF;
      border-radius: 16px;
      padding: 16px 18px;
      margin-bottom: 14px;
    }
    .streak-ranks-ladder {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      max-height: 250px;
      overflow-y: auto;
      padding-right: 4px;
      margin: 10px 0 14px;
    }
    .streak-ladder-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      padding: 9px 11px;
      border-radius: 12px;
      border: 1px solid var(--border);
      background: var(--bg);
      font-size: 0.81rem;
      opacity: 0.72;
    }
    .streak-ladder-item.unlocked {
      background: var(--sage-light);
      border-color: #C2D5C4;
      opacity: 1;
    }
    .streak-ladder-item.current-rank {
      background: #FFF4E8;
      border: 1.5px solid var(--accent);
      opacity: 1;
      box-shadow: 0 4px 12px rgba(200, 109, 81, 0.10);
    }
    .streak-ladder-item.next-rank {
      background: #FFFFFF;
      border: 1px dashed #DFB099;
      opacity: 1;
    }
    .sl-badge {
      font-size: 0.7rem;
      font-weight: 700;
      padding: 2px 7px;
      border-radius: 99px;
      white-space: nowrap;
      background: #EFE8DE;
      color: var(--muted);
    }
    .streak-ladder-item.unlocked .sl-badge {
      background: #DCE9DD;
      color: #355239;
    }
    .streak-ladder-item.current-rank .sl-badge {
      background: var(--accent);
      color: #FFFFFF;
    }
    .streak-ladder-item.next-rank .sl-badge {
      background: #FFF1E6;
      color: var(--accent);
    }

    .ask-quick-channels {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      padding-top: 14px;
      margin-top: 14px;
      border-top: 1px dashed var(--border);
      align-items: center;
      justify-content: space-between;
    }
    .ask-textarea {
      min-height: 104px;
      resize: vertical;
      line-height: 1.5;
      font-family: inherit;
    }

    @media (max-width: 620px) {
      .streak-ranks-ladder {
        grid-template-columns: 1fr;
      }
    }

    /* ==========================================================================
       V18 UPGRADES: TRANSCRIPTION BAR, TEACHER MODE, SRS, EAR TRAINING, LIVE DEMO
       ========================================================================== */

    /* 1. Teacher Mode Sticky Control Bar */
    .teacher-mode-bar {
      display: none;
      background: linear-gradient(135deg, #2D2622 0%, #3E342E 100%);
      color: #FAF6F0;
      border: 1px solid #594A42;
      border-radius: 16px;
      padding: 14px 18px;
      margin-bottom: 18px;
      box-shadow: 0 8px 24px rgba(45, 38, 34, 0.16);
      flex-direction: column;
      gap: 11px;
    }
    .teacher-bar-top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
    }
    .teacher-student-select {
      background: #FAF6F0;
      color: var(--text);
      border: 1px solid #D5C8B8;
      border-radius: 10px;
      padding: 7px 12px;
      font-family: inherit;
      font-size: 0.86rem;
      font-weight: 700;
      min-width: 230px;
      cursor: pointer;
    }
    .teacher-shield-pill {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      font-size: 0.75rem;
      font-weight: 700;
      padding: 4px 10px;
      border-radius: 99px;
      background: rgba(107, 127, 110, 0.28);
      border: 1px solid rgba(185, 214, 189, 0.45);
      color: #DDF0DF;
    }
    .teacher-quick-word-row {
      display: grid;
      grid-template-columns: 1fr 1fr 0.9fr auto;
      gap: 8px;
      align-items: center;
      padding-top: 10px;
      border-top: 1px dashed rgba(250, 246, 240, 0.18);
    }
    .teacher-input {
      background: rgba(255, 255, 255, 0.95);
      border: 1px solid #D5C8B8;
      border-radius: 9px;
      padding: 8px 11px;
      font-family: inherit;
      font-size: 0.83rem;
      color: var(--text);
      width: 100%;
    }

    /* 2. Shadowing-Style Transcription Bar on Flashcards & Shadowing */
    .flashcard-trans-pill {
      display: inline-block;
      margin-top: 10px;
      padding: 5px 14px;
      border-radius: 99px;
      background: #FFF6ED;
      border: 1px solid #EBD4C0;
      color: var(--accent);
      font-size: 0.9rem;
      font-weight: 600;
      letter-spacing: 0.01em;
    }
    .flashcard-tip-line {
      margin-top: 8px;
      font-size: 0.8rem;
      color: var(--muted);
      max-width: 520px;
    }
    .shadow-trans-line {
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--accent);
      margin-bottom: 4px;
    }

    /* 3. Spaced Repetition (SRS) Bar under Flashcard */
    .srs-rating-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
      background: #FAF7F2;
      border: 1px solid var(--border);
      border-radius: 13px;
      padding: 10px 14px;
      margin: 10px 0 14px;
    }
    .srs-btn-group {
      display: flex;
      gap: 7px;
      flex-wrap: wrap;
    }
    .srs-btn {
      border: 1px solid var(--border);
      background: #FFFFFF;
      border-radius: 9px;
      padding: 6px 12px;
      font-family: inherit;
      font-size: 0.8rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.16s ease;
    }
    .srs-btn.srs-hard { color: #A63A22; border-color: #EABDB3; background: #FFF6F4; }
    .srs-btn.srs-hard:hover { background: #FEE7E2; }
    .srs-btn.srs-good { color: #7D5216; border-color: #E8CFAA; background: #FFFBF2; }
    .srs-btn.srs-good:hover { background: #FFF2DA; }
    .srs-btn.srs-easy { color: #2F5233; border-color: #C2D7C5; background: #F2F8F3; }
    .srs-btn.srs-easy:hover { background: #E3F0E5; }

    /* 4. Ear Training (Listening Dictation) */
    .ear-audio-hero {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 12px;
      background: linear-gradient(135deg, #FFF7EC 0%, #EFF4EF 100%);
      border: 1px solid #E5D6C3;
      border-radius: 15px;
      padding: 16px 18px;
      margin-bottom: 14px;
    }
    .ear-answer-well {
      min-height: 58px;
      background: #FAF7F2;
      border: 1.5px dashed #D6C9B8;
      border-radius: 14px;
      padding: 12px 14px;
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
      margin-bottom: 14px;
    }
    .ear-word-bank {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }
    .ear-chip {
      border: 1.5px solid var(--border);
      background: #FFFFFF;
      color: var(--text);
      font-family: inherit;
      font-size: 0.92rem;
      font-weight: 600;
      padding: 8px 14px;
      border-radius: 11px;
      cursor: pointer;
      transition: all 0.15s ease;
      box-shadow: 0 2px 6px rgba(58, 50, 45, 0.04);
    }
    .ear-chip:hover:not(:disabled) {
      border-color: var(--accent);
      transform: translateY(-1px);
    }
    .ear-chip.picked {
      background: #FFF5EC;
      border-color: var(--accent);
      color: var(--accent);
    }
    .ear-chip.used {
      opacity: 0.32;
      cursor: default;
      transform: none;
    }

    /* 5. Public Live Interactive Demo Grid (#portal-preview) */
    .public-live-demo-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 20px;
      margin-bottom: 22px;
      align-items: stretch;
    }
    .demo-widget-card {
      background: linear-gradient(150deg, #FFFFFF 0%, #FDF9F3 100%);
      border: 1.5px solid #E5D5C3;
      border-radius: 20px;
      padding: 22px;
      box-shadow: 0 10px 28px rgba(58, 50, 45, 0.06);
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      gap: 12px;
    }
    .demo-flashcard-box {
      background: #FAF6F0;
      border: 1.5px solid #E8DDD0;
      border-radius: 16px;
      padding: 24px 18px;
      text-align: center;
      cursor: pointer;
      transition: border-color 0.18s, transform 0.18s;
    }
    .demo-flashcard-box:hover {
      border-color: var(--accent);
      transform: translateY(-1px);
    }

    /* 6. Post-Payment Highlight Banner above Calendar */
    .post-payment-book-banner {
      display: none;
      background: linear-gradient(135deg, #ECF6EE 0%, #FFF8EE 100%);
      border: 2px solid #8AB391;
      border-radius: 16px;
      padding: 16px 20px;
      margin-bottom: 16px;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 12px;
    }

    @media (max-width: 860px) {
      .teacher-quick-word-row,
      .public-live-demo-grid {
        grid-template-columns: 1fr;
      }
    }

    /* ==========================================================================
       V22 STAGE 1: LIVE SLOTS, SELF-STUDY ($9.99 + 14D FREE), GIFT CARDS & GUARANTEE
       ========================================================================== */

    .live-slots-strip {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 8px;
      background: #F1F7F2;
      border: 1px solid #C6DAC9;
      border-radius: 13px;
      padding: 10px 14px;
      margin-bottom: 14px;
      font-size: 0.84rem;
      color: #2E4B33;
    }
    .live-slots-chips {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      align-items: center;
    }
    .live-slot-chip {
      background: #FFFFFF;
      border: 1px solid #B7CEBC;
      color: #2B4730;
      font-weight: 700;
      font-size: 0.78rem;
      padding: 3px 9px;
      border-radius: 99px;
    }

    .plan-mode-switch.four-way {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 6px;
    }
    .plan-mode-switch.four-way .mode-tab-btn {
      font-size: 0.82rem;
      padding: 9px 10px;
    }

    .selfstudy-perks-box {
      background: linear-gradient(135deg, #F4F7FF 0%, #FAF6F0 100%);
      border: 1px solid #D4DDF2;
      border-radius: 14px;
      padding: 14px 16px;
      margin-bottom: 14px;
      font-size: 0.87rem;
      color: var(--text);
    }
    .selfstudy-perks-box ul {
      margin: 8px 0 0 18px;
      color: var(--muted);
    }
    .selfstudy-perks-box li { margin-bottom: 4px; }

    .gift-form-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-bottom: 10px;
    }
    .gift-redeem-trigger-row {
      display: flex;
      justify-content: center;
      margin-top: 10px;
    }
    .gift-redeem-link-btn {
      background: none;
      border: none;
      color: var(--muted);
      font-family: inherit;
      font-size: 0.82rem;
      font-weight: 600;
      cursor: pointer;
      text-decoration: underline;
    }
    .gift-redeem-link-btn:hover { color: var(--accent); }

    .trust-guarantee-note {
      text-align: center;
      font-size: 0.79rem;
      color: var(--muted);
      margin-top: 10px;
    }

    .selfstudy-status-banner {
      display: none;
      background: linear-gradient(135deg, #F3F6FF 0%, #FFF9F2 100%);
      border: 1px solid #CFD9F0;
      border-radius: 15px;
      padding: 14px 18px;
      margin-bottom: 16px;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
    }

    @media (max-width: 720px) {
      .plan-mode-switch.four-way {
        grid-template-columns: repeat(2, 1fr);
      }
      .gift-form-grid {
        grid-template-columns: 1fr;
      }
    }

    /* ==========================================================================
       V27 PART A: MOBILE HEADER OVERHAUL, STREAK MODAL SCROLL FIX & MOBILE UX
       ========================================================================== */

    html, body {
      max-width: 100%;
      overflow-x: clip;
    }
    body.modal-open-lock {
      overflow: hidden !important;
    }

    /* Fix touch scrolling for ALL modals & specifically #streakDetailsModal on iOS Safari & Android Chrome */
    .modal-backdrop {
      overflow-y: auto !important;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      touch-action: pan-y;
    }
    .modal-box {
      max-height: min(86vh, 86dvh);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      touch-action: pan-y;
    }

    /* Eliminate nested scroll trap inside Streak Modal so the whole modal scrolls effortlessly with one swipe! */
    #streakDetailsModal .modal-box {
      max-height: none;
      overflow-y: visible;
      margin: auto 0;
    }
    #streakDetailsModal .streak-ranks-ladder {
      max-height: none !important;
      overflow-y: visible !important;
      padding-right: 0;
    }

    /* Clean Header Defaults (Desktop >= 980px) */
    .student-mobile-top-actions,
    .student-mobile-subbar,
    .student-mobile-drawer {
      display: none;
    }

    .mobile-menu-highlight {
      background: linear-gradient(135deg, #FFF5EC 0%, #FFFFFF 100%);
      border: 1px solid #ECCBB2;
      color: var(--accent) !important;
      font-weight: 700 !important;
    }
    .mobile-menu-guides-box {
      background: #FAF6F0;
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 8px;
      margin: 4px 0;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .mobile-menu-guides-label {
      font-size: 0.72rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--muted);
      padding: 4px 10px 2px;
    }

    /* Switch Public Header to Clean Mobile Bar below 980px (prevents multi-line wrapping of nav links!) */
    @media (max-width: 980px) {
      .public-header-right {
        display: none !important;
      }
      .mobile-header-actions {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
      }
    }

    /* Mobile Header & Workspace (< 860px): Replace 7-item student bar pileup with sleek 2-row app bar + drawer! */
    @media (max-width: 860px) {
      header {
        padding: 11px 0;
      }
      .container {
        padding: 0 16px;
      }
      nav.site-nav {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap !important;
        gap: 8px;
      }
      .logo {
        font-size: 1.08rem;
        gap: 8px;
        min-width: 0;
        flex-shrink: 1;
      }
      .logo-text {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .logo-mark {
        width: 30px;
        height: 30px;
      }

      /* Hide desktop 7-item student bar on phones & tablets */
      body.student-mode .student-header-bar {
        display: none !important;
      }
      body.student-mode .student-mobile-top-actions {
        display: inline-flex !important;
        align-items: center;
        gap: 7px;
        flex-shrink: 0;
      }
      body.student-mode .student-mobile-subbar {
        display: flex !important;
        align-items: center;
        gap: 7px;
        flex-wrap: wrap;
        margin-top: 9px;
        padding-top: 8px;
        border-top: 1px solid rgba(234, 226, 215, 0.75);
      }
      body.student-mode .student-mobile-subbar .balance-pill,
      body.student-mode .student-mobile-subbar .unbooked-pill {
        font-size: 0.76rem;
        padding: 4px 10px;
      }
      body.student-mode .student-mobile-drawer.open {
        display: flex !important;
        flex-direction: column;
        gap: 4px;
        margin-top: 10px;
        padding: 8px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        box-shadow: 0 10px 26px rgba(58, 50, 45, 0.1);
      }
      .mobile-drawer-item {
        width: 100%;
        text-align: left;
        background: transparent;
        border: none;
        padding: 10px 12px;
        border-radius: 10px;
        font-family: inherit;
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--text);
        cursor: pointer;
      }
      .mobile-drawer-item:hover,
      .mobile-drawer-item:active {
        background: #FAF4EC;
      }

      /* Mobile Modal Alignment & Smooth Single-Container Scrolling */
      .modal-backdrop {
        align-items: flex-start !important;
        padding: 12px 10px 28px !important;
      }
      .modal-box {
        margin: auto 0;
        padding: 20px 16px;
        border-radius: 18px;
      }
      #streakDetailsModal .streak-week-strip {
        gap: 4px;
      }
      .teacher-student-select {
        min-width: 0;
        width: 100%;
      }

      /* Mobile Hero, Flashcards & Sections Polish */
      .hero {
        padding: 40px 0 32px;
      }
      .hero h1 {
        font-size: 1.95rem;
        line-height: 1.2;
      }
      .hero p {
        font-size: 0.98rem;
        margin-bottom: 22px;
      }
      section {
        padding: 42px 0;
      }
      .section-header h2 {
        font-size: 1.65rem;
      }
      .flashcard-word {
        font-size: 1.52rem;
      }
      .flashcard-trans-pill {
        font-size: 0.82rem;
        padding: 4px 11px;
      }
      .flashcard-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
      }
      .flashcard-controls > div {
        justify-content: center;
      }
      #flashcardCounter {
        text-align: center;
        display: block;
      }
      .srs-rating-bar {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
      }
      .srs-btn-group {
        justify-content: center;
      }
    }

    /* Extra-narrow phones (320px - 430px): Keep top bar ultra-clean (Logo + Portal + Hamburger) */
    @media (max-width: 430px) {
      .mobile-trial-cta {
        display: none !important;
      }
      .mobile-portal-cta {
        padding: 7px 11px;
        font-size: 0.8rem;
      }
      .mobile-menu-btn {
        width: 36px;
        height: 36px;
      }
    }

    /* ==========================================================================
       V29 STAGE 3: TEACHER PULSE RADAR, STUDENT TOPIC REQUEST & PRE-LESSON WARMUP
       ========================================================================== */

    .teacher-pulse-strip {
      display: flex;
      flex-wrap: wrap;
      gap: 7px;
      align-items: center;
      padding-top: 9px;
      border-top: 1px dashed rgba(250, 246, 240, 0.18);
      font-size: 0.79rem;
    }
    .pulse-chip {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 4px 10px;
      border-radius: 99px;
      font-family: inherit;
      font-size: 0.77rem;
      font-weight: 700;
      cursor: pointer;
      border: 1px solid transparent;
      transition: transform 0.14s ease, opacity 0.14s ease;
    }
    .pulse-chip:hover { transform: translateY(-1px); opacity: 0.94; }
    .pulse-chip.p-sleep {
      background: rgba(242, 193, 78, 0.18);
      border-color: rgba(242, 193, 78, 0.45);
      color: #FFE49E;
    }
    .pulse-chip.p-low {
      background: rgba(229, 115, 95, 0.2);
      border-color: rgba(229, 115, 95, 0.48);
      color: #FFC6BC;
    }
    .pulse-chip.p-topic {
      background: rgba(145, 204, 155, 0.22);
      border-color: rgba(145, 204, 155, 0.5);
      color: #D2F4D8;
    }

    .teacher-topic-alert {
      display: none;
      background: rgba(255, 248, 232, 0.12);
      border: 1px solid rgba(242, 193, 78, 0.42);
      border-radius: 11px;
      padding: 9px 12px;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
      font-size: 0.83rem;
      color: #FFF6E5;
    }

    .topic-request-card {
      background: linear-gradient(145deg, #FFFFFF 0%, #FDF8F1 100%);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 18px 22px;
      margin-bottom: 18px;
      box-shadow: var(--shadow-soft);
    }
    .topic-request-row {
      display: flex;
      gap: 9px;
      margin-top: 10px;
      align-items: center;
      flex-wrap: wrap;
    }
    .topic-request-row .input-field {
      flex: 1 1 260px;
      margin-bottom: 0;
    }
    .saved-topic-pill {
      display: none;
      margin-top: 10px;
      background: var(--sage-light);
      border: 1px solid #C3D6C5;
      border-radius: 12px;
      padding: 9px 13px;
      font-size: 0.85rem;
      color: #2B4B30;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
    }

    /* ==========================================================================
       V31 PLATFORM-ONLY GIFT CERTIFICATE GENERATOR & PURE SELF-STUDY MODE
       ========================================================================== */

    .teacher-gift-row {
      display: grid;
      grid-template-columns: 1fr 0.72fr 1.1fr auto;
      gap: 8px;
      align-items: center;
      padding-top: 10px;
      border-top: 1px dashed rgba(250, 246, 240, 0.18);
    }
    .teacher-gift-result {
      display: none;
      background: rgba(236, 246, 238, 0.14);
      border: 1px solid rgba(152, 212, 161, 0.45);
      border-radius: 12px;
      padding: 10px 14px;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 10px;
      font-size: 0.83rem;
      color: #ECF8EE;
    }
    #giftPackSelector {
      grid-template-columns: repeat(4, 1fr);
    }
    @media (max-width: 860px) {
      .teacher-gift-row {
        grid-template-columns: 1fr;
      }
      #giftPackSelector {
        grid-template-columns: repeat(2, 1fr);
      }
    }

    /* ==========================================================================
       V32: 30-DAY PORTAL ACCESS LOCK GATE + STUDENT SELF-STUDY REACTIVATION
       ========================================================================== */

    .portal-locked-banner {
      display: none;
      background: linear-gradient(135deg, #FFF5EC 0%, #FFFFFF 60%, #F7EFE7 100%);
      border: 2px solid #E2B89B;
      border-radius: 20px;
      padding: 24px 26px;
      margin-bottom: 20px;
      box-shadow: 0 10px 28px rgba(200, 109, 81, 0.08);
      flex-direction: column;
      gap: 10px;
    }

    body.portal-access-locked .portal-tab-btn:not([data-ptab="plan"]) {
      opacity: 0.45;
      cursor: not-allowed;
    }
    body.portal-access-locked #topHeaderStreakPill,
    body.portal-access-locked #mobileTopStreakPill {
      display: none !important;
    }

    .student-selfstudy-reactivate-box {
      margin-top: 20px;
      background: linear-gradient(135deg, #F4F7FF 0%, #FAF6F0 100%);
      border: 1.5px solid #CFD9F0;
      border-radius: 18px;
      padding: 20px 22px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 16px;
    }
