:root {
  --bg-main: #0b0f19;
  --bg-card: #131b2e;
  --bg-elevated: #1c2640;
  --bg-glass: rgba(19, 27, 46, 0.88);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #ef4444;
  --accent-soft: rgba(239, 68, 68, 0.15);
  --accent-hover: #f87171;
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --danger: #f43f5e;
  --danger-soft: rgba(244, 63, 94, 0.16);
  --info: #3b82f6;
  --info-soft: rgba(59, 130, 246, 0.15);

  /* Pleco-inspired Tone Colors (Dark Mode) */
  --tone1-color: #ff6b6b;
  --tone2-color: #38d996;
  --tone3-color: #5c9ce6;
  --tone4-color: #c77dff;
  --tone5-color: #94a3b8;

  /* MiZiGe Grid Colors */
  --grid-bg: #101726;
  --grid-border: #334155;
  --grid-line: rgba(148, 163, 184, 0.18);
  --stroke-main: #f8fafc;
  --stroke-outline: #334155;
  --stroke-radical: #ef4444;

  --hanzi-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --radius-lg: 18px;
  --radius-md: 13px;
  --radius-sm: 9px;
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] {
  --bg-main: #f5f4f0;
  --bg-card: #ffffff;
  --bg-elevated: #edece6;
  --bg-glass: rgba(255, 255, 255, 0.92);
  --border-color: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #dc2626;
  --accent-soft: rgba(220, 38, 38, 0.1);
  --accent-hover: #b91c1c;
  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.12);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, 0.12);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.12);

  /* Pleco-inspired Tone Colors (Light Mode) */
  --tone1-color: #dc2626;
  --tone2-color: #059669;
  --tone3-color: #2563eb;
  --tone4-color: #7c3aed;
  --tone5-color: #64748b;

  /* MiZiGe Grid Colors */
  --grid-bg: #fffdf9;
  --grid-border: #cbd5e1;
  --grid-line: rgba(220, 38, 38, 0.2);
  --stroke-main: #0f172a;
  --stroke-outline: #e2e8f0;
  --stroke-radical: #dc2626;
  --shadow-lg: 0 10px 26px rgba(15, 23, 42, 0.09);
}

body.font-kaiti {
  --hanzi-family: 'STKaiti', 'KaiTi', 'Kaiti SC', 'Noto Serif SC', serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overscroll-behavior-y: none;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.hanzi-font {
  font-family: var(--hanzi-family);
}

/* Tone color utility classes (active only when body.tone-colors-on is set) */
body.tone-colors-on .tone-1 { color: var(--tone1-color) !important; }
body.tone-colors-on .tone-2 { color: var(--tone2-color) !important; }
body.tone-colors-on .tone-3 { color: var(--tone3-color) !important; }
body.tone-colors-on .tone-4 { color: var(--tone4-color) !important; }
body.tone-colors-on .tone-5 { color: var(--tone5-color) !important; }

/* App Container centered for desktop preview, 100% full width on phone */
.app-shell {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: calc(58px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  position: relative;
}

/* Top Header */
.app-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  height: calc(58px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: 14px;
  padding-right: 14px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ef4444, #991b1b);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  font-family: var(--hanzi-family);
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.35);
  flex-shrink: 0;
}

.brand-title {
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 155px;
}

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

.icon-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.94);
}

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

/* Tone Legend Strip */
.tone-legend-bar {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

body.tone-colors-on .tone-legend-bar {
  display: flex;
}

.tone-dot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tone-dot span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Main Tab Views */
.tab-view {
  display: none;
  padding: 14px;
  animation: fadeIn 0.18s ease-out;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 100;
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  position: relative;
  transition: color 0.15s ease;
}

.nav-item .nav-icon {
  font-size: 19px;
  line-height: 1;
  transition: transform 0.15s ease;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active .nav-icon {
  transform: translateY(-2px) scale(1.08);
}

.nav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 20px);
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

/* Cards & Common Components */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 15px;
  margin-bottom: 13px;
  box-shadow: var(--shadow-lg);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.pill-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.pill-badge.accent {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Stats Grid on Home */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 6px;
  text-align: center;
}

.stat-value {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
}

.stat-label {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* Quick Action Launchers */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.action-tile {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 13px;
  text-align: left;
  color: var(--text-main);
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.action-tile:active {
  transform: scale(0.97);
}

.action-tile.fire {
  border-color: rgba(244, 63, 94, 0.35);
  background: linear-gradient(145deg, rgba(244, 63, 94, 0.13), var(--bg-card));
}

.action-tile.star {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.12), var(--bg-card));
}

.action-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 18px;
}

.action-tile-title {
  font-size: 13.5px;
  font-weight: 700;
}

.action-tile-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* Filter Controls & Lesson Chips */
.book-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
  background: var(--bg-elevated);
  padding: 4px;
  border-radius: 11px;
}

.book-tab {
  flex: 1 1 calc(50% - 5px);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 6px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}

.book-tab.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.lesson-chips-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin-top: 10px;
}

.lesson-chip {
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: all 0.12s ease;
}

.lesson-chip .chip-num {
  font-size: 13px;
  font-weight: 700;
  display: block;
  color: var(--text-main);
}

.lesson-chip .chip-count {
  font-size: 9.5px;
  opacity: 0.75;
}

.lesson-chip.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.lesson-chip.selected .chip-num {
  color: var(--accent);
}

/* Buttons */
.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-main);
  padding: 9px 14px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.1s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 11.5px;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

/* Switch / Toggle row */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-top: 1px solid var(--border-color);
  font-size: 13px;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--bg-elevated);
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: background 0.2s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.switch.on {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.switch.on::after {
  transform: translateX(20px);
  background: var(--accent);
}

/* ==================== TAB 2: HANDWRITING (MiZiGe) ==================== */
.writer-prompt-card {
  text-align: center;
  padding: 14px;
}

.writer-ru {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.25;
}

.writer-pinyin-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
}

.char-Queue-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 4px;
}

.char-tab {
  min-width: 44px;
  height: 44px;
  border-radius: 11px;
  border: 2px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.char-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.char-tab.done {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.mizige-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 8px 0 12px;
}

.mizige-box {
  width: 280px;
  height: 280px;
  background: var(--grid-bg);
  border: 2px solid var(--grid-border);
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.25);
}

.mizige-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

#hanzi-target {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.writer-status-bar {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 8px;
  min-height: 20px;
  text-align: center;
}

/* ==================== TAB 3: ACTIVE TRAINER (4 IN 1) ==================== */
.mode-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.mode-pill {
  flex: 1 1 auto;
  text-align: center;
  justify-content: center;
  white-space: nowrap;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mode-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.quiz-stage {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18px 12px;
  position: relative;
}

.quiz-hanzi-big {
  font-size: 56px;
  font-weight: 700;
  line-height: 1.15;
  margin: 6px 0;
  letter-spacing: 2px;
}

.quiz-audio-orb {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 10px auto;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.25);
  transition: transform 0.12s ease;
}

.quiz-audio-orb:active {
  transform: scale(0.92);
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin-top: 10px;
}

.option-btn {
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-main);
  padding: 13px 15px;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.1s ease, border-color 0.15s, background 0.15s;
}

.option-btn:active {
  transform: scale(0.98);
}

.option-btn.correct {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.option-btn.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.dictation-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 2px solid var(--border-strong);
  color: var(--text-main);
  font-size: 24px;
  font-family: var(--hanzi-family);
  text-align: center;
  padding: 12px;
  border-radius: 13px;
  outline: none;
  margin-top: 8px;
}

.dictation-input:focus {
  border-color: var(--accent);
}

/* ==================== TAB 4: CONTEXT & SENTENCES ==================== */
.sentence-slots {
  min-height: 62px;
  background: var(--bg-elevated);
  border: 1.5px dashed var(--border-strong);
  border-radius: 13px;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin: 12px 0;
}

.word-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}

.word-tile {
  border: 1.5px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-main);
  padding: 9px 14px;
  border-radius: 11px;
  font-size: 19px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.word-tile.used {
  opacity: 0.25;
  pointer-events: none;
}

/* Story Interactive Tokens */
.story-line {
  padding: 11px 0;
  border-bottom: 1px solid var(--border-color);
}

.story-line:last-child {
  border-bottom: none;
}

.story-speaker {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.story-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  line-height: 1.6;
}

.story-token {
  font-size: 21px;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}

.story-token:hover, .story-token:active {
  background: var(--accent-soft);
}

.story-py {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.story-ru {
  font-size: 13px;
  color: var(--text-main);
  opacity: 0.88;
  margin-top: 3px;
}

/* ==================== TAB 5: DICTIONARY & ADD WORDS ==================== */
.search-bar-wrap {
  position: sticky;
  top: calc(58px + env(safe-area-inset-top, 0px));
  z-index: 40;
  background: var(--bg-main);
  padding: 6px 0 10px;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border-strong);
  color: var(--text-main);
  padding: 12px 38px 12px 14px;
  border-radius: 13px;
  font-size: 16px;
  outline: none;
}

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

.vocab-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vocab-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 13px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  touch-action: manipulation;
}

.vocab-item:active {
  background: var(--bg-elevated);
}

.vocab-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.vocab-hanzi {
  font-size: 25px;
  font-weight: 700;
  min-width: 56px;
}

.vocab-info {
  min-width: 0;
}

.vocab-pinyin {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.vocab-ru {
  font-size: 13.5px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vocab-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.vocab-lesson-tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
}

/* Bottom Sheet Modal for Word Inspector */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

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

.bottom-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 86dvh;
  background: var(--bg-card);
  border-top: 1px solid var(--border-strong);
  border-radius: 22px 22px 0 0;
  padding: 16px 16px calc(22px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  animation: slideUp 0.2s ease-out;
}

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

.sheet-handle {
  width: 42px;
  height: 5px;
  background: var(--border-strong);
  border-radius: 4px;
  margin: 0 auto 14px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 16px;
  margin-bottom: 10px;
  outline: none;
  font-family: inherit;
}

.form-textarea {
  min-height: 110px;
  resize: vertical;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: calc(68px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  padding: 9px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
