:root {
  color-scheme: dark;
  --bg: #050b0d;
  --surface: #0b1718;
  --surface-2: #102124;
  --ink: #f1fbf8;
  --muted: #92a9a5;
  --line: rgba(128, 244, 230, 0.2);
  --line-strong: rgba(111, 244, 226, 0.46);
  --accent: #2de0c2;
  --accent-strong: #8fffea;
  --blue: #1f9cff;
  --amber: #ffc857;
  --danger: #ff6f86;
  --success: #7cffb2;
  --shadow: rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(45, 224, 194, 0.15), transparent 30%),
    linear-gradient(225deg, rgba(31, 156, 255, 0.14), transparent 34%),
    linear-gradient(90deg, rgba(255, 200, 87, 0.06), transparent 42%),
    var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 32%),
    var(--bg);
  background-size: 42px 42px, 42px 42px, auto;
  font-family: "Aptos Display", "Segoe UI", "Noto Sans TC", -apple-system, BlinkMacSystemFont, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 0 42%, rgba(45, 224, 194, 0.08) 48%, transparent 55% 100%);
  mix-blend-mode: screen;
  opacity: 0.65;
}

body.nav-collapsed .side-nav {
  transform: translateX(-100%);
}

body.nav-collapsed .app-shell.with-sidebar {
  margin-left: auto;
  margin-right: auto;
  width: min(920px, 100%);
}

button,
input,
textarea {
  font: inherit;
}

button,
a,
.tool-button,
.secondary-button,
.primary-button,
.side-tab,
.history-item {
  -webkit-tap-highlight-color: rgba(32, 227, 178, 0.24);
}

button,
.tool-button,
.secondary-button,
.primary-button,
.side-tab,
.history-item,
.summary-nav a,
.replay-link,
.tool-link {
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease,
    box-shadow 120ms ease,
    color 120ms ease,
    opacity 120ms ease;
  touch-action: manipulation;
}

button:active,
.tool-button:active,
.secondary-button:active,
.primary-button:active,
.side-tab:active,
.history-item:active,
.summary-nav a:active,
.replay-link:active,
.tool-link:active {
  transform: translateY(1px) scale(0.98);
  opacity: 0.86;
}

button:disabled {
  cursor: progress;
  opacity: 0.58;
}

.app-shell {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
}

.app-shell.with-sidebar {
  margin-left: min(284px, 26vw);
  width: min(920px, calc(100% - min(284px, 26vw)));
}

body.edge-swipe-visual-active {
  overflow-x: hidden;
}

.edge-swipe-preview {
  position: fixed;
  inset: 0;
  z-index: 8;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.68;
  background: var(--bg);
}

.edge-swipe-preview-shell {
  max-height: 100vh;
  overflow: hidden;
  transform: translate3d(-18px, 0, 0) scale(0.985);
  transform-origin: left center;
}

.edge-swipe-surface {
  position: relative;
  z-index: 12;
  will-change: transform;
  touch-action: pan-y;
  filter: drop-shadow(-18px 0 34px rgba(0, 0, 0, 0.28));
  background: var(--bg);
}

.edge-swipe-surface.is-edge-swipe-settling {
  transition: transform 170ms cubic-bezier(0.2, 0.82, 0.2, 1);
}

.sidebar-toggle {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  z-index: 35;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-strong);
  background: rgba(9, 21, 22, 0.9);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.32);
}

.office-mode-toggle {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 64px;
  z-index: 35;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent-strong);
  background: rgba(9, 21, 22, 0.9);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  font-size: 12px;
  font-weight: 800;
}

.side-nav {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: min(284px, 82vw);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: max(68px, env(safe-area-inset-top) + 48px) 14px max(18px, env(safe-area-inset-bottom));
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(45, 224, 194, 0.12), transparent 28%),
    linear-gradient(140deg, rgba(31, 156, 255, 0.08), transparent 32%),
    rgba(4, 12, 13, 0.96);
  backdrop-filter: blur(20px);
  box-shadow: 20px 0 70px rgba(0, 0, 0, 0.38);
  transition: transform 180ms ease;
}

.side-brand {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(102, 255, 224, 0.45);
  border-radius: 8px;
  color: #06100e;
  background:
    linear-gradient(135deg, var(--accent), var(--blue)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent);
  font-size: 13px;
  font-weight: 900;
}

.side-brand strong,
.side-brand small {
  display: block;
}

.side-brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.side-menu {
  display: grid;
  align-content: start;
  gap: 8px;
}

.side-tab {
  width: 100%;
  display: grid;
  gap: 2px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.side-tab span {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.side-tab small {
  font-size: 12px;
}

.side-tab.is-active {
  border-color: rgba(102, 255, 224, 0.42);
  background: linear-gradient(135deg, rgba(45, 224, 194, 0.12), rgba(31, 156, 255, 0.06));
  box-shadow: inset 0 0 24px rgba(45, 224, 194, 0.08), 0 10px 30px rgba(0, 0, 0, 0.22);
}

.side-footer {
  display: grid;
  gap: 8px;
}

.tab-view {
  display: none;
}

.tab-view.is-active {
  display: block;
}

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

.empty-reader {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 18px;
}

.eyebrow,
.source,
.model-line,
.insight-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.05;
  text-shadow: 0 0 18px rgba(45, 224, 194, 0.28);
}

h2 {
  margin-bottom: 8px;
  font-size: 25px;
  line-height: 1.18;
}

h3 {
  margin-bottom: 10px;
  font-size: 18px;
  line-height: 1.25;
}

.tool-button,
.secondary-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(237, 248, 245, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.tool-button:hover,
.secondary-button:hover,
.side-tab:hover,
.history-item:hover,
.summary-nav a:hover,
.replay-link:hover,
.tool-link:hover {
  border-color: rgba(102, 255, 224, 0.52);
  background: rgba(32, 227, 178, 0.11);
  box-shadow: 0 0 0 1px rgba(102, 255, 224, 0.08), 0 12px 34px rgba(32, 227, 178, 0.08);
}

.primary-button:hover {
  box-shadow: 0 16px 40px rgba(29, 159, 240, 0.22), 0 0 0 1px rgba(102, 255, 224, 0.18);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}

.input-panel,
.summary-card,
.history-item,
.cache-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(241, 251, 248, 0.07), rgba(241, 251, 248, 0.026)),
    linear-gradient(135deg, rgba(45, 224, 194, 0.08), transparent 42%);
  box-shadow: 0 18px 50px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
}

.cache-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.pwa-panel {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(237, 248, 245, 0.035);
  font-size: 13px;
  line-height: 1.45;
}

.pwa-panel p {
  margin: 0;
}

.pwa-panel p[data-offline="true"] {
  color: var(--danger);
}

.cache-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
}

.cache-status {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.compact {
  min-height: 38px;
  padding: 0 11px;
  font-size: 13px;
}

.input-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.panel-head,
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-head {
  padding-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.panel-head strong {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 12px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.22);
  outline: none;
}

.mini-actions,
.voice-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.mini-button,
.sort-select {
  border: 1px solid rgba(61, 255, 215, 0.28);
  border-radius: 12px;
  background: rgba(16, 38, 34, 0.78);
  color: var(--text);
  font-weight: 800;
  padding: 10px 14px;
  min-height: 42px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.mini-button:active,
.tool-button:active,
.secondary-button:active,
.primary-button:active,
.side-tab:active,
.history-item:active {
  transform: translateY(1px) scale(0.985);
  filter: brightness(1.18);
}

.mini-button:focus-visible,
.sort-select:focus-visible {
  outline: 2px solid rgba(61, 255, 215, 0.9);
  outline-offset: 3px;
}

.settings-panel .sort-select,
.setting-field .sort-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.quick-links-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.quick-link-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(2, 18, 16, 0.38);
  max-width: 100%;
  box-sizing: border-box;
}

.quick-link-item strong,
.quick-link-item span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.quick-link-item span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

@media (max-width: 760px) {
  .quick-link-item {
    grid-template-columns: minmax(0, 1fr);
  }
}


.summary-section .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.section-speech-btn {
  background: rgba(45, 224, 194, 0.1);
  border: 1px solid rgba(45, 224, 194, 0.3);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 0.75em;
  white-space: nowrap;
  cursor: pointer;
  transition: all 120ms ease;
  touch-action: manipulation;
  flex-shrink: 0;
}
.section-speech-btn:hover {
  background: rgba(45, 224, 194, 0.2);
  border-color: var(--accent);
}
.section-speech-btn.is-speaking {
  background: rgba(45, 224, 194, 0.25);
  border-color: var(--accent-strong);
  color: var(--accent-strong);
  box-shadow: 0 0 8px rgba(45, 224, 194, 0.3);
}
.section-speech-btn.is-paused {
  border-color: var(--amber);
  color: var(--amber);
  background: rgba(255, 200, 87, 0.1);
}
.summary-section.is-speaking {
  border-left: 3px solid var(--accent-strong);
  padding-left: 12px;
  transition: border-color 200ms ease;
}

/* ===== Reading Progress Bar (Phase 3B) ===== */
.reading-progress-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 12px 0;
  background: rgba(16, 38, 34, 0.6);
  border: 1px solid rgba(61, 255, 215, 0.15);
  border-radius: 12px;
  font-size: 0.85em;
}
.reading-progress-info {
  color: var(--text-dim);
  font-weight: 600;
  min-width: 200px;
}
.reading-progress-fill {
  flex: 1;
  min-width: 80px;
  height: 6px;
  background: rgba(61, 255, 215, 0.1);
  border-radius: 3px;
  overflow: hidden;
}
.reading-progress-fill-inner {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 300ms ease;
}
.reading-progress-actions {
  display: flex;
  gap: 8px;
}
.reading-progress-actions .mini-button {
  font-size: 0.8em;
  padding: 6px 12px;
  min-height: 0;
}
.summary-section.section-done {
  opacity: 0.7;
}
.summary-section.section-done .section-header h3::after {
  content: " \u2713";
  color: var(--accent);
  font-size: 0.85em;
}
@media (max-width: 600px) {
  .reading-progress-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .reading-progress-info {
    min-width: 0;
    width: 100%;
  }
}

/* ===== Reading Progress Bar (Phase 3B) ===== */
.reading-progress-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 12px 0;
  background: rgba(16, 38, 34, 0.6);
  border: 1px solid rgba(61, 255, 215, 0.15);
  border-radius: 12px;
  font-size: 0.85em;
}
.reading-progress-info {
  color: var(--text-dim);
  font-weight: 600;
  min-width: 200px;
}
.reading-progress-fill {
  flex: 1;
  min-width: 80px;
  height: 6px;
  background: rgba(61, 255, 215, 0.1);
  border-radius: 3px;
  overflow: hidden;
}
.reading-progress-fill-inner {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 300ms ease;
}
.reading-progress-actions {
  display: flex;
  gap: 8px;
}
.reading-progress-actions .mini-button {
  font-size: 0.8em;
  padding: 6px 12px;
  min-height: 0;
}
.summary-section.section-done {
  opacity: 0.7;
}
.summary-section.section-done > .section-header h3::after {
  content: " \2713";
  color: var(--accent);
  font-size: 0.85em;
}
@media (max-width: 600px) {
  .reading-progress-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .reading-progress-info {
    min-width: 0;
    width: 100%;
  }
}
@media (max-width: 600px) {
  .section-speech-btn {
    font-size: 0.7em;
    padding: 2px 8px;
  }
}

/* Phase 3A: Persistent status banner */
.banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: 12px 48px 12px 20px;
  font-size: 0.95em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transform: translateY(-100%);
  transition: transform 300ms ease;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.banner.is-visible {
  transform: translateY(0);
}
.banner.info {
  background: #0b1718;
  border-bottom: 2px solid var(--accent);
  color: var(--accent);
}
.banner.success {
  background: #0b1a12;
  border-bottom: 2px solid var(--success);
  color: var(--success);
}
.banner.error {
  background: #1a0b0d;
  border-bottom: 2px solid var(--danger);
  color: var(--danger);
}
.banner-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.3em;
  cursor: pointer;
  opacity: 0.7;
  padding: 0 4px;
  line-height: 1;
}
.banner-close:hover { opacity: 1; }
.voice-panel {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(61, 255, 215, 0.2);
  background: rgba(8, 30, 26, 0.64);
  border-radius: 16px;
  padding: 14px;
  margin: 14px 0;
}

.voice-panel label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.voice-panel input[type="range"] {
  width: min(220px, 55vw);
}

.sort-select {
  width: auto;
  min-width: 142px;
}

input::placeholder,
textarea::placeholder {
  color: rgba(237, 248, 245, 0.36);
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(32, 227, 178, 0.16), 0 0 24px rgba(32, 227, 178, 0.12);
}

textarea {
  margin-top: 10px;
  resize: vertical;
}

.file-label {
  display: block;
  margin-top: 12px;
}

input[type="file"] {
  margin-top: 8px;
  padding: 10px;
}

summary {
  color: var(--accent);
  font-weight: 800;
}

.actions-row {
  display: grid;
  grid-template-columns: 1fr 86px;
  gap: 10px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  font-weight: 800;
}

.primary-button {
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, #17b99c, #1f9cff);
  box-shadow: 0 12px 30px rgba(25, 143, 223, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.7;
}

.status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.status[data-type="error"] {
  color: var(--danger);
}

.status[data-type="success"] {
  color: var(--success);
}

.login-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(16px);
}

.login-backdrop[hidden] {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(13, 27, 24, 0.98), rgba(7, 17, 15, 0.98));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.login-card h2 {
  margin-bottom: 0;
}

.login-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.check-row input {
  width: auto;
}

.danger-card {
  border-color: rgba(255, 111, 134, 0.35);
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.status[data-type="error"] {
  color: var(--danger);
}

.status[data-type="success"] {
  color: var(--success);
}

.summary-card {
  margin-top: 18px;
  padding: 20px;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

.summary-header {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 14px;
  align-items: start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  max-width: 100%;
  min-width: 0;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.article-meta span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(237, 248, 245, 0.04);
  font-size: 12px;
  font-weight: 800;
}

.summary-thumb {
  width: 112px;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  overflow: hidden;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-sizing: border-box;
}

.summary-title-block {
  min-width: 0;
}

.channel-name {
  color: var(--muted);
  font-size: 0.72em;
  font-weight: 700;
  white-space: nowrap;
}

.summary-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.action-toolbar {
  padding: 10px;
  border: 1px solid rgba(102, 255, 224, 0.16);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.learning-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.learning-actions .secondary-button {
  width: 100%;
  min-width: 0;
  padding-left: 10px;
  padding-right: 10px;
  white-space: normal;
}

@media (max-width: 420px) {
  .learning-actions {
    gap: 6px;
  }

  .learning-actions .secondary-button {
    font-size: 0.82rem;
    padding-left: 6px;
    padding-right: 6px;
    line-height: 1.2;
  }
}

.player-block {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.player-thumb {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  overflow: hidden;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-sizing: border-box;
}

.video-thumb-link {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #000;
}

.video-thumb-link img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  opacity: 0.86;
}

.play-badge {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 8px 11px;
  border-radius: 999px;
  color: #06100e;
  background: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.tool-link {
  width: fit-content;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.share-box {
  display: grid;
  gap: 9px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(32, 227, 178, 0.36);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(45, 224, 194, 0.1), rgba(31, 156, 255, 0.05));
}

.share-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(10px);
}

.share-modal {
  position: relative;
  width: min(560px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #182724;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

.share-close {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(237, 248, 245, 0.06);
  font-size: 34px;
  line-height: 1;
}

.share-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.share-preview-card {
  display: grid;
  gap: 8px;
  width: min(360px, 92%);
  margin: 10px auto;
  padding: 14px;
  border-radius: 8px;
  color: #1f2523;
  background: #fff;
  transform: rotate(-2deg);
  box-shadow: 14px 16px 0 rgba(255, 255, 255, 0.22);
}

.share-preview-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
}

.share-preview-card strong {
  color: #141917;
  font-size: 20px;
  line-height: 1.2;
}

.share-preview-card span,
.share-preview-card p {
  color: #66706c;
  line-height: 1.45;
}

.share-tabs {
  display: grid;
  gap: 10px;
}

.share-tabs .primary-button,
.share-tabs .secondary-button {
  width: 100%;
}

.share-box p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.share-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.share-input {
  min-width: 0;
}

.tool-button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.action-toolbar .tool-button {
  min-height: 42px;
  color: var(--ink);
}

.summary-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.section-jump-nav {
  padding-top: 4px;
}

.section-jump-nav::before {
  content: "\6587\7ae0\8df3\8f49";
  width: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-nav a {
  padding: 7px 10px;
  border: 1px solid rgba(32, 227, 178, 0.22);
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(32, 227, 178, 0.07);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.overall {
  margin: 18px 0 22px;
  font-size: 17px;
  line-height: 1.75;
}

.summary-section,
.insight {
  margin-top: 24px;
}

.bullet-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  line-height: 1.65;
}

.briefing-list {
  display: grid;
  gap: 12px;
}

.briefing-paragraph {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid rgba(32, 227, 178, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  line-height: 1.78;
}

.timestamp-list {
  display: grid;
  gap: 14px;
}

.timestamp-item {
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

.replay-list .timestamp-item {
  border-left-color: var(--blue);
}

.tools-list {
  display: grid;
  gap: 12px;
}

.tool-card {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid rgba(32, 227, 178, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.tool-card strong {
  color: var(--text);
}

.tool-card p {
  margin: 0;
}

.timestamp-title {
  margin-bottom: 4px;
  font-weight: 800;
}

.timestamp-detail,
.insight p {
  color: var(--muted);
  line-height: 1.7;
}

.summary-section p {
  color: var(--text);
  line-height: 1.7;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.tags span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(32, 227, 178, 0.08);
  font-size: 12px;
  font-weight: 800;
}

.history {
  margin-top: 24px;
}

.history-head {
  margin-bottom: 12px;
}

.history-head h2 {
  margin: 0;
}

.search-input {
  max-width: 190px;
  padding: 10px 11px;
  font-size: 14px;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

#historyView .history-head,
#favoritesView .history-head {
  justify-content: flex-end;
}

#historyView .history-actions,
#favoritesView .history-actions {
  width: 100%;
}

.history-list {
  display: grid;
  gap: 10px;
  max-width: 100%;
  min-width: 0;
}

.history-item {
  display: grid;
  grid-template-columns: auto 96px 1fr;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 12px;
  text-align: left;
  color: var(--ink);
  overflow: hidden;
}

.history-select {
  align-self: center;
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.history-item.is-favorite {
  border-color: rgba(32, 227, 178, 0.44);
}

.secondary-button[data-active="true"] {
  border-color: rgba(32, 227, 178, 0.55);
  color: var(--accent-strong);
}

.reading-mode .app-shell {
  max-width: 880px;
}

.reading-mode .input-panel,
.reading-mode .cache-panel,
.reading-mode .pwa-panel,
.reading-mode .history {
  display: none;
}

.reading-mode .summary-card {
  margin-top: 18px;
}

.history-thumb {
  width: 96px;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  overflow: hidden;
  display: block;
  border-radius: 8px;
  box-sizing: border-box;
}

.history-meta {
  display: grid;
  gap: 5px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.history-meta strong {
  line-height: 1.25;
  min-width: 0;
}

.history-meta span {
  color: var(--muted);
  font-size: 13px;
}

.folder-chip {
  width: fit-content;
  max-width: 100%;
  padding: 4px 9px;
  border: 1px solid rgba(61, 255, 215, 0.24);
  border-radius: 999px;
  color: var(--accent-strong) !important;
  background: rgba(32, 227, 178, 0.08);
  font-size: 12px !important;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.read-chip {
  border-color: rgba(104, 222, 255, 0.38);
  background: rgba(74, 196, 255, 0.11);
  color: #b8f4ff !important;
}

.unread-chip {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted) !important;
}

.folder-manager-panel {
  margin: 16px 0 22px;
}

.folder-manager-panel[hidden] {
  display: none;
}

.folder-manager-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  background: linear-gradient(145deg, rgba(10, 35, 30, 0.94), rgba(6, 20, 18, 0.9));
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  max-width: 100%;
  box-sizing: border-box;
}

.folder-manager-head,
.folder-manager-create,
.folder-manager-row,
.folder-manager-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.folder-manager-actions .compact {
  flex: 0 1 auto;
  padding: 0 10px;
}

.folder-manager-actions {
  justify-content: flex-end;
  flex: 1 1 260px;
}

.folder-manager-head {
  justify-content: space-between;
}

.folder-manager-head h2 {
  margin: 0;
}

.folder-manager-create .search-input {
  max-width: none;
  flex: 1 1 240px;
}

.folder-manager-list {
  display: grid;
  gap: 8px;
}

.folder-manager-row {
  justify-content: space-between;
  padding: 10px;
  border: 1px solid rgba(61, 255, 215, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.folder-manager-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.folder-manager-title strong,
.folder-manager-title span {
  overflow-wrap: anywhere;
}

.danger-button {
  border-color: rgba(255, 119, 119, 0.32);
  color: #ffb5b5;
}

@media (max-width: 420px) {
  h1 {
    font-size: 31px;
  }

  h2 {
    font-size: 23px;
  }

  .summary-card {
    padding: 16px;
  }

  .summary-header {
    grid-template-columns: 1fr;
  }

  .summary-thumb {
    width: 100%;
  }

  .history-item {
    grid-template-columns: auto minmax(0, 86px) minmax(0, 1fr);
    gap: 10px;
  }

  .history-thumb {
    width: 86px;
  }
}

@media (max-width: 760px) {
  body.nav-collapsed .side-nav {
    transform: translateX(-100%);
  }

  body:not(.nav-collapsed)::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(0, 0, 0, 0.36);
  }

  .app-shell.with-sidebar {
    width: min(760px, 100%);
    margin: 0 auto;
    padding-top: max(68px, env(safe-area-inset-top) + 48px);
  }

  .side-nav {
    width: min(300px, 86vw);
  }

  .topbar {
    padding-left: 44px;
  }

  .action-toolbar .tool-button {
    flex: 1 1 calc(50% - 8px);
  }
}

@media (min-width: 761px) {
  .sidebar-toggle {
    left: 16px;
  }
}


.reading-mode .side-nav,
.reading-mode .sidebar-toggle,
.reading-mode .topbar,
.reading-mode #workspaceView,
.reading-mode #historyView,
.reading-mode #favoritesView,
.reading-mode #settingsView {
  display: none;
}

.reading-mode .app-shell.with-sidebar {
  width: min(840px, 100%);
  margin: 0 auto;
  padding-top: max(18px, env(safe-area-inset-top));
}

.reading-mode .summary-card {
  border-color: rgba(102, 255, 224, 0.42);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(102, 255, 224, 0.12);
}

.tool-button[data-active="true"] {
  color: #06100e;
  background: linear-gradient(135deg, var(--accent), var(--blue));
}

.settings-dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.stat-card {
  min-height: 92px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(32, 227, 178, 0.08), rgba(237, 248, 245, 0.025));
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.stat-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stat-card strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
}

@media (max-width: 760px) {
  .settings-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card strong {
    font-size: 17px;
  }
}

.token-panel {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 200, 87, 0.22);
  border-radius: 8px;
  color: var(--muted);
  background: linear-gradient(135deg, rgba(255, 200, 87, 0.08), rgba(31, 156, 255, 0.04));
}

.token-panel strong {
  color: var(--ink);
}

.token-panel small {
  color: rgba(241, 251, 248, 0.58);
  line-height: 1.45;
}

.replay-link {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(31, 156, 255, 0.34);
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(31, 156, 255, 0.08);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 60;
  max-width: min(420px, calc(100% - 32px));
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(10, 24, 25, 0.95);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.42);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}

.toast.is-visible,
.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.toast[data-type="success"],
.toast.success {
  border-color: rgba(124, 255, 178, 0.42);
}

.toast[data-type="error"],
.toast.error {
  border-color: rgba(255, 111, 134, 0.5);
}

button,
.tool-button,
.mini-button,
.secondary-button,
.primary-button,
.share-link {
  touch-action: manipulation;
  transition: transform 120ms ease, border-color 120ms ease, filter 120ms ease, background 120ms ease;
}

button:active,
.tool-button:active,
.mini-button:active,
.secondary-button:active,
.primary-button:active,
.share-link:active {
  transform: translateY(1px) scale(0.985);
  filter: brightness(1.12);
}

.batch-panel,
.channel-import-panel,
.speech-picker,
.qa-panel,
.failure-log-list,
.queue-list {
  display: grid;
  gap: 10px;
}

.workflow-block {
  display: grid;
  gap: 10px;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 12px 0;
}

.workflow-disclosure {
  border-top: 1px solid rgba(61, 255, 215, 0.14);
}

.workflow-disclosure:first-of-type {
  border-top: 0;
}

.workflow-disclosure > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  color: var(--accent-strong);
  font-weight: 900;
  font-size: clamp(20px, 5vw, 28px);
  overflow-wrap: anywhere;
}

.workflow-disclosure > summary::-webkit-details-marker {
  display: none;
}

.workflow-disclosure > summary::after {
  content: "展開";
  flex-shrink: 0;
  border: 1px solid rgba(61, 255, 215, 0.28);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.workflow-disclosure[open] > summary::after {
  content: "收起";
  color: var(--accent);
}

.workflow-block + .workflow-block,
.workflow-block + .channel-import-panel,
.channel-import-panel + .workflow-block {
  border-top: 1px solid rgba(61, 255, 215, 0.14);
  margin-top: 8px;
}

.workflow-block h3 {
  margin: 0;
  color: var(--accent-strong);
  font-size: clamp(18px, 4vw, 23px);
  overflow-wrap: anywhere;
}

.progress-panel {
  border-top: 1px solid rgba(61, 255, 215, 0.14);
  margin-top: 8px;
  padding-top: 14px;
}

.progress-panel-head {
  display: grid;
  gap: 4px;
}

.progress-panel-head span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.queue-list-standalone {
  max-width: 100%;
  min-width: 0;
}

.single-video-actions .mini-button {
  min-width: min(180px, 100%);
}

.manual-transcript-panel {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(61, 255, 215, 0.12);
}

.manual-transcript-panel > summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 900;
  list-style: none;
}

.manual-transcript-panel > summary::-webkit-details-marker {
  display: none;
}

.channel-import-panel h3 {
  margin: 0;
  color: var(--accent-strong);
  font-size: clamp(16px, 4vw, 20px);
}

.quick-link-panel .setting-field {
  max-width: 100%;
  min-width: 0;
}

.quick-link-panel input,
.quick-link-panel .search-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.batch-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.folder-picker {
  display: grid;
  gap: 8px;
  margin: 12px 0 6px;
}

.folder-picker-row {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  max-width: 100%;
}

.folder-select,
.folder-custom-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.channel-import-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(61, 255, 215, 0.18);
  border-radius: 8px;
  background: rgba(8, 28, 24, 0.42);
}

.channel-import-panel summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 800;
}

.playlist-range-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 520px;
}

.playlist-range-controls label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-weight: 700;
}

.playlist-range-controls input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.batch-panel textarea,
.qa-panel textarea {
  width: 100%;
  resize: vertical;
}

.channel-video-list {
  display: grid;
  gap: 10px;
  max-width: 100%;
}

.channel-import-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
  max-width: 100%;
}

.channel-selection-count {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 800;
}

.channel-import-actions .mini-button {
  width: 100%;
  min-width: 0;
  white-space: normal;
}

.channel-import-actions .primary-mini {
  border-color: rgba(61, 255, 215, 0.42);
  color: var(--accent-strong);
}

.channel-import-actions .mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.channel-video-item {
  display: grid;
  grid-template-columns: auto minmax(78px, 110px) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  box-sizing: border-box;
}

.channel-video-item img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.channel-video-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.channel-video-text strong,
.channel-video-text small {
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  .playlist-range-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 100%;
  }

  .channel-import-actions {
    grid-template-columns: 1fr;
  }

  .channel-video-item {
    grid-template-columns: auto minmax(74px, 96px) minmax(0, 1fr);
  }

  .folder-picker-row {
    grid-template-columns: 1fr;
  }
}

.queue-item,
.log-item,
.qa-answer,
.tool-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.queue-item {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.queue-item span {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--muted);
  min-width: 0;
}

.queue-item strong {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: right;
}

.queue-warning {
  border-color: rgba(255, 184, 77, 0.45);
}

.queue-retry-button {
  justify-self: end;
  min-height: 38px;
  padding: 8px 12px;
  white-space: nowrap;
}

.queue-item strong,
.log-item strong,
.qa-answer strong {
  color: var(--accent);
}

@media (max-width: 620px) {
  .queue-list {
    max-width: 100%;
    min-width: 0;
  }

  .queue-item {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
  }

  .queue-item strong {
    justify-self: start;
    text-align: left;
    line-height: 1.35;
  }

  .queue-retry-button {
    justify-self: stretch;
    width: 100%;
  }
}

.speech-section-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.speech-progress {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.speech-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.speech-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  transition: width 180ms ease;
}

.summary-section.is-speaking {
  border-color: rgba(45, 224, 194, 0.62);
  box-shadow: 0 0 0 1px rgba(45, 224, 194, 0.18), 0 18px 55px rgba(45, 224, 194, 0.08);
}

.summary-section.section-done .section-title-row h3::after {
  content: " 已讀";
  margin-left: 8px;
  color: var(--accent);
  font-size: 12px;
}

.qa-panel {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(45, 224, 194, 0.08), rgba(255, 255, 255, 0.025));
}

.video-analysis-result {
  margin-top: 16px;
}

.video-analysis-grid {
  display: grid;
  gap: 12px;
}

.video-analysis-field {
  padding: 14px;
  border: 1px solid rgba(125, 243, 217, 0.25);
  border-radius: 10px;
  background: rgba(5, 27, 23, 0.46);
}

.video-analysis-label {
  display: block;
  margin-bottom: 7px;
  color: var(--accent);
}

.video-analysis-field p {
  margin: 0;
  line-height: 1.65;
  white-space: pre-wrap;
}

.video-analysis-field p + p {
  margin-top: 8px;
}

.video-analysis-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  line-height: 1.65;
}

.tools-list {
  display: grid;
  gap: 10px;
}

.tool-link {
  color: var(--accent-strong);
}

.log-item small {
  color: var(--muted);
}

.share-page .side-nav,
.share-page .sidebar-toggle,
.share-page .topbar {
  display: none;
}

.share-page .app-shell.with-sidebar {
  width: min(860px, 100%);
  margin: 0 auto;
  padding-top: max(18px, env(safe-area-inset-top));
}

.share-page #workspaceView,
.share-page #historyView,
.share-page #favoritesView,
.share-page #settingsView {
  display: none;
}

.share-page #readerView {
  display: block;
}

.reader-navigation-controls {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 86px);
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(3, 46px);
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.reader-navigation-controls.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.reader-nav-button,
.scroll-top-button {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(45, 224, 194, 0.92), rgba(31, 156, 231, 0.92));
  color: #03120f;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 14px 36px rgba(31, 156, 231, 0.22);
  transition: filter 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.reader-nav-button:disabled {
  cursor: not-allowed;
  opacity: 0.28;
  filter: grayscale(0.4);
}

.reader-nav-button:active:not(:disabled),
.scroll-top-button:active {
  filter: brightness(1.16);
  transform: translateY(1px) scale(0.98);
}

@media (min-width: 761px) {
  .reader-navigation-controls {
    right: 24px;
    bottom: 24px;
  }
}

@media (min-width: 761px) {
  body.office-mode {
    --bg: #fff;
    --surface: #fff;
    --surface-2: #fff;
    --ink: #1f2937;
    --muted: #4b5563;
    --line: #d1d5db;
    --line-strong: #9ca3af;
    color-scheme: light;
    color: #1f2937;
    background: #fff;
    font-family: Aptos, Calibri, "Noto Sans TC", sans-serif;
  }

  body.office-mode::before,
  body.office-mode .topbar,
  body.office-mode .player-block,
  body.office-mode .summary-thumb {
    display: none;
  }

  body.office-mode .sidebar-toggle {
    display: grid;
    place-items: center;
    top: 12px;
    left: 12px;
    width: 34px;
    height: 34px;
    color: #374151;
    background: #fff;
    border-color: #d1d5db;
    border-radius: 4px;
    box-shadow: none;
  }

  body.office-mode .office-mode-toggle {
    top: 12px;
    left: 54px;
    min-height: 34px;
    color: #374151;
    background: #fff;
    border-color: #d1d5db;
    border-radius: 4px;
    box-shadow: none;
  }

  body.office-mode .side-nav {
    display: grid;
    grid-template-rows: 1fr auto;
    transform: translateX(-100%);
    color: #1f2937;
    background: #fff;
    border-color: #d1d5db;
    box-shadow: 8px 0 24px rgba(31, 41, 55, 0.12);
    backdrop-filter: none;
  }

  body.office-mode:not(.nav-collapsed) .side-nav {
    transform: translateX(0);
  }

  body.office-mode .side-brand,
  body.office-mode .history-thumb {
    display: none;
  }

  body.office-mode .history-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  body.office-mode .folder-chip,
  body.office-mode .read-chip,
  body.office-mode .unread-chip {
    padding: 0;
    color: #1f2937 !important;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 13px !important;
    font-weight: 600;
  }

  body.office-mode .app-shell.with-sidebar {
    width: min(940px, 100%);
    margin: 0 auto;
    padding: 48px 56px 80px;
  }

  body.office-mode .summary-card,
  body.office-mode .summary-section,
  body.office-mode .analysis-panel,
  body.office-mode .qa-panel {
    color: #1f2937;
    background: #fff;
    border-color: #d1d5db;
    box-shadow: none;
  }

  body.office-mode .summary-header {
    display: block;
    border-color: #d1d5db;
  }

  body.office-mode .source,
  body.office-mode .model-line,
  body.office-mode .summary-section p,
  body.office-mode .briefing-paragraph,
  body.office-mode .summary-section li {
    color: #1f2937;
  }

  body.office-mode .action-toolbar,
  body.office-mode .summary-nav,
  body.office-mode .article-meta span {
    background: #f9fafb;
    border-color: #d1d5db;
    box-shadow: none;
  }

  body.office-mode .tool-button,
  body.office-mode .summary-nav a,
  body.office-mode .replay-link,
  body.office-mode .tool-link {
    color: #1f2937;
    background: #fff;
    border-color: #9ca3af;
    box-shadow: none;
  }

  body.office-mode .section-speech-btn {
    min-height: auto;
    padding: 0;
    color: #4b5563;
    background: transparent;
    border: 0;
    border-bottom: 1px solid #9ca3af;
    border-radius: 0;
    box-shadow: none;
    font-size: 12px;
    font-weight: 600;
  }

  body.office-mode .section-speech-btn:hover,
  body.office-mode .section-speech-btn.is-speaking,
  body.office-mode .section-speech-btn.is-paused {
    color: #111827;
    background: transparent;
    border-bottom-color: #374151;
    box-shadow: none;
  }

  body.office-mode .reader-navigation-controls {
    right: 24px;
    bottom: 24px;
  }

  body.office-mode .reader-nav-button,
  body.office-mode .scroll-top-button {
    color: #374151;
    background: #fff;
    border-color: #9ca3af;
    box-shadow: none;
  }
}
