:root {
  --bg: #FEFDF9;
  --text: #2C2C2C;
  --muted: #6E6E6E;
  --accent: #4A90E2;
  --accent-dark: #357ABD;
  --highlight: #FFF3A1;
  --border: #E5E2DA;
  --sheet-bg: #FFFFFF;
  --danger: #E74C3C;
  --overlay: rgba(254, 253, 249, 0.92);
  color-scheme: light;
}

[data-theme="sepia"] {
  --bg: #F4EDDF;
  --text: #43392C;
  --muted: #857A66;
  --accent: #4A90E2;
  --accent-dark: #357ABD;
  --highlight: #F0DC8E;
  --border: #DCCFB4;
  --sheet-bg: #FBF6EA;
  --danger: #C0563F;
  --overlay: rgba(244, 237, 223, 0.92);
}

[data-theme="dark"] {
  --bg: #17181A;
  --text: #E4E2DC;
  --muted: #9C9A93;
  --accent: #6FA8DC;
  --accent-dark: #4A90E2;
  --highlight: #57502A;
  --border: #3A3B3E;
  --sheet-bg: #232427;
  --danger: #E06C5B;
  --overlay: rgba(23, 24, 26, 0.92);
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

button {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: calc(48px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: center;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.toolbar-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 15px;
  padding: 6px 10px;
  min-height: 44px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.toolbar-btn:active {
  background: rgba(128, 128, 128, 0.18);
}

/* Reader */
.reader {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  position: relative;
  touch-action: pan-y;
}

.welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 24px;
  text-align: center;
}

.welcome-content h1 {
  font-size: 32px;
  margin-bottom: 8px;
}

.welcome-tagline {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 340px;
  margin: 0 auto 24px;
}

.welcome-content .welcome-footnote {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 340px;
  margin: 20px auto 0;
}

.welcome-content .welcome-note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  background: var(--sheet-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  max-width: 360px;
  margin: 12px auto 0;
}

.welcome-content .welcome-note strong {
  color: var(--text);
  font-weight: 600;
}

.intro-steps {
  counter-reset: step;
  list-style: none;
  margin: 0 auto 28px;
  padding: 0;
  max-width: 360px;
  text-align: left;
}

.intro-steps li {
  counter-increment: step;
  font-size: 15px;
  line-height: 1.5;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.intro-steps li:last-child {
  border-bottom: none;
}

.intro-steps li::before {
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  vertical-align: -5px;
}

.intro-steps strong {
  font-weight: 600;
}

.welcome-hint {
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.welcome-actions .primary-btn,
.welcome-actions .secondary-btn {
  min-width: 220px;
  min-height: 44px;
}

.welcome-content p {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.book-content {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px max(18px, env(safe-area-inset-right)) 120px max(18px, env(safe-area-inset-left));
  font-size: 18px;
  line-height: 1.8;
}

.book-content p {
  margin: 0 0 1em;
}

.book-content h1, .book-content h2, .book-content h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

.book-content img {
  max-width: 100%;
  height: auto;
}

.word {
  cursor: pointer;
  border-radius: 2px;
  padding: 0 1px;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.15s ease;
}

/* Hover feedback only for real pointers — iOS/Android apply :hover on
   touch, which grays a word and sticks while the user is scrolling. */
@media (hover: hover) and (pointer: fine) {
  .word:hover {
    background: rgba(74, 144, 226, 0.15);
  }
}

.word.saved {
  background: var(--highlight);
}

.word.selected {
  background: rgba(74, 144, 226, 0.35);
}

.summary-marker {
  display: inline-block;
  width: 100%;
  margin: 24px 0;
  text-align: center;
}

.summary-btn {
  border: 1px solid var(--accent);
  background: var(--sheet-bg);
  color: var(--accent);
  padding: 8px 16px;
  min-height: 44px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading-content p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.empty-book {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  color: var(--muted);
  font-size: 16px;
}

.empty-book p {
  margin: 0 0 16px;
}

/* Inline definition card */
.popcard {
  position: fixed;
  z-index: 45;
  display: block;
  max-width: 320px;
  animation: popcard-in 0.15s ease;
}

.popcard.hidden {
  display: none;
}

@keyframes popcard-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
}

.popcard-content {
  background: var(--sheet-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px 16px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.12);
  max-height: 45vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.popcard-arrow {
  width: 0;
  height: 0;
  margin: 0 auto;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
}

.popcard-arrow.down {
  border-top: 8px solid var(--sheet-bg);
  margin-bottom: -1px;
}

.popcard-arrow.up {
  border-bottom: 8px solid var(--sheet-bg);
  margin-top: -1px;
}

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

.popcard-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.popcard-definition {
  font-size: 15px;
  line-height: 1.5;
  margin: 0 0 8px;
}

.popcard-example {
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
  font-style: italic;
  border-left: 3px solid var(--border);
  padding-left: 10px;
  margin: 0 0 12px;
}

.loading-small {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.popcard-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.popcard-actions button {
  flex: 1;
  padding: 8px 6px;
  font-size: 13px;
}

/* Buttons */
.primary-btn {
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.primary-btn.small {
  font-size: 13px;
  padding: 8px 12px;
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary-btn {
  border: 1px solid var(--border);
  background: var(--sheet-bg);
  color: var(--text);
  font-size: 15px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.secondary-btn.small {
  font-size: 13px;
  padding: 8px 8px;
}

.secondary-btn:active {
  background: var(--bg);
}

.danger-btn {
  border: 1px solid var(--danger);
  background: var(--sheet-bg);
  color: var(--danger);
  font-size: 15px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.danger-btn:active {
  background: rgba(231, 76, 60, 0.1);
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 22px;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text);
  border-radius: 6px;
  flex-shrink: 0;
}

.icon-btn:focus-visible,
.toolbar-btn:focus-visible,
.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.danger-btn:focus-visible,
.ghost-danger:focus-visible,
.sort-chip:focus-visible,
.summary-btn:focus-visible,
.word:focus-visible,
.word-item-delete:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input:focus-visible {
  outline-offset: 1px;
}

.toolbar-btn:focus-visible {
  outline-offset: 1px;
}

/* Panels */
.words-panel, .settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 85vw;
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  border-left: 1px solid var(--border);
  z-index: 60;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  transition: transform 0.25s ease;
}

.words-panel.hidden, .settings-panel.hidden {
  transform: translateX(100%);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-header h2 {
  margin: 0;
  font-size: 18px;
}

.words-count {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 4px;
}

.words-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.words-toolbar input[type="search"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  background: var(--sheet-bg);
  color: var(--text);
}

.sort-chips {
  display: flex;
  gap: 8px;
}

.sort-chip {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--sheet-bg);
  color: var(--muted);
  font-size: 13px;
  padding: 6px 4px;
  min-height: 44px;
  border-radius: 22px;
  cursor: pointer;
}

.sort-chip.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
  background: rgba(74, 144, 226, 0.1);
}

.sync-row {
  display: flex;
  gap: 8px;
}

.sync-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
}

#shelf-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sync-row button {
  flex-shrink: 0;
  min-height: 44px;
}

.sync-help {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 10px 0 12px;
}

.words-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 0;
  list-style: none;
}

.word-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.word-item-text {
  flex: 1;
  padding-right: 8px;
}

.word-item-term {
  font-weight: 600;
}

.word-item-def {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.word-item-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.word-item-meta.due-now {
  color: var(--danger);
  font-weight: 500;
}

.word-item-delete {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 20px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  margin-right: -10px;
  cursor: pointer;
  flex-shrink: 0;
}

.words-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.settings-body {
  padding: 16px 16px 32px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.settings-heading {
  margin: 28px 0 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.settings-body > .settings-heading:first-child {
  margin-top: 0;
}

.settings-card {
  background: var(--sheet-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2px 14px;
}

.settings-field {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.settings-field:last-child {
  border-bottom: none;
}

.settings-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 6px;
}

.settings-field input[type="text"],
.settings-field input[type="password"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
}

.settings-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  resize: none;
}

.edit-fields {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px;
}

.settings-slider {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.settings-slider:last-of-type {
  border-bottom: none;
}

.settings-slider-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 4px;
}

.settings-value {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.settings-body input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.settings-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 8px 2px 0;
}

.settings-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
}

.settings-quick-actions button {
  flex: 1 1 auto;
  min-width: 96px;
  min-height: 44px;
  font-size: 13px;
  white-space: nowrap;
}

.ghost-danger {
  border: 1px solid transparent;
  background: transparent;
  color: var(--danger);
}

.ghost-danger:active {
  background: rgba(231, 76, 60, 0.1);
}

.theme-picker {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}

.theme-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
}

.theme-btn.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.settings-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.settings-actions button {
  flex: 1;
  min-height: 44px;
}

/* Study view */
.study-view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  z-index: 70;
  display: flex;
  flex-direction: column;
}

.study-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.study-header h2 {
  margin: 0;
  font-size: 18px;
}

.study-today {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--sheet-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
}

.study-today:empty {
  display: none;
}

.study-card {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  width: 100%;
  max-width: 560px;
  margin: 24px auto;
  padding: 24px;
  background: var(--sheet-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  text-align: center;
  cursor: pointer;
  user-select: none;
}

.card-front, .card-back {
  margin: auto;
}

.card-front p, .card-back p {
  margin: 0;
}

#card-word {
  font-size: 28px;
  font-weight: 600;
}

.card-hint {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
}

.card-definition {
  font-size: 16px;
  line-height: 1.45;
}

#study-example:not(:empty) {
  margin-bottom: 20px;
}

#study-example:not(:empty) + #study-definition {
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.card-example {
  font-size: 20px;
  line-height: 1.5;
  color: var(--muted);
  font-style: italic;
}

.card-example mark {
  background: var(--highlight);
  color: var(--text);
  font-style: inherit;
  padding: 1px 3px;
  border-radius: 4px;
}

.study-controls {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
}

.study-controls button {
  flex: 1;
  min-height: 48px;
  padding: 14px 4px;
  font-size: 14px;
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
}

.rating-btn.again { background: var(--danger); }
.rating-btn.hard { background: #E67E22; }
.rating-btn.good { background: var(--accent); }
.rating-btn.easy { background: #27AE60; }

.rating-due {
  display: block;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
  margin-top: 2px;
  opacity: 0.9;
}

.study-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

/* Summary modal */
.summary-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: rgba(0,0,0,0.35);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.summary-box {
  background: var(--sheet-bg);
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.summary-box h2 {
  margin: 0;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 18px;
}

.summary-content {
  padding: 16px;
  overflow-y: auto;
  line-height: 1.6;
}

.summary-actions {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  text-align: right;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.16);
  z-index: 90;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
}

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

/* Responsive */
@media (max-width: 480px) {
  .toolbar {
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }

  .toolbar-btn {
    font-size: 14px;
    padding: 6px 8px;
  }

  .book-content {
    padding: 16px max(14px, env(safe-area-inset-right)) 120px max(14px, env(safe-area-inset-left));
  }

  .words-panel, .settings-panel {
    width: 100%;
    max-width: 100%;
  }

  .study-card {
    width: auto;
    align-self: stretch;
    margin: 16px 16px 8px;
  }

.card-menu-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
}

.card-menu {
  position: absolute;
  top: 50px;
  right: 14px;
  min-width: 150px;
  background: var(--sheet-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  z-index: 3;
}

.card-menu-item {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.card-menu-item + .card-menu-item {
  border-top: 1px solid var(--border);
}

.card-menu-item:active {
  background: var(--bg);
}

.card-menu-danger {
  color: var(--danger);
}

.study-controls {
    gap: 6px;
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* iPhone 13 mini and similar (360pt width) */
@media (max-width: 390px) {
  .toolbar {
    gap: 4px;
  }

  .toolbar-left, .toolbar-right {
    gap: 2px;
  }

  .toolbar-btn {
    font-size: 13px;
    padding: 6px 6px;
  }

  .toolbar-title {
    font-size: 15px;
  }

  .intro-steps li {
    font-size: 14px;
    padding: 8px 0;
  }

  .welcome-tagline {
    font-size: 15px;
  }

  .welcome-actions .primary-btn,
  .welcome-actions .secondary-btn {
    min-width: 200px;
  }

  .study-card {
    padding: 18px 14px;
    margin: 12px 12px 6px;
  }

  #card-word {
    font-size: 26px;
  }

  .study-controls button {
    font-size: 13px;
    padding: 12px 2px;
  }

  .summary-modal {
    padding: 10px;
  }

  .welcome-content h1 {
    font-size: 28px;
  }
}
