/* ── SDPal — Tool & Component Styles ── */

/* ═══════════════════════════════════════
   CONTENT INPUT
   ═══════════════════════════════════════ */

.content-input {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.input-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 32px 20px;
  border: 1.5px dashed var(--border-hover);
  border-radius: var(--r-xl);
  background: var(--bg-card);
  transition: all var(--t);
  min-height: 200px;
}
.input-hero.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: var(--accent-glow);
}
.input-hero-icon { font-size: 44px; margin-bottom: 14px; }
.input-hero-title { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.input-hero-sub { font-size: 13px; color: var(--text-2); margin-bottom: 22px; max-width: 260px; line-height: 1.5; }
.input-hero-buttons { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 240px; }
.input-hero-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  font-size: 13px;
  width: 100%;
  border-radius: var(--r-full) !important;
}

.input-editor {
  display: flex;
  flex-direction: column;
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-card);
  min-height: 0;
}
.input-editor-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.input-editor-chars { font-size: 11px; color: var(--text-3); font-weight: 500; }
.input-editor-textarea {
  flex: 1;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  min-height: 120px;
  resize: none;
  line-height: 1.7;
  font-size: 14px;
  padding: 14px 18px;
}
.input-editor-textarea:focus { box-shadow: none !important; }

.input-editor-previews { padding: 0 14px 10px; display: flex; flex-direction: column; gap: 4px; }
.input-editor-previews:empty { display: none; padding: 0; }

.input-file-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--bg-input);
  border-radius: var(--r-sm);
  font-size: 12px;
}
.input-file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.input-file-status { font-size: 11px; color: var(--text-3); flex-shrink: 0; }


/* ═══════════════════════════════════════
   AI OUTPUT / READER
   ═══════════════════════════════════════ */

.ai-reader {
  flex: 1;
  overflow-y: auto;
  padding: 28px 4px;
  line-height: 1.85;
  font-size: 15px;
  overflow-wrap: break-word;
}
.ai-reader h1, .ai-reader h2, .ai-reader h3 { margin-top: 22px; margin-bottom: 10px; font-weight: 700; letter-spacing: -0.02em; }
.ai-reader h1 { font-size: 22px; }
.ai-reader h2 { font-size: 18px; }
.ai-reader h3 { font-size: 16px; }
.ai-reader p { margin-bottom: 12px; }
.ai-reader ul, .ai-reader ol { padding-left: 22px; margin-bottom: 12px; }
.ai-reader li { margin-bottom: 6px; }
.ai-reader code { background: var(--bg-elevated); padding: 2px 7px; border-radius: 5px; font-family: var(--font-mono); font-size: 13px; }
.ai-reader pre { background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--r-md); padding: 16px; overflow-x: auto; margin-bottom: 14px; }
.ai-reader pre code { background: none; padding: 0; }
.ai-reader strong { font-weight: 700; }
.ai-reader blockquote { border-left: 3px solid var(--accent); padding-left: 16px; color: var(--text-2); margin: 12px 0; }

.ai-cursor::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 17px;
  background: var(--accent);
  border-radius: 1px;
  margin-left: 2px;
  animation: cursorBlink 0.9s step-end infinite;
  vertical-align: text-bottom;
}
@keyframes cursorBlink { 50% { opacity: 0; } }

.output-actions {
  display: flex;
  gap: 8px;
  padding: 14px 4px;
  border-top: 1px solid var(--border-subtle);
}
.output-actions .btn { flex: 1; }


/* ═══════════════════════════════════════
   MODE SWITCHER
   ═══════════════════════════════════════ */

.mode-switcher {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 3px;
  gap: 2px;
  max-width: 420px;
  margin: 0 auto 16px;
}
.mode-switcher button {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-2);
  transition: all var(--t);
}
.mode-switcher button.active {
  background: var(--accent);
  color: var(--text-inv);
  box-shadow: var(--accent-glow-sm);
}


/* ═══════════════════════════════════════
   QUIZ
   ═══════════════════════════════════════ */

.quiz-progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}
.quiz-progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.35s var(--ease);
}
.quiz-progress-text {
  font-size: 12px;
  color: var(--text-3);
  text-align: right;
  margin-bottom: 20px;
  font-weight: 500;
}

.quiz-q-text {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: -0.02em;
  padding: 4px 0 28px;
}

.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-opt {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 15px;
  min-height: 54px;
  background: var(--bg-card);
  -webkit-tap-highlight-color: transparent;
}
.quiz-opt:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.quiz-opt:active { transform: scale(0.985); }
.quiz-opt.selected { border-color: var(--accent); background: var(--accent-dim); box-shadow: var(--accent-glow-sm); }
.quiz-opt.correct { border-color: var(--accent); background: var(--accent-dim); }
.quiz-opt.wrong { border-color: var(--danger); background: var(--danger-dim); }

.quiz-opt-badge {
  width: 30px; height: 30px;
  border-radius: var(--r-full);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.15s;
}
.quiz-opt.selected .quiz-opt-badge { background: var(--accent); color: var(--text-inv); border-color: var(--accent); }

.quiz-results { text-align: center; padding: 36px 0; }
.quiz-score-ring { width: 150px; height: 150px; margin: 0 auto 24px; position: relative; }
.quiz-score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.quiz-score-ring .ring-bg { fill: none; stroke: var(--border); stroke-width: 7; }
.quiz-score-ring .ring-fill { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset 1.5s var(--ease); filter: drop-shadow(0 0 8px rgba(34,197,94,0.3)); }
.quiz-score-num { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 34px; font-weight: 800; letter-spacing: -0.03em; }

.quiz-dots { display: flex; gap: 6px; justify-content: center; margin: 18px 0; flex-wrap: wrap; }
.quiz-dot { width: 10px; height: 10px; border-radius: 50%; transition: all var(--t); }
.quiz-dot.correct { background: var(--accent); box-shadow: 0 0 6px rgba(34,197,94,0.3); }
.quiz-dot.wrong { background: var(--danger); }
.quiz-dot.skipped { background: var(--border); }

.quiz-review-card {
  text-align: left;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  background: var(--bg-card);
}
.quiz-review-card.is-correct { border-left: 4px solid var(--accent); }
.quiz-review-card.is-wrong { border-left: 4px solid var(--danger); }
.quiz-review-q { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.quiz-review-explain { font-size: 13px; color: var(--text-2); margin-top: 10px; padding: 12px; background: var(--bg-input); border-radius: var(--r-sm); line-height: 1.65; }


/* ═══════════════════════════════════════
   FLASHCARDS
   ═══════════════════════════════════════ */

.fc-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
  max-width: 100% !important;
}

.fc-card {
  width: calc(100% - 40px);
  max-width: 440px;
  aspect-ratio: 4/3;
  max-height: 55vh;
  perspective: 1200px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.3s var(--ease);
}
.fc-card.swipe-left { transform: translateX(-120%) rotate(-12deg); opacity: 0; transition: all 0.4s var(--ease); }
.fc-card.swipe-right { transform: translateX(120%) rotate(12deg); opacity: 0; transition: all 0.4s var(--ease); }

.fc-inner {
  width: 100%; height: 100%;
  position: relative;
  transition: transform 0.5s var(--ease);
  transform-style: preserve-3d;
}
.fc-inner.flipped { transform: rotateY(180deg); }

.fc-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  overflow-y: auto;
  background: var(--bg-card);
}
.fc-front { background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary)); }
.fc-back { background: linear-gradient(135deg, var(--bg-elevated), var(--bg-tertiary)); transform: rotateY(180deg); }

.fc-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-3); margin-bottom: 14px; }
.fc-text-front { font-size: 20px; font-weight: 700; line-height: 1.5; letter-spacing: -0.02em; }
.fc-text-back { font-size: 15px; line-height: 1.7; color: var(--text-2); }
.fc-hint { font-size: 12px; color: var(--text-3); text-align: center; }

.fc-counter { font-size: 14px; font-weight: 600; color: var(--text-2); text-align: center; margin-bottom: 6px; }
.fc-progress-bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 16px; }
.fc-progress-fill { height: 100%; background: var(--accent); transition: width 0.35s var(--ease); }

.fc-actions { display: flex; gap: 28px; justify-content: center; padding: 14px 0; }
.fc-action-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: all var(--t-spring);
}
.fc-action-btn:active { transform: scale(0.88); }
.fc-btn-no { border: 2px solid var(--danger); color: var(--danger); }
.fc-btn-no:hover { background: var(--danger-dim); }
.fc-btn-yes { border: 2px solid var(--accent); color: var(--accent); }
.fc-btn-yes:hover { background: var(--accent-dim); box-shadow: var(--accent-glow-sm); }

.fc-summary-grid { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 16px 0; }
.fc-summary-sq {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t);
}
.fc-summary-sq.known { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-mid); }
.fc-summary-sq.missed { background: var(--danger-dim); color: var(--danger); border: 1px solid var(--danger-border); }


/* ═══════════════════════════════════════
   CHAT
   ═══════════════════════════════════════ */

.chat-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.chat-header-title { flex: 1; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.chat-header-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; margin-right: 5px; box-shadow: 0 0 6px rgba(34,197,94,0.4); }
.chat-header-btn {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: all var(--t);
}
.chat-header-btn:hover { background: var(--bg-card-hover); color: var(--text-1); }
.chat-header-btn svg { width: 18px; height: 18px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.chat-msg { display: flex; gap: 10px; max-width: 85%; animation: pageIn 0.2s var(--ease); }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.bot { align-self: flex-start; }

.chat-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-msg.bot .chat-avatar { background: var(--accent-dim); color: var(--accent); }

.chat-bot-col { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chat-bot-label { font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; }

.chat-bubble {
  padding: 12px 16px;
  border-radius: var(--r-lg);
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: break-word;
}
.chat-msg.user .chat-bubble {
  background: var(--accent);
  color: var(--text-inv);
  border-bottom-right-radius: 4px;
  box-shadow: var(--accent-glow-sm);
}
.chat-msg.bot .chat-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
}

.chat-typing-dots { display: flex; gap: 5px; padding: 4px 0; }
.chat-typing-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: chatBounce 1.2s infinite; }
.chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatBounce { 0%,80%,100% { transform: translateY(0); } 40% { transform: translateY(-5px); } }

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  align-items: flex-end;
  background: var(--bg-secondary);
}
.chat-attach-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  border: 1px solid var(--border);
  flex-shrink: 0;
  transition: all var(--t);
}
.chat-attach-btn:hover { border-color: var(--accent); color: var(--accent); }
.chat-attach-btn svg { width: 16px; height: 16px; }

.chat-input {
  flex: 1;
  min-height: 38px;
  max-height: 120px;
  resize: none;
  padding: 8px 16px;
  border-radius: var(--r-xl) !important;
  font-size: 14px;
  line-height: 1.5;
}

.chat-send {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-inv);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--t);
  box-shadow: var(--accent-glow-sm);
}
.chat-send:hover { background: var(--accent-hover); box-shadow: var(--accent-glow); }
.chat-send:disabled { opacity: 0.35; box-shadow: none; }
.chat-send svg { width: 16px; height: 16px; }

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 14px;
  padding: 32px 20px;
}
.chat-empty-avatar { font-size: 44px; }
.chat-empty-text { font-size: 16px; font-weight: 600; color: var(--text-2); letter-spacing: -0.01em; }
.chat-suggestions { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 340px; margin-top: 4px; }
.chat-suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
  text-align: left;
}
.chat-suggestion:hover { border-color: var(--accent-mid); background: var(--accent-dim); }
.chat-suggestion-icon { font-size: 18px; flex-shrink: 0; }


/* ═══════════════════════════════════════
   TIMER
   ═══════════════════════════════════════ */

.timer-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 28px;
  padding: 24px;
  max-width: 100% !important;
}

.timer-ring-wrap { width: 260px; height: 260px; position: relative; }
@media (min-width: 500px) { .timer-ring-wrap { width: 280px; height: 280px; } }
.timer-ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring-bg { fill: none; stroke: var(--border); stroke-width: 4; }
.timer-ring-fill { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 0.5s; filter: drop-shadow(0 0 10px rgba(34,197,94,0.25)); }
.timer-display { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; }
.timer-time { font-size: 52px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -3px; }
.timer-mode-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 2px; margin-top: 4px; }

.focus-timer .timer-time { font-size: 72px; }
.focus-timer .timer-ring-wrap { width: 320px; height: 320px; }
.focus-timer .timer-ring-fill { filter: drop-shadow(0 0 16px rgba(34,197,94,0.35)); }

.timer-play {
  width: 68px; height: 68px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-inv);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-spring);
  box-shadow: var(--accent-glow);
}
.timer-play:hover { transform: scale(1.06); }
.timer-play:active { transform: scale(0.94); }
.timer-play svg { width: 26px; height: 26px; }

.timer-modes { display: flex; gap: 6px; }
.timer-mode-btn {
  padding: 7px 18px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  border: 1px solid var(--border);
  transition: all var(--t);
}
.timer-mode-btn.active { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); box-shadow: var(--accent-glow-sm); }

.timer-presets { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.timer-preset {
  padding: 9px 20px;
  border-radius: var(--r-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--t);
}
.timer-preset:hover { border-color: var(--accent-mid); background: var(--accent-dim); color: var(--accent); }


/* ═══════════════════════════════════════
   TRANSLATOR
   ═══════════════════════════════════════ */

.translate-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.translate-half { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.translate-label {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 18px 6px;
  font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 1px;
}
.translate-lang-pill {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 600; color: var(--text-1); cursor: pointer;
  text-transform: none; letter-spacing: 0; transition: all var(--t);
}
.translate-lang-pill:hover { border-color: var(--accent-mid); }
.translate-textarea {
  flex: 1; border: none !important; background: transparent !important;
  padding: 10px 18px; font-size: 15px; line-height: 1.7; resize: none;
}
.translate-textarea:focus { box-shadow: none !important; }
.translate-divider { display: flex; align-items: center; justify-content: center; height: 1px; background: var(--border); position: relative; }
.translate-swap {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-secondary); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); position: absolute; z-index: 2; cursor: pointer;
  transition: all var(--t);
}
.translate-swap:hover { border-color: var(--accent); color: var(--accent); }
.translate-swap svg { width: 16px; height: 16px; }
.translate-output { flex: 1; padding: 10px 18px; font-size: 15px; line-height: 1.7; overflow-y: auto; }
.translate-loading { height: 2px; background: var(--border); position: absolute; left: 0; right: 0; top: -1px; overflow: hidden; }
.translate-loading.active::after { content: ''; position: absolute; left: -40%; width: 40%; height: 100%; background: var(--accent); animation: translateSlide 1.5s infinite; }
@keyframes translateSlide { to { left: 100%; } }


/* ═══════════════════════════════════════
   TTS PLAYER
   ═══════════════════════════════════════ */

.tts-player {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; gap: 28px; padding: 28px; max-width: 100% !important;
}
.tts-waveform { display: flex; align-items: center; gap: 3px; height: 80px; }
.tts-bar {
  width: 3px; border-radius: 2px; background: var(--accent); opacity: 0.25;
  transition: height 0.12s, opacity 0.12s;
}
.tts-bar.active { opacity: 0.85; }
.tts-play-btn {
  width: 68px; height: 68px; border-radius: 50%;
  background: var(--accent); color: var(--text-inv);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--accent-glow); transition: all var(--t-spring);
}
.tts-play-btn:hover { transform: scale(1.06); }
.tts-play-btn:active { transform: scale(0.94); }
.tts-play-btn svg { width: 26px; height: 26px; }


/* ═══════════════════════════════════════
   NOTES
   ═══════════════════════════════════════ */

.notes-wrap { display: flex; flex: 1; min-height: 0; max-width: 100% !important; }
.notes-sidebar {
  width: 240px; border-right: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0;
  background: var(--bg-secondary);
}
.notes-editor { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.notes-toolbar {
  display: flex; gap: 2px; padding: 8px 14px; border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto; -webkit-overflow-scrolling: touch; flex-shrink: 0;
}
.notes-toolbar button {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-size: 14px; flex-shrink: 0;
}
.notes-toolbar button:hover { background: var(--bg-card-hover); color: var(--text-1); }

.notes-title-input {
  border: none !important; border-bottom: 1px solid var(--border-subtle) !important;
  border-radius: 0 !important; font-size: 20px; font-weight: 700; padding: 16px 24px;
  background: transparent !important; letter-spacing: -0.02em;
}
.notes-title-input:focus { box-shadow: none !important; }

.notes-content {
  flex: 1; padding: 16px 24px; outline: none; overflow-y: auto;
  line-height: 1.8; font-size: 15px;
}
.notes-content:empty::before { content: attr(data-placeholder); color: var(--text-3); }

.notes-status {
  padding: 8px 24px; border-top: 1px solid var(--border-subtle);
  font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 12px;
}

@media (max-width: 768px) {
  .notes-sidebar { display: none; position: fixed; top: 0; left: 0; bottom: 0; z-index: 200; width: 260px; }
  .notes-sidebar.open { display: flex; }
  .notes-scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 199; }
}


/* ═══════════════════════════════════════
   LIBRARY
   ═══════════════════════════════════════ */

.library-search { position: relative; margin-bottom: 12px; }
.library-search input { padding-left: 42px; height: 46px; font-size: 14px; border-radius: var(--r-lg); }
.library-search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-3); }

.library-filters { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 2px; }
.library-filter {
  padding: 7px 15px; border-radius: var(--r-full); font-size: 12px; font-weight: 600;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-2);
  white-space: nowrap; flex-shrink: 0; transition: all var(--t);
}
.library-filter.active { background: var(--accent-dim); border-color: var(--accent-mid); color: var(--accent); }

.library-items { display: flex; flex-direction: column; gap: 6px; }
.library-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-md);
  cursor: pointer; transition: all var(--t);
}
.library-item:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }

.library-item-icon {
  width: 38px; height: 38px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0;
}
.library-item-info { flex: 1; min-width: 0; }
.library-item-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.01em; }
.library-item-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }


/* ═══════════════════════════════════════
   MEMORIZE
   ═══════════════════════════════════════ */

.mem-journey { display: flex; align-items: center; justify-content: center; padding: 16px 0 22px; }
.mem-node {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--text-3); flex-shrink: 0;
  transition: all 0.3s;
}
.mem-node.active { border-color: var(--accent); color: var(--accent); animation: memPulse 2s infinite; }
.mem-node.done { border-color: var(--accent); background: var(--accent); color: var(--text-inv); }
.mem-line { width: 36px; height: 2px; background: var(--border); }
.mem-line.done { background: var(--accent); }
@keyframes memPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.3); } 50% { box-shadow: 0 0 0 7px transparent; } }


/* ═══════════════════════════════════════
   PLANNER
   ═══════════════════════════════════════ */

.planner-week { display: flex; align-items: center; border-bottom: 1px solid var(--border-subtle); padding: 8px 4px; }
.planner-week-btn { padding: 8px; color: var(--text-3); }
.planner-days { display: flex; flex: 1; gap: 2px; }
.planner-day {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px; border-radius: var(--r-md); cursor: pointer; transition: all var(--t);
}
.planner-day.today { background: var(--accent-dim); }
.planner-day.selected { border: 1px solid var(--accent); }
.planner-day-abbr { font-size: 10px; font-weight: 600; color: var(--text-3); text-transform: uppercase; }
.planner-day-num { font-size: 16px; font-weight: 700; }
.planner-day-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }

.planner-fab {
  position: fixed;
  bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0) + 18px);
  right: 22px;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: var(--text-inv);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--accent-glow), var(--shadow-lg); z-index: 50;
  transition: all var(--t-spring);
}
.planner-fab:hover { transform: scale(1.08); }
.planner-fab svg { width: 22px; height: 22px; }
@media (min-width: 769px) { .planner-fab { bottom: 24px; } }


/* ═══════════════════════════════════════
   SHARED COMPONENTS
   ═══════════════════════════════════════ */

.toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 11px 18px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: slideInRight 0.3s var(--ease); max-width: 320px;
}
.toast.success { border-color: var(--accent-mid); color: var(--accent-bright); }
.toast.error { border-color: var(--danger-border); color: var(--danger); }
@keyframes slideInRight { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 500;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn 0.15s;
}
.modal {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 26px; max-width: 400px; width: 100%;
  box-shadow: var(--shadow-xl);
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.02em; }
.modal-body { color: var(--text-2); font-size: 14px; margin-bottom: 20px; line-height: 1.6; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; gap: 10px; text-align: center; padding: 48px 24px; max-width: 100% !important;
}
.empty-state-icon { font-size: 44px; opacity: 0.45; }
.empty-state-text { font-size: 14px; color: var(--text-3); max-width: 260px; line-height: 1.6; }
