@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #14161a;
  --panel: #1c1f25;
  --panel-border: #2b2f37;
  --text: #e8e9ec;
  --text-dim: #8b909c;
  --live: #e8934a;
  --live-dim: #4a3626;
  --off: #3d4450;
  --danger: #d9584f;
  --radius: 10px;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(232, 147, 74, 0.06), transparent 40%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 48px);
  color: var(--text);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  min-height: 100vh;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  color: var(--text-dim);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

/* ---- Login screen ---- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 32px 28px;
}

.login-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.login-mark .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 10px rgba(232, 147, 74, 0.7);
}

.login-mark span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.login-card h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 6px;
}

.login-card p {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin: 0 0 22px;
  line-height: 1.5;
}

.login-card input {
  width: 100%;
  background: #101215;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s ease;
}

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

.login-card button {
  width: 100%;
  margin-top: 14px;
  background: var(--live);
  color: #1c1006;
  border: none;
  border-radius: 8px;
  padding: 12px 14px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: filter 0.15s ease;
}

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

.login-error {
  margin-top: 12px;
  color: var(--danger);
  font-size: 0.82rem;
  font-family: 'IBM Plex Mono', monospace;
  min-height: 1.2em;
}

/* ---- Library ---- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px;
  border-bottom: 1px solid var(--panel-border);
}

.topbar .mark {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 8px rgba(232, 147, 74, 0.6);
}

.topbar h1 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.01em;
}

.topbar .count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.76rem;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.logout-btn:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 28px 32px;
}

.empty-state {
  padding: 80px 32px;
  text-align: center;
  color: var(--text-dim);
}

.empty-state .big {
  font-size: 2rem;
  margin-bottom: 10px;
}

.empty-state p {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.6;
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s ease;
}

.card.is-public {
  border-color: var(--live-dim);
}

.card-name {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  word-break: break-all;
  line-height: 1.4;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.status-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.card.is-public .status-label { color: var(--live); }

/* Toggle switch */
.switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex: none;
}

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

.switch .track {
  position: absolute;
  inset: 0;
  background: var(--off);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.switch .track::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #0f1013;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.switch input:checked + .track {
  background: var(--live);
}

.switch input:checked + .track::before {
  transform: translateX(20px);
  background: #1c1006;
}

.switch input:disabled + .track {
  opacity: 0.5;
  cursor: default;
}

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

.link-row input {
  flex: 1;
  min-width: 0;
  background: #101215;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text-dim);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
}

.copy-btn {
  flex: none;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.copy-btn:hover {
  border-color: var(--live);
  color: var(--live);
}

@media (max-width: 520px) {
  .topbar { padding: 18px; }
  .grid { padding: 18px; grid-template-columns: 1fr; }
}
