:root {
        color-scheme: light dark;
        --bg: #0b1220;
        --fg: #f8fafc;
        --accent: #7c3aed;
        --accent-strong: #5b21b6;
        --surface: rgba(15, 23, 42, 0.78);
        --surface-soft: rgba(15, 23, 42, 0.55);
        --text-subtle: rgba(226, 232, 240, 0.75);
        --space-1: 0.25rem;
        --space-2: 0.5rem;
        --space-3: 0.75rem;
        --space-4: 1rem;
        --space-5: 1.5rem;
        --space-6: 2rem;
        --radius: 14px;
        --hero-card: #121a2b;
        --hero-text: #eaf0ff;
        --hero-muted: #a7b3d1;
        --hero-brand: #7b5cff;
        --hero-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
      }

      * {
        box-sizing: border-box;
      }

      body {
        margin: 0;
        min-height: 100vh;
        font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
        background:
          radial-gradient(120% 120% at 10% 10%, rgba(124, 58, 237, 0.28), transparent 42%),
          radial-gradient(120% 120% at 90% 30%, rgba(34, 211, 238, 0.2), transparent 48%),
          var(--bg);
        color: var(--fg);
        padding: 0;
        scroll-behavior: smooth;
      }

      body.modal-open {
        overflow: hidden;
      }

      .skip-link {
        position: absolute;
        top: 0.5rem;
        left: 0.5rem;
        padding: 0.4rem 0.85rem;
        background: var(--accent);
        color: #fff;
        border-radius: 999px;
        transform: translateY(-200%);
        transition: transform 0.2s ease;
        z-index: 1000;
      }

      .skip-link:focus {
        transform: translateY(0);
      }

      .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
      }

      .layout {
        width: min(1080px, 100%);
        margin: 0 auto;
        padding: clamp(1.25rem, 4vw, 3rem) clamp(1rem, 4vw, 2.75rem);
        display: flex;
        flex-direction: column;
        gap: clamp(2rem, 4vw, 3rem);
        min-height: 100vh;
      }

      .app-shell-header {
        display: none;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.35rem 0.75rem;
        border-radius: 999px;
        background: rgba(15, 15, 19, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.07);
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
      }

      .layout[data-view="app"] .app-shell-header {
        display: flex;
      }

      .drawer-toggle {
        width: 40px;
        height: 40px;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        background: transparent;
        color: var(--fg);
        cursor: pointer;
        position: relative;
      }

      .drawer-toggle span,
      .drawer-toggle span::before,
      .drawer-toggle span::after {
        position: absolute;
        left: 50%;
        width: 16px;
        height: 2px;
        border-radius: 999px;
        background: currentColor;
        content: "";
        transform: translateX(-50%);
      }

      .drawer-toggle span::before {
        top: -5px;
      }

      .drawer-toggle span::after {
        top: 5px;
      }

      .app-shell-title {
        font-weight: 700;
        letter-spacing: 0.2em;
      }

      .sync-pill {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.15);
        background: rgba(12, 18, 32, 0.6);
        color: var(--hero-muted);
        padding: 0.35rem 0.85rem;
        font-size: 0.85rem;
      }

      .sync-dot {
        width: 8px;
        height: 8px;
        border-radius: 999px;
        background: #34d399;
        box-shadow: 0 0 12px rgba(52, 211, 153, 0.8);
      }

      body.drawer-open {
        overflow: hidden;
      }

      .app-drawer {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: min(320px, 80vw);
        background: rgba(9, 12, 24, 0.96);
        border-right: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
        transform: translateX(-105%);
        transition: transform 220ms ease;
        z-index: 1200;
        padding: 1.5rem;
      }

      .app-drawer.open {
        transform: translateX(0);
      }

      .drawer-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(2px);
        z-index: 1100;
      }

      .drawer-overlay[hidden] {
        display: none;
      }

      .drawer-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1.5rem;
        gap: 1rem;
      }

      .drawer-label {
        margin: 0;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.2em;
        color: var(--hero-muted);
      }

      .drawer-close {
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: var(--fg);
        border-radius: 999px;
        width: 36px;
        height: 36px;
        cursor: pointer;
      }

      .drawer-nav {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
      }

      .drawer-link {
        width: 100%;
        text-align: left;
        padding: 0.6rem 0.4rem;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.08);
        color: var(--fg);
        font-size: 0.95rem;
        cursor: pointer;
      }

      .drawer-link:hover,
      .drawer-link:focus {
        background: rgba(255, 255, 255, 0.1);
      }

      .drawer-link.danger {
        color: #fca5a5;
        border-color: rgba(248, 113, 113, 0.4);
        background: rgba(248, 113, 113, 0.08);
      }

      .drawer-divider {
        height: 1px;
        background: rgba(255, 255, 255, 0.08);
        margin: 0.75rem 0;
      }

      .layout[data-view="landing"] .workspace {
        display: none;
      }

      .layout[data-view="app"] .landing {
        display: none;
      }

      .app-panes {
        display: flex;
        flex-direction: column;
        gap: clamp(2rem, 4vw, 3rem);
      }

      .app-pane[hidden] {
        display: none !important;
      }

      .layout[data-view="landing"] .app-panes,
      .layout[data-view="landing"] .tab-bar {
        display: none !important;
      }

      .layout[data-tab="profile"] #workspace,
      .layout[data-tab="profile"] #learn-pane,
      .layout[data-tab="profile"] #audio-pane {
        display: none !important;
      }

      .layout[data-tab="profile"] #profile-pane {
        display: block;
      }

      .pane-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 1.5rem;
      }

      .pane-preheading {
        text-transform: uppercase;
        letter-spacing: 0.08em;
        font-size: 0.75rem;
        color: var(--text-subtle);
        margin: 0;
      }

      .pane-subtitle {
        margin: 0.5rem 0 0;
        color: var(--text-subtle);
      }

      .learn-collection,
      .audio-section,
      .profile-card {
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.07);
        border-radius: 18px;
        padding: var(--space-3);
      }

      .credits-note {
        margin: var(--space-2) 0 0;
        color: var(--hero-muted);
        font-size: 0.9rem;
      }

      .credits-warning {
        margin: 0.35rem 0 0;
        font-size: 0.9rem;
        color: #fbbf24;
      }

      .credits-display {
        margin-top: var(--space-2);
      }

      .credits-balance {
        display: flex;
        align-items: baseline;
        gap: 0.5rem;
        font-size: 1.1rem;
      }

      .credits-balance strong {
        font-size: 2rem;
        color: rgba(123, 92, 255, 0.9);
      }

      .confirm-modal {
        position: fixed;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 2000;
      }

      .confirm-modal[hidden] {
        display: none;
      }

      .confirm-modal-overlay {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(3px);
      }

      .confirm-modal-card {
        position: relative;
        width: min(420px, 90vw);
        background: rgba(11, 15, 28, 0.95);
        border-radius: 16px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        padding: 1.5rem;
        display: grid;
        gap: 1rem;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
      }

      .confirm-modal-card h3 {
        margin: 0;
      }

      .confirm-modal-card p {
        margin: 0;
        color: var(--hero-muted);
      }

      .confirm-modal-card label {
        display: grid;
        gap: 0.5rem;
      }

      .confirm-modal-card input {
        font: inherit;
        padding: 0.6rem;
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        background: rgba(0, 0, 0, 0.35);
        color: inherit;
      }

      .confirm-modal-actions {
        display: flex;
        justify-content: flex-end;
        gap: 0.75rem;
      }

      .credit-packages {
        display: grid;
        gap: var(--space-3);
        margin-top: var(--space-3);
      }

      .credit-package {
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid rgba(255, 255, 255, 0.07);
        border-radius: 12px;
        padding: var(--space-3);
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
      }

      .credit-package h4 {
        margin: 0;
        font-size: 1.1rem;
      }

      .package-credits {
        font-size: 1.5rem;
        font-weight: 600;
        color: rgba(123, 92, 255, 0.9);
        margin: 0;
      }

      .package-description {
        font-size: 0.9rem;
        color: rgba(226, 232, 240, 0.7);
        margin: 0;
      }

      .package-price {
        font-size: 1.2rem;
        font-weight: 600;
        margin: 0.5rem 0;
      }

      .credit-package button {
        margin-top: auto;
      }

      .learn-collection {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-3);
        cursor: pointer;
      }

      .learn-collection.active {
        border-color: rgba(123, 92, 255, 0.6);
        box-shadow: 0 12px 30px rgba(123, 92, 255, 0.25);
      }

      .learn-collection-info {
        display: flex;
        flex-direction: column;
        gap: 0.2rem;
      }

      .learn-collection-info h3 {
        margin: 0;
        font-size: 1rem;
      }

      .learn-collection-info p {
        margin: 0;
        font-size: 0.9rem;
        color: var(--hero-muted);
      }

      .learn-collection-subtitle {
        color: var(--hero-muted);
      }

      .learn-collection-meta {
        font-size: 0.85rem;
        color: var(--hero-muted);
      }

      .review-deck-item .learn-collection,
      .review-deck-item .collection-card {
        padding: var(--space-3) var(--space-4);
      }

      .review-collection .collection-title.active {
        color: var(--accent);
      }

      .review-collection-meta {
        display: flex;
        align-items: center;
        gap: 0.35rem;
      }

      .review-meta-accent {
        color: var(--accent);
      }

      .review-sheet-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
      }

      .review-sheet-row {
        display: flex;
        justify-content: space-between;
        gap: var(--space-2);
        padding: 0.65rem 0.9rem;
        border-radius: 14px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(255, 255, 255, 0.03);
        font-size: 0.9rem;
      }

      .review-sheet-row.empty {
        justify-content: center;
        color: var(--text-subtle);
      }

      .review-sheet-name {
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .review-sheet-meta {
        color: var(--hero-muted);
        white-space: nowrap;
      }

      .review-sheet-cta {
        margin-left: auto;
        margin-top: 0.35rem;
        padding: 0.35rem 0.75rem;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.18);
        background: rgba(255, 255, 255, 0.08);
        color: inherit;
        font-size: 0.85rem;
        cursor: pointer;
      }

      .review-virtual-sentinel {
        display: flex;
        justify-content: center;
        margin-top: var(--space-3);
      }

      .review-virtual-button {
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        background: transparent;
        color: inherit;
        padding: 0.4rem 1.1rem;
        cursor: pointer;
      }

      .review-empty-state {
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
        align-items: flex-start;
        border-radius: 18px;
        border: 1px dashed rgba(255, 255, 255, 0.18);
        padding: var(--space-4);
        background: rgba(255, 255, 255, 0.04);
      }

      .review-empty-state p {
        margin: 0;
        color: var(--text-subtle);
      }

      .review-empty-cta {
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        padding: 0.35rem 1rem;
        background: rgba(255, 255, 255, 0.08);
        color: inherit;
        cursor: pointer;
      }

      .learn-empty-state {
        text-align: center;
        padding: var(--space-3);
        border-radius: 16px;
        border: 1px dashed rgba(148, 163, 184, 0.2);
        background: rgba(15, 23, 42, 0.35);
        color: var(--text-subtle);
        font-size: 0.95rem;
      }

      .learn-collection {
        display: flex;
        flex-direction: column;
        gap: var(--space-3);
      }

      .learn-collection-header {
        display: flex;
        align-items: center;
        gap: var(--space-3);
      }

      .learn-collection-heading {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        flex: 1;
        min-width: 0;
      }

      .collection-toggle {
        width: 36px;
        height: 36px;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.14);
        background: rgba(255, 255, 255, 0.04);
        color: inherit;
        font-size: 0.85rem;
      }

      .collection-title {
        flex: 1;
        min-width: 0;
        background: none;
        border: 0;
        color: inherit;
        font: inherit;
        text-align: left;
        padding: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        cursor: pointer;
      }

      .collection-title:disabled {
        color: var(--text-subtle);
        cursor: not-allowed;
      }

      .collection-body {
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
      }

      .collection-body[hidden] {
        display: none;
      }

      .sheet-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
      }

      .sheet-row {
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.03);
      }

      .sheet-row-meta {
        display: flex;
        flex-direction: column;
        gap: 0.2rem;
      }

      .inline-edit-input {
        width: 100%;
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.16);
        background: rgba(15, 23, 42, 0.8);
        color: inherit;
        font: inherit;
        padding: 0.5rem 0.75rem;
      }

      .collection-title,
      .collection-toggle,
      .sheet-row-open {
        transition: background 160ms ease, transform 160ms ease;
      }

      .collection-title:focus-visible,
      .collection-toggle:focus-visible,
      .sheet-row-open:focus-visible,
      .inline-edit-input:focus-visible {
        outline: 2px solid rgba(123, 92, 255, 0.7);
        outline-offset: 2px;
      }

      .collection-inline-actions,
      .sheet-inline-actions {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
      }

      .collection-inline-actions button,
      .sheet-inline-actions button {
        width: 32px;
        height: 32px;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.18);
        background: rgba(255, 255, 255, 0.04);
        color: var(--hero-muted);
        display: grid;
        place-items: center;
        font-size: 0.85rem;
      }

      .swipe-track {
        position: relative;
        overflow: hidden;
        touch-action: pan-y;
      }

      .swipe-content {
        position: relative;
        z-index: 1;
        padding: 0.85rem 0;
        transition: transform 160ms ease;
      }

      .sheet-row .swipe-content {
        padding: 0.85rem 1rem;
      }

      .sheet-row-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-2);
      }

      .sheet-row-open {
        width: 100%;
        border: 0;
        background: none;
        color: inherit;
        font: inherit;
        text-align: left;
        padding: 0;
        display: block;
        flex: 1;
      }

      .sheet-row-open:disabled {
        opacity: 0.7;
        cursor: default;
      }

      .swipe-actions {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        display: flex;
        gap: 1px;
        transform: translateX(110%);
        transition: transform 160ms ease;
      }

      .swipe-actions button {
        min-width: 84px;
        border: none;
        background: rgba(255, 255, 255, 0.1);
        color: inherit;
        font: inherit;
        font-weight: 600;
        padding: 0 1rem;
      }

      .swipe-actions button[data-variant="danger"] {
        background: rgba(255, 93, 93, 0.18);
        color: #ffbdbd;
      }

      .swipe-track.swipe-open .swipe-content {
        transform: translateX(-168px);
      }

      .swipe-track.swipe-open .swipe-actions {
        transform: translateX(0);
      }

      @media (pointer: coarse) {
        .collection-inline-actions,
        .sheet-inline-actions {
          display: none;
        }
      }

      .sheet-row.add-row {
        border: 1px dashed rgba(255, 255, 255, 0.2);
        background: transparent;
      }

      .sheet-row.add-row button {
        width: 100%;
        border: none;
        background: none;
        color: var(--hero-muted);
        font-weight: 600;
        cursor: pointer;
        padding: 0.85rem 1rem;
        text-align: left;
      }

      .action-group {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
      }

      .sheet-editor {
        position: fixed;
        inset: 0;
        display: none;
        background: rgba(7, 12, 21, 0.96);
        backdrop-filter: blur(12px);
        z-index: 10000;
        overflow: hidden;
      }

      .sheet-editor.visible {
        display: block;
      }

      .sheet-editor-panel {
        width: 100%;
        max-width: none;
        height: 100vh;
        background: rgba(6, 11, 20, 0.94);
        border: 1px solid rgba(148, 163, 184, 0.08);
        border-radius: 0;
        display: grid;
        grid-template-rows: auto 1fr auto;
        overflow: hidden;
      }

      .sheet-editor header {
        position: sticky;
        top: 0;
        z-index: 20;
        padding: clamp(0.9rem, 2.5vw, 1.5rem) clamp(1.1rem, 5vw, 2.75rem);
        background: linear-gradient(145deg, rgba(12, 21, 36, 0.96), rgba(8, 14, 28, 0.96));
        border-bottom: 1px solid rgba(148, 163, 184, 0.14);
        box-shadow: 0 10px 28px rgba(5, 10, 20, 0.4);
      }

      .sheet-editor header > * {
        width: min(960px, 100%);
        margin: 0 auto;
      }

      .sheet-editor-controls {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.6rem;
        flex-wrap: wrap;
      }

      .sheet-editor-controls-right {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
      }

      .sheet-save-indicator {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2rem;
        height: 2rem;
        cursor: help;
      }

      .sheet-save-icon {
        width: 1rem;
        height: 1rem;
        color: rgba(34, 197, 94, 0.9);
      }

      .sheet-save-indicator[data-state="unsaved"] .sheet-save-icon,
      .sheet-save-indicator[data-state="editing"] .sheet-save-icon {
        color: rgba(239, 68, 68, 0.95);
      }

      .sheet-save-indicator[data-state="saving"] .sheet-save-icon {
        color: rgba(249, 115, 22, 0.95);
        animation: savePulse 1.1s infinite;
      }

      .sheet-save-indicator[data-state="error"] .sheet-save-icon {
        color: rgba(248, 113, 113, 0.95);
      }

      .sheet-save-indicator[data-state="offline"] .sheet-save-icon {
        color: rgba(148, 163, 184, 0.7);
      }

      @keyframes savePulse {
        0% {
          transform: scale(1);
        }
        50% {
          transform: scale(1.45);
        }
        100% {
          transform: scale(1);
        }
      }

      .editor-icon-button {
        width: 40px;
        height: 40px;
        border-radius: 999px;
        border: 1px solid rgba(148, 163, 184, 0.18);
        background: rgba(255, 255, 255, 0.04);
        color: inherit;
        display: grid;
        place-items: center;
      }

      .editor-icon-button svg {
        width: 20px;
        height: 20px;
      }

.sheet-meta-card {
  width: min(780px, 100%);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 18px;
  background: rgba(8, 14, 28, 0.78);
  padding: 1.1rem 1.25rem;
  margin: 0 auto 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: 0 18px 35px rgba(5, 10, 20, 0.35);
}

.sheet-meta-card .sheet-title-stack {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.sheet-meta-card .sheet-title-inline {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  padding: 0.15rem 0.35rem;
  border-radius: 12px;
}

.sheet-meta-card .sheet-summary-inline {
  margin: 0;
  min-height: 1.25rem;
  padding: 0.1rem 0.35rem;
  border-radius: 10px;
  color: rgba(226, 232, 240, 0.75);
}

.ai-popover {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: clamp(1rem, 5vw, 2rem);
  background: rgba(3, 6, 12, 0.45);
  backdrop-filter: blur(3px);
  z-index: 1000;
}

.ai-popover[hidden] {
  display: none;
}

.ai-popover-card {
  width: min(420px, 100%);
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(6, 11, 20, 0.96);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 25px 40px rgba(4, 7, 12, 0.6);
}

.ai-popover-section h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(226, 232, 240, 0.75);
}

.ai-popover-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ai-popover-section li {
  font-size: 0.9rem;
  padding-left: 0.2rem;
  color: rgba(226, 232, 240, 0.85);
}

.ai-popover-section li.ok {
  color: rgba(34, 197, 94, 0.95);
}

.ai-popover-section li.warn {
  color: rgba(248, 113, 113, 0.95);
}

.ai-storage-summary {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.7);
  padding-inline: 0.15rem;
}

.ai-popover-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
}

.ai-popover-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ai-mode-controls {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(10, 16, 28, 0.65);
}

.ai-mode-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.85);
}

.ai-mode-controls select,
.ai-mode-controls textarea {
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(6, 11, 20, 0.85);
  color: inherit;
  padding: 0.45rem 0.55rem;
  font-size: 0.95rem;
}

.ai-mode-controls textarea {
  min-height: 70px;
  resize: vertical;
}

.ai-mode-description {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.9);
}

.ai-mode-counter {
  align-self: flex-end;
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.8);
}

      /*
       * Mobile Optimizations (max-width: 768px)
       * - Compact sheet editor header (reduces from 1/3 to 1/6 of screen)
       * - Smaller text sizes and padding throughout header
       * - Tighter spacing between elements
       * - Smaller icon buttons for better mobile UX
       */
@media (max-width: 768px) {
  .sheet-editor header {
    padding: 0.75rem 1rem;
    position: static;
    background: transparent;
    border-bottom: none;
    box-shadow: none;
  }

  .sheet-editor-body {
    padding: 0.85rem 0.6rem calc(5.5rem + env(safe-area-inset-bottom));
    gap: 1.1rem;
  }

  .sheet-editor header > * {
    width: 100%;
  }

  .sheet-meta-card {
    width: 100%;
    padding: 0.85rem 1rem;
    gap: 0.5rem;
  }

  .sheet-meta-card .sheet-title-inline {
    font-size: 1.35rem;
    padding: 0.1rem 0.25rem;
  }
  .sheet-meta-card .sheet-summary-inline {
    font-size: 0.9rem;
    padding: 0.05rem 0.25rem;
    min-height: 1rem;
  }
  .sheet-meta-card .sheet-title-stack {
    gap: 0.15rem;
  }

  .sheet-meta-card .sheet-collection-label,
  .sheet-collection-label {
    font-size: 0.8rem;
    white-space: normal;
  }

  .editor-icon-button {
    width: 36px;
    height: 36px;
        }

        .editor-icon-button svg {
          width: 18px;
          height: 18px;
        }

  .sheet-save-indicator {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
  }

  .sheet-editor-controls-right {
    gap: 0.5rem;
  }

  .sheet-editor-body > * {
    width: 100%;
  }

  .sheet-block-gutter {
    flex-direction: row;
    justify-content: flex-start;
    padding-top: 0;
  }

  .block-insert,
  .block-handle {
    width: 26px;
    height: 26px;
  }

  .toolbar-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .sheet-editor-footer {
    padding: 0.65rem 0.85rem;
    padding-bottom: max(0.65rem, env(safe-area-inset-bottom));
  }
}

      .sheet-title-inline[contenteditable="true"],
      .sheet-summary-inline[contenteditable="true"] {
        border: 1px solid rgba(148, 163, 184, 0.3);
        background: rgba(255, 255, 255, 0.04);
      }

      .sheet-title-inline.empty,
      .sheet-summary-inline.empty {
        color: rgba(226, 232, 240, 0.45);
      }

      .sheet-collection-label {
        margin: 0;
        font-size: 0.9rem;
        color: rgba(226, 232, 240, 0.65);
        white-space: nowrap;
      }

      .sheet-editor-body {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: clamp(1.5rem, 3vw, 2.5rem);
        overflow-y: auto;
        padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1.25rem, 5vw, 3rem)
          calc(6rem + env(safe-area-inset-bottom));
      }

      .sheet-editor-options {
        display: flex;
        align-items: center;
        gap: 0.65rem;
        position: relative;
      }

      .sheet-editor-options-panel {
        display: inline-flex;
        align-items: center;
        gap: 0.75rem;
      }

      .sheet-editor-options-actions {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
      }

      .sheet-editor-options-toggle {
        display: none;
      }

      .sheet-editor-body > * {
        width: min(780px, 100%);
      }

      .sheet-block-list {
        display: grid;
        gap: 0.65rem;
        width: 100%;
      }

.sheet-block-card {
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 16px;
  background: rgba(10, 16, 28, 0.78);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  overflow: visible;
  position: relative;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

      .sheet-block-card.dragging {
        border-color: rgba(123, 92, 255, 0.6);
        box-shadow: 0 12px 28px rgba(123, 92, 255, 0.2);
        background: rgba(123, 92, 255, 0.12);
      }

      .sheet-block-card.drag-over {
        border-color: rgba(123, 92, 255, 0.5);
      }

      .sheet-block-card.drag-over-top::before,
      .sheet-block-card.drag-over-bottom::after {
        content: "";
        position: absolute;
        left: 0.7rem;
        right: 0.7rem;
        height: 3px;
        border-radius: 999px;
        background: rgba(123, 92, 255, 0.85);
        box-shadow: 0 0 12px rgba(123, 92, 255, 0.35);
        pointer-events: none;
      }

      .sheet-block-card.drag-over-top::before {
        top: 0.25rem;
      }

      .sheet-block-card.drag-over-bottom::after {
        bottom: 0.25rem;
      }

      .sheet-block-card.is-preview .block-hint,
      .sheet-block-card.is-preview .block-editor,
      .sheet-block-card.is-preview .math-editor,
      .sheet-block-card.is-preview .math-preview {
        display: none;
      }

      .sheet-block-card.is-preview {
        border-color: transparent;
        background: transparent;
        padding: 0.2rem 0.95rem;
      }

      .sheet-block-card.is-preview .sheet-block-gutter {
        opacity: 0;
        pointer-events: none;
        transition: opacity 120ms ease-in-out;
      }

      .sheet-block-card.is-preview:hover .sheet-block-gutter,
      .sheet-block-card.is-preview:focus-within .sheet-block-gutter {
        opacity: 1;
        pointer-events: auto;
      }

      .sheet-block-card.is-preview .block-preview {
        padding: 0.2rem 0;
      }

      .sheet-block-card.has-depth {
        margin-left: calc(var(--block-depth, 0) * 1.25rem);
      }

      .code-preview {
        font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
          monospace;
        white-space: pre-wrap;
        word-break: break-word;
        background: rgba(15, 23, 42, 0.45);
        border-radius: 12px;
        padding: 0.75rem 1rem;
        margin-bottom: 0.5rem;
        max-width: 100%;
        overflow-x: auto;
        overflow-wrap: break-word;
      }

      .code-editor {
        font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
          monospace;
        min-height: 120px;
        background: rgba(10, 16, 28, 0.85);
        color: inherit;
        border: 1px solid rgba(148, 163, 184, 0.2);
        border-radius: 14px;
        padding: 0.75rem 1rem;
        resize: vertical;
        line-height: 1.5;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-wrap: break-word;
      }

      .code-editor:focus {
        outline: 1px solid rgba(123, 92, 255, 0.55);
        outline-offset: 2px;
      }

      .math-editor {
        font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
          monospace;
        min-height: 80px;
        background: rgba(10, 16, 28, 0.85);
        color: inherit;
        border: 1px solid rgba(148, 163, 184, 0.2);
        border-radius: 14px;
        padding: 0.75rem 1rem;
        resize: vertical;
        line-height: 1.5;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-wrap: break-word;
      }

.math-editor:focus {
  outline: 1px solid rgba(123, 92, 255, 0.55);
  outline-offset: 2px;
}

.sheet-image-frame {
  width: 100%;
  border-radius: 16px;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  background: rgba(9, 13, 24, 0.75);
  padding: 0.35rem;
  display: grid;
  gap: 0.35rem;
  justify-items: center;
}

.sheet-image-frame img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(15, 23, 42, 0.35);
}

.sheet-image-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.sheet-image-actions button {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.02);
  color: var(--fg);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.sheet-image-caption {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(9, 14, 24, 0.8);
  padding: 0.45rem 0.65rem;
  color: inherit;
  font: inherit;
}

.sheet-image-caption:focus {
  outline: 1px solid rgba(123, 92, 255, 0.5);
  outline-offset: 2px;
}

.block-editor {
  min-height: 1.5rem;
  padding: 0.25rem 0.35rem;
  border-radius: 10px;
  line-height: 1.6;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: pre-wrap;
      }

      .block-editor:focus {
        outline: 1px solid rgba(123, 92, 255, 0.4);
        outline-offset: 1px;
        background: rgba(255, 255, 255, 0.02);
      }

.sheet-block-gutter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding-top: 0.15rem;
}

      .block-handle-wrapper {
        position: relative;
      }

.block-insert,
.block-handle {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font-size: 1rem;
      }

      .block-handle {
        cursor: grab;
        position: relative;
      }

      .block-body {
        display: flex;
        flex-direction: column;
        gap: 0.45rem;
        min-width: 0;
        overflow: hidden;
      }

      .block-hint {
        font-size: 0.85rem;
        color: rgba(226, 232, 240, 0.6);
      }

      .block-preview {
        border: 1px dashed rgba(148, 163, 184, 0.4);
        border-radius: 16px;
        padding: 0.6rem 0.9rem;
        min-height: 2.2rem;
        background: rgba(255, 255, 255, 0.02);
        cursor: pointer;
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
      }

      .block-preview:focus-visible {
        outline: 2px solid rgba(123, 92, 255, 0.65);
        outline-offset: 2px;
      }

      .block-preview pre {
        margin: 0;
        white-space: pre-wrap;
        font-size: 0.95rem;
      }

      .block-preview-divider {
        border: 0;
        border-top: 1px solid rgba(226, 232, 240, 0.35);
        margin: 0.35rem 0;
      }

      .block-menu {
        position: absolute;
        top: 0;
        left: calc(100% + 0.5rem);
        background: rgba(3, 6, 14, 0.95);
        border: 1px solid rgba(148, 163, 184, 0.2);
        border-radius: 12px;
        padding: 0.35rem;
        display: none;
        min-width: 160px;
        z-index: 25;
        box-shadow: 0 18px 32px rgba(0, 0, 0, 0.45);
      }

      .block-menu.open {
        display: grid;
        gap: 0.2rem;
      }

      .block-menu button {
        text-align: left;
        border: 0;
        background: transparent;
        padding: 0.45rem 0.6rem;
        border-radius: 8px;
        font-size: 0.9rem;
        color: rgba(226, 232, 240, 0.9);
        display: flex;
        align-items: center;
        gap: 0.35rem;
      }

      .block-menu button:hover,
      .block-menu button:focus-visible {
        background: rgba(123, 92, 255, 0.14);
      }

      .block-add-button {
        border: 1px dashed rgba(148, 163, 184, 0.4);
        border-radius: 16px;
        padding: 0.85rem 1rem;
        width: 100%;
        background: transparent;
        color: inherit;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
      }

.sheet-editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: clamp(0.9rem, 3vw, 1.2rem) clamp(1rem, 4vw, 2rem);
  padding-bottom: max(clamp(0.9rem, 3vw, 1.2rem), env(safe-area-inset-bottom));
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(8, 14, 28, 0.98);
  backdrop-filter: blur(8px);
  box-shadow: 0 -10px 28px rgba(5, 10, 20, 0.4);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 25;
}

.sheet-editor-footer .action-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.ai-action-group {
  justify-content: center;
}

.sheet-editor-footer button {
  min-width: unset;
}

.toolbar-icon {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
}

.toolbar-icon.primary {
  border: 1px solid rgba(123, 92, 255, 0.65);
}

.toolbar-icon.sparkle {
  border: 1px solid rgba(251, 191, 36, 0.8);
}

.toolbar-icon.audio {
  border: 1px solid rgba(59, 130, 246, 0.7);
}

.toolbar-icon.sparkle.is-busy {
  animation: aiPulse 900ms ease-in-out infinite;
}

@keyframes aiPulse {
  0% {
    box-shadow: 0 0 0 rgba(251, 191, 36, 0.2);
  }
  50% {
    box-shadow: 0 0 18px rgba(251, 191, 36, 0.45);
  }
  100% {
    box-shadow: 0 0 0 rgba(251, 191, 36, 0.2);
  }
}

      .audio-toggle {
        display: inline-flex;
        align-items: center;
        gap: 0.6rem;
      }

      .audio-toggle input {
        width: 18px;
        height: 18px;
      }

      .sheet-editor-view {
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
        font-size: 1.05rem;
        line-height: 1.7;
        color: rgba(226, 232, 240, 0.9);
      }

      .sheet-view-card {
        border: 1px solid rgba(148, 163, 184, 0.28);
        border-radius: 20px;
        background: linear-gradient(135deg, rgba(26, 34, 56, 0.92), rgba(12, 18, 30, 0.82));
        padding: 1.15rem 1.35rem;
        box-shadow: 0 20px 45px rgba(6, 8, 20, 0.35);
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        cursor: pointer;
        transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
      }

      .sheet-view-card:hover {
        border-color: rgba(148, 163, 184, 0.6);
        transform: translateY(-1px);
        background: linear-gradient(135deg, rgba(32, 41, 66, 0.95), rgba(17, 26, 44, 0.9));
      }

      .sheet-view-card:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 4px;
      }

      .sheet-view-label {
        margin: 0;
        font-size: 0.85rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: rgba(226, 232, 240, 0.55);
      }

      .sheet-view-body {
        font-size: 1.05rem;
        color: rgba(226, 232, 240, 0.92);
        white-space: pre-wrap;
      }

      .sheet-view-body pre {
        margin: 0;
        padding: 0.85rem 1rem;
        border-radius: 14px;
        background: rgba(7, 10, 18, 0.85);
        border: 1px solid rgba(148, 163, 184, 0.35);
        font-size: 0.95rem;
        white-space: pre-wrap;
      }

      .sheet-view-divider {
        border: 0;
        border-top: 1px dashed rgba(148, 163, 184, 0.4);
        margin: 0.5rem 0;
      }

      .sheet-view-empty {
        padding: 2rem 1.5rem;
        border-radius: 20px;
        border: 1px dashed rgba(148, 163, 184, 0.35);
        text-align: center;
        font-size: 1rem;
        color: rgba(226, 232, 240, 0.7);
      }

      .sheet-editor[data-mode="view"] .edit-only {
        display: none !important;
      }

      .sheet-editor[data-mode="edit"] .view-only {
        display: none !important;
      }

      .tab-bar {
        position: sticky;
        bottom: 0.5rem;
        display: flex;
        gap: 0.5rem;
        padding: 0.5rem;
        border-radius: 999px;
        background: rgba(15, 15, 19, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.07);
        box-shadow: 0 20px 40px rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(16px);
        margin-top: 1rem;
      }

      .tab-button {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0.4rem 0.75rem;
        gap: 0.25rem;
        border: none;
        border-radius: 999px;
        background: transparent;
        color: var(--text-subtle);
        font-size: 0.9rem;
        cursor: pointer;
        transition: color 150ms ease, background 150ms ease;
      }

      .tab-icon {
        display: inline-flex;
        width: 22px;
        height: 22px;
        align-items: center;
        justify-content: center;
      }

      .tab-icon svg {
        width: 20px;
        height: 20px;
        stroke-width: 1.6;
      }

      .tab-button.active {
        color: var(--accent);
        background: rgba(155, 107, 255, 0.16);
      }

      .tab-button .tab-underline {
        width: 24px;
        height: 2px;
        border-radius: 999px;
        background: currentColor;
        opacity: 0;
        transition: opacity 150ms ease;
      }

      .tab-button.active .tab-underline {
        opacity: 1;
      }

      .landing {
        display: flex;
        flex-direction: column;
        gap: var(--space-5);
        padding: clamp(var(--space-5), 6vw, var(--space-6));
        background: var(--surface-soft);
        border-radius: 28px;
        border: 1px solid rgba(148, 163, 184, 0.18);
        box-shadow: 0 40px 120px rgba(15, 23, 42, 0.35);
        backdrop-filter: blur(18px);
      }

      .site-header {
        position: sticky;
        top: 0;
        z-index: 10;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: env(safe-area-inset-top) var(--space-5) var(--space-3);
        border-radius: 999px;
        background: linear-gradient(180deg, rgba(12, 18, 32, 0.85), rgba(12, 18, 32, 0));
      }

      @supports (backdrop-filter: blur(6px)) {
        .site-header {
          backdrop-filter: blur(6px);
        }
      }

      .brand {
        font-weight: 700;
        letter-spacing: 0.08em;
        text-decoration: none;
        color: var(--fg);
      }

      .lang-btn {
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.12);
        color: var(--fg);
        padding: 0.4rem 0.9rem;
        border-radius: 999px;
        font-weight: 600;
        letter-spacing: 0.05em;
      }

      .hero {
        display: grid;
        gap: var(--space-5);
        justify-items: center;
        align-items: center;
      }

      @media (min-width: 960px) {
        .hero {
          grid-template-columns: minmax(0, 1.1fr) minmax(320px, 1fr);
          align-items: stretch;
          gap: var(--space-6);
        }
      }

      @media (max-width: 720px) {
        .hero-copy {
          padding-right: var(--space-4);
        }

        .hero-visual img {
          object-position: 70% 45%;
          transform: scale(1.18);
        }
      }

      .hero-copy {
        position: relative;
        display: grid;
        gap: var(--space-4);
        padding: clamp(var(--space-4), 5vw, var(--space-6));
        padding-right: clamp(var(--space-5), 14vw, 18rem);
        border-radius: var(--radius);
        background: rgba(6, 8, 20, 0.7);
        box-shadow: var(--hero-shadow);
        overflow: hidden;
        isolation: isolate;
        text-align: center;
        align-items: center;
        justify-items: center;
      }

      .hero-copy::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(120deg, rgba(4, 6, 16, 0.92) 0%, rgba(4, 6, 16, 0.7) 45%, rgba(4, 6, 16, 0.05) 100%);
        z-index: 1;
      }

      .hero-copy > *:not(.hero-visual) {
        position: relative;
        z-index: 2;
      }

      .hero-title {
        margin: 0;
        font-size: clamp(1.9rem, 6vw, 3rem);
        line-height: 1.1;
        text-shadow: 0 18px 36px rgba(2, 2, 8, 0.65);
      }

      .hero-sub {
        margin: 0;
        font-size: clamp(0.95rem, 2.8vw, 1.15rem);
        color: var(--hero-muted);
        max-width: 48ch;
        background: rgba(4, 7, 18, 0.65);
        padding: var(--space-3);
        border-radius: calc(var(--radius) * 0.6);
        box-shadow: 0 14px 35px rgba(2, 2, 10, 0.55);
        backdrop-filter: blur(6px);
      }

      .brand-pill {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.35rem 0.85rem;
        border-radius: 999px;
        background: rgba(79, 70, 229, 0.18);
        border: 1px solid rgba(129, 140, 248, 0.35);
        font-size: 0.75rem;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        margin: 0 auto;
      }

      .brand-pill .logo-dot {
        width: 16px;
        height: 16px;
      }

      .hero-visual {
        position: absolute;
        inset: 0;
        margin: 0;
        z-index: 0;
        pointer-events: none;
      }

      .hero-visual img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: 58% 42%;
        transform: scale(1.08);
        filter: drop-shadow(0 25px 45px rgba(3, 4, 15, 0.65));
      }

      .home-pane {
        display: grid;
        gap: var(--space-5);
      }

      .home-highlights {
        display: grid;
        gap: var(--space-4);
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      }

      .home-card {
        border-radius: 22px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        padding: var(--space-5);
        background: rgba(12, 18, 32, 0.82);
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
        display: grid;
        gap: var(--space-3);
      }

      .home-card-accent {
        background: linear-gradient(135deg, rgba(123, 92, 255, 0.4), rgba(59, 130, 246, 0.25));
        border-color: rgba(123, 92, 255, 0.5);
      }

      .home-card-label {
        margin: 0;
        text-transform: uppercase;
        letter-spacing: 0.2em;
        font-size: 0.75rem;
        color: var(--hero-muted);
      }

      .home-card-metric {
        font-size: clamp(2.2rem, 4vw, 2.8rem);
        font-weight: 700;
        display: flex;
        align-items: baseline;
        gap: var(--space-2);
      }

      .home-card-meta {
        font-size: 1rem;
        color: rgba(234, 240, 255, 0.8);
      }

      .home-card-body {
        margin: 0;
        color: var(--hero-muted);
      }

      .home-card .btn,
      .home-card .btn-primary,
      .home-card .btn-secondary,
      .home-card .btn-ghost {
        width: auto;
        min-width: 0;
      }

      .home-decks {
        border-radius: 24px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        padding: var(--space-5);
        background: rgba(12, 18, 32, 0.8);
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
      }

      .home-decks-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: var(--space-4);
      }

      .home-deck-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
      }

      .home-deck-item {
        width: 100%;
        border-radius: 16px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(14, 20, 36, 0.7);
        padding: var(--space-3);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-3);
        color: var(--fg);
        cursor: pointer;
      }

      .home-deck-item.active {
        border-color: rgba(123, 92, 255, 0.8);
        box-shadow: 0 12px 30px rgba(123, 92, 255, 0.35);
      }

      .home-deck-text {
        display: flex;
        flex-direction: column;
      }

      .home-deck-name {
        font-weight: 600;
      }

      .home-deck-meta {
        font-size: 0.9rem;
        color: var(--hero-muted);
      }

      .home-deck-chevron {
        font-size: 1.25rem;
        color: var(--hero-muted);
      }

      .home-deck-empty {
        color: var(--hero-muted);
      }

      .hero-auth {
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
      }

      .cta-stack {
        display: grid;
        gap: var(--space-3);
        width: min(100%, 380px);
        margin: 0 auto;
        justify-items: center;
      }

      .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        border: 0;
        border-radius: 12px;
        padding: 0.95rem 1rem;
        font-weight: 700;
        text-decoration: none;
        font: inherit;
        cursor: pointer;
        transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
      }

      .btn-primary {
        background: var(--hero-brand);
        color: #fff;
        box-shadow: 0 12px 28px rgba(123, 92, 255, 0.35);
      }

      .btn-secondary {
        background: #25304b;
        color: var(--hero-text);
      }

      .btn-ghost {
        background: transparent;
        color: var(--hero-text);
        border: 1px solid rgba(255, 255, 255, 0.2);
      }

      .btn:hover,
      .btn:focus {
        transform: translateY(-1px);
      }

      .btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
      }

      button[data-busy="true"],
      .btn[data-busy="true"] {
        cursor: progress;
        opacity: 0.7;
      }

      .email-form {
        display: grid;
        gap: var(--space-3);
        background: var(--hero-card);
        padding: var(--space-4);
        border-radius: var(--radius);
        border: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: var(--hero-shadow);
        animation: reveal 0.22s ease-out;
      }

      .email-form form {
        display: grid;
        gap: var(--space-3);
      }

      .email-form .label {
        display: block;
        font-size: 0.85rem;
        color: var(--hero-muted);
        margin-bottom: 0.25rem;
      }

      .email-form input {
        width: 100%;
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        padding: 0.8rem 0.9rem;
        background: #0f1626;
        color: var(--hero-text);
        font: inherit;
      }

      .email-form details {
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        padding-top: var(--space-3);
      }

      .email-form summary {
        cursor: pointer;
        font-weight: 600;
        margin-bottom: var(--space-2);
        color: var(--hero-text);
      }

      .email-form summary::-webkit-details-marker {
        display: none;
      }

      .email-form details[open] summary {
        margin-bottom: var(--space-3);
      }

      .learn-more {
        display: inline-block;
        margin-top: var(--space-3);
        color: var(--hero-muted);
        text-decoration: underline;
      }

      .features {
        padding: 0 var(--space-1) calc(var(--space-6) + env(safe-area-inset-bottom));
      }

      .features-grid {
        display: grid;
        gap: var(--space-3);
      }

      @media (min-width: 640px) {
        .features-grid {
          grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        }
      }

      .feature-card {
        padding: var(--space-4);
        border-radius: 18px;
        border: 1px solid rgba(148, 163, 184, 0.2);
        background: rgba(15, 23, 42, 0.7);
        display: grid;
        gap: var(--space-2);
      }

      .feature-card strong {
        font-size: 0.95rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: rgba(226, 232, 240, 0.85);
      }

      .feature-card p {
        margin: 0;
        color: var(--text-subtle);
        font-size: 0.95rem;
      }

      @keyframes reveal {
        from {
          opacity: 0;
          transform: translateY(-4px);
        }
        to {
          opacity: 1;
          transform: none;
        }
      }

      .auth-card {
        background: rgba(12, 18, 32, 0.72);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: var(--radius);
        padding: var(--space-5);
        box-shadow: var(--hero-shadow);
      }

      .auth-alert {
        margin-bottom: 1rem;
        border-radius: 16px;
        padding: 0.85rem 1.1rem;
        font-size: 0.95rem;
        border: 1px solid rgba(148, 163, 184, 0.28);
        background: rgba(79, 70, 229, 0.12);
        color: rgba(226, 232, 240, 0.95);
      }

      .auth-alert.info {
        border-color: rgba(129, 140, 248, 0.45);
        background: rgba(99, 102, 241, 0.18);
      }

      .auth-alert.success {
        border-color: rgba(34, 197, 94, 0.35);
        background: rgba(34, 197, 94, 0.16);
        color: #d1fae5;
      }

      .auth-alert.warn {
        border-color: rgba(251, 191, 36, 0.4);
        background: rgba(251, 191, 36, 0.16);
        color: #fef3c7;
      }

      .auth-subtitle {
        margin: 0 0 var(--space-3);
        font-size: 0.95rem;
        color: var(--hero-muted);
      }

      .legal-links {
        margin-top: 1.5rem;
        font-size: 0.85rem;
        color: var(--text-subtle);
        line-height: 1.5;
      }

      .legal-links a {
        color: var(--fg);
        text-decoration: underline;
      }

      .workspace {
        display: grid;
        gap: 1.75rem;
        padding: clamp(2rem, 5vw, 3rem);
        background: rgba(15, 23, 42, 0.76);
        border-radius: 28px;
        border: 1px solid rgba(148, 163, 184, 0.16);
        box-shadow: 0 40px 120px rgba(15, 23, 42, 0.38);
      }

      .workspace-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1.5rem;
      }

      .branding {
        display: flex;
        align-items: center;
        gap: 1rem;
      }

      .logo-dot {
        width: 46px;
        height: 46px;
        border-radius: 16px;
        background: linear-gradient(135deg, var(--accent), rgba(124, 58, 237, 0.5));
        box-shadow: 0 12px 30px rgba(124, 58, 237, 0.4);
      }

      .branding .label {
        display: block;
        font-size: 0.8rem;
        letter-spacing: 0.3em;
        text-transform: uppercase;
        color: rgba(226, 232, 240, 0.65);
      }

      .branding h1 {
        margin: 0;
        font-size: clamp(1.8rem, 2.2vw, 2.4rem);
      }

      .workspace-user {
        display: flex;
        align-items: center;
        gap: 1rem;
        background: rgba(15, 23, 42, 0.6);
        border: 1px solid rgba(148, 163, 184, 0.18);
        border-radius: 16px;
        padding: 0.8rem 1rem;
        flex-wrap: wrap;
      }

      .workspace-user .user-meta {
        min-width: 0;
        display: grid;
        gap: 0.25rem;
        font-size: 0.9rem;
      }

      .workspace-user .user-actions {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: flex-end;
      }

      .workspace-user [data-role="auth-username"] {
        font-weight: 600;
      }

      .workspace-user [data-role="auth-email"] {
        color: var(--text-subtle);
        font-size: 0.85rem;
      }

      .workspace-summary {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 1.5rem;
        background: rgba(15, 23, 42, 0.6);
        border-radius: 20px;
        border: 1px solid rgba(148, 163, 184, 0.12);
        padding: clamp(1.4rem, 3vw, 1.9rem);
      }

      .profile-actions {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
        margin-top: 1rem;
      }

      .learn-header-actions {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        flex-wrap: wrap;
        justify-content: flex-end;
      }

      .workspace-summary h2 {
        margin: 0 0 0.5rem;
        font-size: 1.45rem;
      }

      .workspace-summary p {
        margin: 0;
        color: var(--text-subtle);
        max-width: 60ch;
      }

      .workspace-body {
        display: grid;
        grid-template-columns: minmax(240px, 300px) 1fr;
        gap: clamp(1.5rem, 3vw, 2.5rem);
      }

      .learn-main {
        display: flex;
        flex-direction: column;
        gap: var(--space-4);
      }

      .learn-collection-list {
        display: flex;
        flex-direction: column;
        gap: var(--space-3);
      }

      .learn-empty-state {
        text-align: center;
        padding: 1.4rem 1.6rem;
        border-radius: 18px;
        border: 1px solid rgba(148, 163, 184, 0.16);
        background: rgba(15, 23, 42, 0.55);
        color: var(--text-subtle);
        font-size: 0.95rem;
      }

      .learn-collection,
      .collection-card,
      .audio-section,
      .profile-card {
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.07);
        border-radius: 18px;
        padding: var(--space-3);
      }

      .learn-collection,
      .collection-card {
        display: flex;
        flex-direction: column;
        gap: var(--space-3);
      }

      .learn-collection-header,
      .collection-card-header {
        display: flex;
        align-items: center;
        gap: var(--space-3);
      }

      .learn-collection-heading,
      .collection-card-heading {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        flex: 1;
        min-width: 0;
      }

      .collection-toggle {
        width: 36px;
        height: 36px;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.14);
        background: rgba(255, 255, 255, 0.04);
        color: inherit;
        font-size: 0.85rem;
      }

      .collection-title {
        flex: 1;
        min-width: 0;
        background: none;
        border: 0;
        color: inherit;
        font: inherit;
        text-align: left;
        padding: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        cursor: pointer;
      }

      .collection-title:disabled {
        color: var(--text-subtle);
        cursor: not-allowed;
      }

      .learn-collection-meta {
        font-size: 0.85rem;
        color: var(--hero-muted);
      }

      .collection-body {
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
      }

      .collection-body[hidden] {
        display: none;
      }

      .sheet-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
      }

      .sheet-row {
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.03);
      }

      .sheet-row-meta {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
      }

      .sheet-row-title,
      .sheet-row-title button {
        font-weight: 600;
      }

      .sheet-row button.inline-rename-trigger {
        background: none;
        border: 0;
        color: inherit;
        font: inherit;
        padding: 0;
        text-align: left;
        cursor: pointer;
      }

      .inline-edit-input {
        width: 100%;
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.16);
        background: rgba(15, 23, 42, 0.8);
        color: inherit;
        font: inherit;
        padding: 0.5rem 0.75rem;
      }

      .swipe-track {
        position: relative;
        overflow: hidden;
        touch-action: pan-y;
      }

      .swipe-content {
        position: relative;
        z-index: 1;
        padding: 0.85rem 0;
        transition: transform 160ms ease;
      }

      .sheet-row .swipe-content {
        padding: 0.85rem 1rem;
      }

      .swipe-delete {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 96px;
        border: none;
        background: rgba(255, 93, 93, 0.18);
        color: #ffbdbd;
        font-weight: 600;
        transform: translateX(110%);
        transition: transform 160ms ease;
      }

      .swipe-track.swipe-open .swipe-content {
        transform: translateX(-96px);
      }

      .swipe-track.swipe-open .swipe-delete {
        transform: translateX(0);
      }

      .sidebar {
        display: grid;
        gap: clamp(1.2rem, 2.5vw, 1.8rem);
      }

      .sidebar-section {
        display: grid;
        gap: 0.9rem;
        background: rgba(15, 23, 42, 0.62);
        border: 1px solid rgba(148, 163, 184, 0.14);
        border-radius: 20px;
        padding: clamp(1rem, 2vw, 1.4rem);
        max-height: 38vh;
      }

      .sidebar-header,
      .sidebar-section-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
      }

      .sidebar-header h3,
      .sidebar-section-header h3 {
        margin: 0;
        font-size: 1rem;
      }

      .sidebar-header button {
        font-size: 0.85rem;
        padding: 0.45rem 0.75rem;
      }

      .sidebar-section-header {
        align-items: baseline;
      }

      .deck-meta {
        font-size: 0.8rem;
        color: var(--text-subtle);
        letter-spacing: 0.05em;
        text-transform: uppercase;
      }

      .sidebar-section ul {
        margin: 0;
        padding: 0;
        list-style: none;
        display: grid;
        gap: 0.45rem;
        overflow-y: auto;
        scrollbar-width: thin;
      }

      .sidebar-section ul::-webkit-scrollbar {
        width: 6px;
      }

      .sidebar-section ul::-webkit-scrollbar-thumb {
        background: rgba(148, 163, 184, 0.24);
        border-radius: 999px;
      }

      .deck-list {
        max-height: 200px;
      }

      .deck-item {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 0.75rem;
      }

      .deck-select {
        flex: 1;
        display: grid;
        gap: 0.3rem;
        text-align: left;
        background: rgba(226, 232, 240, 0.05);
        border: 1px solid transparent;
        border-radius: 14px;
        padding: 0.75rem 0.95rem;
        color: inherit;
        cursor: pointer;
        transition: transform 150ms ease, background 150ms ease, border 150ms ease;
      }

      .deck-select:hover,
      .deck-select:focus {
        transform: translateY(-1px);
        background: rgba(226, 232, 240, 0.1);
        outline: none;
      }

      .deck-item.active .deck-select {
        border-color: rgba(124, 58, 237, 0.4);
        background: rgba(124, 58, 237, 0.18);
        box-shadow: 0 14px 36px rgba(124, 58, 237, 0.22);
      }

      .deck-title {
        font-weight: 600;
        font-size: 0.98rem;
      }

      .deck-item .deck-meta {
        font-size: 0.78rem;
      }

      .deck-item.collection-item {
        width: 100%;
        flex-direction: column;
        gap: 0.6rem;
      }

      .collection-item-body {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
      }

      .collection-item-body .deck-select {
        width: 100%;
      }

      .collection-sheet-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: grid;
        gap: 0.35rem;
      }

      .collection-sheet-item {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 0.5rem;
        border: 1px solid rgba(148, 163, 184, 0.12);
        border-radius: 12px;
        padding: 0.4rem 0.65rem;
        background: rgba(12, 18, 32, 0.6);
      }

      .collection-sheet-item--empty {
        font-style: italic;
        color: rgba(226, 232, 240, 0.7);
      }

      .collection-sheet-title {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--fg);
      }

      .collection-sheet-meta {
        font-size: 0.75rem;
        color: rgba(226, 232, 240, 0.7);
        white-space: nowrap;
      }

      .deck-item.empty {
        opacity: 0.65;
        text-align: center;
      }

      .deck-actions {
        display: flex;
        align-items: center;
        gap: 0.4rem;
      }

      .icon-button {
        font: inherit;
        border-radius: 10px;
        padding: 0.45rem 0.75rem;
        border: 1px solid rgba(148, 163, 184, 0.2);
        background: rgba(226, 232, 240, 0.1);
        color: var(--fg);
        cursor: pointer;
        transition: transform 150ms ease, background 150ms ease, border 150ms ease;
      }

      .icon-button:hover,
      .icon-button:focus {
        transform: translateY(-1px);
        outline: none;
        background: rgba(226, 232, 240, 0.18);
      }

      .icon-button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
      }

      .card-list {
        max-height: 46vh;
        list-style: none;
        margin: 0;
        padding: 0;
      }

      .card-sheet-section {
        border-bottom: 1px solid rgba(148, 163, 184, 0.1);
        padding: 0.75rem 0;
        display: grid;
        gap: 0.6rem;
      }

      .card-sheet-section:last-child {
        border-bottom: none;
        padding-bottom: 0;
      }

      .card-sheet-header {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 0.5rem;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        font-size: 0.72rem;
        color: rgba(226, 232, 240, 0.65);
      }

      .card-sheet-title {
        font-size: 0.92rem;
        letter-spacing: normal;
        text-transform: none;
        color: var(--fg);
        font-weight: 600;
      }

      .card-sheet-meta {
        font-size: 0.75rem;
        color: rgba(226, 232, 240, 0.65);
      }

      .card-sheet-cards {
        list-style: none;
        margin: 0;
        padding: 0;
        display: grid;
        gap: 0.55rem;
      }

      .card-list-item {
        border: 1px solid rgba(148, 163, 184, 0.14);
        border-radius: 16px;
        padding: 0.8rem 0.95rem;
        background: rgba(15, 23, 42, 0.55);
        display: grid;
        gap: 0.55rem;
        transition: border 150ms ease, box-shadow 150ms ease;
      }

      .card-list-item.active {
        border-color: rgba(124, 58, 237, 0.4);
        box-shadow: 0 14px 34px rgba(124, 58, 237, 0.24);
      }

      .card-list-item.empty {
        text-align: center;
        color: var(--text-subtle);
      }

      .card-list-question {
        font-size: 0.95rem;
        font-weight: 500;
        color: rgba(248, 250, 252, 0.95);
      }

      .card-tag {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.75rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: rgba(226, 232, 240, 0.75);
      }

      .card-list-status {
        font-size: 0.82rem;
        letter-spacing: 0.06em;
        text-transform: uppercase;
      }

      .card-list-status.due-now {
        color: #f87171;
      }

      .card-list-status.due-soon {
        color: #fbbf24;
      }

      .card-list-status.due-later {
        color: rgba(148, 163, 184, 0.9);
      }

      .card-list-status.due-new {
        color: rgba(148, 163, 184, 0.7);
      }

      .progress-track {
        width: 100%;
        height: 6px;
        border-radius: 999px;
        background: rgba(226, 232, 240, 0.08);
        overflow: hidden;
      }

      .progress-fill {
        height: 100%;
        border-radius: 999px;
        background: var(--accent);
        transition: width 200ms ease;
      }

      .progress-fill.is-due {
        background: #fbbf24;
      }

      .progress-fill.is-overdue {
        background: #f87171;
      }

      .card-actions {
        display: flex;
        gap: 0.4rem;
        margin-top: 0.4rem;
      }

      .privacy-modal {
        position: fixed;
        inset: 0;
        display: none;
        align-items: center;
        justify-content: center;
        padding: 2rem;
        background: rgba(9, 14, 24, 0.78);
        backdrop-filter: blur(18px);
        z-index: 9999;
      }

      /* Import modal needs higher z-index to appear above sheet editor */
      #markdown-import-modal {
        z-index: 10001;
      }

      .privacy-modal.visible {
        display: flex;
      }

      .privacy-card {
        width: min(880px, 100%);
        max-height: 90vh;
        background: rgba(15, 23, 42, 0.94);
        border: 1px solid rgba(148, 163, 184, 0.28);
        border-radius: 24px;
        box-shadow: 0 48px 160px rgba(15, 23, 42, 0.6);
        display: grid;
        grid-template-rows: auto 1fr auto;
      }

      .privacy-card header {
        padding: 1.8rem 2.2rem 1.2rem;
        border-bottom: 1px solid rgba(148, 163, 184, 0.2);
      }

      .privacy-card header h2 {
        margin: 0;
        font-size: 1.85rem;
      }

      .privacy-card header p {
        margin: 0.6rem 0 0;
        color: var(--text-subtle);
        font-size: 0.95rem;
      }

      .privacy-card main {
        padding: 1.5rem 2.2rem;
        overflow-y: auto;
      }

      .privacy-card main section + section {
        margin-top: 1.75rem;
        padding-top: 1.75rem;
        border-top: 1px solid rgba(148, 163, 184, 0.16);
      }

      .privacy-card main h3 {
        margin: 0 0 0.75rem;
        font-size: 1.25rem;
      }

      .privacy-card main h4 {
        margin: 1.35rem 0 0.55rem;
        font-size: 1.05rem;
      }

      .privacy-card main p,
      .privacy-card main li {
        font-size: 0.95rem;
        line-height: 1.6;
        color: rgba(226, 232, 240, 0.92);
      }

      .privacy-card main ul {
        margin: 0.75rem 0 0.75rem 1.5rem;
      }

      .privacy-card footer {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 1rem;
        padding: 1.6rem 2.2rem 1.9rem;
        border-top: 1px solid rgba(148, 163, 184, 0.2);
      }

      .system-banner {
        width: 100%;
        border-radius: 16px;
        padding: 0.85rem 1.25rem;
        margin-bottom: 1rem;
        font-size: 0.95rem;
        border: 1px solid rgba(148, 163, 184, 0.35);
        background: rgba(79, 70, 229, 0.16);
        color: rgba(226, 232, 240, 0.95);
      }

      .system-banner.warn {
        border-color: rgba(251, 191, 36, 0.5);
        background: rgba(251, 191, 36, 0.15);
        color: #fef3c7;
      }

      .system-banner.success {
        border-color: rgba(34, 197, 94, 0.45);
        background: rgba(34, 197, 94, 0.15);
        color: #d1fae5;
      }

      .cookie-banner {
        position: fixed;
        bottom: 1rem;
        left: 50%;
        transform: translateX(-50%);
        width: min(520px, calc(100% - 2rem));
        background: rgba(15, 23, 42, 0.92);
        border: 1px solid rgba(148, 163, 184, 0.28);
        border-radius: 18px;
        padding: 1rem 1.25rem;
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
        display: none;
        gap: 0.75rem;
        z-index: 9998;
      }

      .cookie-banner.visible {
        display: flex;
        flex-direction: column;
      }

      .cookie-banner p {
        margin: 0;
        color: rgba(226, 232, 240, 0.9);
        font-size: 0.92rem;
        line-height: 1.5;
      }

      .review-area {
        display: grid;
        gap: 1.5rem;
      }

    .pill {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        border-radius: 999px;
        padding: 0.45rem 1.1rem;
        background: rgba(124, 58, 237, 0.18);
        font-size: 0.95rem;
        text-transform: uppercase;
        letter-spacing: 0.18em;
      }

      .toolbar {
        display: flex;
        justify-content: flex-end;
        gap: 0.75rem;
        margin-top: -0.25rem;
      }

      .primary,
      .secondary,
      .auth button {
        font: inherit;
        border-radius: 12px;
        padding: 0.75rem 1.1rem;
        cursor: pointer;
        border: 1px solid transparent;
        transition: transform 150ms ease, background 150ms ease, border 150ms ease;
      }

      .primary {
        background: var(--accent);
        color: var(--fg);
        box-shadow: 0 14px 30px rgba(124, 58, 237, 0.35);
      }

      .secondary.ghost {
        background: transparent;
        border-color: rgba(148, 163, 184, 0.3);
        color: var(--fg);
        box-shadow: none;
      }

      .secondary.ghost:hover,
      .secondary.ghost:focus {
        background: rgba(148, 163, 184, 0.2);
      }

      .language-toggle {
        font-size: 0.85rem;
        padding: 0.45rem 0.9rem;
      }

      .mode-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: var(--space-4);
        flex-wrap: wrap;
      }

      .mode-preheading {
        margin: 0 0 0.35rem;
        font-size: 0.75rem;
        letter-spacing: 0.25em;
        text-transform: uppercase;
        color: var(--hero-muted);
      }

      .mode-actions {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-2);
        justify-content: flex-end;
      }

      .learn-decks {
        border: 1px solid rgba(255, 255, 255, 0.07);
        border-radius: 18px;
        padding: var(--space-3);
        background: rgba(15, 20, 32, 0.65);
        display: grid;
        gap: var(--space-3);
      }

      .learn-decks-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: var(--space-3);
        flex-wrap: wrap;
      }

      .learn-decks-actions {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        flex-wrap: wrap;
      }

      .exam-target-chip {
        padding: 0.25rem 0.65rem;
        border-radius: 999px;
        border: 1px solid rgba(148, 163, 184, 0.3);
        font-size: 0.85rem;
        color: rgba(226, 232, 240, 0.85);
        background: rgba(10, 16, 28, 0.65);
      }

      .exam-target-chip[hidden] {
        display: none !important;
      }

      .learn-decks-body {
        display: grid;
        gap: var(--space-3);
      }

      .review-decks {
        margin-top: var(--space-4);
      }

      .primary:hover,
      .primary:focus {
        background: var(--accent-strong);
        transform: translateY(-1px);
        outline: none;
      }

      .secondary {
        background: rgba(226, 232, 240, 0.08);
        color: var(--fg);
        border: 1px solid rgba(148, 163, 184, 0.18);
      }

      .secondary:hover,
      .secondary:focus {
        background: rgba(226, 232, 240, 0.14);
        transform: translateY(-1px);
        outline: none;
      }

      .secondary.danger {
        color: #ff8b8b;
        border-color: rgba(248, 113, 113, 0.45);
        background: rgba(248, 113, 113, 0.08);
      }

      .secondary.danger:hover,
      .secondary.danger:focus {
        background: rgba(248, 113, 113, 0.14);
        color: #ffb4b4;
      }

      .review-idle,
      .review-complete {
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 18px;
        padding: var(--space-4);
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: var(--space-4);
        flex-wrap: wrap;
        background: rgba(12, 18, 32, 0.7);
      }

      .review-card {
        border-radius: 20px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(10, 14, 26, 0.9);
        padding: var(--space-4);
        display: grid;
        gap: var(--space-3);
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
      }

      .review-card-status {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.85rem;
        letter-spacing: 0.2em;
        text-transform: uppercase;
        color: var(--hero-muted);
      }

      .card-deadline {
        margin-left: 0.75rem;
        font-size: 0.8rem;
        letter-spacing: normal;
        text-transform: none;
        color: var(--hero-brand);
      }

      .card-deadline[hidden] {
        display: none !important;
      }

      .review-flashcard {
        border: none;
        background: linear-gradient(135deg, rgba(36, 43, 74, 0.9), rgba(29, 32, 52, 0.9));
        border-radius: 18px;
        padding: clamp(1.5rem, 5vw, 2.5rem);
        color: var(--fg);
        font: inherit;
        text-align: left;
        cursor: pointer;
        min-height: 220px;
        display: grid;
        gap: var(--space-3);
      }

      .review-flashcard .question,
      .review-flashcard .answer {
        font-size: clamp(1.1rem, 0.8vw + 1rem, 1.6rem);
        line-height: 1.5;
      }

      .review-card[data-state="answer"] .question {
        display: none;
      }

      .review-card[data-state="question"] .answer {
        display: none;
      }

      .card-audio-controls {
        display: flex;
        gap: 0.5rem;
        align-items: center;
        margin: 0.35rem 0 0.15rem;
        flex-wrap: wrap;
      }

      .card-audio-group {
        display: inline-flex;
        gap: 0.35rem;
        flex-wrap: wrap;
        align-items: center;
      }

      .card-audio-button {
        border: 1px solid rgba(148, 163, 184, 0.25);
        border-radius: 999px;
        background: rgba(15, 23, 42, 0.55);
        color: var(--fg);
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
        cursor: pointer;
      }

      .card-audio-button.subtle {
        border-style: dashed;
        opacity: 0.9;
        font-size: 0.75rem;
      }

      .card-audio-button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
      }

      .review-grade-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: var(--space-2);
      }

      .review-grade-grid button {
        border-radius: 14px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(255, 255, 255, 0.04);
        padding: var(--space-3);
        text-align: left;
        color: var(--fg);
        display: grid;
        gap: 0.25rem;
      }

      .review-grade-grid button strong {
        font-size: 1rem;
      }

      .review-grade-grid button span {
        font-size: 0.85rem;
        color: var(--hero-muted);
      }

      .review-grade-grid button.grade-flash {
        animation: gradePulse 320ms ease;
      }

      @keyframes gradePulse {
        0% {
          transform: translateY(0) scale(1);
          box-shadow: 0 0 0 rgba(123, 92, 255, 0);
        }
        50% {
          transform: translateY(-2px) scale(1.02);
          box-shadow: 0 8px 20px rgba(123, 92, 255, 0.3);
        }
        100% {
          transform: translateY(0) scale(1);
          box-shadow: 0 0 0 rgba(123, 92, 255, 0);
        }
      }

      .review-encouragement {
        margin-top: 0.5rem;
        font-size: 0.95rem;
        color: rgba(226, 232, 240, 0.85);
        text-align: center;
        opacity: 0;
        transform: translateY(8px);
        transition: opacity 180ms ease, transform 180ms ease;
      }

      .review-encouragement.visible {
        opacity: 1;
        transform: translateY(0);
      }

      .review-session {
        display: grid;
        gap: var(--space-4);
      }

      .review-exit {
        width: fit-content;
        margin-left: auto;
      }

      .review-idle-metric {
        font-size: clamp(2rem, 5vw, 2.8rem);
        margin: 0.5rem 0 0;
      }

      .audio-hero {
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 18px;
        padding: var(--space-4);
        background: rgba(12, 18, 32, 0.65);
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: var(--space-4);
        flex-wrap: wrap;
      }

      .audio-storage-panel {
        margin-top: var(--space-4);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 18px;
        padding: var(--space-3);
        background: rgba(12, 18, 32, 0.6);
        display: grid;
        gap: var(--space-3);
      }

      .audio-storage-panel-header {
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
      }

      .audio-mode-banner {
        margin: 0;
        font-size: 0.9rem;
        color: var(--hero-muted);
        border-radius: 12px;
        border: 1px dashed rgba(255, 255, 255, 0.15);
        padding: 0.75rem 1rem;
        background: rgba(15, 23, 42, 0.55);
      }

      .audio-storage-panel-body {
        display: grid;
        gap: var(--space-3);
      }

      .audio-storage-options-inline {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: var(--space-3);
      }

      .audio-storage-progress {
        display: grid;
        gap: 0.5rem;
      }

      .audio-storage-progress-bar {
        width: 100%;
        height: 10px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.08);
        overflow: hidden;
      }

      .audio-storage-progress-fill {
        height: 100%;
        width: 0%;
        background: linear-gradient(90deg, #7c3aed, #36c9ff);
        border-radius: 999px;
        transition: width 160ms ease;
      }

      .audio-storage-summary {
        margin: 0;
        font-size: 0.95rem;
        color: var(--hero-muted);
      }

      .audio-storage-warning {
        margin: 0;
        font-size: 0.9rem;
        color: #fbbf24;
      }

      .audio-recent {
        display: grid;
        gap: var(--space-3);
        margin-top: var(--space-4);
      }

      .audio-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
      }

      .audio-list li {
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 14px;
        padding: var(--space-3);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-3);
        background: rgba(12, 18, 32, 0.6);
      }

      .audio-session-meta {
        display: flex;
        flex-direction: column;
        gap: 0.2rem;
      }

      .audio-list-empty {
        text-align: center;
        color: var(--hero-muted);
        border-style: dashed;
      }


      .auth {
        display: grid;
        gap: var(--space-3);
        padding: 0;
      }

      .auth[data-state="loading"] {
        opacity: 0.6;
      }

      .auth h2 {
        margin: 0;
        font-size: 1.35rem;
      }

      .auth-actions {
        display: contents;
      }

      .auth form {
        display: contents;
        gap: 0;
        background: none;
        border: 0;
        padding: 0;
      }

      .auth label {
        display: block;
      }

      .auth input {
        font: inherit;
      }

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

      .auth .auth-message {
        font-size: 0.85rem;
        color: var(--hero-muted);
      }

      .sync-status {
        font-size: 0.85rem;
        color: rgba(255, 255, 255, 0.6);
      }

      .editor {
        display: grid;
        gap: 0.75rem;
        padding: clamp(1.2rem, 2.4vw, 1.6rem);
        border-radius: 20px;
        background: rgba(15, 23, 42, 0.65);
        border: 1px solid rgba(148, 163, 184, 0.16);
      }

      .editor h2 {
        margin: 0;
        font-size: 1.1rem;
      }

      .editor label {
        display: grid;
        gap: 0.35rem;
        font-size: 0.9rem;
        color: rgba(255, 255, 255, 0.7);
      }

      .editor input,
      .editor textarea {
        font: inherit;
        padding: 0.7rem;
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, 0.14);
        background: rgba(0, 0, 0, 0.2);
        color: inherit;
        resize: vertical;
        min-height: 48px;
      }

      .editor textarea {
        min-height: 96px;
      }

      .editor-actions {
        display: flex;
        gap: 0.75rem;
        justify-content: flex-end;
      }

      .editor-actions button {
        font: inherit;
      }

      .editor[hidden] {
        display: none;
      }

      footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.85rem;
        color: rgba(255, 255, 255, 0.6);
      }

      .workspace-user .user-actions button {
        white-space: nowrap;
      }

      footer button {
        font: inherit;
        background: rgba(226, 232, 240, 0.08);
        border: 1px solid rgba(148, 163, 184, 0.16);
        color: var(--fg);
        border-radius: 999px;
        padding: 0.5rem 1.1rem;
        cursor: pointer;
        transition: transform 150ms ease, background 150ms ease;
      }

      footer button:hover,
      footer button:focus {
        transform: translateY(-1px);
        background: rgba(226, 232, 240, 0.16);
        outline: none;
      }

      @media (max-width: 900px) {
        .landing {
          grid-template-columns: 1fr;
        }

        .workspace-body {
          grid-template-columns: 1fr;
        }

        .learn-main {
          grid-template-columns: 1fr;
        }

        .sidebar {
          order: 2;
        }

        .review-area {
          order: 1;
        }

        .sidebar-section {
          max-height: none;
        }

        .card-list {
          max-height: none;
        }

        .deck-item {
          flex-direction: column;
          align-items: stretch;
        }

        .deck-actions {
          justify-content: flex-end;
        }
      }

      @media (max-width: 600px) {
        body {
          padding: 1rem;
        }

        .layout {
          gap: 1.5rem;
        }

        .landing,
        .workspace {
          padding: 1.75rem;
        }

        .workspace-header {
          flex-direction: column;
          align-items: flex-start;
        }

        .workspace-user {
          width: 100%;
          justify-content: flex-start;
          gap: 0.75rem;
        }

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

        .card-actions {
          flex-wrap: wrap;
        }
      }
.is-hidden {
  display: none !important;
}

.card-source-context {
  margin: 0 0 0.5rem 0;
  font-size: 0.8125rem;
  color: var(--text-subtle);
  opacity: 0.8;
}

.editor-context {
  margin: -0.5rem 0 1rem;
  color: var(--text-subtle);
  font-size: 0.875rem;
}

.md-import-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.md-import-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.md-import-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.md-import-heading {
  font-weight: 500;
}

.md-import-file,
.md-import-select {
  padding: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.375rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
}

.md-import-preview {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.md-import-preview-content {
  max-height: 200px;
  overflow-y: auto;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.md-import-mode-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.md-import-radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.md-import-radio {
  width: 1rem;
  height: 1rem;
}

.md-import-footer {
  display: flex;
  gap: 0.75rem;
  padding: 0 1.5rem 1.5rem;
}

.md-import-action {
  flex: 1;
}

.privacy-docs-notice {
  margin: 0;
  color: var(--text-subtle);
  font-size: 0.85rem;
}

.sheet-ai-panel,
.sheet-audio-panel {
  margin: 1rem 1.25rem 0;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sheet-ai-panel.is-hidden,
.sheet-audio-panel.is-hidden {
  display: none;
}

.sheet-ai-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.sheet-ai-title {
  margin: 0;
  font-weight: 600;
}

.sheet-ai-subtitle {
  margin: 0.15rem 0 0;
  color: var(--text-subtle);
  font-size: 0.9rem;
}

.sheet-ai-credits {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--hero-brand);
}

.sheet-ai-generate {
  justify-content: center;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sheet-ai-warning {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.sheet-ai-hint {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--hero-muted);
}

.audio-storage-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.25rem 0 0.75rem;
}

.audio-storage-option {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.audio-storage-option input {
  margin-top: 0.3rem;
}

.audio-storage-option strong {
  display: block;
}

.audio-storage-option p {
  margin: 0.15rem 0 0;
  color: var(--text-subtle);
  font-size: 0.85rem;
}
.sheet-audio-panel .sheet-ai-subtitle {
  color: var(--text-subtle);
}

.sheet-linked-cards {
  margin: 1rem 1.25rem 0;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  background: rgba(12, 18, 32, 0.6);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sheet-linked-cards.is-hidden {
  display: none;
}

.sheet-editor-body .sheet-ai-panel,
.sheet-editor-body .sheet-audio-panel,
.sheet-editor-body .sheet-linked-cards {
  margin: 0;
}

@media (max-width: 900px) {
  .sheet-editor-controls-right {
    align-items: flex-start;
  }

  .sheet-editor-options {
    align-items: flex-start;
  }

  .sheet-editor-options-toggle {
    display: inline-flex;
  }

  .sheet-editor-options-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.85rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(6, 11, 20, 0.96);
    box-shadow: 0 18px 32px rgba(3, 8, 20, 0.7);
    display: none;
    min-width: min(280px, 85vw);
    z-index: 40;
  }

  .sheet-editor-options-panel[data-state="open"] {
    display: flex;
  }

  .sheet-editor-options-panel .audio-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .sheet-editor-options-panel .editor-icon-button {
    width: 100%;
    justify-content: center;
  }
}

.linked-cards-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.linked-cards-header h3 {
  margin: 0;
  font-size: 1rem;
}

.linked-card-subtitle {
  margin: 0.15rem 0 0;
  color: var(--text-subtle);
  font-size: 0.85rem;
}

.linked-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.linked-card-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.5rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
}

.linked-card-front,
.linked-card-back {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.linked-card-back {
  color: var(--text-subtle);
}

.linked-card-meta {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-subtle);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.linked-card-empty,
.linked-card-loading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.linked-card-loading .loading-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  background: var(--hero-brand);
  display: inline-block;
  animation: linkedCardPulse 0.9s ease-in-out infinite;
}

@keyframes linkedCardPulse {
  0% {
    opacity: 0.4;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
  100% {
    opacity: 0.4;
    transform: scale(0.9);
  }
}

.audio-library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.audio-storage-chip {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  color: var(--hero-brand);
}

.audio-track {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.audio-track.playing {
  border-color: rgba(124, 58, 237, 0.4);
  background: rgba(124, 58, 237, 0.15);
}

.audio-track-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.audio-track-title {
  margin: 0;
  font-weight: 600;
}

.audio-track-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.audio-track button {
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.audio-track-controls {
  display: flex;
  gap: 0.35rem;
}

.audio-track-controls button {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  cursor: pointer;
}

      .audio-track button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
      }

      .audio-local-hint {
        margin-top: 1rem;
        padding: 0.9rem 1rem;
        border-radius: 0.75rem;
        background: rgba(255, 255, 255, 0.04);
        border: 1px dashed rgba(255, 255, 255, 0.16);
        color: var(--text-subtle);
      }

      .audio-collection {
        padding: var(--space-3);
      }

      .audio-collection-body {
        display: flex;
        flex-direction: column;
        gap: var(--space-3);
        margin-top: var(--space-3);
      }

      .audio-sheet-section {
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 14px;
        padding: var(--space-3);
        background: rgba(255, 255, 255, 0.02);
      }

      .audio-sheet-header {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        font-size: 0.9rem;
        margin-bottom: var(--space-2);
      }

      .audio-track-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
      }

      .audio-track-row {
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 12px;
        padding: 0.85rem 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        background: rgba(255, 255, 255, 0.01);
      }

      .audio-track-row.playing {
        border-color: rgba(124, 58, 237, 0.45);
        background: rgba(124, 58, 237, 0.15);
      }

      .audio-track-badges {
        display: flex;
        gap: 0.35rem;
        flex-wrap: wrap;
        margin: 0.25rem 0;
      }

      .audio-track-badge {
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        padding: 0.1rem 0.55rem;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
      }

.flashcard-quick-menu {
  position: absolute;
  z-index: 1500;
  background: rgba(10, 15, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  padding: 0.35rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.flashcard-quick-menu button {
  background: none;
  border: none;
  color: var(--fg);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
}

.flashcard-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1400;
}

.flashcard-modal:not([hidden]) {
  display: flex;
}

.flashcard-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 15, 0.7);
  backdrop-filter: blur(4px);
}

.flashcard-modal__dialog {
  position: relative;
  background: rgba(15, 20, 36, 0.98);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: min(520px, 90vw);
  padding: 1.5rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.flashcard-modal__dialog header {
  margin-bottom: 1rem;
}

.flashcard-modal__dialog h2 {
  margin: 0 0 0.25rem;
}

.flashcard-modal__dialog p {
  margin: 0;
  color: var(--text-subtle);
  font-size: 0.9rem;
}

.flashcard-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.flashcard-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.flashcard-field span {
  font-weight: 600;
}

.flashcard-field textarea {
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
  color: var(--fg);
  padding: 0.75rem;
  font-family: inherit;
  resize: vertical;
}

.flashcard-form-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}
.plan-note {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-subtle);
}
