:root {
  --bg: #120e1c;
  --surface: #1f1733;
  --surface-hover: #271d3d;
  --card-border: #362552;
  --text: #f4f1fb;
  --text-dim: #a394c2;
  --purple: #a78bfa;
  --purple-deep: #7c3aed;
  --yellow: #facc15;
  --yellow-soft: #fde68a;
  --danger: #f87171;
  --font-ui: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  background:
    radial-gradient(ellipse 900px 520px at 15% -10%, rgba(124, 58, 237, 0.28), transparent 60%),
    radial-gradient(ellipse 700px 460px at 100% 0%, rgba(250, 204, 21, 0.10), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- LOGIN ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 40px 34px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.08), 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 80px rgba(124, 58, 237, 0.15);
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.login-logo .vinyl {
  width: 56px;
  height: 56px;
  animation: spin 9s linear infinite;
}

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

.login-card h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--yellow), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-sub { margin: 0 0 8px; color: var(--text-dim); font-size: 14px; }

.login-card input {
  background: var(--bg);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 13px 15px;
  border-radius: 10px;
  font-size: 15px;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color .15s;
}

.login-card input:focus { border-color: var(--purple); }

.login-card button {
  background: var(--yellow);
  color: #1a1420;
  border: none;
  padding: 13px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  margin-top: 6px;
  transition: filter .15s, transform .1s;
}

.login-card button:hover { filter: brightness(1.08); }
.login-card button:active { transform: scale(0.98); }

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin: 0;
}

/* ---------- APP ---------- */
.app { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  background: rgba(18, 14, 28, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
  padding: 12px 22px;
}

.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }

.brand-icon { width: 26px; height: 26px; flex-shrink: 0; }

.brand-text {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--yellow), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.search-wrap { flex: 1; max-width: 700px; margin: 0 auto; position: relative; }

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  background: var(--surface);
  border: 1px solid transparent;
  color: var(--text);
  padding: 10px 14px 10px 38px;
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color .15s, background .15s;
}

.search-wrap input:focus { background: var(--bg); border-color: var(--purple); }

.topbar-actions { display: flex; gap: 4px; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}

.icon-btn svg { width: 19px; height: 19px; }

.icon-btn:hover { background: var(--surface-hover); color: var(--yellow); }
.icon-btn.active { color: var(--yellow); background: var(--surface-hover); }

.content { max-width: 900px; margin: 0 auto; padding: 32px 20px 80px; }

.composer-wrap { display: flex; justify-content: center; margin-bottom: 36px; }

.composer {
  width: 100%;
  max-width: 620px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 16px 18px;
  transition: border-color .15s, box-shadow .15s;
}

.composer:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.composer-title {
  width: 100%;
  background: none;
  border: none;
  color: var(--yellow-soft);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  outline: none;
  margin-bottom: 8px;
}

.composer-content {
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  resize: none;
  min-height: 24px;
}

.composer-content::placeholder,
.composer-title::placeholder { color: var(--text-dim); font-family: var(--font-ui); }

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--card-border);
}

.composer-hint {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}

.text-btn {
  background: none;
  border: none;
  color: var(--purple);
  font-size: 14px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
}

.text-btn:hover { background: var(--surface-hover); color: var(--yellow); }

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  margin: 0 0 14px 4px;
  font-weight: 600;
}

.notes-grid {
  column-count: 1;
  column-gap: 18px;
}

@media (min-width: 560px) { .notes-grid { column-count: 2; } }
@media (min-width: 820px) { .notes-grid { column-count: 3; } }
@media (min-width: 1100px) { .notes-grid { column-count: 4; } }

.note-card {
  break-inside: avoid;
  margin-bottom: 18px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 16px 16px 8px;
  background: var(--surface);
  position: relative;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.note-card:hover {
  transform: translateY(-2px);
  border-color: var(--purple);
  box-shadow: 0 10px 28px rgba(124, 58, 237, 0.22);
}

.note-card.pinned {
  border-color: var(--yellow);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.25);
}

.note-card.pinned:hover {
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.35), 0 10px 28px rgba(250, 204, 21, 0.18);
}

.note-title {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 15px;
  color: var(--yellow-soft);
  outline: none;
  margin-bottom: 6px;
  min-height: 18px;
}

.note-title:empty::before { content: attr(data-placeholder); color: var(--text-dim); }

.note-content {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  outline: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 18px;
  color: var(--text);
}

.note-content:empty::before { content: attr(data-placeholder); color: var(--text-dim); font-family: var(--font-ui); }

.note-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  opacity: 0;
  transition: opacity .15s;
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px solid transparent;
}

.note-card:hover .note-footer, .note-card:focus-within .note-footer { opacity: 1; }

.note-actions { display: flex; gap: 2px; }

.note-actions button {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 7px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.note-actions button svg { width: 16px; height: 16px; }

.note-actions button:hover { background: var(--surface-hover); color: var(--text); }
.note-actions button.pin-btn:hover { color: var(--yellow); }
.note-actions button:last-child:hover { color: var(--danger); }

.note-card.pinned .note-actions .pin-btn { color: var(--yellow); }

.empty-state { text-align: center; color: var(--text-dim); margin-top: 70px; font-size: 15px; }
