  :root {
    color-scheme: light dark;
    
    /* Neutrals */
    --bg: #f0f4f8;
    --surface: #ffffff;
    --surface-2: #e8eef5;
    --surface-3: #d4dce8;
    --text: #1a2332;
    --text-2: #3d4f63;
    --text-3: #6b7a8f;
    --border: #d4dce8;
    --border-2: #b8c4d4;
    
    /* Brand */
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --primary-bg: #eef2ff;
    
    /* Accents */
    --listening: #e11d48;
    --listening-bg: #fff1f2;
    --reading: #059669;
    --reading-bg: #ecfdf5;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(30, 41, 59, 0.06);
    --shadow: 0 1px 3px rgba(30, 41, 59, 0.1), 0 1px 2px rgba(30, 41, 59, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(30, 41, 59, 0.1), 0 2px 4px -1px rgba(30, 41, 59, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(30, 41, 59, 0.1), 0 4px 6px -2px rgba(30, 41, 59, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(30, 41, 59, 0.12), 0 10px 10px -5px rgba(30, 41, 59, 0.05);
    
    /* Radius */
    --r-sm: 6px;
    --r: 10px;
    --r-lg: 14px;
    --r-xl: 20px;
    --r-full: 9999px;
    
    /* Motion */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  
  html {
    color-scheme: light dark;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
  }
  
  body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  
  button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  
  button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }
  
  [hidden] { display: none !important; }
  
  /* Scrollbar */
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
  
  /* App Layout */
  .app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
  }

  .app-body {
    display: flex;
    flex: 1;
  }

  /* Sidebar */
  .sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    height: calc(100dvh - 52px);
    position: sticky;
    top: 52px;
    overflow: hidden;
  }

  .sidebar-nav {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }

  .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-2);
    border-radius: 6px;
  }

  .sidebar-close-btn:hover {
    background: var(--hover);
    color: var(--text);
  }

  @media (max-width: 768px) {
    .sidebar-close-btn {
      display: flex;
    }

    #menuBtn {
      display: flex !important;
    }
  }

  #menuBtn {
    display: none;
  }

  .sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
  }

  .sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-3);
    flex-shrink: 0;
  }

  .sidebar-footer p {
    margin: 4px 0;
  }

  .sidebar-contributors a {
    color: var(--primary);
    text-decoration: none;
  }

  .sidebar-contributors a:hover {
    text-decoration: underline;
  }

  .app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  /* Header */
  .header {
    position: sticky;
    top: 0;
    z-index: 100;
    max-width: 100%;
    overflow-x: clip;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
  }

  .header-inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    min-height: 52px;
    height: auto;
    padding: 6px 12px;
    padding-top: calc(6px + env(safe-area-inset-top));
  }

  .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
    text-decoration: none;
  }

  .logo > span {
    white-space: nowrap;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--r);
    color: white;
  }

  .header-spacer {
    flex: 1 1 auto;
    min-width: 0;
  }

  .icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--r);
    color: var(--text-2);
    transition: all 0.15s var(--ease);
  }

  .icon-btn:hover {
    background: var(--surface-2);
    color: var(--text);
  }
  
  .icon-btn:active {
    transform: scale(0.95);
  }

  .icon-btn.active {
    background: var(--primary-bg);
    color: var(--primary);
  }
  
  /* Sort Button */
  .sort-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--r);
    cursor: pointer;
    transition: all 0.15s;
  }

  .sort-btn:hover {
    background: var(--surface-2);
    border-color: var(--text-3);
  }

  .sort-btn.active {
    background: var(--primary-bg);
    border-color: var(--primary);
  }

  .sort-btn-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
  }

  .sort-btn.active .sort-btn-text {
    color: var(--primary);
  }

  .search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 14px;
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: var(--r-lg);
    transition: all 0.15s var(--ease);
  }
  
  .search-box:focus-within {
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
  }
  
  .search-box input {
    flex: 1;
    height: 100%;
    border: none;
    background: none;
    font-size: 15px;
    color: var(--text);
  }
  
  .search-box input::placeholder { color: var(--text-3); }
  .search-box input:focus { outline: none; }
  
  .search-clear {
    display: none;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    background: var(--surface-3);
    border-radius: var(--r-full);
    color: var(--text-3);
    font-size: 12px;
  }
  
  .search-box.has-value .search-clear { display: flex; }
  
  /* Breadcrumb */
  .breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-2);
    min-width: 0;
  }

  .breadcrumb-path {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .breadcrumb-path::-webkit-scrollbar {
    display: none;
  }

  .breadcrumb-count {
    flex-shrink: 0;
    margin-left: auto;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    background: var(--surface-2);
    border-radius: 999px;
    white-space: nowrap;
  }

  .breadcrumb button {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    gap: 4px;
    padding: 2px 6px;
    border: none;
    background: transparent;
    color: var(--text-2);
    font-size: inherit;
    cursor: pointer;
    border-radius: var(--r-sm);
    transition: all 0.15s;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .breadcrumb button:hover {
    background: var(--surface-2);
    color: var(--text);
  }

  .breadcrumb-sep {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    color: var(--text-3);
    padding: 0 1px;
    white-space: nowrap;
  }

  .breadcrumb-current {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 2px 6px;
    color: var(--text);
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
  }

  /* Main Content */
  .main {
    flex: 1;
    padding: 0 10px 12px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
  }
  
  /* Welcome State */
  .welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 16px;
    min-height: 60vh;
  }
  
  .welcome-icon {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-radius: var(--r-xl);
    color: white;
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
  }
  
  @keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
  }
  
  .welcome h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
  }
  
  .welcome p {
    font-size: 15px;
    color: var(--text-2);
    max-width: 320px;
  }
  
  /* Cards Grid */
  .cards-grid {
    margin-bottom: 16px;
  }

  .cards-grid--fit {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 10px;
  }

  .cards-grid--uniform {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    align-items: stretch;
  }
  
  .card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    height: auto;
  }

  .cards-grid--fit .card {
    width: auto;
    max-width: 100%;
    flex: 0 0 auto;
  }

  .cards-grid--uniform .card {
    width: 100%;
    min-height: 190px;
  }
  
  .card:hover {
    border-color: var(--border-2);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
  }
  
  .card:active {
    transform: translateY(0);
    box-shadow: var(--shadow);
  }
  
  .card-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
    padding: 10px;
    overflow: hidden;
    box-sizing: border-box;
  }

  .cards-grid--fit .card-thumb {
    aspect-ratio: var(--card-ar, 3 / 4);
    width: var(--card-w, 176px);
    max-width: 100%;
  }

  .cards-grid--uniform .card-thumb {
    aspect-ratio: 3 / 4;
    width: 100%;
  }
  
  .card-thumb svg {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
  }
  
  .card-body {
    padding: 8px 10px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }
  
  .card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
  }
  
  .card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-3);
    white-space: nowrap;
  }
  
  .list-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: 52px;
    z-index: 10;
    padding: 8px 10px;
    margin: 0 -10px 8px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: none;
  }

  .main > .list-toolbar:first-child {
    margin-top: 0;
  }

  .list-toolbar-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    white-space: nowrap;
  }

  .listening-toolbar {
    justify-content: flex-end;
  }

  .listening-filter-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .sort-btn.icon-only {
    padding: 8px 10px;
    min-width: 40px;
  }

  /* Reading Search Inline */
  .reading-search {
    justify-content: stretch;
  }

  .reading-search .search-box {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    transition: all 0.2s ease;
  }

  .reading-search .search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
  }

  .reading-search .search-box svg {
    color: var(--text-3);
    flex-shrink: 0;
  }

  .reading-search input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--text);
    outline: none;
  }

  .reading-search input::placeholder {
    color: var(--text-3);
  }

  .reading-search .search-clear {
    width: 20px;
    height: 20px;
    border: none;
    background: var(--surface-3);
    border-radius: 50%;
    color: var(--text-2);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .reading-search .search-clear:hover {
    background: var(--text-3);
    color: var(--text);
  }

  .reading-expand-toggle {
    flex-shrink: 0;
    padding: 8px 12px;
  }
  
  /* Reading List */
  .reading-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  
  .reading-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: all 0.2s var(--ease);
  }
  
  .reading-item:hover {
    border-color: var(--border-2);
    box-shadow: var(--shadow-sm);
  }
  
  .reading-item.expanded {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
  }
  
  .reading-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
  }
  
  .reading-header:hover {
    background: var(--surface-2);
  }
  
  .reading-expand {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border-radius: var(--r-sm);
    color: var(--text-3);
    transition: all 0.2s var(--ease);
    flex-shrink: 0;
  }
  
  .reading-item.expanded .reading-expand {
    background: var(--primary);
    color: white;
    transform: rotate(90deg);
  }
  
  .reading-titles {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .reading-title-line {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
  }
  
  .reading-answers {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 10px;
  }
  
  .answer-chip {
    display: block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    background: var(--answer-bg, var(--primary-bg));
    color: var(--answer-text, var(--primary));
    border-radius: var(--r-sm);
    border: 1px solid var(--answer-border, transparent);
  }
  
  .reading-body {
    display: none;
    padding: 0 12px 10px;
    border-top: 1px solid var(--border);
  }
  
  .reading-item.expanded .reading-body {
    display: block;
  }
  
  .reading-extra {
    margin-top: 12px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    background: var(--surface-2);
    border-radius: var(--r-sm);
  }
  
  /* Detail View */
  .detail-view {
    animation: fadeIn 0.2s var(--ease);
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  .detail-answers {
    padding: 0 16px 32px;
  }
  
  /* Answers Grid */
  .answers-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
  }
  
  .answer-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--surface-2);
    border-radius: var(--r-sm);
    transition: all 0.1s var(--ease);
  }
  
  .answer-cell:hover {
    background: var(--surface-3);
  }
  
  .answer-num {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
  }
  
  .answer-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    font-size: 14px;
    font-weight: 800;
    background: var(--primary);
    color: white;
    border-radius: 6px;
  }
  
  /* Empty State */
  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    color: var(--text-2);
  }
  
  .empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--text-3);
    margin-bottom: 16px;
  }
  
  /* Tree Navigation */
  .drawer-tree {
    padding: 0 8px;
  }

  .tree-folder {
    margin-bottom: 4px;
  }

  .tree-folder-header {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    padding: 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    position: relative;
    border-radius: var(--r);
    transition: background 0.15s;
  }

  .tree-folder-header:hover {
    background: var(--surface-2);
  }

  .tree-arrow-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: inherit;
    flex-shrink: 0;
    padding: 0;
  }

  .tree-label-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    padding: 10px 8px 10px 0;
    border: none;
    background: transparent;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    cursor: pointer;
    text-align: left;
    text-transform: uppercase;
  }

  .tree-folder.open > .tree-folder-header {
    color: var(--primary);
  }

  .tree-sub .tree-folder-header,
  .tree-test .tree-folder-header {
    padding-left: 28px;
  }

  .tree-test .tree-folder-header {
    padding-left: 44px;
    font-size: 13px;
    font-weight: 500;
  }

  .tree-test .tree-children .tree-item {
    padding-left: 56px;
  }

  .tree-arrow {
    transition: transform 0.2s ease;
    color: var(--text-3);
  }

  .tree-folder.open > .tree-folder-header .tree-arrow {
    transform: rotate(90deg);
  }

  .tree-count {
    margin-left: auto;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-3);
    background: var(--surface-2);
    padding: 2px 8px;
    border-radius: var(--r-full);
  }

  .tree-folder.open > .tree-folder-header .tree-count {
    background: var(--primary-bg);
    color: var(--primary);
  }

  .tree-children {
    display: none;
    padding-left: 20px;
  }

  .tree-folder.open > .tree-children {
    display: block;
  }

  .tree-sub > .tree-folder-header {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
  }

  .tree-sub > .tree-folder-header:hover {
    color: var(--text);
  }

  .tree-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px 8px 32px;
    border: none;
    background: transparent;
    font-size: 13px;
    color: var(--text-2);
    cursor: pointer;
    border-radius: var(--r);
    transition: all 0.15s;
    text-align: left;
  }

  .tree-item:hover {
    background: var(--surface-2);
    color: var(--text);
  }

  .tree-item.active {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 500;
  }

  .tree-item .tree-count {
    font-size: 11px;
    padding: 2px 6px;
  }
  
  /* Responsive */
  /* Mobile < 640px */
  .cards-grid {
    gap: 8px;
  }
  
  .main {
    padding: 0 8px 10px;
  }

  .main > :first-child:not(.list-toolbar) {
    margin-top: 10px;
  }

  .breadcrumb {
    padding: 5px 8px;
    gap: 6px;
    font-size: 12px;
  }
  
  /* Tablet 640px - 899px */
  @media (min-width: 640px) {
    .cards-grid--fit,
    .cards-grid--uniform {
      gap: 12px;
    }

    .cards-grid--uniform {
      grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    
    .main {
      padding: 0 12px 14px;
    }
    
  }
  
  /* Desktop 900px+ */
  @media (min-width: 900px) {
    .cards-grid--uniform {
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
  }
  
  /* Large Desktop 1200px+ */
  @media (min-width: 1200px) {
    .cards-grid--uniform {
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 14px;
    }
  }
  
  /* Reading List Responsive */
  .reading-header {
    gap: 10px;
    padding: 12px;
  }
  
  .reading-expand {
    width: 24px;
    height: 24px;
  }
  
  .reading-answers {
    gap: 4px;
  }
  
  .reading-body {
    padding: 0 12px 12px;
  }
  
  .reading-extra {
    margin-top: 10px;
    padding: 8px 10px;
    font-size: 12px;
  }
  
  /* Detail View Responsive */
  .detail-view {
    padding: 0;
  }
  
  .detail-answers {
    padding: 0 12px 24px;
  }
  
  .answer-cell {
    padding: 8px 10px;
  }
  
  .answer-num {
    font-size: 11px;
  }
  
  .answer-letter {
    width: 22px;
    height: 22px;
    font-size: 12px;
    font-weight: 700;
  }
  
  /* Welcome State Responsive */
  .welcome {
    padding: 40px 16px;
  }
  
  .welcome-icon {
    width: 80px;
    height: 80px;
  }
  
  .welcome-icon svg {
    width: 36px;
    height: 36px;
  }
  
  .welcome h1 {
    font-size: 20px;
  }
  
  .welcome p {
    font-size: 14px;
  }
  
  @media (min-width: 640px) {
    .reading-header {
      gap: 12px;
      padding: 16px;
    }
    
    .reading-expand {
      width: 28px;
      height: 28px;
    }
    
    .reading-answers {
      gap: 6px;
    }
    
    .reading-body {
      padding: 0 16px 16px;
    }
    
    .reading-extra {
      margin-top: 12px;
      padding: 10px 12px;
      font-size: 13px;
    }
    
    .welcome {
      padding: 60px 24px;
    }
    
    .welcome-icon {
      width: 100px;
      height: 100px;
    }
    
    .welcome-icon svg {
      width: 48px;
      height: 48px;
    }
    
    .welcome h1 {
      font-size: 24px;
    }
    
    .welcome p {
      font-size: 15px;
    }
  }
  
  /* Touch Device Optimizations */
  @media (hover: none) and (pointer: coarse) {
    .card:hover {
      transform: none;
      box-shadow: var(--shadow);
    }
    
    .card:active {
      transform: scale(0.98);
    }
    
    .reading-item:hover {
      box-shadow: none;
    }
    
    .answer-cell:hover {
      background: var(--surface-2);
    }
  }
  
  /* Dark Mode (manual toggle via data-theme attribute) */
  [data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-2: #334155;
    --surface-3: #475569;
    --text: #f1f5f9;
    --text-2: #cbd5e1;
    --text-3: #94a3b8;
    --border: #334155;
    --border-2: #475569;
    --primary-bg: rgba(99, 102, 241, 0.2);
    --listening-bg: rgba(225, 29, 72, 0.2);
    --reading-bg: rgba(5, 150, 105, 0.2);
    --answer-bg: rgba(148, 163, 184, 0.12);
    --answer-text: #e2e8f0;
    --answer-border: rgba(148, 163, 184, 0.22);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow: 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.5), 0 2px 4px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.6), 0 4px 6px -2px rgba(0,0,0,0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.7), 0 10px 10px -5px rgba(0,0,0,0.5);
  }
  
  [data-theme="dark"] .header {
    background: rgba(26, 29, 38, 0.9);
  }
  
  [data-theme="dark"] .card-thumb {
    background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
  }
  
  [data-theme="dark"] .reading-item {
    background: var(--surface-2);
  }
  
  [data-theme="dark"] .reading-header {
    background: var(--surface-2);
  }

  /* Auto dark mode based on system preference */
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #0f172a;
      --surface: #1e293b;
      --surface-2: #334155;
      --surface-3: #475569;
      --text: #f1f5f9;
      --text-2: #cbd5e1;
      --text-3: #94a3b8;
      --border: #334155;
      --border-2: #475569;
      --primary-bg: rgba(99, 102, 241, 0.2);
      --listening-bg: rgba(225, 29, 72, 0.2);
      --reading-bg: rgba(5, 150, 105, 0.2);
      --answer-bg: rgba(148, 163, 184, 0.12);
      --answer-text: #e2e8f0;
      --answer-border: rgba(148, 163, 184, 0.22);
      --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
      --shadow: 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
      --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.5), 0 2px 4px -1px rgba(0,0,0,0.4);
      --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.6), 0 4px 6px -2px rgba(0,0,0,0.5);
      --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.7), 0 10px 10px -5px rgba(0,0,0,0.5);
    }
    
    :root:not([data-theme="light"]) .header {
      background: rgba(26, 29, 38, 0.9);
    }
    
    :root:not([data-theme="light"]) .card-thumb {
      background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
    }

  }

  /* Compact density */
  [data-density="compact"] .list-toolbar {
    padding: 4px 8px;
    margin-bottom: 4px;
    gap: 6px;
  }

  [data-density="compact"] .reading-search .search-box,
  [data-density="compact"] .listening-toolbar .sort-btn {
    padding: 4px 8px;
  }

  [data-density="compact"] .reading-list {
    gap: 4px;
  }

  [data-density="compact"] .reading-item {
    border-radius: var(--r-sm);
  }

  [data-density="compact"] .reading-header {
    padding: 6px 8px;
    gap: 6px;
  }

  [data-density="compact"] .reading-meta {
    padding: 0 8px 4px 2px;
    margin-top: 0;
  }

  [data-density="compact"] .reading-title-line {
    font-size: 13px;
    line-height: 1.25;
  }

  [data-density="compact"] .reading-titles {
    gap: 1px;
  }

  [data-density="compact"] .reading-body {
    padding: 0 8px 6px;
  }

  [data-density="compact"] .reading-answers {
    gap: 2px;
  }

  [data-density="compact"] .answer-chip {
    padding: 3px 6px;
    font-size: 11px;
  }

  [data-density="compact"] .reading-extra {
    margin-top: 6px;
    padding: 6px 8px;
    font-size: 12px;
  }

  [data-density="compact"] .main:has(.listening-toolbar) {
    padding-left: 0;
    padding-right: 0;
  }

  [data-density="compact"] .listening-toolbar {
    margin-left: 0;
    margin-right: 0;
    padding-left: 10px;
    padding-right: 10px;
  }

  [data-density="compact"] .cards-grid--fit {
    gap: 0;
    margin-bottom: 0;
    width: 100%;
  }

  [data-density="compact"] .card {
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  [data-density="compact"] .card:hover {
    transform: none;
    box-shadow: none;
  }

  [data-density="compact"] .card-body {
    display: none !important;
  }

  [data-density="compact"] .cards-grid--fit .card-thumb {
    padding: 0;
    border-radius: 0;
    width: var(--card-w, 25vw);
    max-width: none;
  }

  [data-density="compact"] .cards-grid .card {
    min-height: 0 !important;
  }

  .listening-orient-btn {
    padding: 6px 8px;
    line-height: 0;
  }
  
  /* Scroll to top button */
.scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  z-index: 100;
}

.scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-top:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.scroll-top:active {
  transform: scale(0.95);
}

/* Better focus states */
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Improved card hover */
.card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.card:active {
  transform: scale(0.98);
}

/* Reading item animation */
.reading-item {
  transition: all 0.25s ease;
}

.reading-item:hover {
  background: var(--surface-2);
}

.reading-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.reading-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  padding: 0 10px 6px 2px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.reading-meta::-webkit-scrollbar {
  display: none;
}

.reading-meta-text {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}

.reading-header {
  flex: 1;
  min-width: 0;
}

.reading-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.reading-item.expanded .reading-body {
  max-height: 500px;
}

.reading-expand {
  transition: transform 0.25s ease;
}

.reading-item.expanded .reading-expand {
  transform: rotate(90deg);
}

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      transition-duration: 0.01ms !important;
    }
  }
  /* Mobile: sidebar becomes drawer */
  @media (max-width: 768px) {
    .header-inner {
      gap: 3px;
      min-height: 48px;
      padding: 4px 6px;
      padding-top: calc(4px + env(safe-area-inset-top));
      max-width: 100%;
    }

    .icon-btn {
      width: 32px;
      height: 32px;
      border-radius: var(--r-sm);
    }

    .header .icon-btn svg {
      width: 18px;
      height: 18px;
    }

    .logo {
      gap: 5px;
      font-size: 13px;
      letter-spacing: -0.4px;
    }

    .logo-icon {
      width: 28px;
      height: 28px;
      border-radius: var(--r-sm);
    }

    .logo-icon svg {
      width: 15px;
      height: 15px;
    }

    .header-spacer {
      flex: 1 1 0;
      min-width: 2px;
    }

    .sort-btn {
      padding: 5px 6px;
      min-width: 0;
      border-radius: var(--r-sm);
    }

    .sort-btn-text {
      font-size: 10px;
      letter-spacing: 0;
    }

    .app-body {
      flex-direction: column;
    }

    .sidebar {
      position: fixed;
      top: 0;
      left: 0;
      bottom: 0;
      width: min(320px, 85vw);
      height: 100dvh;
      z-index: 210;
      transform: translateX(-100%);
      transition: transform 0.3s var(--ease);
      box-shadow: var(--shadow-xl);
    }

    .sidebar.open {
      transform: translateX(0);
    }

    .sidebar-header {
      padding-top: env(safe-area-inset-top);
    }

    .app-main {
      width: 100%;
    }

    .header-spacer {
      display: block;
    }
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }

  .sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

