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

:root {
  --bg-primary: #f2f2f7;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e5e5ea;
  --bg-elevated: #ffffff;
  --text-primary: #1c1c1e;
  --text-secondary: rgba(60, 60, 67, 0.6);
  --text-tertiary: rgba(60, 60, 67, 0.3);
  --accent: #007aff;
  --accent-active: #0056b3;
  --red: #ff3b30;
  --orange: #ff9500;
  --green: #34c759;
  --separator: rgba(60, 60, 67, 0.12);
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --sheet-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.2);
  --chord-bg: rgba(0, 122, 255, 0.1);
  --chord-text: #007aff;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 52px;
  --tabbar-h: 52px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;
    --bg-elevated: #2c2c2e;
    --text-primary: #f5f5f7;
    --text-secondary: rgba(235, 235, 245, 0.6);
    --text-tertiary: rgba(235, 235, 245, 0.3);
    --accent: #0a84ff;
    --accent-active: #409cff;
    --red: #ff453a;
    --orange: #ff9f0a;
    --green: #30d158;
    --separator: rgba(84, 84, 88, 0.36);
    --card-shadow: none;
    --sheet-shadow: 0 -2px 20px rgba(0, 0, 0, 0.4);
    --glass-bg: rgba(28, 28, 30, 0.72);
    --glass-border: rgba(56, 56, 58, 0.5);
    --chord-bg: rgba(10, 132, 255, 0.15);
    --chord-text: #0a84ff;
  }
}

:root[data-theme="dark"] {
  --bg-primary: #000000;
  --bg-secondary: #1c1c1e;
  --bg-tertiary: #2c2c2e;
  --bg-elevated: #2c2c2e;
  --text-primary: #f5f5f7;
  --text-secondary: rgba(235, 235, 245, 0.6);
  --text-tertiary: rgba(235, 235, 245, 0.3);
  --accent: #0a84ff;
  --accent-active: #409cff;
  --red: #ff453a;
  --orange: #ff9f0a;
  --green: #30d158;
  --separator: rgba(84, 84, 88, 0.36);
  --card-shadow: none;
  --sheet-shadow: 0 -2px 20px rgba(0, 0, 0, 0.4);
  --glass-bg: rgba(28, 28, 30, 0.72);
  --glass-border: rgba(56, 56, 58, 0.5);
  --chord-bg: rgba(10, 132, 255, 0.15);
  --chord-text: #0a84ff;
}

@font-face {
  font-family: 'MuseJazz Text';
  src: url('../fonts/MuseJazzText.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.47;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  position: relative;
}

/* ── Header ── */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: var(--header-h);
  background: var(--glass-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator);
}

.app-header .header-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.app-header .header-left,
.app-header .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 60px;
}

.app-header .header-right {
  justify-content: flex-end;
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--accent);
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.header-btn:active {
  transform: scale(0.92);
}

.header-btn.text-btn {
  width: auto;
  height: auto;
  background: none;
  border-radius: 0;
  font-size: 17px;
  font-weight: 400;
  padding: 4px;
}

.header-btn.text-btn.primary {
  font-weight: 600;
}

/* ── Large Title ── */

.large-title-container {
  padding: 4px 16px 8px;
  flex-shrink: 0;
}

.large-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

/* ── Main Content ── */

.view {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
}

.view.active {
  display: block;
}

/* ── Search Bar ── */

.search-container {
  padding: 0 16px 12px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 9px 12px;
}

.search-bar svg {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.search-bar input {
  flex: 1;
  border: none;
  background: none;
  font-size: 17px;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
}

.search-bar input::placeholder {
  color: var(--text-tertiary);
}

/* ── Tab Bar ── */

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--glass-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
}

.tab-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  border: none;
  background: none;
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.2s ease;
  font-family: inherit;
  letter-spacing: 0.01em;
}

.tab-bar-item svg {
  width: 24px;
  height: 24px;
}

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

/* ── Grouped List (iOS style) ── */

.list-group {
  margin: 0 16px 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  flex-shrink: 0;
}

.list-group-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 24px 16px 8px;
  flex-shrink: 0;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
  color: inherit;
  min-height: 44px;
}

.list-item:active {
  background: var(--bg-tertiary);
}

.list-item + .list-item {
  border-top: 0.5px solid var(--separator);
  margin-left: 16px;
  padding-left: 0;
}

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: 17px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-chevron {
  color: var(--text-tertiary);
  font-size: 14px;
  flex-shrink: 0;
}

.list-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

/* ── Song Card (Library Grid) ── */

.song-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 16px;
  background: var(--separator);
  border-radius: 12px;
  overflow: hidden;
}

.song-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: background 0.15s ease;
}

.song-card:active {
  background: var(--bg-tertiary);
}

.song-card-info {
  flex: 1;
  min-width: 0;
}

.song-card-title {
  font-size: 17px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-card-artist {
  font-size: 15px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.song-card-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--chord-bg);
  color: var(--chord-text);
}

.song-card-chevron {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ── Song Detail View ── */

.song-detail-header {
  padding: 16px;
  text-align: center;
}

.song-detail-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.song-detail-artist {
  font-size: 17px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.song-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.control-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-right: 0.5px solid var(--separator);
}

.control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 36px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}

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

.control-btn + .control-btn {
  border-left: 0.5px solid var(--separator);
}

.control-value {
  font-size: 15px;
  font-weight: 600;
  padding: 0 10px;
  min-width: 32px;
  text-align: center;
}

/* ── Chord Sheet ── */

.chord-sheet {
  padding: 16px;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
}

.chord-sheet .chord {
  display: inline;
  font-weight: var(--chord-weight, 700);
  font-style: var(--chord-style, normal);
  color: var(--chord-text);
  background: var(--chord-bg);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 14px;
  cursor: default;
  user-select: all;
  position: relative;
  top: -1px;
}

.chord-sheet .section-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 16px;
  margin-bottom: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
}

/* ── Notes / Rhythm Section ── */

.song-info-section {
  margin: 0 16px 16px;
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.song-info-section-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 12px 16px 4px;
}

.song-info-section-body {
  padding: 8px 16px 14px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
}

.rhythm-display {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.15em;
}

.rhythm-display .down {
  color: var(--accent);
}

.rhythm-display .up {
  color: var(--orange);
}

.rhythm-display .mute {
  color: var(--text-tertiary);
}

/* ── Form (Add/Edit) ── */

.form-container {
  padding: 0 16px 32px;
}

.form-group {
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--card-shadow);
}

.form-group-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 20px 16px 8px;
}

.form-row {
  padding: 0 16px;
}

.form-row + .form-row {
  border-top: 0.5px solid var(--separator);
}

.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding-top: 10px;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  border: none;
  background: none;
  font-size: 17px;
  color: var(--text-primary);
  padding: 8px 0 12px;
  outline: none;
  font-family: inherit;
  resize: none;
}

.form-row textarea {
  min-height: 200px;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.6;
}

.form-row select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%238e8e93' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
  padding-right: 20px;
}

.form-row input::placeholder,
.form-row textarea::placeholder {
  color: var(--text-tertiary);
}

.form-hint {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px 16px 12px;
  line-height: 1.4;
}

/* ── Tag Input ── */

.tag-input-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}

.tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: none;
  background: var(--text-tertiary);
  color: var(--bg-secondary);
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
  line-height: 1;
}

.tag-new-input {
  border: none;
  background: none;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  min-width: 80px;
  font-family: inherit;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  font-family: inherit;
}

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

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

.btn-danger {
  background: var(--red);
  color: #ffffff;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--accent);
}

.btn-full {
  width: 100%;
}

.btn-small {
  padding: 8px 16px;
  font-size: 15px;
  border-radius: 10px;
}

/* ── Empty State ── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  text-align: center;
}

.empty-state-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-state-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.4;
  max-width: 280px;
}

/* ── Modal / Sheet ── */

.modal-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-sheet {
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  max-height: 85dvh;
  background: var(--bg-secondary);
  border-radius: 16px 16px 0 0;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: var(--safe-bottom);
}

.modal-overlay.open .modal-sheet {
  transform: translateY(0);
}

.modal-handle {
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
}

.modal-handle::after {
  content: '';
  width: 36px;
  height: 5px;
  background: var(--text-tertiary);
  border-radius: 3px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 12px;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
}

.modal-body {
  padding: 0 16px 24px;
}

/* ── Settings ── */

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  min-height: 44px;
}

.settings-row + .settings-row {
  border-top: 0.5px solid var(--separator);
}

.settings-row-label {
  font-size: 17px;
}

.settings-row-value {
  font-size: 17px;
  color: var(--text-secondary);
}

/* ── Toggle Switch (iOS) ── */

.toggle {
  position: relative;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: var(--bg-tertiary);
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.25s ease;
}

.toggle input:checked + .toggle-track {
  background: var(--green);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s cubic-bezier(0.5, 1, 0.89, 1);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
}

/* ── Confirmation Dialog ── */

.confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--separator);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 16px;
}

.confirm-btn {
  padding: 14px;
  border: none;
  background: var(--bg-secondary);
  font-size: 17px;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}

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

.confirm-btn.destructive {
  color: var(--red);
  font-weight: 600;
}

.confirm-btn.cancel {
  font-weight: 600;
}

/* ── Floating Action Button ── */

.fab {
  position: fixed;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  right: 16px;
  z-index: 50;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.35);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fab:active {
  transform: scale(0.9);
}

/* ── Category Pill ── */

.category-pills {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-pills::-webkit-scrollbar {
  display: none;
}

.category-pill {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--separator);
  background: none;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
}

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

/* ── Toast ── */

.toast {
  position: fixed;
  top: calc(var(--safe-top) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  z-index: 300;
  padding: 12px 20px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: 14px;
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease, visibility 0.25s;
  white-space: nowrap;
}

.toast {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

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

/* ── Scroll Fade ── */

.view::-webkit-scrollbar {
  display: none;
}

.view {
  scrollbar-width: none;
}

/* ── Desktop (≥ 768px) ── */

@media (min-width: 768px) {
  #app {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .tab-bar {
    position: static;
    grid-column: 1;
    grid-row: 1 / span 2;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
    width: auto;
    height: 100%;
    padding: 16px 0 0;
    border-top: none;
    border-right: 0.5px solid var(--separator);
  }

  .tab-bar-item {
    padding: 12px 0;
    flex: none;
  }

  .app-header {
    grid-column: 2;
    grid-row: 1;
  }

  .view {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
    padding-bottom: 32px;
  }

  .fab {
    bottom: 24px;
    right: 24px;
  }

  .modal-sheet {
    border-radius: 16px;
    margin-bottom: 16px;
  }

  .chord-sheet {
    font-size: 16px;
    max-width: 700px;
    margin: 0 auto;
  }
}

/* ── Search Online Button ── */

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-row input {
  flex: 1;
}

.search-online-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  transition: transform 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.search-online-btn:active {
  transform: scale(0.95);
}

.search-online-btn:disabled {
  opacity: 0.5;
}

.search-online-btn svg {
  flex-shrink: 0;
}

/* ── Search Results ── */

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.search-result-item:active {
  opacity: 0.6;
}

.search-result-item + .search-result-item {
  border-top: 0.5px solid var(--separator);
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-size: 17px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-artist {
  font-size: 15px;
  color: var(--text-secondary);
}

.search-result-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.search-result-type {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--chord-bg);
  color: var(--chord-text);
}

.search-result-rating {
  font-size: 12px;
  color: var(--orange);
}

.search-result-arrow {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ── Spinner ── */

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

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

/* ── Animation Utilities ── */

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

.animate-in {
  animation: fadeIn 0.3s ease both;
}

/* ── Font Picker ── */

.font-picker {
  display: flex;
  flex-direction: column;
}

.font-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  min-height: 48px;
}

.font-option:active {
  background: var(--bg-tertiary);
}

.font-option + .font-option {
  border-top: 0.5px solid var(--separator);
}

.font-option-label {
  font-size: 17px;
}

.font-option-preview {
  font-size: 14px;
  color: var(--text-secondary);
}

.font-option-check {
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.font-option.selected .font-option-check {
  opacity: 1;
}

/* ── Song Count Badge ── */

.song-count {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 0 16px 8px;
}

/* ── Typography Controls ── */

.typo-controls {
  margin: 0 16px 12px;
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.typo-controls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
}

.typo-controls-header span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.typo-controls-header .typo-chevron {
  font-size: 12px;
  color: var(--text-tertiary);
  transition: transform 0.2s ease;
}

.typo-controls.open .typo-chevron {
  transform: rotate(180deg);
}

.typo-controls-body {
  display: none;
  padding: 0 16px 14px;
}

.typo-controls.open .typo-controls-body {
  display: block;
}

.typo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.typo-row + .typo-row {
  border-top: 0.5px solid var(--separator);
}

.typo-row-label {
  font-size: 14px;
  color: var(--text-primary);
  flex-shrink: 0;
}

.typo-row-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.typo-toggle-group {
  display: flex;
  gap: 4px;
}

.typo-toggle-btn {
  width: 36px;
  height: 32px;
  border: 1.5px solid var(--separator);
  border-radius: 8px;
  background: none;
  color: var(--text-primary);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.typo-toggle-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.typo-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-tertiary);
  outline: none;
}

.typo-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.typo-slider-value {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 36px;
  text-align: right;
}

/* ── Import Method Sheet ── */

.import-method-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.import-method-item:active {
  background: var(--bg-tertiary);
}

.import-method-item + .import-method-item {
  border-top: 0.5px solid var(--separator);
}

.import-method-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--chord-bg);
  color: var(--chord-text);
  flex-shrink: 0;
}

.import-method-info {
  flex: 1;
}

.import-method-title {
  font-size: 17px;
  font-weight: 500;
}

.import-method-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.paste-textarea {
  width: 100%;
  min-height: 200px;
  border: 1.5px solid var(--separator);
  border-radius: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  font-family: 'SF Mono', 'Menlo', monospace;
  line-height: 1.6;
  padding: 12px;
  outline: none;
  resize: vertical;
  margin-bottom: 12px;
}

.paste-textarea:focus {
  border-color: var(--accent);
}

.paste-textarea::placeholder {
  color: var(--text-tertiary);
}

/* ── Segmented Control ── */

.segmented {
  display: flex;
  margin: 0 16px 12px;
  padding: 2px;
  background: rgba(118, 118, 128, 0.2);
  border-radius: 9px;
}

.segment {
  flex: 1;
  padding: 6px 0;
  border: none;
  border-radius: 7px;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.segment.active {
  background: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* ── Folders ── */

.folder-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 12px;
}

.folder-back {
  display: flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 17px;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 0;
}

.folder-bar-name {
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Key Info ── */

.key-info {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 0 16px 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.key-info b {
  color: var(--text-primary);
  font-weight: 600;
}

.key-info .key-reset {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}

/* ── Typo Bar + Pen ── */

.typo-bar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 16px 12px;
}

.typo-bar .typo-controls {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.pen-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-secondary);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: var(--card-shadow);
  transition: transform 0.15s ease, background 0.15s ease;
}

.pen-toggle:active { transform: scale(0.92); }

.pen-toggle.active {
  background: var(--accent);
  color: #ffffff;
}

.sheet-wrap {
  position: relative;
}

.ink-canvas {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  touch-action: auto;
  z-index: 5;
}

.sheet-wrap.pen-mode .ink-canvas {
  pointer-events: auto;
  touch-action: none;
  cursor: crosshair;
}

.pen-toolbar {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px);
  transform: translate(-50%, calc(100% + 140px));
  visibility: hidden;
  pointer-events: none;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 24px;
  background: var(--glass-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 0.5px solid var(--glass-border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.35s;
  max-width: calc(100vw - 16px);
}

.pen-toolbar.open {
  transform: translate(-50%, 0);
  visibility: visible;
  pointer-events: auto;
}

.pen-tool {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pen-tool.active {
  background: var(--accent);
  color: #ffffff;
}

.pen-color {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  outline: 1.5px solid var(--separator);
  cursor: pointer;
  flex-shrink: 0;
}

.pen-color.active {
  border-color: var(--bg-secondary);
  outline: 2px solid var(--accent);
}

.pen-sep {
  width: 0.5px;
  height: 22px;
  background: var(--separator);
  margin: 0 2px;
}

.pen-done {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  padding: 0 8px;
  cursor: pointer;
}

@media (min-width: 768px) {
  .pen-toolbar { bottom: 24px; left: calc(50% + 44px); }
}

/* ── Chord-only lines (alignment preserved) ── */

.chord-sheet .chord-line .chord {
  padding: 0;
  border-radius: 3px;
  top: 0;
  font-size: inherit;
}

/* ── Sheet search / paste folder ── */

.sheet-search {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
}

.sheet-search input,
.paste-folder {
  flex: 1;
  width: 100%;
  border: 1.5px solid var(--separator);
  border-radius: 10px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  padding: 8px 12px;
  outline: none;
}

.paste-folder { margin-bottom: 10px; }

.sheet-search input:focus,
.paste-folder:focus { border-color: var(--accent); }

.result-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 8px 0 6px;
}

.result-line {
  font-size: 15px;
  padding: 6px 0;
  border-top: 0.5px solid var(--separator);
}

.result-line small { color: var(--text-secondary); }

.song-card-badge.warn {
  background: rgba(255, 149, 0, 0.15);
  color: var(--orange);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .segment.active { background: #636366; }
}
:root[data-theme="dark"] .segment.active { background: #636366; }

/* ── Chord sheet lines ── */

.chord-sheet .ln {
  display: block;
}

.sheet-search { align-items: stretch; }
.sheet-search-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* ── Folder menu / chips ── */

.folder-menu-btn {
  margin-left: auto;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.folder-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 14px;
}

.folder-chip {
  padding: 6px 14px;
  border-radius: 16px;
  border: 1.5px solid var(--separator);
  background: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.folder-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.folder-chips:empty { display: none; }

/* ── Select mode ── */

.select-bar {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px);
  transform: translate(-50%, calc(100% + 140px));
  visibility: hidden;
  pointer-events: none;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 24px;
  background: var(--glass-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 0.5px solid var(--glass-border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.35s;
  max-width: calc(100vw - 16px);
}

.select-bar.open {
  transform: translate(-50%, 0);
  visibility: visible;
  pointer-events: auto;
}

.select-btn {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  padding: 8px 8px;
  cursor: pointer;
  white-space: nowrap;
}

.select-btn.danger { color: var(--red); }

.select-count {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 0 6px;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .select-bar { bottom: 24px; left: calc(50% + 44px); }
}

.sel-check {
  display: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--text-tertiary);
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  color: transparent;
}

.song-grid.selecting .sel-check { display: flex; }

.song-card.selected .sel-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.move-new { display: flex; gap: 8px; }
.move-new input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--separator);
  border-radius: 10px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  padding: 8px 12px;
  outline: none;
}

/* ── Drag to reorder ── */

.drag-handle {
  width: 40px;
  height: 40px;
  margin: -8px -8px -8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  touch-action: none;
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
}

.song-grid.selecting .drag-handle { display: none; }

.song-card { position: relative; }
.song-card.shifting { transition: transform 0.18s ease; }
.swipe-row.dragging {
  z-index: 10;
  background: var(--bg-elevated);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  transition: none;
}
.swipe-row.dragging .drag-handle { color: var(--accent); cursor: grabbing; }

.inline-icon { vertical-align: -2px; margin: 0 2px; flex-shrink: 0; }
.typo-controls-header .typo-chevron { display: flex; }
.search-result-rating { display: inline-flex; align-items: center; gap: 1px; }
.font-option-check { display: flex; }

.pen-toggle:disabled { opacity: 0.35; cursor: default; }
.pen-tool:disabled { opacity: 0.35; }
.typo-bar { align-items: flex-start; }

.search-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 10px;
}
.search-summary-text {
  font-size: 14px;
  color: var(--text-secondary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-links {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 0 0;
}
.share-song-line {
  font-size: 15px;
  padding: 6px 0;
  border-top: 0.5px solid var(--separator);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.share-song-line small { color: var(--text-secondary); white-space: nowrap; }


/* ── Akor sayfası: akor ile söz arası ── */
.chord-sheet .chord-line { margin-bottom: var(--pair-gap, 0); }

/* ── Kaydırınca eylemler (iOS) ── */
.swipe-row {
  position: relative;
  overflow: hidden;
  background: var(--bg-secondary);
  touch-action: pan-y;
}
.swipe-row + .swipe-row .swipe-content { box-shadow: inset 0 0.5px 0 var(--separator); }
.swipe-row:not(.open) .swipe-actions { visibility: hidden; }
.swipe-content {
  position: relative;
  background: var(--bg-secondary);
  will-change: transform;
}
.swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
}
.swipe-action {
  width: 74px;
  border: none;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.swipe-action:active { filter: brightness(0.85); }
.swipe-row.dragging { overflow: visible; }
.selecting .swipe-actions { display: none; }
.swipe-row.no-swipe .swipe-content { transform: none !important; }
.swipe-content .song-card,
.swipe-content .list-item { border-top: none; margin-left: 0; padding-left: 16px; }

/* ── Ayarlar satırları ── */
.set-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-row .list-item-subtitle { color: var(--text-secondary); font-size: 14px; }
.list-item.nav-row + .list-item.nav-row { margin-left: 0; padding-left: 16px; }

/* ── Yazı ayarları denetimleri ── */
.vc { display: flex; flex-direction: column; }
.vc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px;
  min-height: 46px;
}
.vc-row + .vc-row { border-top: 0.5px solid var(--separator); }
.vc-label { font-size: 16px; flex-shrink: 0; }
.vc-ctl { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: flex-end; min-width: 0; }
.vc-ctl .typo-slider { flex: 1; min-width: 80px; max-width: 220px; width: auto; }
.vc-val { font-size: 14px; color: var(--text-secondary); min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.vc-nav { cursor: pointer; }
.vc-nav .vc-val { display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 16px; }
.vc-step {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1.5px solid var(--separator);
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.vc-step.big { font-size: 19px; }
.vc-step:active { background: var(--bg-tertiary); }
.vc-foot { padding: 10px 4px 2px; border-top: 0.5px solid var(--separator); display: flex; justify-content: center; }
.view-preview {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  overflow: hidden;
  white-space: pre-wrap;
  max-height: 180px;
}
.typo-controls-body .vc { padding: 0 12px 8px; }

/* ── Seçim sayfası ── */
.choice-row .list-item-subtitle { font-size: 14px; color: var(--text-secondary); }
.choice-check { color: var(--accent); display: none; }
.choice-row.selected .choice-check { display: flex; }
.choice-row + .choice-row { margin-left: 0; padding-left: 16px; }

.vc-stack { flex-wrap: wrap; row-gap: 6px; }
.vc-stack .vc-label { width: 100%; font-size: 15px; color: var(--text-secondary); }
.vc-stack .vc-ctl { width: 100%; justify-content: flex-start; flex: none; }
.vc-stack .vc-ctl .typo-slider { max-width: none; }
