/* ==========================================================================
   Design Tokens & CSS Variables
   ========================================================================== */

:root {
  /* Dark Theme (Default for Auditorium & Conference Halls) */
  --bg-app: #080c14;
  --bg-shell: #0e1422;
  --bg-card: #151d2f;
  --bg-card-subtle: #1a243a;
  --bg-hover: #222f4c;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-highlight: rgba(56, 189, 248, 0.4);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-on-accent: #0f172a;

  /* Accent Colors */
  --accent-cyan: #38bdf8;
  --accent-cyan-dim: rgba(56, 189, 248, 0.14);
  --accent-emerald: #34d399;
  --accent-emerald-dim: rgba(52, 211, 153, 0.14);
  --accent-amber: #fbbf24;
  --accent-amber-dim: rgba(251, 191, 36, 0.14);
  --accent-indigo: #818cf8;
  --accent-indigo-dim: rgba(129, 140, 248, 0.14);

  --media-bg: #05080f;

  /* Sizing & Geometry */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --header-height: 64px;
  --bottom-bar-height: 76px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body.theme-light {
  --bg-app: #e2e8f0;
  --bg-shell: #ffffff;
  --bg-card: #f8fafc;
  --bg-card-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;
  
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-medium: rgba(15, 23, 42, 0.16);
  --border-highlight: rgba(2, 132, 199, 0.4);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-on-accent: #ffffff;

  --accent-cyan: #0284c7;
  --accent-cyan-dim: rgba(2, 132, 199, 0.1);
  --accent-emerald: #059669;
  --accent-emerald-dim: rgba(5, 150, 105, 0.1);
  --accent-amber: #d97706;
  --accent-amber-dim: rgba(217, 119, 6, 0.1);
  --accent-indigo: #4f46e5;
  --accent-indigo-dim: rgba(79, 70, 229, 0.1);

  --media-bg: #e2e8f0;
}

/* ==========================================================================
   Base Styles & Reset
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ==========================================================================
   Responsive App Shell
   ========================================================================== */

.app-shell {
  width: 100%;
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  background-color: var(--bg-shell);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

@media (min-width: 768px) {
  .app-shell {
    width: 96vw;
    max-width: 1360px;
    height: 94vh;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-lg);
  }
}

/* ==========================================================================
   App Header
   ========================================================================== */

.app-header {
  height: var(--header-height);
  padding: 10px 16px;
  background: var(--bg-shell);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 20;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .app-header {
    padding: 12px 24px;
    height: 70px;
  }
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.live-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-dot {
  width: 7px;
  height: 7px;
  background-color: #ef4444;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.live-text {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.talk-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 768px) {
  .talk-title {
    font-size: 1.05rem;
  }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-icon-btn {
  height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
}

.header-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.header-icon-btn.active {
  background: var(--accent-cyan-dim);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.header-icon-btn.highlight {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.btn-label-desktop {
  display: none;
}

@media (min-width: 768px) {
  .btn-label-desktop {
    display: inline-block;
  }
  .header-icon-btn {
    padding: 0 14px;
  }
}

.lang-icon {
  font-size: 0.95rem;
}

/* Theme Icon Switch */
body.theme-dark .icon-moon { display: none; }
body.theme-dark .icon-sun { display: block; }
body.theme-light .icon-moon { display: block; }
body.theme-light .icon-sun { display: none; }

/* Progress Bar */
.progress-container {
  height: 3px;
  background: var(--bg-card);
  width: 100%;
  flex-shrink: 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-cyan);
  width: 1%;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Deck Main Area (Mobile 1-Column / Desktop 2-Column)
   ========================================================================== */

.deck-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  padding-bottom: calc(var(--bottom-bar-height) + var(--safe-bottom) + 16px);
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .deck-main {
    padding: 24px;
    padding-bottom: calc(var(--bottom-bar-height) + 24px);
  }
}

.slide-card-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeInSlide 0.2s ease-out;
  max-width: 480px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .slide-card-container {
    max-width: 100%;
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 24px;
    align-items: start;
  }
}

@media (min-width: 1100px) {
  .slide-card-container {
    grid-template-columns: 1.35fr 1fr;
    gap: 32px;
  }
}

@keyframes fadeInSlide {
  from {
    opacity: 0.35;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Left Column (Image + Desktop Controls) */
.slide-left-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 768px) {
  .slide-left-column {
    position: sticky;
    top: 0;
  }
}

/* Slide Media Box */
.slide-media-box {
  position: relative;
  background: var(--media-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .slide-media-box {
    box-shadow: var(--shadow-md);
  }
}

.slide-main-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity 0.15s ease;
  cursor: zoom-in;
}

.image-loading-spinner {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border-medium);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.slide-media-box.loading .image-loading-spinner {
  display: block;
}

.slide-media-box.loading .slide-main-image {
  opacity: 0.3;
}

.slide-media-badge-bar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 2;
}

.slide-badge-num {
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-mono);
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  color: #ffffff;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.slide-badge-topic {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  color: var(--accent-indigo);
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.15);
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expand-img-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xs);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: all 0.15s ease;
}

.expand-img-btn:hover {
  background: rgba(0, 0, 0, 0.95);
  transform: scale(1.08);
}

/* Desktop Sub Controls below Image */
.desktop-sub-controls {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  color: var(--text-muted);
  font-size: 0.76rem;
}

@media (min-width: 768px) {
  .desktop-sub-controls {
    display: flex;
  }
}

.keyboard-hints kbd {
  font-family: var(--font-mono);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.jump-indicator-text {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Right Column (Info & Translation Content) */
.slide-right-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (min-width: 768px) {
  .slide-right-column {
    gap: 16px;
  }
}

.jp-title-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
}

.jp-badge {
  font-size: 0.65rem;
  font-weight: 800;
  background: var(--bg-card);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.jp-title-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slide-en-title {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

@media (min-width: 768px) {
  .slide-en-title {
    font-size: 1.45rem;
  }
}

/* Supplementary Note Card */
.slide-note-card {
  background: var(--bg-card-subtle);
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.note-icon {
  font-size: 0.95rem;
  line-height: 1.2;
}

.note-text {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.45;
  font-style: italic;
}

/* ==========================================================================
   Diagram Visual Guide Card (Flows, Comparison, Label Keys)
   ========================================================================== */

.diagram-guide-card {
  background: var(--bg-card);
  border: 1.5px solid var(--accent-indigo);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(129, 140, 248, 0.08);
}

.diagram-guide-header {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.diagram-guide-icon {
  font-size: 1rem;
}

.diagram-guide-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-indigo);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.diagram-guide-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Diagram Label Mappings (JP -> EN) */
.diagram-labels-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.diagram-section-subhead {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.diagram-label-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.diagram-label-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
}

.diagram-label-badge .badge-jp {
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-shell);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
  font-size: 0.72rem;
}

.diagram-label-badge .badge-arrow {
  color: var(--accent-indigo);
  font-weight: 800;
  font-size: 0.8rem;
}

.diagram-label-badge .badge-en {
  font-weight: 600;
  color: var(--text-secondary);
}

/* Diagram Flow Steps (Step 1 -> Step 2 -> Step 3) */
.diagram-flow-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.diagram-flow-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--bg-card-subtle);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.flow-step-num {
  width: 22px;
  height: 22px;
  background: var(--accent-indigo);
  color: #ffffff;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.flow-step-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.flow-step-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
}

.flow-step-desc {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Diagram Compare Grid (Before vs Now) */
.diagram-compare-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 540px) {
  .diagram-compare-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.diagram-compare-col {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.diagram-compare-col.highlight {
  border-color: var(--accent-emerald);
  background: rgba(52, 211, 153, 0.05);
}

.compare-col-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-primary);
}

.diagram-compare-col.highlight .compare-col-title {
  color: var(--accent-emerald);
}

.compare-col-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Diagram Compare Steps Grid (Slide 93: Before vs Now step lists) */
.diagram-compare-steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 540px) {
  .diagram-compare-steps-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.diagram-compare-step-col {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.diagram-compare-step-col.before {
  border-left: 3px solid var(--text-muted);
}

.diagram-compare-step-col.now {
  border-left: 3px solid var(--accent-emerald);
  background: rgba(52, 211, 153, 0.04);
}

.compare-step-col-head {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

.compare-step-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.compare-step-item {
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--text-secondary);
  padding-left: 8px;
  border-left: 2px solid var(--border-medium);
}

.compare-step-item.warning {
  color: var(--accent-amber);
  font-weight: 600;
  border-left-color: var(--accent-amber);
}

.compare-step-note {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--border-subtle);
}

.compare-steps-summary {
  background: var(--bg-card-subtle);
  border: 1px dashed var(--accent-indigo);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  font-size: 0.78rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.compare-steps-summary strong {
  color: var(--accent-indigo);
}

/* Diagram Tree Structure */
.diagram-tree-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tree-root {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tree-children {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 18px;
  border-left: 2px solid var(--border-medium);
  margin-left: 6px;
}

.tree-child-item {
  font-size: 0.76rem;
  color: var(--text-secondary);
  position: relative;
}

.tree-child-item::before {
  content: '↳';
  color: var(--accent-indigo);
  margin-right: 4px;
}

/* Bullets Card */
.bullets-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 768px) {
  .bullets-card {
    padding: 18px 20px;
    gap: 12px;
  }
}

.bullets-heading {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.bullets-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bullet-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .bullet-item {
    font-size: 0.96rem;
  }
}

.bullet-dot {
  color: var(--accent-cyan);
  font-weight: 800;
  font-size: 1.1rem;
  line-height: 1.2;
  flex-shrink: 0;
}

/* Glossary Section */
.glossary-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.glossary-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.glossary-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.term-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-emerald);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.term-chip:hover {
  background: var(--accent-emerald-dim);
  border-color: var(--accent-emerald);
  transform: translateY(-1px);
}

.term-chip-jp {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Bottom Navigation Bar (Thumb Friendly & Desktop Bar)
   ========================================================================== */

.bottom-nav-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-bar-height) + var(--safe-bottom));
  padding: 10px 16px var(--safe-bottom);
  background: var(--bg-shell);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  backdrop-filter: blur(12px);
  z-index: 30;
}

@media (min-width: 768px) {
  .bottom-nav-bar {
    padding: 12px 24px;
  }
}

.nav-arrow-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  height: 48px;
  min-width: 90px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

@media (min-width: 768px) {
  .nav-arrow-btn {
    min-width: 120px;
    font-size: 0.92rem;
  }
}

.nav-arrow-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.nav-arrow-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.nav-arrow-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nav-jump-pill {
  flex: 1;
  max-width: 320px;
  margin: 0 auto;
  height: 48px;
  background: var(--accent-cyan-dim);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.nav-jump-pill:hover {
  background: rgba(56, 189, 248, 0.24);
  transform: translateY(-1px);
}

.nav-jump-pill:active {
  transform: scale(0.97);
}

.jump-pill-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.jump-current {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.jump-hint {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* ==========================================================================
   Table of Contents Modal / Desktop Drawer
   ========================================================================== */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.sheet-backdrop.open {
  display: flex;
}

@media (min-width: 768px) {
  .sheet-backdrop {
    align-items: center;
    padding: 24px;
  }
}

.sheet-modal {
  width: 100%;
  max-width: 520px;
  background: var(--bg-shell);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-top: 1px solid var(--border-medium);
  padding: 14px 18px calc(20px + var(--safe-bottom));
  max-height: 82vh;
  max-height: 82dvh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideUpSheet 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg);
}

@media (min-width: 768px) {
  .sheet-modal {
    max-width: 640px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-medium);
    padding: 20px 24px;
    animation: popScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

@keyframes slideUpSheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes popScale {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.sheet-pull-bar {
  width: 36px;
  height: 4px;
  background: var(--border-medium);
  border-radius: var(--radius-full);
  margin: 0 auto 2px;
}

@media (min-width: 768px) {
  .sheet-pull-bar {
    display: none;
  }
}

.sheet-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sheet-heading-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.sheet-title {
  font-size: 1.1rem;
  font-weight: 800;
}

.sheet-count {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.sheet-close-btn {
  width: 32px;
  height: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s ease;
}

.sheet-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sheet-search-bar {
  display: flex;
  gap: 8px;
}

.sheet-search-bar input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: var(--font-main);
  outline: none;
  transition: border-color 0.15s ease;
}

.sheet-search-bar input:focus {
  border-color: var(--accent-cyan);
}

.quick-jump-go {
  padding: 10px 16px;
  background: var(--accent-cyan);
  color: #0f172a;
  font-weight: 700;
  font-size: 0.85rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.quick-jump-go:active {
  transform: scale(0.96);
}

.sheet-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.sheet-section-divider {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent-indigo);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 4px 2px;
}

.sheet-item {
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sheet-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
  transform: translateX(2px);
}

.sheet-item.active {
  background: var(--accent-cyan-dim);
  border-color: var(--accent-cyan);
}

.sheet-item-num {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--accent-cyan);
  padding: 3px 6px;
  background: var(--bg-shell);
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}

.sheet-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sheet-item-en {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-item-jp {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Fullscreen Image Modal
   ========================================================================== */

.image-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(8px);
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.image-modal-backdrop.open {
  display: flex;
}

.image-modal-content {
  position: relative;
  max-width: 96vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.image-modal-content img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
}

.image-modal-close {
  position: absolute;
  top: -42px;
  right: 0;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-modal-caption {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ==========================================================================
   Glossary Popover Modal
   ========================================================================== */

.term-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 110;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.term-modal-backdrop.open {
  display: flex;
}

.term-modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-shell);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  animation: popScale 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.term-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.term-modal-en {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-emerald);
  display: block;
}

.term-modal-jp {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 4px;
}

.term-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.term-modal-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
