:root {
  --bg: #0b0c0f;
  --card: #1c1d21;
  --card-hover: #232429;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text-1: rgba(255, 255, 255, 0.94);
  --text-2: rgba(255, 255, 255, 0.60);
  --text-3: rgba(255, 255, 255, 0.38);
  --accent: #e8a33d;
  --accent-strong: #f4b95c;
  --accent-soft: rgba(232, 163, 61, 0.22);
  --type-text: #7fb2e8;
  --type-image: #b98ff0;
  --type-file: #5bc9b8;
  --success: #6bcb77;
  --danger: #ff6b6b;
  --font: -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
}

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

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font);
}

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button, input { font-family: inherit; }

.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* ---------- onboarding ---------- */

#onboarding {
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  gap: 22px;
  text-align: center;
}

.onboarding-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(155deg, var(--accent-strong), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
}
.onboarding-mark svg { width: 34px; height: 34px; color: #211404; }

#onboarding h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  margin: 4px 0 0;
}
#onboarding p.sub {
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.5;
  margin: 0;
  max-width: 320px;
}

.onboarding-form {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.field label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.field input {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text-1);
  font-size: 15px;
  outline: none;
}
.field input:focus { border-color: var(--accent); }

.primary-btn {
  background: var(--accent);
  color: #211404;
  font-weight: 700;
  font-size: 15px;
  border: none;
  border-radius: 12px;
  padding: 13px;
  cursor: pointer;
  margin-top: 4px;
}
.primary-btn:active { transform: scale(0.98); }
.primary-btn:disabled { opacity: 0.6; }

.form-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

/* ---------- main app ---------- */

#app-header {
  padding: 16px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.app-nav-row { display: flex; align-items: center; justify-content: space-between; }
.app-title { font-family: var(--font-display); font-weight: 700; font-size: 28px; letter-spacing: -0.02em; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent-strong);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px;
}

.sync-status { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.sync-dot.offline { background: var(--danger); }

.ios-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 12px;
}
.ios-search svg { width: 16px; height: 16px; color: var(--text-3); flex-shrink: 0; }
.ios-search input { background: transparent; border: none; outline: none; color: var(--text-1); font-size: 15px; width: 100%; }
.ios-search input::placeholder { color: var(--text-3); }

.add-clip-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #211404;
  font-weight: 700;
  font-size: 14.5px;
  border: none;
  border-radius: 12px;
  padding: 13px;
  cursor: pointer;
}
.add-clip-btn svg { width: 17px; height: 17px; }
.add-clip-btn:active { transform: scale(0.98); }

#list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 6px 6px;
}

.item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  width: 100%;
  color: inherit;
}
.item:active { background: var(--card-hover); }
.item.copied { background: var(--accent-soft); border-color: var(--accent); }

.item-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.item-icon svg { width: 16px; height: 16px; }
.item-icon.text { background: rgba(127,178,232,0.16); color: var(--type-text); }
.item-icon.image { background: rgba(185,143,240,0.16); color: var(--type-image); }
.item-icon.file { background: rgba(91,201,184,0.16); color: var(--type-file); }

.item-main { flex: 1; min-width: 0; }
.item-title {
  font-size: 14px;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.item-meta { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.pin-btn { width: 30px; height: 30px; border-radius: 8px; background: transparent; border: none; color: var(--text-3); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pin-btn.pinned { color: var(--accent-strong); }
.pin-btn svg { width: 15px; height: 15px; }

.empty-state { padding: 60px 20px; text-align: center; color: var(--text-3); font-size: 14px; display: none; }
.empty-state.visible { display: block; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 8px);
  background: #232429;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 11px 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  box-shadow: 0 20px 40px -15px rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast svg { width: 16px; height: 16px; color: var(--success); flex-shrink: 0; }
.toast.error svg { color: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001ms !important; }
}
