/* ── CSS Variables & App Shell ──────────────────────────── */
    :root {
      --blue: #4a90e2;
      --orange: #e07b00;
      --green: #2a7a2a;
      --nav-h: 64px;
      --header-h: 50px;
      --sidebar-w: 220px;
      --banner-h: 0px;
      --sab: env(safe-area-inset-bottom, 0px);
    }
    *, *::before, *::after { box-sizing: border-box; }
    #app-shell { height: 100dvh; overflow: hidden; overscroll-behavior: none; }
    #app-header {
      position: fixed; top: var(--banner-h); left: 0; right: 0;
      height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
      padding-top: env(safe-area-inset-top, 0px);
      background: var(--blue); color: #fff;
      display: flex; align-items: center; padding-right: 1rem; padding-left: 1rem; gap: 0.75rem;
      z-index: 500; box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    }
    #app-title { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.01em; flex: 1; }
    #header-user-name { font-size: 0.8rem; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
    .tab-content {
      display: none; position: fixed;
      top: calc(var(--banner-h) + var(--header-h) + env(safe-area-inset-top, 0px)); left: 0; right: 0;
      bottom: calc(var(--nav-h) + var(--sab));
      overflow-y: auto; overflow-x: hidden; padding: 1rem;
      -webkit-overflow-scrolling: touch;
      transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .tab-content.active { display: block; }
    #tab-nav {
      position: fixed; bottom: 0; left: 0; right: 0;
      height: calc(var(--nav-h) + var(--sab));
      padding-bottom: var(--sab);
      background: #fff; border-top: 1px solid #e0e0e0;
      display: flex; z-index: 400;
      transform: translateZ(0);
      transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    body.nav-hidden #tab-nav {
      transform: translateY(100%) !important;
    }
    body.nav-hidden .tab-content {
      bottom: 0;
    }
    @media (max-width: 767px) {
      body.nav-hidden #word-panel {
        bottom: 0;
      }
    }
    button, .tab-btn, .stat-item, .rm-btn {
      touch-action: manipulation;
      -webkit-tap-highlight-color: transparent;
    }
    .tab-btn {
      flex: 1; display: flex; flex-direction: column; align-items: center;
      justify-content: center; gap: 2px;
      background: none; border: none; cursor: pointer;
      color: #999; padding: 6px 0;
      transition: color 0.15s; min-height: 44px;
    }
    .tab-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .tab-btn span { font-size: 0.59rem; }
    .tab-btn.active { color: var(--blue); }
    /* Word manager in words tab – always open, non-collapsible feel */
    #tab-words > details[id="word-manager"] > summary {
      pointer-events: none; list-style: none; cursor: default;
      font-size: 1.05rem; font-weight: bold; color: #333;
      padding: 0 0 0.6rem; border-bottom: 1px solid #eee; margin-bottom: 0.5rem;
    }
    #tab-words > details[id="word-manager"] > summary::before,
    #tab-words > details[id="word-manager"] > summary::-webkit-details-marker { display: none; }
    /* Stats bar mobile: compact 4-column single row */
    @media (max-width: 767px) {
      #stats-bar {
        display: flex;
        flex-direction: row;
        gap: 0;
        padding: 0.25rem 0.3rem;
        margin-bottom: 0.6rem;
      }
      .stat-item {
        flex: 1;
        min-width: 0;
        padding: 0.15rem 0.05rem;
        border-radius: 3px;
      }
      .stat-value { font-size: 0.85rem; }
      .stat-label { font-size: 0.5em; }
    }
    /* Settings – user section */
    #settings-user-section { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #eee; }
    #settings-user-section h2 { font-size: 1rem; margin: 0 0 0.75rem; color: #333; }
    #settings-username-display { font-size: 0.85rem; color: #888; margin-bottom: 1rem; }
    .settings-btn {
      display: block; width: 100%; text-align: left;
      padding: 0.65rem 0.9rem; margin-bottom: 0.5rem;
      background: #f5f5f5; border: 1px solid #e0e0e0; border-radius: 8px;
      cursor: pointer; font-size: 0.9rem; color: #333;
    }
    .settings-btn:hover { background: #eaeaea; }
    .settings-btn.danger { color: #c00; border-color: #fcc; background: #fff5f5; }
    .settings-btn.danger:hover { background: #ffe0e0; }
    /* About tab */
    #tab-about { line-height: 1.7; }
    #tab-about h1 { font-size: 1.25rem; margin: 0 0 0.2rem; color: #222; }
    #tab-about .about-subtitle { font-size: 0.88rem; color: #999; margin: 0 0 1.5rem; }
    #tab-about h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.07em; color: #aaa; margin: 1.5rem 0 0.6rem; }
    .about-step {
      display: flex; gap: 0.75rem; align-items: flex-start;
      margin-bottom: 0.6rem; padding: 0.7rem 0.85rem;
      background: #f8f9fb; border-radius: 8px;
      border-left: 3px solid var(--blue);
    }
    .about-step-num { font-size: 1rem; font-weight: 700; color: var(--blue); flex-shrink: 0; min-width: 1.1rem; line-height: 1.6; }
    .about-step-body strong { display: block; font-size: 0.88rem; color: #222; margin-bottom: 0.1rem; }
    .about-step-body span { font-size: 0.82rem; color: #555; }
    .about-tip { background: #fffbe6; border: 1px solid #ffe58a; border-radius: 6px; padding: 0.55rem 0.85rem; margin-bottom: 0.5rem; font-size: 0.84rem; color: #7a5c00; }
    .about-nav-table { font-size: 0.87rem; color: #444; }
    .about-nav-table tr td:first-child { font-weight: 600; width: 5.5rem; color: #333; padding: 0.2rem 0; }
    .about-nav-table tr td:last-child { color: #666; }
    .about-footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #eee; font-size: 0.76rem; color: #ccc; text-align: center; }
    /* Desktop overrides */
    @media (min-width: 768px) {
      #app-header { left: var(--sidebar-w); }
      #tab-nav {
        top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); bottom: 0; left: 0; right: auto;
        width: var(--sidebar-w); height: auto; flex-direction: column;
        border-top: none; border-right: 1px solid #e0e0e0;
        padding-bottom: 0; background: #fafafa;
        align-items: stretch; padding-top: 0.5rem;
      }
      .tab-btn {
        flex: none; flex-direction: row; justify-content: flex-start;
        gap: 0.65rem; padding: 0.7rem 1rem; font-size: 0.88rem;
        border-radius: 6px; margin: 1px 6px; min-height: 42px;
      }
      .tab-btn svg { width: 18px; height: 18px; }
      .tab-btn span { font-size: 0.88rem; }
      .tab-content { left: var(--sidebar-w); bottom: 0; padding: 1.5rem 2rem; }
    }
    /* ── /App Shell ─────────────────────────────────────────── */
    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
      margin: 0;
      padding: 0;
      line-height: 1.6;
    }
    button {
      margin-right: 0.75rem;
      margin-bottom: 1rem;
      padding: 0.5rem 0.8rem;
      cursor: pointer;
    }
    #paragraph {
      border: 1px solid #ddd;
      padding: 1rem;
      min-height: 80px;
      border-radius: 8px;
      margin-top: 0.75rem;
      margin-bottom: 1rem;
    }
    .word {
      cursor: pointer;
      padding: 0;
      border-radius: 4px;
      user-select: none;
    }
    .word.selected {
      background: #ffe58a;
      position: relative;
    }
    .word.selected[data-reading]:hover::after {
      content: attr(data-reading);
      position: absolute;
      bottom: calc(100% + 4px);
      left: 50%;
      transform: translateX(-50%);
      background: #333;
      color: #fff;
      padding: 2px 7px;
      border-radius: 4px;
      font-size: 0.78em;
      white-space: nowrap;
      pointer-events: none;
      z-index: 10;
    }
    /* Ruby reading text */
    ruby.word { display: inline ruby; }
    ruby.word rt { font-size: 0; line-height: 0; color: #555; text-align: center; transition: font-size 0.1s; }
    ruby.word.selected rt { font-size: 0.55em; line-height: normal; }
    #paragraph.furigana-always { line-height: 2.2; }
    #paragraph.furigana-always ruby.word rt { font-size: 0.55em; line-height: normal; }
    /* Word states */
    .word.known-word { color: #1a7a1a; opacity: 0.75; }
    #paragraph.no-tint .word.known-word { color: inherit; opacity: 1; }
    .word.panel-active { outline: 2px solid #4a90e2; outline-offset: 1px; border-radius: 3px; }
    /* Word count badge */
    #word-count-badge {
      display: none;
      margin-left: 10px;
      padding: 2px 10px;
      border-radius: 12px;
      font-size: 0.85em;
      font-weight: 600;
      color: #1a7a1a;
      background: rgba(42, 154, 42, 0.12);
      box-shadow: 0 0 6px 1px rgba(42, 154, 42, 0.35);
      vertical-align: middle;
    }
    /* Display mode toggle bar */
    #reading-mode-bar { display: flex; align-items: center; gap: 0.4rem; margin: 0.5rem 0 0.75rem; flex-wrap: wrap; }
    .rm-label { font-size: 0.85em; color: #555; margin-right: 0.2rem; }
    .rm-btn { padding: 0.25rem 0.75rem; border: 1px solid #ccc; border-radius: 999px; background: #f5f5f5; color: #444; cursor: pointer; font-size: 0.85em; transition: background 0.15s, color 0.15s, border-color 0.15s; margin: 0; }
    .rm-btn:hover { background: #e8e8e8; }
    .rm-btn.active { background: #4a90e2; color: #fff; border-color: #4a90e2; }
    /* ── Study landing cards ─────────────────────────────── */
    #study-landing { display: flex; flex-direction: column; gap: 1rem; margin-top: 0.5rem; }
    .study-card { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; border: 1px solid #e0e0e0; border-radius: 12px; background: #fafafa; }
    .study-card-icon { width: 2rem; height: 2rem; flex-shrink: 0; color: #888; display: flex; align-items: center; justify-content: center; }
    .study-card-icon svg { width: 100%; height: 100%; display: block; }
    .study-card-body { flex: 1; min-width: 0; }
    .study-card-body h2 { margin: 0 0 0.2rem; font-size: 1rem; font-weight: 600; }
    .study-card-body p { margin: 0; font-size: 0.85em; color: #666; }
    .study-card-btn { flex-shrink: 0; padding: 0.45rem 1.1rem; border-radius: 8px; border: none; background: #4a90e2; color: #fff; font-size: 0.9em; font-weight: 500; cursor: pointer; }
    .study-card-btn:hover { background: #3a7bd5; }
    .study-btn { border-radius: 6px; padding: 0.5rem 1.1rem; font-size: 0.95rem; font-weight: 500; cursor: pointer; transition: background-color 0.25s ease, color 0.25s ease; border: none; margin-right: 0; margin-bottom: 0; }
    .study-btn-generate { background: #f5f5f5; color: #333; border: 1px solid #e0e0e0; }
    .study-btn-generate:hover { background: #e8e8e8; }
    .study-btn-generating { background: var(--orange); color: #fff; }
    .study-btn-clear { background: #9a2a2a; color: #fff; }
    .study-btn-clear:hover { background: #7a1a1a; }
    .study-btn-submit { background: var(--green); color: #fff; }
    .study-btn-submit:hover { background: #1e681e; }
    .study-section-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.1rem; }
    .study-back-btn { display: inline-flex; align-items: center; gap: 0.3rem; background: none; border: none; color: #4a90e2; font-size: 0.9em; cursor: pointer; padding: 0 0 0.75rem; }
    .study-back-btn:hover { text-decoration: underline; }
    .study-gear-btn { background: none; border: none; color: #aaa; cursor: pointer; padding: 0.5rem 0.4rem 0.5rem 0; margin: 0; transition: color 0.15s; display: flex; align-items: center; }
    .study-gear-btn svg { width: 1.1rem; height: 1.1rem; display: block; }
    .study-gear-btn:hover { color: #555; }
    .study-card-actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
    .study-card-actions button { margin: 0; }
    .study-gear-card { padding: 0.45rem 0.6rem; color: #aaa; display: flex; align-items: center; border: 1px solid #ccc; border-radius: 6px; }
    .study-gear-card svg { width: 1.15rem; height: 1.15rem; }
    .study-gear-card:hover { color: #555; border-color: #999; }

    /* ── Podcast player ──────────────────────────────────── */
    #podcast-player { display: flex; flex-direction: column; gap: 0.75rem; padding-bottom: 10rem; }
    #podcast-track-info { background: #f5f5f5; border-radius: 8px; padding: 0.75rem 1rem; }
    #podcast-track-num { font-size: 0.8em; color: #888; }
    #podcast-track-text { margin: 0.25rem 0 0; font-size: 1em; line-height: 1.6; }
    #podcast-playlist { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.5rem; }
    /* Fixed playbar */
    #podcast-playbar {
      position: fixed; bottom: var(--nav-h); left: 0; right: 0;
      background: #fff; border-top: 1px solid #e0e0e0;
      padding: 0.6rem 1rem 0.5rem;
      display: flex; flex-direction: column; gap: 0.3rem;
      z-index: 90;
      box-shadow: 0 -2px 8px rgba(0,0,0,0.07);
    }
    #podcast-progress-wrap { display: flex; flex-direction: column; gap: 0.15rem; }
    #podcast-seek { width: 100%; accent-color: #4a90e2; }
    #podcast-time { font-size: 0.78em; color: #888; text-align: right; }
    #podcast-controls { display: flex; justify-content: center; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
    #podcast-controls > button { font-size: 1.4rem; background: none; border: none; cursor: pointer; padding: 0.25rem 0.5rem; color: #333; margin: 0; }
    #podcast-controls > button:hover { color: #4a90e2; }
    #podcast-speed-wrap { display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
    #podcast-speed-btns { display: flex; gap: 0.25rem; }
    .speed-btn { padding: 0.35rem 0.65rem; border: 1px solid #ddd; border-radius: 999px; background: #f5f5f5; color: #555; font-size: 0.88em; cursor: pointer; margin: 0; }
    .speed-btn:hover { background: #e8e8e8; }
    .speed-btn.active { background: #4a90e2; color: #fff; border-color: #4a90e2; }
    #podcast-options-wrap { display: flex; align-items: center; justify-content: center; gap: 1rem; }
    .podcast-option-toggle { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85em; color: #555; cursor: pointer; user-select: none; }
    .podcast-option-toggle input { accent-color: #4a90e2; width: 15px; height: 15px; }
    @media (min-width: 768px) {
      #podcast-playbar { left: var(--sidebar-w); }
    }
    .podcast-playlist-item { padding: 0.5rem 0.75rem; border-radius: 6px; border: 1px solid #e8e8e8; font-size: 0.9em; cursor: pointer; background: #fff; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .podcast-playlist-item:hover { background: #f0f4ff; }
    .podcast-playlist-item.active { background: #e8f0fe; border-color: #4a90e2; font-weight: 500; }

    /* ── Reading section layout ───────────────────────────── */
    #reading-section { display: flex; flex-direction: column; }
    #reading-content-row { display: flex; align-items: flex-start; width: 100%; }
    #reading-main { flex: 1; min-width: 0; }

    /* ── Word panel — desktop sidebar ─────────────────────── */
    @media (min-width: 768px) {
      #word-panel { width: 0; flex-shrink: 0; overflow: hidden; opacity: 0; transition: width 0.25s ease, opacity 0.2s ease; }
      #word-panel.open { width: 270px; margin-left: 1.25rem; opacity: 1; }
      #wp-inner { width: 270px; border: 1px solid #e0e0e0; border-radius: 8px; background: #fafafa; padding: 1rem; overflow-y: auto; max-height: 80vh; position: sticky; top: 1rem; box-sizing: border-box; }
      #wp-backdrop { display: none !important; }
      #wp-close { display: none; }
    }

    /* ── Word panel — mobile bottom sheet ────────────────── */
    @media (max-width: 767px) {
      #word-panel { position: fixed; bottom: calc(var(--nav-h) + var(--sab)); left: 0; right: 0; background: #fff; border-radius: 16px 16px 0 0; box-shadow: 0 -4px 24px rgba(0,0,0,0.16); max-height: 55vh; transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.4,0,0.2,1); z-index: 901; }
      #word-panel.open { transform: translateY(0); }
      #wp-inner { overflow-y: auto; max-height: 55vh; padding: 1rem 1.25rem 1.5rem; -webkit-overflow-scrolling: touch; }
      #wp-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 900; }
      #wp-backdrop.visible { display: block; }
    }

    /* ── Word panel contents ──────────────────────────────── */
    #wp-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.4rem; }
    #wp-title { display: flex; align-items: baseline; gap: 0.45rem; flex-wrap: wrap; }
    #wp-surface { font-size: 1.55rem; font-weight: bold; color: #111; line-height: 1.2; }
    #wp-reading { font-size: 0.95rem; color: #666; }
    #wp-lemma { font-size: 0.82rem; color: #999; margin-top: 0.1rem; width: 100%; }
    #wp-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: #aaa; min-width: 36px; min-height: 36px; display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }
    #wp-close:hover { color: #333; }
    #wp-pos { font-size: 0.75em; color: #888; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.6rem; min-height: 1em; }
    #wp-jlpt { font-size: 0.85em; color: #fff; background: #777; border-radius: 3px; padding: 1px 5px; margin-left: 0.25rem; vertical-align: middle; text-transform: uppercase; letter-spacing: 0; }
    #wp-loading { color: #999; font-size: 0.88em; padding: 0.25rem 0; }
    #wp-error { color: #c00; font-size: 0.85em; margin-bottom: 0.5rem; }
    #wp-senses { margin: 0 0 0.5rem; padding-left: 1.2rem; font-size: 0.93rem; line-height: 1.65; color: #222; }
    #wp-senses li { margin-bottom: 0.15rem; }
    .wp-section-label { font-size: 0.7em; text-transform: uppercase; letter-spacing: 0.07em; color: #aaa; margin: 0.8rem 0 0.3rem; }
    #wp-context { font-size: 0.88rem; line-height: 1.65; color: #444; background: #f4f4f4; border-radius: 4px; padding: 0.4rem 0.6rem; }
    #wp-context mark { background: #ffe58a; border-radius: 2px; padding: 0 1px; font-style: normal; }
    #wp-custom-input { width: 100%; box-sizing: border-box; padding: 0.4rem 0.5rem; font-size: 0.88rem; border: 1px solid #ddd; border-radius: 4px; resize: vertical; font-family: inherit; margin-top: 0.2rem; }
    #wp-custom-save { margin-top: 0.35rem; padding: 0.3rem 0.75rem; font-size: 0.85em; cursor: pointer; border: 1px solid #4a90e2; border-radius: 4px; background: #4a90e2; color: #fff; }
    #wp-custom-save:hover { background: #357abd; border-color: #357abd; }
    #wp-custom-saved { font-size: 0.88rem; color: #444; background: #eef4ff; border-radius: 4px; padding: 0.3rem 0.5rem; margin-bottom: 0.3rem; white-space: pre-wrap; }
    #wp-kanji-wrap { margin-top: 0.6rem; }
    .wp-kanji-btn { width: 100%; padding: 0.3rem 0.5rem; font-size: 0.82em; cursor: pointer; border: 1px solid #ddd; border-radius: 4px; background: #f7f7f7; color: #555; text-align: left; }
    .wp-kanji-btn:hover { background: #eee; }
    #wp-kanji-cards { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
    .kanji-card { display: grid; grid-template-columns: 2.6rem 1fr; gap: 0.3rem 0.6rem; align-items: start; background: #fafafa; border: 1px solid #eee; border-radius: 6px; padding: 0.45rem 0.6rem; }
    .kanji-card-char { font-size: 2rem; line-height: 1; text-align: center; grid-row: span 2; align-self: center; color: #222; }
    .kanji-card-meanings { font-size: 0.88rem; color: #222; font-weight: 500; }
    .kanji-card-readings { font-size: 0.8rem; color: #666; }
    .kanji-card-meta { grid-column: 2; font-size: 0.75rem; color: #aaa; }
    #status {
      color: #333;
      margin-top: 0.5rem;
    }
    #word-manager {
      margin-top: 0;
      border-top: none;
      padding-top: 0;
    }
    #word-manager h2 {
      margin-bottom: 1rem;
    }
    #add-word-row {
      display: flex;
      gap: 0.5rem;
      margin-bottom: 1rem;
      align-items: center;
    }
    #add-word-row input {
      padding: 0.4rem 0.6rem;
      flex: 1;
      max-width: 300px;
    }
    #words-table {
      width: 100%;
      border-collapse: collapse;
      display: none;
    }
    details#word-manager[open] #words-table {
      display: table;
    }
    #words-table th, #words-table td {
      text-align: left;
      padding: 0.4rem 0.75rem;
      border-bottom: 1px solid #eee;
    }
    #words-table th {
      background: #f5f5f5;
    }
    #words-table th.sortable {
      cursor: pointer;
      user-select: none;
    }
    #words-table th.sortable:hover {
      background: #e8e8e8;
    }
    #word-search {
      padding: 0.4rem 0.6rem;
      border: 1px solid #ccc;
      border-radius: 4px;
    }
    .col-advanced { display: none; }
    #words-table.show-advanced .col-advanced { display: table-cell; }
    #word-pie-wrap {
      display: flex;
      align-items: center;
      gap: 1rem;
      margin: 0.5rem 0 0.75rem;
    }
    #word-pie-legend {
      display: flex;
      flex-direction: column;
      gap: 0.3rem;
      font-size: 0.85em;
    }
    .pie-legend-item {
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }
    .pie-swatch {
      width: 12px;
      height: 12px;
      border-radius: 2px;
      flex-shrink: 0;
    }
    #words-table button.word-actions-btn {
      padding: 0.15rem 0.5rem;
      background: none;
      border: 1px solid #ccc;
      border-radius: 4px;
      cursor: pointer;
      font-size: 1rem;
      color: #555;
    }
    .word-actions-menu {
      display: flex;
      flex-direction: column;
      gap: 0.3rem;
      margin-top: 0.3rem;
      min-width: 110px;
    }
    .word-actions-menu[hidden] { display: none; }
    .word-actions-menu button { margin: 0 !important; width: 100%; text-align: left; }
    #words-table button.remove-btn {
      padding: 0.25rem 0.6rem;
      margin: 0;
      color: #c00;
      background: none;
      border: 1px solid #c00;
      border-radius: 4px;
      cursor: pointer;
    }
    #words-table button.grade-wrong-btn {
      padding: 0.25rem 0.6rem;
      margin: 0 0 0 0.3rem;
      color: #b06000;
      background: none;
      border: 1px solid #b06000;
      border-radius: 4px;
      cursor: pointer;
    }
    #words-table button.grade-known-btn {
      padding: 0.25rem 0.6rem;
      margin: 0 0 0 0.3rem;
      color: #2a7a2a;
      background: none;
      border: 1px solid #2a7a2a;
      border-radius: 4px;
      cursor: pointer;
    }
    #word-manager-status {
      color: #555;
      font-size: 0.9em;
      margin-top: 0.5rem;
    }
    #import-words-section {
      margin: 0.75rem 0 0.25rem;
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
      align-items: center;
    }
    #import-words-section label {
      font-size: 0.85em;
      color: #555;
      font-weight: 600;
      white-space: nowrap;
    }
    #importFileInput { display: none; }
    .deck-btn {
      padding: 0.25rem 0.65rem;
      border: 1px solid #4a90e2;
      border-radius: 999px;
      background: #fff;
      color: #4a90e2;
      cursor: pointer;
      font-size: 0.85em;
      transition: background 0.15s, color 0.15s;
    }
    .deck-btn:hover { background: #4a90e2; color: #fff; }
    .deck-btn:disabled { opacity: 0.5; cursor: default; }
    .deck-badge {
      font-size: 0.72em;
      background: #3a3a5c;
      color: #9999bb;
      padding: 1px 5px;
      border-radius: 3px;
      margin-left: 5px;
      vertical-align: middle;
    }
    #words-table button.suspend-btn {
      padding: 0.25rem 0.6rem;
      margin: 0 0 0 0.3rem;
      color: #888;
      background: none;
      border: 1px solid #888;
      border-radius: 4px;
      cursor: pointer;
    }
    #words-table button.unsuspend-btn {
      padding: 0.25rem 0.6rem;
      margin: 0 0 0 0.3rem;
      color: #b8a000;
      background: none;
      border: 1px solid #b8a000;
      border-radius: 4px;
      cursor: pointer;
    }
    #words-table tr.suspended-row td { opacity: 0.6; }
    #words-table button.note-btn {
      padding: 0.25rem 0.6rem;
      margin: 0 0 0 0.3rem;
      color: #4a90e2;
      background: none;
      border: 1px solid #4a90e2;
      border-radius: 4px;
      cursor: pointer;
      font-size: 0.85em;
    }
    #words-table tr.note-edit-row td {
      background: #f8faff;
      padding: 0.5rem 0.75rem;
      border-top: none;
    }
    .note-edit-wrap { display: flex; gap: 0.5rem; align-items: flex-start; }
    .note-edit-wrap textarea {
      flex: 1; min-height: 3rem; padding: 0.35rem 0.5rem;
      border: 1px solid #ccc; border-radius: 4px; font-size: 0.9em;
      resize: vertical; font-family: inherit;
    }
    .note-edit-actions { display: flex; flex-direction: column; gap: 0.35rem; }
    .note-save-btn { padding: 0.3rem 0.75rem; background: #4a90e2; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 0.85em; }
    .note-save-btn:hover { background: #357abd; }
    .note-cancel-btn { padding: 0.3rem 0.75rem; background: none; color: #666; border: 1px solid #ccc; border-radius: 4px; cursor: pointer; font-size: 0.85em; }
    #deck-filter-wrap {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin: 0.4rem 0 0.2rem;
      font-size: 0.88em;
    }
    #deck-filter-wrap label { color: #555; font-weight: 600; }
    #deckFilter {
      padding: 0.2rem 0.4rem;
      border: 1px solid #ccc;
      border-radius: 4px;
      font-size: 0.88em;
      background: #fff;
    }
    #bulk-action-row {
      display: flex;
      gap: 0.5rem;
      align-items: center;
    }
    #reviews-table {
      width: 100%;
      border-collapse: collapse;
    }
    #reviews-table th, #reviews-table td {
      text-align: left;
      padding: 0.4rem 0.75rem;
      border-bottom: 1px solid #eee;
    }
    #reviews-table th {
      background: #f5f5f5;
    }
    .rating-1 { color: #c00; font-weight: bold; }
    .rating-3 { color: #080; font-weight: bold; }
    #llm-config {
      margin-bottom: 1.25rem;
    }
    #llm-config summary {
      cursor: pointer;
      font-weight: bold;
      color: #555;
      user-select: none;
      margin-bottom: 0.5rem;
    }
    #llm-config-fields {
      display: flex;
      flex-wrap: wrap;
      gap: 1rem;
      align-items: flex-end;
      margin-top: 0.75rem;
      padding: 0.75rem;
      background: #f9f9f9;
      border: 1px solid #e0e0e0;
      border-radius: 6px;
    }
    #llm-config-fields label {
      display: flex;
      flex-direction: column;
      font-size: 0.85em;
      color: #444;
      gap: 0.25rem;
    }
    #llm-config-fields select,
    #llm-config-fields input[type="number"] {
      padding: 0.3rem 0.5rem;
      border: 1px solid #ccc;
      border-radius: 4px;
      font-size: 0.9em;
    }
    #llm-config-fields .checkbox-label {
      flex-direction: row;
      align-items: center;
      gap: 0.4rem;
    }
    #stats-bar {
      display: flex;
      gap: 2rem;
      margin-bottom: 1.5rem;
      padding: 0.75rem 1.25rem;
      background: #f5f5f5;
      border: 1px solid #e0e0e0;
      border-radius: 8px;
      transition: gap 0.3s ease, padding 0.3s ease, margin-bottom 0.3s ease;
    }
    #stats-bar.compact {
      gap: 0.75rem;
      padding: 0.3rem 0.75rem;
      margin-bottom: 0.6rem;
    }
    #stats-bar.compact .stat-value { font-size: 1rem; line-height: 1.3; }
    #stats-bar.compact .stat-label { display: none; }
    .stat-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      min-width: 80px;
      cursor: pointer;
      border-radius: 6px;
      padding: 0.25rem 0.5rem;
      transition: background 0.15s;
    }
    @media (max-width: 767px) {
      .stat-item { min-width: 0; padding: 0.15rem 0.25rem; }
    }
    .stat-item:hover {
      background: #e8e8e8;
    }
    .stat-value {
      font-size: 1.6rem;
      font-weight: bold;
      color: #333;
      line-height: 1.2;
    }
    .stat-label {
      font-size: 0.75em;
      color: #666;
      text-align: center;
    }
    #fsrs-dashboard {
      margin-top: 0;
      border-top: none;
      padding-top: 0;
    }
    #fsrs-dashboard h2 {
      margin-bottom: 1rem;
    }
    #fsrs-top-row {
      display: flex;
      gap: 2rem;
      align-items: flex-start;
      flex-wrap: wrap;
      margin-bottom: 1.5rem;
    }
    #fsrs-meter-wrap {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.4rem;
    }
    #fsrs-meter-wrap svg {
      width: 110px;
      height: 110px;
    }
    #meter-label {
      font-size: 0.8em;
      color: #555;
      text-align: center;
    }
    #fsrs-right {
      display: flex;
      flex-direction: column;
      gap: 1rem;
      flex: 1;
      min-width: 200px;
    }
    #confidence-box {
      display: flex;
      align-items: center;
      gap: 0.6rem;
    }
    #confidence-badge {
      display: inline-block;
      padding: 0.25rem 0.75rem;
      border-radius: 12px;
      font-size: 0.85em;
      font-weight: bold;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }
    .conf-low  { background: #fde8e8; color: #c00; }
    .conf-medium { background: #fff3d6; color: #a05000; }
    .conf-high { background: #e3f5e1; color: #1a7a1a; }
    #fsrs-stats-summary {
      display: flex;
      gap: 1.5rem;
      flex-wrap: wrap;
    }
    .fsrs-stat {
      display: flex;
      flex-direction: column;
      align-items: center;
      min-width: 90px;
    }
    .fsrs-stat-value {
      font-size: 1.3rem;
      font-weight: bold;
      color: #333;
    }
    .fsrs-stat-label {
      font-size: 0.72em;
      color: #666;
      text-align: center;
    }
    #calibration-section h3 {
      font-size: 0.95em;
      color: #444;
      margin: 0 0 0.6rem;
    }
    .cal-row {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin-bottom: 0.35rem;
      font-size: 0.82em;
    }
    .cal-bin-label {
      width: 36px;
      color: #888;
      flex-shrink: 0;
      text-align: right;
    }
    .cal-bars {
      position: relative;
      width: 200px;
      height: 14px;
      background: #f0f0f0;
      border-radius: 3px;
      overflow: hidden;
      flex-shrink: 0;
    }
    .cal-bar-actual {
      position: absolute;
      left: 0;
      top: 0;
      height: 100%;
      background: #4a90e2;
      border-radius: 3px;
      transition: width 0.3s;
    }
    .cal-bar-predicted {
      position: absolute;
      top: 3px;
      height: 8px;
      width: 2px;
      background: #e07b00;
      border-radius: 1px;
    }
    .cal-counts {
      color: #aaa;
      flex-shrink: 0;
    }
    /* ── Tooltip ── */
    .tip {
      position: relative;
      cursor: help;
    }
    #fsrs-no-data {
      color: #999;
      font-size: 0.9em;
    }
    #sim-controls {
      display: flex;
      gap: 1rem;
      align-items: center;
      flex-wrap: wrap;
      margin-bottom: 0.75rem;
    }
    #sim-controls label {
      display: flex;
      align-items: center;
      gap: 0.3rem;
      font-size: 0.85em;
      color: #555;
    }
    #sim-controls input[type="number"] {
      width: 68px;
      padding: 0.3rem 0.4rem;
      border: 1px solid #ccc;
      border-radius: 4px;
    }
    #sim-status {
      font-size: 0.88em;
      color: #555;
      min-height: 1.2em;
    }
    #sim-chart {
      width: 100%;
      display: block;
      margin-top: 1rem;
      overflow: visible;
    }
    #tune-result {
      margin-top: 0.75rem;
      font-size: 0.88em;
      color: #333;
      padding: 0.5rem 0.75rem;
      background: #f9f9f9;
      border: 1px solid #e8e8e8;
      border-radius: 6px;
      display: none;
    }
    #sim-config-display {
      margin-top: 0.5rem;
      font-size: 0.8em;
      color: #888;
    }
    /* ── Advanced Settings outer collapsible ── */
    #advanced-settings {
      margin-top: 0;
    }
    #advanced-settings > summary {
      cursor: pointer;
      font-weight: bold;
      color: #333;
      user-select: none;
      padding: 0.5rem 0;
      border-top: none;
      list-style: none;
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }
    #advanced-settings > summary::before {
      content: "▶";
      font-size: 0.7em;
      color: #aaa;
      transition: transform 0.15s;
    }
    #advanced-settings[open] > summary::before {
      transform: rotate(90deg);
    }
    #advanced-settings > summary h2 {
      margin: 0;
      font-size: 1em;
      display: inline;
    }
    #advanced-settings-body {
      padding-top: 0.5rem;
    }
    /* ── Inner collapsibles ── */
    #fsrs-sim, #review-log {
      margin-top: 1rem;
    }
    #fsrs-sim > summary, #review-log > summary {
      cursor: pointer;
      font-weight: bold;
      color: #555;
      user-select: none;
      padding: 0.4rem 0;
      border-top: 1px solid #eee;
      list-style: none;
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }
    #fsrs-sim > summary::before, #review-log > summary::before {
      content: "▶";
      font-size: 0.65em;
      color: #bbb;
      transition: transform 0.15s;
    }
    #fsrs-sim[open] > summary::before, #review-log[open] > summary::before {
      transform: rotate(90deg);
    }
    #fsrs-sim > summary h3, #review-log > summary h3 {
      margin: 0;
      font-size: 0.95em;
      display: inline;
      font-weight: bold;
    }
    #fsrs-sim-body, #review-log-body {
      padding-top: 0.75rem;
    }
    /* ── FSRS tune row (dashboard) ── */
    #fsrs-tune-row {
      display: flex;
      align-items: center;
      gap: 1rem;
      margin-top: 1rem;
      flex-wrap: wrap;
    }
    #fsrs-last-tuned {
      font-size: 0.82em;
      color: #888;
    }
    #fsrs-auto-tune-notice {
      font-size: 0.82em;
      color: #e07b00;
      display: none;
    }
    /* ── Auth overlay ── */
    #auth-screen {
      position: fixed; inset: 0;
      background: rgba(0,0,0,0.55);
      display: flex; align-items: center; justify-content: center;
      z-index: 9999;
    }
    #auth-screen.hidden { display: none; }
    #auth-box {
      background: #fff; border-radius: 12px; padding: 2rem 2.5rem;
      width: 340px; box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    }
    #auth-box h2 { margin: 0 0 1.2rem; font-size: 1.3rem; }
    .auth-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.4rem; }
    .auth-tab {
      flex: 1; padding: 0.45rem; border: 1px solid #ddd; border-radius: 6px;
      background: #f5f5f5; cursor: pointer; font-size: 0.95rem;
    }
    .auth-tab.active { background: #333; color: #fff; border-color: #333; }
    .auth-form { display: none; flex-direction: column; gap: 0.7rem; }
    .auth-form.active { display: flex; }
    .auth-form input {
      padding: 0.5rem 0.75rem; border: 1px solid #ddd; border-radius: 6px;
      font-size: 0.95rem;
    }
    .auth-form button[type=submit] {
      padding: 0.55rem; background: #333; color: #fff; border: none;
      border-radius: 6px; cursor: pointer; font-size: 0.95rem; margin: 0;
    }
    .auth-form button[type=submit]:hover { background: #555; }
    #auth-error { color: #c00; font-size: 0.88rem; min-height: 1.2em; }
    .auth-link { background: none; border: none; color: #666; font-size: 0.82rem; cursor: pointer; text-decoration: underline; padding: 0; margin-top: -0.1rem; text-align: left; }
    .auth-link:hover { color: #333; }
    .auth-success { color: #2a9a2a; font-size: 0.88rem; margin: 0; }
    #user-bar { display: none; }
    /* ── Hamburger menu (hidden – navigation moved to tab bar) ── */
    #hamburger-btn, #hamburger-menu { display: none !important; }
    /* ── Profile / Admin modals ── */
    .modal-overlay {
      position: fixed; inset: 0;
      background: rgba(0,0,0,0.45);
      display: flex; align-items: center; justify-content: center;
      z-index: 9998;
    }
    .modal-overlay.hidden { display: none; }
    /* ── Toast notification ── */
    #toast {
      position: fixed; bottom: calc(var(--nav-h) + var(--sab) + 0.75rem); left: 50%; transform: translateX(-50%) translateY(2rem);
      background: #2e7d32; color: #fff; padding: 0.65rem 1.4rem;
      border-radius: 8px; font-size: 0.95rem; font-weight: 500;
      box-shadow: 0 4px 16px rgba(0,0,0,0.18);
      opacity: 0; transition: opacity 0.25s, transform 0.25s;
      pointer-events: none; z-index: 9999;
    }
    #toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
    .modal-box {
      background: #fff; border-radius: 12px; padding: 1.75rem 2rem;
      width: 420px; max-width: 92vw;
      box-shadow: 0 8px 32px rgba(0,0,0,0.16);
      max-height: 80vh; overflow-y: auto;
    }
    .modal-box h2 { margin: 0 0 1.2rem; font-size: 1.2rem; }
    .modal-close {
      float: right; background: none; border: none; font-size: 1.3rem;
      cursor: pointer; color: #999; margin: 0; padding: 0; line-height: 1;
    }
    .modal-close:hover { color: #333; }
    /* ── Onboarding modal ── */
    .onboarding-pref-section {
      border: 1px solid #eee; border-radius: 8px; padding: 0.75rem 0.9rem;
      margin-bottom: 0.7rem;
    }
    .onboarding-pref-header {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 0.3rem;
    }
    .onboarding-pref-title { font-weight: 600; font-size: 0.95rem; }
    .onboarding-pref-desc { font-size: 0.85rem; color: #666; margin: 0; }
    .onboarding-soon { opacity: 0.5; pointer-events: none; }
    .onboarding-soon-badge {
      font-size: 0.72rem; background: #eee; color: #888;
      border-radius: 10px; padding: 0.15rem 0.55rem;
    }
    /* ── Demo mode ── */
    #demo-banner {
      position: fixed; top: 0; left: 0; right: 0;
      height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
      padding-top: env(safe-area-inset-top, 0px);
      padding-left: 1rem; padding-right: 1rem;
      background: #7a3b00; color: #fff;
      display: flex; align-items: center; justify-content: center; gap: 1rem;
      font-size: 0.86rem; z-index: 500;
      box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    }
    #demo-banner.hidden { display: none; }
    #demo-banner button {
      padding: 0.22rem 0.7rem; background: #fff; color: #7a3b00;
      border: none; border-radius: 4px; cursor: pointer; font-size: 0.82rem;
      font-weight: 600; white-space: nowrap; flex-shrink: 0;
    }
    #demo-banner button:hover { background: #ffe0b2; }
    .profile-row {
      display: flex; gap: 0.5rem; align-items: center;
      margin-bottom: 0.6rem; font-size: 0.93rem;
    }
    .profile-label { color: #888; width: 70px; flex-shrink: 0; }
    .profile-value { color: #222; font-weight: 500; }
    .role-badge {
      display: inline-block; padding: 0.15rem 0.6rem;
      border-radius: 10px; font-size: 0.78rem; font-weight: bold;
      text-transform: uppercase; letter-spacing: 0.04em;
    }
    .role-user { background: #e8f0fe; color: #1a56db; }
    .role-admin { background: #fde8e8; color: #c00; }
    /* admin users table */
    #admin-users-table {
      width: 100%; border-collapse: collapse; margin-top: 0.75rem; font-size: 0.88rem;
    }
    #admin-users-table th, #admin-users-table td {
      text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid #eee;
    }
    #admin-users-table th { background: #f5f5f5; }
    .role-select { font-size: 0.85rem; padding: 0.2rem 0.4rem; border: 1px solid #ccc; border-radius: 4px; }
    #admin-status { font-size: 0.85rem; color: #555; margin-top: 0.5rem; min-height: 1.2em; }
/* ══════════════════════════════════════════════════════
   NEW STYLES: Config tab, FABs, hints, advanced toggle
   ══════════════════════════════════════════════════════ */

/* ── Config back button ───────────────────────────────── */
#config-back-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  color: var(--blue, #4a90e2);
  font-size: 1rem;
  padding: 0 0 1.1rem;
  cursor: pointer;
  font-weight: 500;
}
#config-back-btn:active { opacity: 0.6; }

/* ── Config settings list ─────────────────────────────── */
.settings-list {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e5e5ea;
  background: #fff;
}
.settings-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.85rem 1rem;
  background: #fff;
  border: none;
  border-bottom: 1px solid #e5e5ea;
  cursor: pointer;
  text-align: left;
  font-size: 1rem;
  color: #000;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
}
.settings-list-item:last-child { border-bottom: none; }
.settings-list-item:active { background: #f0f0f0; }
.sli-label { flex: 1; }
.sli-chevron { color: #c7c7cc; flex-shrink: 0; }
.config-page { display: none; }
.config-page.active { display: block; }
.config-subsection { border: 1px solid #e8e8e8; border-radius: 8px; margin-bottom: 0.75rem; }
.config-subsection-title { font-size: 0.85rem; font-weight: 600; color: #444; padding: 0.65rem 0.9rem; cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.config-subsection-title::-webkit-details-marker { display: none; }
.config-subsection-title::after { content: '›'; font-size: 1.1rem; color: #aaa; transition: transform 0.2s; }
.config-subsection[open] .config-subsection-title::after { transform: rotate(90deg); }
.config-subsection .config-row { padding: 0 0.9rem; }
.config-subsection .config-row:last-child { padding-bottom: 0.75rem; }
.config-page h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #aaa;
  margin: 0 0 1rem;
  font-weight: 600;
}

/* ── Config rows ──────────────────────────────────────── */
.config-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}
.config-row label {
  font-size: 0.9rem;
  color: #333;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
/* Labels wrapping a select or number input: disable label-text activation,
   keep only the actual control tappable */
.config-row label:has(select),
.config-row label:has(input[type="number"]),
.config-row label:has(input[type="text"]) {
  pointer-events: none;
}
.config-row label:has(select) select,
.config-row label:has(input[type="number"]) input,
.config-row label:has(input[type="text"]) input {
  pointer-events: auto;
}
.config-row select,
.config-row input[type="number"],
.config-row input[type="text"] {
  padding: 0.3rem 0.5rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.88rem;
  background: #fafafa;
}
.config-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); flex-shrink: 0; }

/* ── Hint / question-mark tooltips ───────────────────── */
.hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #dde8f8;
  color: #4a90e2;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: help;
  flex-shrink: 0;
  position: relative;
  vertical-align: middle;
}
/* Standalone hints (siblings of label) float right to avoid adjacent tap targets */
.config-row > .hint {
  margin-left: auto;
}

/* ── Advanced settings hidden state ──────────────────── */
.advanced-only { display: none; }
body.show-advanced .advanced-only { display: flex; }
body.show-advanced .advanced-only-block { display: block; }
.advanced-only-block { display: none; }

/* ── Advanced settings toggle row ────────────────────── */
#advanced-toggle-row {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #f8f8f8;
  border-radius: 8px;
  border: 1px solid #e8e8e8;
}
#advanced-toggle-row h3 {
  font-size: 0.85rem;
  color: #555;
  margin: 0 0 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
#advanced-toggle-row p {
  font-size: 0.78rem;
  color: #999;
  margin: 0 0 0.75rem;
  line-height: 1.5;
}
.toggle-switch-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: #555;
}
.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-track::before {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .toggle-track { background: var(--blue); }
.toggle-switch input:checked + .toggle-track::before { transform: translateX(18px); }

/* ── Profile fields in config tab ─────────────────────── */
#config-profile-fields {
  background: #f8f9fb;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.profile-field-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.3rem 0;
  font-size: 0.88rem;
}
.profile-field-row .pf-label { color: #999; width: 60px; flex-shrink: 0; }
.profile-field-row .pf-value { color: #333; font-weight: 500; }

/* ── Floating action buttons (FABs) ──────────────────── */
#quick-add-fab, #dict-fab {
  position: fixed;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(0,0,0,0.22);
  z-index: 450;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
  right: 1.25rem;
}
#quick-add-fab:hover, #dict-fab:hover {
  transform: scale(1.07);
  box-shadow: 0 5px 18px rgba(0,0,0,0.28);
}
#quick-add-fab {
  bottom: calc(var(--nav-h) + var(--sab) + 0.75rem);
  background: var(--blue);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
}
#quick-add-fab.hidden { opacity: 0; pointer-events: none; }
#dict-fab {
  bottom: calc(var(--nav-h) + var(--sab) + 0.75rem);
  background: var(--orange);
  color: #fff;
  opacity: 0;
  pointer-events: none;
}
#dict-fab.visible { opacity: 1; pointer-events: auto; }
#dict-fab svg { width: 24px; height: 24px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Desktop: hide FABs (word panel is sidebar, quick-add is in words tab) */
@media (min-width: 768px) and (pointer: fine) {
  #quick-add-fab, #dict-fab { display: none; }
}

/* ── Quick-add modal ──────────────────────────────────── */
#quick-add-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 9000;
  padding-bottom: calc(var(--nav-h) + var(--sab));
}
#quick-add-modal.hidden { display: none; }
#quick-add-box {
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 1.25rem 1.25rem 1.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.16);
}
#quick-add-box h3 { margin: 0 0 0.75rem; font-size: 1rem; color: #333; }
#quick-add-input-row {
  display: flex;
  gap: 0.5rem;
}
#quick-add-word-input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}
#quick-add-submit {
  padding: 0.55rem 1rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}
#quick-add-submit:hover { background: #357abd; }
#quick-add-status { font-size: 0.82rem; color: #666; margin-top: 0.5rem; min-height: 1.2em; }

/* ── Tune button standalone ───────────────────────────── */
#fsrs-tune-section { margin-top: 0.75rem; }
#tune-status { font-size: 0.85rem; color: #555; margin-top: 0.4rem; min-height: 1.2em; }

/* ── Stats tab extras (duplicated stat cards + pie) ────── */
#stats-tab-extras { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #eee; }
#stats-tab-extras h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.07em; color: #aaa; margin: 0 0 0.75rem; font-weight: 600; }
#stats-tab-extras #stats-bar-clone {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem 1rem;
  background: #f5f5f5;
  border-radius: 8px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
@media (max-width: 767px) {
  #stats-tab-extras #stats-bar-clone { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
}
#stats-tab-extras #stats-bar-clone .stat-item { min-width: unset; }

/* ── JLPT deck reveal ─────────────────────────────────── */
.deck-modal-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  width: 100%;
  text-align: left;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
  cursor: pointer;
  font-size: 0.9rem;
}
.deck-modal-btn:hover { background: #eef4fd; border-color: var(--blue); }
.deck-modal-btn strong { color: var(--blue); min-width: 2.5rem; }
.deck-modal-btn span { color: #888; font-size: 0.85rem; }
#show-jlpt-btn { margin-bottom: 0; }

/* ── Furigana setting in config ───────────────────────── */
.radio-group { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.radio-option {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: #444;
  cursor: pointer;
}
.radio-option input[type="radio"] { accent-color: var(--blue); }

/* ── About section in config ──────────────────────────── */
#config-about { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid #eee; }
#config-about h1 { font-size: 1.1rem; margin: 0 0 0.1rem; color: #222; }
#config-about .about-subtitle { font-size: 0.82rem; color: #999; margin: 0 0 1rem; }
#config-about h2 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em; color: #aaa; margin: 1rem 0 0.5rem; font-weight: 600; }
#config-page-about .about-body { font-size: 0.84rem; color: #444; margin: 0 0 0.6rem; line-height: 1.5; }
#config-page-about .about-list { font-size: 0.84rem; color: #444; margin: 0 0 0.6rem 1.2rem; padding: 0; line-height: 1.6; }
#config-page-about .about-sign { font-size: 0.82rem; color: #999; margin: 0.8rem 0 0; font-style: italic; }
