    :root {
      --bg: #f3f4f6;
      --card: #ffffff;
      --text: #111827;
      --muted: #6b7280;
      --line: #e5e7eb;
      --blue: #2563eb;
      --blue-dark: #1d4ed8;
      --green: #065f46;
      --orange: #b45309;
      --red: #b91c1c;
      --shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
    }

    * {
      box-sizing: border-box;
    }

    html,
    body {
      max-width: 100%;
      overflow-x: hidden;
    }

    body {
      margin: 0;
      background: var(--bg);
      color: var(--text);
      font-family: Arial, sans-serif;
      padding: 0;
    }

    .app {
      max-width: 900px;
      margin: 0 auto;
      padding: 8px;
    }

    .site-shell {
      min-height: 100vh;
      background: #f8fafc;
      color: #111827;
    }

    .site-header {
      max-width: 1080px;
      margin: 0 auto;
      padding: 14px 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
    }

    .brand {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      cursor: pointer;
      background: transparent;
      border: 0;
      padding: 0;
      min-height: 0;
      color: inherit;
      text-align: left;
    }

    .brand-mark {
      width: 34px;
      height: 34px;
      border-radius: 10px;
      background: #111827;
      color: #fff;
      display: grid;
      place-items: center;
      font-weight: 700;
      font-size: 13px;
    }

    .brand-title {
      font-weight: 750;
      font-size: 18px;
    }

    .brand-subtitle {
      color: #6b7280;
      font-size: 12px;
    }

    .site-actions {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .app-shell {
      max-width: 920px;
      margin: 0 auto;
      padding: 14px 12px 32px;
    }

    .app-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      margin-bottom: 12px;
      padding: 0;
      max-width: none;
    }

    .intro-panel {
      background: #ffffff;
      border: 1px solid #e5e7eb;
      border-radius: 14px;
      padding: 14px 16px;
      margin: 0 8px 12px;
    }

    .intro-panel h1 {
      font-size: 22px;
      line-height: 1.2;
      margin: 0 0 6px;
      letter-spacing: -0.02em;
    }

    .intro-panel p {
      font-size: 14px;
      line-height: 1.55;
      color: #4b5563;
      margin: 0;
    }

    .study-stats-panel {
      background: #ffffff;
      border: 1px solid #e5e7eb;
      border-radius: 14px;
      padding: 12px;
      margin: 0 8px 12px;
      box-sizing: border-box;
      max-width: 100%;
      min-width: 0;
      overflow: hidden;
    }

    .study-stats-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 8px;
    }

    .study-stats-header h2 {
      margin: 0;
      font-size: 18px;
      letter-spacing: -0.01em;
    }

    .study-stats-header p {
      margin: 2px 0 0;
      font-size: 12px;
      color: #6b7280;
    }

    .study-stats-close {
      min-height: 28px;
      padding: 4px 10px;
      font-size: 12px;
      border-radius: 999px;
      border: 1px solid #d1d5db;
      background: #fff;
      color: #111827;
    }

    .study-stats-range {
      display: inline-flex;
      gap: 6px;
      flex-wrap: wrap;
      margin-bottom: 8px;
    }

    .study-stats-range button {
      min-height: 26px;
      padding: 4px 8px;
      font-size: 12px;
      border: 1px solid #d1d5db;
      background: #fff;
      color: #111827;
      border-radius: 999px;
    }

    .study-stats-range button.is-active {
      background: #eff6ff;
      border-color: #93c5fd;
      color: #1d4ed8;
    }

    .study-stats-status {
      margin: 0 0 8px;
      font-size: 12px;
      color: #6b7280;
    }

    .chunks-list-panel {
      background: #ffffff;
      border: 1px solid #e5e7eb;
      border-radius: 14px;
      padding: 12px;
      margin: 0 8px 12px;
      box-sizing: border-box;
      max-width: 100%;
      min-width: 0;
    }

    .drill-panel {
      background: #ffffff;
      border: 1px solid #99f6e4;
      border-radius: 14px;
      padding: 14px;
      margin: 0 8px 12px;
      box-sizing: border-box;
      max-width: 100%;
      min-width: 0;
      box-shadow: 0 8px 20px rgba(15, 118, 110, 0.08);
    }

    .drill-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 12px;
      margin-bottom: 8px;
    }

    .drill-header h2 {
      margin: 0 0 2px;
      font-size: 1.05rem;
    }

    .drill-header p,
    .drill-status,
    .drill-hint {
      margin: 0;
      color: #64748b;
      font-size: 12px;
    }

    .drill-close,
    .drill-setup-toolbar > button:not(.drill-deck-toggle),
    .drill-actions button {
      min-height: 32px;
      padding: 5px 10px;
      border-radius: 999px;
      border: 1px solid #99f6e4;
      background: #fff;
      color: #0f766e;
      font-size: 13px;
      font-weight: 700;
    }

    .drill-setup-toolbar {
      display: flex;
      gap: 6px;
      align-items: stretch;
      margin: 0 0 6px;
      flex-wrap: wrap;
    }

    .drill-shuffle-btn.is-active {
      background: #ccfbf1;
      border-color: #0d9488;
      color: #0f766e;
    }

    .upload-panel {
      background: #ffffff;
      border: 1px solid #99f6e4;
      border-radius: 14px;
      padding: 14px;
      margin: 0 8px 12px;
      box-sizing: border-box;
      max-width: 100%;
      min-width: 0;
      box-shadow: 0 8px 20px rgba(15, 118, 110, 0.08);
    }

    .upload-panel .drill-header {
      margin-bottom: 10px;
    }

    .upload-mode-toggle {
      display: inline-flex;
      gap: 0;
      margin: 0 0 10px;
      border: 1px solid #cbd5e1;
      border-radius: 999px;
      overflow: hidden;
      background: #f8fafc;
    }

    .upload-mode-toggle button {
      min-height: 30px;
      padding: 4px 12px;
      border: 0;
      background: transparent;
      color: #475569;
      font-size: 12px;
      font-weight: 700;
    }

    .upload-mode-toggle button.is-active {
      background: #0f766e;
      color: #fff;
    }

    .upload-form-grid {
      display: grid;
      gap: 8px;
    }

    .upload-field label {
      display: block;
      margin: 0 0 4px;
      color: #334155;
      font-size: 12px;
      font-weight: 700;
    }

    .upload-field input[type="text"],
    .upload-field input[type="file"] {
      width: 100%;
      box-sizing: border-box;
      border: 1px solid #cbd5e1;
      border-radius: 10px;
      padding: 8px 10px;
      font-size: 13px;
      background: #fff;
      color: #0f172a;
    }

    .upload-field input[type="file"] {
      padding: 7px 8px;
    }

    .upload-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 4px;
    }

    .upload-actions button {
      min-height: 32px;
      padding: 5px 12px;
      border-radius: 999px;
      border: 1px solid #99f6e4;
      background: #fff;
      color: #0f766e;
      font-size: 13px;
      font-weight: 700;
    }

    .upload-actions button.primary {
      background: #0f766e;
      border-color: #0f766e;
      color: #fff;
    }

    .upload-actions button:disabled {
      opacity: 0.55;
      cursor: not-allowed;
    }

    .upload-progress-wrap {
      margin-top: 8px;
      display: none;
    }

    .upload-progress-wrap.is-visible {
      display: block;
    }

    .upload-progress-meta {
      display: flex;
      justify-content: space-between;
      gap: 8px;
      margin: 0 0 4px;
      color: #475569;
      font-size: 12px;
      font-weight: 700;
    }

    .upload-progress-track {
      height: 10px;
      border-radius: 999px;
      background: #e2e8f0;
      overflow: hidden;
    }

    .upload-progress-fill {
      height: 100%;
      width: 0%;
      border-radius: 999px;
      background: linear-gradient(90deg, #14b8a6, #0f766e);
      transition: width 0.12s linear;
    }

    .upload-status {
      margin: 8px 0 0;
      color: #64748b;
      font-size: 12px;
    }

    .drill-setup-toolbar .drill-deck-toggle {
      flex: 1 1 auto;
      min-width: 0;
      min-height: 32px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      border: 1px solid #cbd5e1;
      border-radius: 10px;
      background: #fff;
      color: #0f172a;
      padding: 4px 10px;
      font-size: 13px;
      font-weight: 700;
      text-align: left;
    }

    .drill-deck-toggle[aria-expanded="true"] {
      border-color: #0d9488;
    }

    .drill-setup-toolbar .drill-deck-toggle:hover:not(:disabled) {
      background: #f8fafc;
      color: #0f172a;
    }

    #drillDeckToggleLabel {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .drill-deck-caret {
      flex: 0 0 auto;
      color: #64748b;
      font-size: 11px;
    }

    .drill-deck-list {
      margin: 0 0 6px;
      border: 1px solid #cbd5e1;
      border-radius: 10px;
      overflow-x: hidden;
      overflow-y: auto;
      max-height: min(36vh, 196px);
      max-height: min(36dvh, 196px);
      background: #fff;
      -webkit-overflow-scrolling: touch;
    }

    .drill-deck-list[hidden] {
      display: none;
    }

    .drill-deck-item,
    .drill-deck-empty {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 8px;
      width: 100%;
      min-height: 32px;
      margin: 0;
      padding: 5px 10px;
      border: 0;
      border-bottom: 1px solid #f1f5f9;
      border-radius: 0;
      background: #fff;
      color: #0f172a;
      font-size: 13px;
      font-weight: 650;
      line-height: 1.25;
      text-align: left;
      appearance: none;
      -webkit-appearance: none;
      -webkit-tap-highlight-color: transparent;
    }

    .drill-deck-item:hover:not(:disabled) {
      background: #f8fafc;
      color: #0f172a;
    }

    .drill-deck-item:last-child,
    .drill-deck-empty:last-child {
      border-bottom: 0;
    }

    .drill-deck-item.is-selected,
    .drill-deck-item.is-selected:hover:not(:disabled) {
      background: #ccfbf1;
      color: #0f766e;
    }

    .drill-deck-count {
      flex: 0 0 auto;
      color: #64748b;
      font-size: 11px;
      font-weight: 700;
    }

    .drill-deck-empty {
      color: #64748b;
      font-weight: 600;
    }

    .drill-actions .primary,
    .drill-setup-toolbar button.primary {
      background: #0d9488;
      border-color: #0d9488;
      color: #fff;
    }

    .drill-card {
      border: 1px solid #e2e8f0;
      border-radius: 12px;
      padding: 14px;
      background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
      margin: 10px 0;
    }

    .drill-card-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 4px;
    }

    .drill-card-top .drill-card-label {
      margin: 0;
    }

    .drill-star-btn {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      min-height: 28px;
      padding: 3px 8px;
      border: 1px solid #d1d5db;
      border-radius: 999px;
      background: #fff;
      color: #374151;
      font-size: 12px;
      font-weight: 700;
      line-height: 1;
    }

    .drill-star-btn:hover:not(:disabled) {
      background: #fffbeb;
      color: #92400e;
    }

    .drill-star-btn.is-starred {
      border-color: #f59e0b;
      background: #fffbeb;
      color: #92400e;
    }

    .drill-star-btn.is-starred:hover:not(:disabled) {
      background: #fef3c7;
      color: #92400e;
    }

    .drill-deck-item.is-starred-deck {
      background: #fffbeb;
    }

    .drill-deck-item.is-starred-deck.is-selected {
      background: #fde68a;
      color: #92400e;
    }

    .drill-card-label {
      margin: 0 0 4px;
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: #64748b;
      font-weight: 700;
    }

    .drill-prompt {
      margin: 0 0 12px;
      font-size: 22px;
      line-height: 1.35;
      color: #0f172a;
      font-weight: 700;
    }

    .drill-answer {
      margin: 0 0 12px;
      font-size: 22px;
      line-height: 1.35;
      color: #0f766e;
      font-weight: 700;
    }

    .drill-explanation {
      margin: 0;
      font-size: 15px;
      line-height: 1.4;
      color: #334155;
      white-space: pre-wrap;
    }

    .drill-timing {
      margin: 8px 0 0;
      font-size: 13px;
      line-height: 1.35;
      color: #0f766e;
      font-weight: 600;
    }

    .drill-history-wrap {
      margin: 8px 0 12px;
    }

    .drill-history-bar {
      display: flex;
      align-items: stretch;
      width: 100%;
      height: 14px;
      border-radius: 999px;
      overflow: visible;
      background: #e2e8f0;
      gap: 3px;
      padding: 3px;
      box-sizing: border-box;
    }

    .drill-history-seg {
      min-width: 6px;
      border-radius: 999px;
      height: 100%;
      box-sizing: border-box;
      opacity: 0.88;
      transition: filter 120ms ease, opacity 120ms ease, box-shadow 120ms ease;
    }

    .drill-history-seg.is-current {
      opacity: 1;
      box-shadow: 0 0 0 2px #0f172a;
      z-index: 1;
      filter: saturate(1.15);
    }

    .drill-history-seg.is-capped {
      background-image: repeating-linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.35) 0,
        rgba(255, 255, 255, 0.35) 3px,
        transparent 3px,
        transparent 6px
      );
    }

    .drill-history-trend {
      margin: 6px 0 0;
      font-size: 12px;
      line-height: 1.3;
      color: #64748b;
      font-weight: 600;
    }

    .drill-history-trend.is-faster { color: #15803d; }
    .drill-history-trend.is-slower { color: #b45309; }
    .drill-history-trend.is-same { color: #64748b; }

    .drill-actions {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .drill-grade-row {
      display: grid;
      grid-template-columns: repeat(5, minmax(0, 1fr));
      gap: 8px;
    }

    #drillTodayBtn {
      background: #0d9488;
      border-color: #0d9488;
      color: #ffffff;
    }
    #drillLater1Btn,
    #drillLater3Btn,
    #drillLater7Btn,
    #drillLater30Btn {
      background: #ffffff;
      border-color: #99f6e4;
      color: #0f766e;
    }

    .drill-hint { margin-top: 10px; }

    @media (max-width: 640px) {
      .drill-grade-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      #drillTodayBtn {
        grid-column: 1 / -1;
      }
    }

    .chunks-list-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 8px;
    }

    .chunks-list-header h2 {
      margin: 0;
      font-size: 18px;
      letter-spacing: -0.01em;
    }

    .chunks-list-header p {
      margin: 2px 0 0;
      font-size: 12px;
      color: #6b7280;
      overflow-wrap: anywhere;
    }

    .chunks-list-close {
      flex: 0 0 auto;
      min-height: 28px;
      padding: 4px 10px;
      font-size: 12px;
      border-radius: 999px;
      border: 1px solid #d1d5db;
      background: #fff;
      color: #111827;
    }

    .chunks-list-status {
      margin: 0 0 8px;
      font-size: 12px;
      color: #6b7280;
    }

    .chunks-list-body {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 8px;
      max-height: min(70vh, 520px);
      max-height: min(70dvh, 520px);
      overflow-x: hidden;
      overflow-y: auto;
      min-width: 0;
      -webkit-overflow-scrolling: touch;
    }

    .chunks-list-empty {
      margin: 0;
      font-size: 13px;
      color: #6b7280;
    }

    .chunks-list-item {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      flex: 0 0 auto;
      width: 100%;
      height: auto;
      min-height: 0;
      text-align: left;
      white-space: normal;
      border: 1px solid #e5e7eb;
      background: #fff;
      border-radius: 10px;
      padding: 10px 12px;
      cursor: pointer;
      color: #111827;
      box-sizing: border-box;
      appearance: none;
      -webkit-appearance: none;
    }

    .chunks-list-item:hover {
      background: #f9fafb;
    }

    .chunks-list-item.is-active {
      border-color: #0d9488;
      background: #f0fdfa;
    }

    .chunks-list-item-meta {
      font-size: 11px;
      font-weight: 700;
      color: #6b7280;
      margin-bottom: 6px;
      line-height: 1.3;
    }

    .chunks-list-item-vi {
      font-size: 14px;
      line-height: 1.4;
      margin-bottom: 4px;
      overflow-wrap: anywhere;
      word-break: break-word;
      white-space: normal;
    }

    .chunks-list-item-tr {
      font-size: 12px;
      line-height: 1.4;
      color: #4b5563;
      overflow-wrap: anywhere;
      word-break: break-word;
      white-space: normal;
    }

    .stats-balance {
      border: 1px solid #e5e7eb;
      border-radius: 10px;
      background: #fff;
      padding: 10px;
      margin-bottom: 10px;
    }

    .stats-balance-title {
      margin: 0 0 6px;
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: #64748b;
      font-weight: 700;
    }

    .stats-balance-meta {
      display: flex;
      justify-content: space-between;
      gap: 8px;
      margin: 0 0 8px;
      font-size: 12px;
      color: #475569;
      font-weight: 600;
    }

    .stats-balance-meta .listen { color: #1d4ed8; }
    .stats-balance-meta .phrase { color: #0f766e; }

    .stats-balance-bar {
      display: flex;
      width: 100%;
      height: 14px;
      border-radius: 999px;
      overflow: hidden;
      background: #e2e8f0;
      gap: 2px;
    }

    .stats-balance-bar .listen {
      background: #3b82f6;
      min-width: 0;
    }

    .stats-balance-bar .phrase {
      background: #14b8a6;
      min-width: 0;
    }

    .stats-summary-cards {
      display: none;
    }

    .stats-overview {
      border: 1px solid #dbe4ea;
      border-radius: 16px;
      background:
        radial-gradient(circle at top right, rgba(20, 184, 166, 0.14), transparent 42%),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
      padding: 14px;
      margin-bottom: 12px;
      box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
    }

    .stats-overview-toggle {
      display: inline-flex;
      gap: 4px;
      padding: 3px;
      border-radius: 999px;
      background: #eef2f7;
      margin-bottom: 12px;
    }

    .stats-overview-toggle button {
      border: 0;
      background: transparent;
      color: #64748b;
      border-radius: 999px;
      min-height: 32px;
      padding: 6px 12px;
      font-weight: 700;
      font-size: 12px;
    }

    .stats-overview-toggle button.is-active {
      background: #0f766e;
      color: #fff;
    }

    .stats-overview-hero {
      display: grid;
      gap: 4px;
      margin-bottom: 12px;
    }

    .stats-overview-kicker {
      margin: 0;
      font-size: 11px;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      color: #64748b;
      font-weight: 700;
    }

    .stats-overview-total {
      margin: 0;
      font-size: clamp(34px, 8vw, 48px);
      line-height: 1;
      font-weight: 800;
      letter-spacing: -0.04em;
      color: #0f172a;
    }

    .stats-overview-motto {
      margin: 2px 0 0;
      font-size: 14px;
      line-height: 1.4;
      color: #334155;
      font-weight: 600;
    }

    .stats-overview-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin: 10px 0 12px;
    }

    .stats-overview-pill {
      border: 1px solid #e2e8f0;
      background: #fff;
      border-radius: 999px;
      padding: 5px 10px;
      font-size: 12px;
      font-weight: 700;
      color: #475569;
    }

    .stats-overview-bars {
      display: grid;
      gap: 8px;
    }

    .stats-overview-row {
      display: grid;
      grid-template-columns: minmax(92px, 120px) 1fr auto;
      gap: 8px;
      align-items: center;
    }

    .stats-overview-row-label {
      font-size: 12px;
      font-weight: 700;
      color: #334155;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .stats-overview-track {
      height: 12px;
      border-radius: 999px;
      background: #e2e8f0;
      overflow: hidden;
    }

    .stats-overview-fill {
      display: block;
      height: 100%;
      border-radius: 999px;
      min-width: 0;
    }

    .stats-overview-fill.is-listen { background: #3b82f6; }
    .stats-overview-fill.is-phrase { background: #14b8a6; }
    .stats-overview-fill.is-manual { background: #f59e0b; }
    .stats-overview-fill.is-manual-2 { background: #fb7185; }
    .stats-overview-fill.is-manual-3 { background: #8b5cf6; }
    .stats-overview-fill.is-manual-4 { background: #10b981; }

    .stats-overview-row-value {
      font-size: 12px;
      font-weight: 800;
      color: #0f172a;
      min-width: 58px;
      text-align: right;
    }

    .stats-overview-empty {
      margin: 0;
      color: #64748b;
      font-size: 13px;
    }

    .manual-study-box {
      border: 1px solid #e5e7eb;
      border-radius: 10px;
      background: #fff;
      padding: 10px;
      margin-bottom: 10px;
    }

    .manual-study-box h3 {
      margin: 0 0 8px;
      font-size: 13px;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: #64748b;
    }

    .manual-study-form {
      display: grid;
      grid-template-columns: minmax(110px, 1.1fr) minmax(120px, 1.3fr) minmax(70px, 0.7fr) minmax(0, 1.4fr) auto;
      gap: 8px;
      align-items: end;
      margin-bottom: 10px;
    }

    .manual-study-form label {
      display: grid;
      gap: 4px;
      font-size: 11px;
      font-weight: 700;
      color: #64748b;
      text-transform: uppercase;
      letter-spacing: 0.03em;
    }

    .manual-study-form input,
    .manual-study-form select {
      width: 100%;
      min-height: 34px;
      border: 1px solid #d1d5db;
      border-radius: 8px;
      padding: 6px 8px;
      font-size: 13px;
      background: #fff;
      color: #111827;
    }

    .manual-study-form button {
      min-height: 34px;
      white-space: nowrap;
    }

    .manual-week-nav {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin: 0 0 8px;
    }

    .manual-week-nav strong {
      font-size: 13px;
      color: #0f172a;
    }

    .manual-week-breakdown {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin: 0 0 8px;
    }

    .manual-week-chip {
      border: 1px solid #e2e8f0;
      border-radius: 999px;
      padding: 4px 10px;
      font-size: 12px;
      font-weight: 700;
      color: #334155;
      background: #f8fafc;
    }

    .manual-week-chip.is-total {
      background: #ecfeff;
      border-color: #99f6e4;
      color: #0f766e;
    }

    .manual-week-chip.is-listen { color: #1d4ed8; }
    .manual-week-chip.is-phrase { color: #0f766e; }

    .manual-entry-list {
      display: grid;
      gap: 6px;
    }

    .manual-entry-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      border: 1px solid #e5e7eb;
      border-radius: 8px;
      padding: 7px 8px;
      background: #f8fafc;
      font-size: 13px;
    }

    .manual-entry-row p {
      margin: 0;
      color: #111827;
    }

    .manual-entry-row .muted {
      color: #64748b;
      font-size: 12px;
    }

    .manual-entry-row button {
      min-height: 28px;
      padding: 4px 8px;
      font-size: 12px;
    }

    .manual-study-status {
      margin: 0 0 8px;
      font-size: 12px;
      color: #64748b;
    }

    @media (max-width: 720px) {
      .manual-study-form {
        grid-template-columns: 1fr 1fr;
      }
      .manual-study-form button {
        grid-column: 1 / -1;
      }
    }

    .stats-card {
      border: 1px solid #e5e7eb;
      border-radius: 10px;
      background: #f8fafc;
      padding: 8px;
      min-width: 0;
    }

    .stats-card-label {
      margin: 0;
      font-size: 11px;
      color: #6b7280;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      font-weight: 700;
    }

    .stats-card-value {
      margin: 6px 0 0;
      font-size: 18px;
      line-height: 1.1;
      font-weight: 700;
      color: #111827;
    }

    .activity-calendar {
      border: 1px solid #e5e7eb;
      border-radius: 10px;
      padding: 10px;
      margin-bottom: 10px;
      background: #fff;
    }

    .calendar-weekdays,
    .calendar-grid {
      display: grid;
      grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(34px, 0.9fr);
      gap: 4px;
      align-items: center;
    }

    .calendar-weekdays {
      margin-bottom: 4px;
    }

    .calendar-weekday {
      text-align: center;
      font-size: 10px;
      line-height: 1.2;
      color: #94a3b8;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.02em;
    }

    .calendar-weekday.is-week-total {
      color: #64748b;
    }

    .activity-week-total {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 100%;
      aspect-ratio: 1 / 1;
      border-radius: 4px;
      border: 2px solid #334155;
      background: #f1f5f9;
      color: #0f172a;
      font-size: 10px;
      font-weight: 700;
      line-height: 1.1;
      text-align: center;
      padding: 2px;
      box-sizing: border-box;
      user-select: none;
      overflow: hidden;
    }

    .activity-week-total.is-empty {
      color: #94a3b8;
      font-weight: 600;
      background: #f8fafc;
      border-color: #94a3b8;
    }

    .activity-week-total-fill {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      pointer-events: none;
    }

    .activity-week-total-fill .listen,
    .activity-week-total-fill .phrase {
      width: 100%;
      min-height: 0;
    }

    .activity-week-total-fill .listen { background: #93c5fd; }
    .activity-week-total-fill .phrase { background: #5eead4; }

    .activity-week-total-label {
      position: relative;
      z-index: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 70%;
      padding: 2px 3px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.9);
      box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
      color: #0f172a;
    }

    .activity-week-total.is-empty .activity-week-total-label {
      background: transparent;
      box-shadow: none;
      color: #94a3b8;
    }

    .activity-day {
      display: block;
      width: 100%;
      aspect-ratio: 1 / 1;
      border-radius: 4px;
      border: 1px solid rgba(15, 23, 42, 0.06);
      cursor: pointer;
      min-height: 12px;
      padding: 0;
      overflow: hidden;
      background: #f3f4f6;
    }

    .activity-day.is-empty-day {
      cursor: default;
      background: #f3f4f6;
      border-color: rgba(15, 23, 42, 0.05);
      opacity: 0.7;
    }

    .activity-day.is-today {
      box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.35);
    }

    .activity-day.is-selected {
      outline: 2px solid #111827;
      outline-offset: 1px;
    }

    .activity-day-split {
      display: flex;
      width: 100%;
      height: 100%;
    }

    .activity-day-listen,
    .activity-day-phrase {
      display: block;
      height: 100%;
      min-width: 0;
    }

    .activity-day.level-0 { background: #f3f4f6; }
    .activity-day.level-1 .activity-day-listen { background: #bfdbfe; }
    .activity-day.level-1 .activity-day-phrase { background: #99f6e4; }
    .activity-day.level-2 .activity-day-listen { background: #93c5fd; }
    .activity-day.level-2 .activity-day-phrase { background: #5eead4; }
    .activity-day.level-3 .activity-day-listen { background: #3b82f6; }
    .activity-day.level-3 .activity-day-phrase { background: #14b8a6; }
    .activity-day.level-4 .activity-day-listen { background: #1d4ed8; }
    .activity-day.level-4 .activity-day-phrase { background: #0f766e; }

    .activity-legend {
      display: flex;
      gap: 12px;
      margin-top: 8px;
      font-size: 11px;
      color: #64748b;
      font-weight: 600;
    }

    .activity-legend span::before {
      content: "";
      display: inline-block;
      width: 8px;
      height: 8px;
      border-radius: 2px;
      margin-right: 5px;
      vertical-align: middle;
    }

    .activity-legend .listen::before { background: #3b82f6; }
    .activity-legend .phrase::before { background: #14b8a6; }

    .daily-table {
      border: 1px solid #e5e7eb;
      border-radius: 10px;
      background: #fff;
      overflow-x: auto;
      margin-bottom: 10px;
    }

    .daily-table table {
      width: 100%;
      min-width: 480px;
      border-collapse: collapse;
    }

    .daily-table th,
    .daily-table td {
      text-align: left;
      font-size: 12px;
      padding: 8px;
      border-bottom: 1px solid #f1f5f9;
      white-space: nowrap;
    }

    .daily-table th {
      color: #6b7280;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.03em;
      font-size: 11px;
    }

    .daily-table tr:last-child td {
      border-bottom: none;
    }

    .daily-row-button {
      border: 0;
      background: transparent;
      color: inherit;
      font: inherit;
      padding: 0;
      cursor: pointer;
      text-align: left;
    }

    .daily-row-button.is-selected {
      color: #1d4ed8;
      font-weight: 700;
    }

    .study-day-detail {
      border: 1px solid #e5e7eb;
      border-radius: 10px;
      background: #fff;
      padding: 10px;
    }

    .study-day-detail h3 {
      margin: 0 0 6px;
      font-size: 14px;
    }

    .study-day-detail-list {
      display: grid;
      gap: 6px;
    }

    .study-day-detail-item {
      border: 1px solid #f1f5f9;
      border-radius: 8px;
      padding: 8px;
      background: #f8fafc;
    }

    .study-day-detail-item p {
      margin: 0;
      font-size: 12px;
      color: #374151;
      overflow-wrap: anywhere;
    }

    .mode-note {
      display: inline-flex;
      margin-top: 10px;
      padding: 4px 8px;
      border-radius: 999px;
      background: #f3f4f6;
      color: #4b5563;
      font-size: 12px;
      font-weight: 700;
    }

    .mode-note.is-working {
      background: #ecfdf5;
      color: #047857;
    }

    .mode-note.is-admin {
      background: #eff6ff;
      color: #1d4ed8;
    }

    .trainer-panel {
      background: #ffffff;
      border: 1px solid #e5e7eb;
      border-radius: 14px;
      padding: 12px;
      box-shadow: none;
      min-width: 0;
      max-width: 100%;
      overflow: hidden;
    }

    .lesson-bar {
      display: grid;
      grid-template-columns: auto 1fr auto;
      align-items: center;
      gap: 8px;
      margin-bottom: 10px;
      margin-top: 0;
    }

    .lesson-bar label {
      font-size: 13px;
      color: #6b7280;
      font-weight: 700;
    }

    #openTrainerHeaderBtn,
    #openTrainerHeroBtn,
    #tryDemoLessonBtn,
    #trainerHomeBtn,
    #homeView {
      display: none !important;
    }

    .home-page {
      max-width: 1080px;
      margin: 0 auto;
      padding: 18px 16px 48px;
    }

    .hero {
      display: grid;
      grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
      gap: 28px;
      align-items: center;
      margin-bottom: 28px;
    }

    .eyebrow {
      color: #1d4ed8;
      font-weight: 700;
      font-size: 13px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .hero h1 {
      font-size: clamp(34px, 5vw, 58px);
      line-height: 1.02;
      letter-spacing: -0.04em;
      margin: 8px 0 16px;
    }

    .hero p {
      font-size: 17px;
      line-height: 1.65;
      color: #4b5563;
      max-width: 620px;
      margin: 0 0 14px;
    }

    .hero-actions {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 16px;
    }

    .primary-button {
      background: #111827;
      color: #fff;
      border: 1px solid #111827;
      border-radius: 999px;
      padding: 10px 16px;
      font-weight: 700;
      cursor: pointer;
    }

    .primary-button:hover:not(:disabled) {
      background: #1f2937;
    }

    .secondary-button {
      background: #fff;
      color: #111827;
      border: 1px solid #d1d5db;
      border-radius: 999px;
      padding: 10px 16px;
      font-weight: 700;
      cursor: pointer;
    }

    .secondary-button:hover:not(:disabled) {
      background: #f9fafb;
    }

    .hero-note {
      margin-top: 12px;
      font-size: 13px;
      color: #6b7280;
    }

    .hero-card,
    .feature-card {
      background: #fff;
      border: 1px solid #e5e7eb;
      border-radius: 18px;
      box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
    }

    .hero-card {
      padding: 16px;
    }

    .preview-title {
      margin: 0 0 8px;
      font-size: 13px;
      color: #6b7280;
      font-weight: 700;
    }

    .preview-meta {
      margin: 0 0 12px;
      font-size: 13px;
      color: #111827;
      font-weight: 700;
    }

    .preview-range {
      margin: 0;
      font-size: 12px;
      color: #374151;
      font-weight: 700;
    }

    .preview-line {
      margin: 7px 0;
      padding: 10px 12px;
      border-radius: 12px;
      background: #f3f4f6;
      color: #4b5563;
      font-size: 14px;
      letter-spacing: 0.06em;
    }

    .preview-label {
      margin-top: 10px;
      font-size: 12px;
      color: #6b7280;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .preview-controls {
      margin-top: 12px;
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 6px;
    }

    .preview-controls button {
      background: #fff;
      color: #111827;
      border: 1px solid #d1d5db;
      border-radius: 10px;
      min-height: 32px;
      font-size: 12px;
      padding: 4px;
    }

    .preview-footer {
      margin-top: 12px;
      font-size: 12px;
      color: #6b7280;
    }

    .feature-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
      margin-bottom: 18px;
    }

    .feature-card {
      padding: 14px;
    }

    .feature-card h3 {
      margin: 0 0 6px;
      font-size: 15px;
    }

    .feature-card p {
      margin: 0;
      font-size: 13px;
      line-height: 1.5;
      color: #4b5563;
    }

    .admin-pill {
      display: none;
      margin-top: 8px;
      font-size: 11px;
      color: #92400e;
      background: #fffbeb;
      border: 1px solid #fde68a;
      border-radius: 999px;
      padding: 2px 7px;
      width: fit-content;
      font-weight: 700;
    }

    .method-note {
      background: #fff;
      border: 1px solid #e5e7eb;
      border-radius: 16px;
      padding: 14px 16px;
      margin-bottom: 22px;
    }

    .method-note h3 {
      margin: 0 0 6px;
      font-size: 14px;
    }

    .method-note p {
      margin: 0;
      color: #4b5563;
      font-size: 13px;
      line-height: 1.55;
    }

    .home-footer {
      color: #6b7280;
      font-size: 12px;
      text-align: center;
      padding-bottom: 8px;
    }

    .top-bar {
      display: grid;
      grid-template-columns: auto 1fr auto auto;
      align-items: center;
      gap: 8px;
      margin-bottom: 8px;
    }

    .title {
      font-size: 16px;
      font-weight: 700;
      white-space: nowrap;
    }

    .video-select-wrap {
      min-width: 0;
    }

    select,
    input,
    textarea {
      width: 100%;
      min-height: 36px;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 6px 9px;
      font-size: 0.92rem;
      background: #fff;
    }

    button {
      min-height: 36px;
      border: none;
      border-radius: 8px;
      padding: 7px 11px;
      font-size: 0.92rem;
      font-weight: 700;
      cursor: pointer;
      background: var(--blue);
      color: #fff;
    }

    button:hover:not(:disabled) {
      background: var(--blue-dark);
    }

    button:disabled {
      cursor: not-allowed;
      opacity: 0.6;
    }

    .mode-badge {
      font-size: 11px;
      font-weight: 700;
      border-radius: 999px;
      padding: 3px 6px;
      border: 1px solid transparent;
      white-space: nowrap;
      line-height: 1;
    }

    .badge-transcript {
      background: #dcfce7;
      color: #14532d;
      border-color: #86efac;
    }

    .badge-fixed {
      background: #fef3c7;
      color: #78350f;
      border-color: #fcd34d;
    }

    .auth-area {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      justify-self: end;
    }

    .auth-user {
      font-size: 12px;
      color: #374151;
      white-space: nowrap;
    }

    .study-today {
      display: none;
      font-size: 11px;
      color: #111827;
      border: 1px solid #d1d5db;
      border-radius: 999px;
      padding: 2px 7px;
      background: #f9fafb;
      white-space: nowrap;
    }

    .study-counter-button {
      border: 1px solid #e5e7eb;
      background: #fff;
      color: #374151;
      border-radius: 999px;
      padding: 4px 8px;
      font-size: 12px;
      min-height: 0;
      cursor: pointer;
    }

    .study-counter-button:hover:not(:disabled) {
      border-color: #cbd5e1;
      background: #f8fafc;
    }

    .study-counter-button:disabled {
      opacity: 0.65;
      cursor: default;
    }

    .auth-btn {
      min-height: 26px;
      padding: 3px 8px;
      border-radius: 999px;
      border: 1px solid #d1d5db;
      background: #fff;
      color: #111827;
      font-size: 12px;
      font-weight: 700;
    }

    a.auth-btn {
      display: inline-flex;
      align-items: center;
      text-decoration: none;
    }

    .login-panel {
      margin-bottom: 8px;
      background: #ffffff;
      border: 1px solid var(--line);
      border-radius: 10px;
      box-shadow: var(--shadow);
      padding: 8px;
      display: none;
    }

    .login-panel-row {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
    }

    .login-panel-row input {
      width: 180px;
      min-height: 30px;
      font-size: 12px;
    }

    .login-panel-row button {
      min-height: 30px;
      font-size: 12px;
      padding: 4px 9px;
    }

    .player-card {
      background: var(--card);
      border-radius: 12px;
      box-shadow: var(--shadow);
      padding: 8px;
      border: 1px solid var(--line);
    }

    .player-container {
      width: 100%;
      max-width: 100%;
      margin: 0 auto;
      border-radius: 12px;
      overflow: hidden;
      background: #000;
      aspect-ratio: 16 / 9;
      max-height: 56vh;
    }

    #player {
      width: 100%;
      height: 100%;
      background: #000;
    }

    #localVideo {
      width: 100%;
      height: 100%;
      object-fit: contain;
      background: #000;
      border-radius: 12px;
      display: block;
    }

    .controls-main {
      margin-top: 8px;
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 8px;
      width: 100%;
    }

    .control-btn {
      min-width: 0;
      width: 100%;
      min-height: 40px;
      font-size: 0.95rem;
      padding: 7px 6px;
    }

    .primary-control {
      background: #0f766e;
    }

    .primary-control:hover:not(:disabled) {
      background: #0d5c56;
    }

    .playback-mode-bar {
      margin-top: 8px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }

    .playback-mode-bar .mode-toggle button {
      min-height: 24px;
      padding: 5px 10px;
    }

    .progress-wrap.is-auto-gap {
      background: #fde68a;
    }

    .progress-wrap.is-auto-gap .progress-fill {
      background: linear-gradient(90deg, #d97706, #f59e0b);
    }

    .segment-info {
      margin-top: 6px;
      text-align: center;
      border-left: 3px solid transparent;
      padding-left: 6px;
    }

    .segment-info-row {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      max-width: 100%;
      flex-wrap: wrap;
    }

    .segment-info.current-segment.is-favorite-segment {
      border-left-color: #f59e0b;
    }

    .mode-toggle {
      display: inline-flex;
      border: 1px solid #d1d5db;
      border-radius: 999px;
      overflow: hidden;
      background: #fff;
    }

    .mode-toggle button {
      border: 0;
      border-radius: 0;
      min-height: 22px;
      background: transparent;
      color: #374151;
      padding: 4px 9px;
      font-size: 12px;
      font-weight: 700;
      line-height: 1;
    }

    .mode-toggle button:hover:not(:disabled) {
      background: #f3f4f6;
    }

    .mode-toggle button.is-active {
      background: #111827;
      color: #fff;
    }

    .favorite-toggle {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      border: 1px solid #d1d5db;
      background: #fff;
      color: #374151;
      border-radius: 999px;
      padding: 3px 8px;
      font-size: 12px;
      line-height: 1;
      font-weight: 700;
      min-height: 24px;
    }

    .favorite-toggle:hover:not(:disabled) {
      background: #f9fafb;
    }

    .favorite-toggle .favorite-icon {
      font-size: 15px;
      line-height: 1;
    }

    .favorite-toggle.is-favorite {
      border-color: #f59e0b;
      background: #fffbeb;
      color: #92400e;
      font-weight: 600;
    }

    .favorite-toggle.is-saving {
      opacity: 0.65;
      pointer-events: none;
    }

    .chunk-toggle {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      border: 1px solid #d1d5db;
      background: #fff;
      color: #374151;
      border-radius: 999px;
      padding: 3px 8px;
      font-size: 12px;
      line-height: 1;
      font-weight: 700;
      min-height: 24px;
    }

    .chunk-toggle:hover:not(:disabled) {
      background: #f9fafb;
    }

    .chunk-toggle.is-active-chunk {
      border-color: #0d9488;
      background: #f0fdfa;
      color: #0f766e;
    }

    .chunk-toggle:disabled {
      opacity: 0.45;
    }

    .segment-info.current-segment.is-chunk-segment {
      border-left-color: #0d9488;
    }

    .chunk-select-bar {
      margin-top: 8px;
      display: none;
      align-items: center;
      justify-content: center;
      gap: 8px;
      flex-wrap: wrap;
      font-size: 12px;
      color: #0f766e;
    }

    .chunk-select-bar.is-visible {
      display: inline-flex;
    }

    .chunk-select-bar button {
      min-height: 24px;
      padding: 3px 8px;
      border-radius: 999px;
      border: 1px solid #99f6e4;
      background: #fff;
      color: #0f766e;
      font-size: 12px;
      font-weight: 700;
    }

    .chunk-token {
      display: inline;
      cursor: pointer;
      border-radius: 4px;
      padding: 0 2px;
      margin: 0 1px;
      line-height: 1.55;
    }

    .chunk-token:hover {
      background: #ccfbf1;
    }

    .chunk-token.is-selected {
      background: #5eead4;
      color: #134e4a;
      font-weight: 700;
    }

    .vi-text.is-chunk-selectable,
    .ru-text.is-chunk-selectable {
      user-select: none;
    }

    .chunk-editor {
      display: none;
      margin-top: 10px;
      padding: 12px;
      border: 1px solid #99f6e4;
      border-radius: 12px;
      background: linear-gradient(180deg, #f0fdfa 0%, #ffffff 100%);
      text-align: left;
    }

    .chunk-editor.is-open {
      display: block;
    }

    .chunk-editor-title {
      margin: 0 0 8px;
      font-size: 13px;
      font-weight: 700;
      color: #0f766e;
    }

    .chunk-editor-row {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
      margin-bottom: 8px;
    }

    .chunk-editor-row label {
      font-size: 12px;
      color: #334155;
      font-weight: 600;
    }

    .chunk-editor-row .muted {
      font-size: 12px;
      color: #64748b;
    }

    .chunk-editor-row button {
      min-height: 28px;
      padding: 4px 9px;
      border-radius: 999px;
      border: 1px solid #99f6e4;
      background: #fff;
      color: #0f766e;
      font-size: 12px;
      font-weight: 700;
    }

    .chunk-editor-row button:disabled {
      opacity: 0.45;
    }

    .chunk-editor textarea {
      width: 100%;
      min-height: 64px;
      resize: vertical;
      border: 1px solid #cbd5e1;
      border-radius: 8px;
      padding: 8px 10px;
      font-size: 14px;
      line-height: 1.4;
      font-family: inherit;
      box-sizing: border-box;
    }

    .chunk-editor .chunk-editor-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 8px;
    }

    .chunk-editor .chunk-editor-actions button {
      min-height: 30px;
      padding: 5px 10px;
      border-radius: 999px;
      border: 1px solid #99f6e4;
      background: #fff;
      color: #0f766e;
      font-size: 12px;
      font-weight: 700;
    }

    .chunk-editor .chunk-editor-actions button.primary {
      background: #0d9488;
      border-color: #0d9488;
      color: #fff;
    }

    .chunk-editor .chunk-editor-actions button:disabled {
      opacity: 0.45;
    }

    .edit-phrase-btn {
      min-height: 26px;
      padding: 3px 8px;
      border-radius: 999px;
      background: #f3f4f6;
      color: #111827;
      border: 1px solid #d1d5db;
      font-size: 12px;
      font-weight: 700;
    }

    .edit-phrase-btn:hover:not(:disabled) {
      background: #e5e7eb;
    }

    .phrase-editor {
      margin-top: 8px;
      background: #ffffff;
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 10px;
      box-shadow: 0 5px 14px rgba(15, 23, 42, 0.06);
      display: none;
    }

    .editor-header {
      margin: 0 0 4px;
      font-size: 0.95rem;
      font-weight: 700;
    }

    .editor-warning {
      margin: 0 0 8px;
      font-size: 0.82rem;
      color: #6b7280;
    }

    .save-status {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: 12px;
      color: #4b5563;
      margin-bottom: 6px;
    }

    .save-status.is-saved {
      color: #166534;
    }

    .save-status.is-dirty {
      color: #92400e;
    }

    .save-status.is-saving {
      color: #1d4ed8;
    }

    .save-status.is-failed {
      color: #b91c1c;
    }

    .audio-boundary-editor,
    .token-boundary-editor {
      margin-top: 8px;
      border: 1px solid #e5e7eb;
      border-radius: 10px;
      padding: 8px 10px;
      background: #f9fafb;
    }

    .editor-section-title {
      margin: 0 0 6px;
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: #6b7280;
      font-weight: 700;
    }

    .audio-timeline {
      position: relative;
      height: 20px;
      border-radius: 999px;
      background: #e5e7eb;
      overflow: hidden;
      touch-action: none;
    }

    .audio-range {
      position: absolute;
      top: 0;
      bottom: 0;
      background: rgba(37, 99, 235, 0.22);
      border-left: 2px solid #2563eb;
      border-right: 2px solid #2563eb;
    }

    .audio-handle {
      position: absolute;
      top: 1px;
      width: 10px;
      height: 18px;
      border-radius: 999px;
      background: #2563eb;
      box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
      cursor: ew-resize;
      touch-action: none;
    }

    .audio-split-handle {
      background: #f59e0b;
      box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
    }

    .audio-readout {
      margin-top: 5px;
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      color: #374151;
      flex-wrap: wrap;
    }

    .audio-controls {
      margin-top: 6px;
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: center;
    }

    .audio-controls button {
      min-height: 24px;
      padding: 3px 7px;
      font-size: 12px;
      border-radius: 8px;
      background: #fff;
      color: #111827;
      border: 1px solid #d1d5db;
    }

    .boundary-handle {
      display: inline-block;
      width: 3px;
      height: 1.4em;
      background: #2563eb;
      border-radius: 2px;
      vertical-align: middle;
      cursor: ew-resize;
      margin: 0 2px;
      border: 0;
      padding: 0;
      min-height: 0;
      cursor: ew-resize;
      touch-action: none;
    }

    .inline-boundary-editor {
      margin-top: 6px;
      font-size: 17px;
      line-height: 1.6;
      padding: 8px 10px;
      background: #fff;
      border: 1px solid #e5e7eb;
      border-radius: 8px;
      word-break: break-word;
    }

    .context-text {
      color: #6b7280;
    }

    .selected-text {
      background: #dbeafe;
      border-radius: 4px;
      padding: 1px 3px;
      color: #111827;
    }

    .inline-token {
      cursor: pointer;
    }

    .inline-token:hover {
      text-decoration: underline;
    }

    .split-inline-marker {
      color: #f59e0b;
      font-weight: 700;
      display: inline-block;
      margin: 0 1px;
    }

    .boundary-tools {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
      margin-top: 6px;
      font-size: 12px;
    }

    .boundary-tools button {
      min-height: 24px;
      padding: 3px 7px;
      font-size: 12px;
      border-radius: 8px;
      border: 1px solid #d1d5db;
      background: #fff;
      color: #111827;
    }

    .boundary-side-btn.is-active {
      background: #eff6ff;
      border-color: #93c5fd;
      color: #1e3a8a;
    }

    .boundary-nudge-row {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      flex-wrap: wrap;
    }

    .editor-actions {
      margin-top: 8px;
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .editor-actions button {
      min-height: 28px;
      padding: 4px 9px;
      font-size: 12px;
      border-radius: 8px;
      border: 1px solid #d1d5db;
      background: #fff;
      color: #111827;
    }

    #applyPhraseEditBtn {
      background: #2563eb;
      color: #fff;
      border-color: #1d4ed8;
    }

    #saveLessonBtn {
      background: #0f766e;
      color: #fff;
      border-color: #0d5c56;
    }

    .segment-tools {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
      margin-top: 4px;
    }

    .segment-tools button {
      font-size: 12px;
      padding: 4px 8px;
      min-height: 26px;
      border: 1px solid #d1d5db;
      background: #fff;
      border-radius: 8px;
      color: #111827;
    }

    .split-status {
      font-size: 12px;
      color: #6b7280;
      margin: 6px 0 0;
    }

    .copy-fallback {
      margin-top: 8px;
      width: 100%;
      min-height: 90px;
      display: none;
      font-size: 0.8rem;
    }

    .segment-title {
      margin: 0;
      font-size: 0.92rem;
      font-weight: 700;
      color: #374151;
    }

    .segment-time {
      display: none;
    }

    .progress-wrap {
      margin: 6px 0 8px;
      width: 100%;
      height: 4px;
      border-radius: 999px;
      background: #e5e7eb;
      overflow: hidden;
    }

    .progress-fill {
      width: 0%;
      height: 100%;
      background: linear-gradient(90deg, #2563eb, #06b6d4);
      transition: width 0.08s linear;
    }

    .fixed-settings {
      margin-top: 8px;
      background: #f9fafb;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 8px;
    }

    .settings-row {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: nowrap;
      white-space: nowrap;
    }

    .field {
      flex: 0 1 auto;
      min-width: 0;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .field label {
      margin: 0;
      font-size: 0.82rem;
      font-weight: 700;
      white-space: nowrap;
    }

    .field input {
      width: 56px;
      min-height: 32px;
      padding: 4px 8px;
      font-size: 0.9rem;
    }

    .unit-text {
      font-size: 0.82rem;
      color: #4b5563;
      font-weight: 700;
    }

    .text-card {
      margin-top: 8px;
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 10px 12px;
      box-shadow: 0 5px 14px rgba(15, 23, 42, 0.06);
      box-sizing: border-box;
      min-width: 0;
      max-width: 100%;
      overflow: hidden;
    }

    .text-card.hidden-state {
      background: #f8fafc;
      border-style: dashed;
      cursor: pointer;
    }

    .text-card.hidden-state:hover {
      background: #f1f5f9;
    }

    .text-card-title {
      margin: 0 0 4px;
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--muted);
      font-weight: 700;
    }

    .text-placeholder {
      margin: 0;
      color: #6b7280;
      font-size: 0.95rem;
      display: block;
      max-width: 100%;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    .text-mask {
      display: block;
      max-width: 100%;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      letter-spacing: 0.08em;
      font-size: 22px;
      line-height: 1.2;
      color: #9ca3af;
      font-weight: 700;
      user-select: none;
    }

    .vi-text {
      margin: 0;
      font-size: 22px;
      line-height: 1.35;
      max-width: 100%;
      white-space: normal;
      overflow-wrap: anywhere;
      word-break: normal;
    }

    .ru-text {
      margin: 0;
      font-size: 18px;
      line-height: 1.35;
      color: #374151;
      max-width: 100%;
      white-space: normal;
      overflow-wrap: anywhere;
      word-break: normal;
    }

    .muted {
      color: var(--muted);
    }

    .debug-toggle {
      margin-top: 6px;
      background: transparent;
      border: none;
      color: var(--blue);
      text-decoration: underline;
      padding: 0;
      min-height: 0;
      font-weight: 600;
      font-size: 12px;
      cursor: pointer;
      opacity: 0.7;
    }

    .debug-panel {
      margin-top: 8px;
      display: none;
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 10px;
      background: #f9fafb;
    }

    .debug-panel p {
      margin: 4px 0;
      font-size: 0.88rem;
      color: #374151;
      word-break: break-word;
    }

    .toast-container {
      position: fixed;
      top: 12px;
      right: 12px;
      left: auto;
      z-index: 9999;
      display: flex;
      flex-direction: column;
      gap: 8px;
      max-width: min(420px, calc(100vw - 24px));
      pointer-events: none;
    }

    .toast {
      box-sizing: border-box;
      width: 100%;
      max-width: 100%;
      background: #111827;
      color: #fff;
      border-radius: 12px;
      padding: 11px 13px;
      font-size: 0.92rem;
      box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
      overflow-wrap: anywhere;
      word-break: break-word;
    }

    .toast-info {
      background: #1f2937;
    }

    .toast-success {
      background: var(--green);
    }

    .toast-warning {
      background: var(--orange);
    }

    .toast-error {
      background: var(--red);
    }

    @media (max-width: 760px) {
      .title {
        font-size: 14px;
      }

      .control-btn {
        min-height: 36px;
        font-size: 0.84rem;
        padding: 5px 4px;
      }

      .vi-text {
        font-size: 20px;
      }

      .ru-text {
        font-size: 16px;
      }

      .text-mask {
        font-size: 20px;
      }

      .top-bar {
        grid-template-columns: auto 1fr auto;
        gap: 6px;
      }

      .site-header {
        padding-top: 10px;
        padding-bottom: 10px;
      }

      .site-actions {
        width: 100%;
        justify-content: flex-start;
      }

      .lesson-bar {
        grid-template-columns: 1fr;
        gap: 4px;
      }

      .mode-badge {
        font-size: 10px;
        padding: 2px 5px;
      }

      .controls-main {
        gap: 6px;
      }

      .control-btn {
        font-size: 0.82rem;
        padding: 7px 4px;
      }

      .field input {
        width: 52px;
      }

      .toast-container {
        left: 12px;
        right: 12px;
        max-width: none;
      }
    }

    @media (max-width: 420px) {
      .favorite-toggle .favorite-label,
      .chunk-toggle .chunk-label,
      .drill-star-label {
        display: none;
      }
    }

    @media (max-width: 520px) {
      .app-shell {
        padding: 10px 8px 24px;
      }

      .app-header {
        align-items: flex-start;
      }

      .intro-panel {
        padding: 12px;
      }

      .intro-panel h1 {
        font-size: 20px;
      }

      .intro-panel p {
        font-size: 13px;
      }

      .stats-summary-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }

      .calendar-weekdays,
      .calendar-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(30px, 0.95fr);
      }

      .activity-week-total {
        font-size: 9px;
      }

      .study-stats-header {
        flex-wrap: wrap;
      }

      .daily-table table {
        min-width: 420px;
      }

      .chunks-list-panel {
        margin: 0 0 10px;
        padding: 10px;
        border-radius: 12px;
      }

      .chunks-list-header h2 {
        font-size: 16px;
      }

      .chunks-list-body {
        max-height: min(62vh, 480px);
        max-height: min(62dvh, 480px);
        gap: 8px;
      }

      .chunks-list-item {
        padding: 10px;
      }

      .chunks-list-item-vi {
        font-size: 13px;
      }

      .chunks-list-item-tr {
        font-size: 12px;
      }

      .toast-container {
        left: 10px;
        right: 10px;
        top: 10px;
        max-width: none;
        width: auto;
      }

      .toast {
        width: 100%;
        max-width: 100%;
        font-size: 13px;
        line-height: 1.35;
      }
    }
  