/* ==========================================================================
   読書ノート to note | Design System & Styling (Vanilla CSS)
   Aesthetic: Sleek, Minimal, Futuristic Glassmorphism (Dark / Slate / Indigo)
   ========================================================================== */

:root {
  /* Color Palette - Curated HSL Tokens */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-card-solid: #1e293b;
  --bg-input: rgba(15, 23, 42, 0.9);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(56, 189, 248, 0.4);
  --border-glow: rgba(129, 140, 248, 0.5);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  /* Vibrant Accent Gradients */
  --accent-cyan: #38bdf8;
  --accent-indigo: #818cf8;
  --accent-purple: #c084fc;
  --accent-amber: #fbbf24;
  --accent-rose: #f43f5e;
  --accent-emerald: #10b981;

  --grad-primary: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  --grad-surface: linear-gradient(180deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.85) 100%);
  --grad-glow: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, transparent 70%);

  /* Shadows & Glassmorphism */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.25);

  --glass-blur: blur(16px);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Typography */
  --font-main: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-brand: 'Outfit', 'Inter', sans-serif;
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* App Container Layout */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  position: relative;
  background-color: var(--bg-primary);
  box-shadow: 0 0 40px rgba(0,0,0,0.6);
}

/* Top App Bar */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 20;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title {
  font-family: var(--font-brand);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-weight: 500;
  font-size: 0.85rem;
  opacity: 0.85;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-active);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: scale(0.95);
}

.voice-pulse-btn {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

.voice-pulse-btn:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: #f43f5e;
}

/* Book Selector Strip */
.book-selector-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
}

.book-select-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 8px;
  background: var(--bg-card);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.book-select-dropdown {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.book-select-dropdown option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.pill-btn-small {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-btn-small:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

/* Main Viewport & Scroll Area */
.main-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  padding-bottom: calc(75px + env(safe-area-inset-bottom, 16px));
  -webkit-overflow-scrolling: touch;
}

.app-view {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.app-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Book Hero Card */
.book-hero-card {
  background: var(--grad-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}

.book-hero-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.book-hero-main {
  display: flex;
  gap: 14px;
  align-items: center;
}

.book-cover-badge {
  width: 52px;
  height: 70px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.book-hero-info {
  flex: 1;
  min-width: 0;
}

.book-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.book-author {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.book-stats {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.stat-badge {
  font-size: 0.76rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.stat-badge strong {
  color: var(--accent-cyan);
}

.book-hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* Action Buttons */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  text-align: center;
}

.action-btn:hover {
  transform: translateY(-1px);
}

.action-btn:active {
  transform: scale(0.98);
}

.action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.action-btn.primary {
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.action-btn.primary:hover {
  background: #2563eb;
}

.action-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.action-btn.gradient-accent {
  background: var(--grad-primary);
  color: #0f172a;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.action-btn.gradient-accent:hover {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.action-btn.danger {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

.action-btn.btn-large {
  padding: 14px 20px;
  font-size: 1rem;
}

.full-width {
  width: 100%;
}

/* Section Containers */
.section-container {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.tree-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

.text-link-btn {
  background: transparent;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 2px 4px;
}

.text-link-btn:hover {
  text-decoration: underline;
}

.divider {
  color: var(--text-muted);
}

/* Empty State */
.empty-state-box {
  background: var(--bg-card);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.empty-state-box h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-state-box p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 320px;
  margin: 0 auto;
}

/* TOC Tree Styles */
.toc-tree-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chapter-block {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.chapter-block:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.chapter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  user-select: none;
}

.chapter-title-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.chapter-toggle-icon {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.chapter-block.open .chapter-toggle-icon {
  transform: rotate(90deg);
}

.chapter-title {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.chapter-badge-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-list {
  display: none;
  flex-direction: column;
  padding: 6px 10px 10px 10px;
  background: rgba(15, 23, 42, 0.4);
  border-top: 1px solid var(--border-subtle);
  gap: 6px;
}

.chapter-block.open .section-list {
  display: flex;
}

/* Section Item */
.section-item-card {
  display: flex;
  flex-direction: column;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  transition: all 0.2s ease;
}

.section-item-card:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: var(--border-active);
}

.section-item-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-label-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.section-item-title {
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #e2e8f0;
}

.section-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--accent-cyan);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.section-add-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  transform: scale(1.03);
}

/* Attached Memos under Section */
.section-attached-memos {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Memo Feed & Cards */
.memo-feed-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.memo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  position: relative;
}

.memo-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.memo-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.memo-chapter-tag {
  font-size: 0.76rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(129, 140, 248, 0.15);
  border: 1px solid rgba(129, 140, 248, 0.3);
  color: #a5b4fc;
  font-weight: 500;
}

.memo-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.mini-icon-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.memo-raw-text {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-primary);
  margin-bottom: 10px;
  white-space: pre-wrap;
  user-select: text;
}

/* AI Structured Insights Box */
.ai-insights-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.insight-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.84rem;
}

.insight-label {
  font-weight: 700;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.label-summary { color: var(--accent-cyan); }
.label-insight { color: var(--accent-amber); }
.label-note { color: var(--accent-purple); }

.insight-text {
  color: #cbd5e1;
  line-height: 1.45;
  user-select: text;
}

/* Studio & Note Plan View */
.studio-intro-card {
  background: var(--grad-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 18px;
}

.studio-badge {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(192, 132, 252, 0.2));
  border: 1px solid rgba(192, 132, 252, 0.4);
  color: #d8b4fe;
  margin-bottom: 8px;
}

.studio-desc {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.5;
}

.studio-form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-select, .form-input, .memo-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.92rem;
  outline: none;
  transition: all 0.2s ease;
}

.form-select:focus, .form-input:focus, .memo-textarea:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Note Plan Output Box */
.note-plan-box {
  background: var(--bg-card);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-glow);
  margin-top: 18px;
}

.plan-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.plan-status-tag {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.plan-actions {
  display: flex;
  gap: 8px;
}

.pill-btn {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.markdown-preview-area {
  font-size: 0.92rem;
  line-height: 1.7;
  color: #e2e8f0;
  user-select: text;
  max-height: 480px;
  overflow-y: auto;
  white-space: pre-wrap;
  padding-right: 6px;
}

.markdown-preview-area h1, .markdown-preview-area h2, .markdown-preview-area h3 {
  color: #fff;
  margin: 14px 0 6px 0;
}

.markdown-preview-area h2 {
  font-size: 1.15rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 4px;
}

.markdown-preview-area h3 {
  font-size: 1rem;
  color: var(--accent-cyan);
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 64px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(11, 15, 25, 0.92);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--border-subtle);
  z-index: 30;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
  transition: all 0.2s ease;
}

.nav-item.active {
  color: var(--accent-cyan);
}

.nav-item.active svg {
  stroke: var(--accent-cyan);
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.5));
}

.nav-icon-badge-wrapper {
  position: relative;
  display: inline-block;
}

.nav-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent-rose);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modals & Bottom Sheets */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.25s ease;
}

.modal-overlay.hidden {
  display: none;
}

/* Bottom Sheet (Mobile Optimized) */
.bottom-sheet {
  width: 100%;
  max-width: 600px;
  background: var(--bg-secondary);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  padding: 16px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 16px));
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  margin: 0 auto 12px auto;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sheet-sub {
  font-size: 0.78rem;
  color: var(--accent-indigo);
  font-weight: 600;
  text-transform: uppercase;
}

.sheet-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}

/* Voice Recorder UI */
.voice-recorder-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.voice-record-btn {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.4);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.voice-record-btn:active {
  transform: scale(0.92);
}

.voice-record-btn.recording {
  background: linear-gradient(135deg, #e11d48, #be123c);
  animation: pulseRecording 1.4s infinite;
}

@keyframes pulseRecording {
  0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.6); }
  70% { box-shadow: 0 0 0 14px rgba(244, 63, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.voice-status-info {
  flex: 1;
  min-width: 0;
}

.voice-status-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.voice-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 18px;
  margin-top: 4px;
}

.voice-waves span {
  width: 3px;
  height: 100%;
  background: var(--accent-cyan);
  border-radius: 2px;
  animation: waveAnim 0.8s infinite ease-in-out alternate;
}

.voice-waves span:nth-child(2) { animation-delay: 0.15s; }
.voice-waves span:nth-child(3) { animation-delay: 0.3s; }
.voice-waves span:nth-child(4) { animation-delay: 0.45s; }
.voice-waves span:nth-child(5) { animation-delay: 0.6s; }

@keyframes waveAnim {
  0% { height: 4px; }
  100% { height: 18px; }
}

.memo-textarea {
  min-height: 110px;
  resize: none;
}

.sheet-footer {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* Centered Modal Dialogs */
.modal-dialog {
  width: 90%;
  max-width: 500px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  margin: auto;
  animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 10px;
  background: rgba(15, 23, 42, 0.5);
}

/* Upload Dropzone */
.upload-dropzone {
  border: 2px dashed var(--border-active);
  border-radius: var(--radius-md);
  padding: 28px 16px;
  text-align: center;
  background: rgba(56, 189, 248, 0.04);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.upload-dropzone:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: var(--accent-cyan);
}

.file-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.dropzone-main {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.dropzone-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.preview-thumbnail-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 0;
  margin-top: 12px;
}

.preview-thumbnail {
  width: 72px;
  height: 96px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.manual-toc-textarea {
  width: 100%;
  min-height: 120px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: monospace;
  font-size: 0.85rem;
  padding: 8px;
}

/* Field Hints & Utilities */
.field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 4px;
}

.field-hint a {
  color: var(--accent-cyan);
  text-decoration: none;
}

.setting-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 16px 0;
}

.backup-btn-grid {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.chip-btn {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip-btn.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 600;
}

.required {
  color: var(--accent-rose);
}

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  width: 90%;
  max-width: 400px;
  pointer-events: none;
}

.toast-item {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-active);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease-out;
  display: flex;
  align-items: center;
  gap: 8px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
