/* Orion Lists – dark theme, mobile-first, zero frameworks */

:root {
  --bg: #121212;
  --surface: #1e1e1e;
  --surface-2: #262626;
  --border: #333;
  --text: #e0e0e0;
  --text-dim: #8a8a8a;
  --accent: #64ffda;
  --accent-ink: #06231c;
  --danger: #ef5350;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* ── top bar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.logo { font-weight: 700; letter-spacing: 0.3px; }

.conn { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); }
.conn-on  { color: var(--accent); border-color: var(--accent); }
.conn-off { color: var(--danger); border-color: var(--danger); }

/* ── views ── */
.view {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

/* ── input rows ── */
.input-row { display: flex; gap: 8px; margin-bottom: 16px; }

.input-row input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px; /* ≥16px prevents iOS zoom-on-focus */
}
.input-row input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.input-row input::placeholder { color: var(--text-dim); }

.input-row button {
  padding: 12px 20px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.input-row button:active { transform: scale(0.97); }

/* ── home: list cards ── */
.cards { list-style: none; display: grid; gap: 10px; }

.cards li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cards li:active { background: var(--surface-2); }
.cards li .name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cards li.pinned { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.cards li .chev { color: var(--text-dim); flex: none; }
.cards li .pin {
  flex: none; background: none; border: 0;
  font-size: 17px; padding: 4px 6px; cursor: pointer; border-radius: 8px;
  opacity: 0.35; filter: grayscale(1);
  -webkit-tap-highlight-color: transparent;
}
.cards li .pin:hover { opacity: 0.8; }
.cards li.pinned .pin { opacity: 1; filter: none; }
.cards li .del-list {
  flex: none; background: none; border: 0; color: var(--text-dim);
  font-size: 18px; padding: 4px 8px; cursor: pointer; border-radius: 8px;
}
.cards li .del-list:hover { color: var(--danger); }

/* ── list view ── */
.list-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }

.back {
  flex: none;
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
}

#listTitle {
  flex: 1; min-width: 0;
  font-size: 20px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.count { flex: none; font-size: 12px; color: var(--text-dim); }

.edit-btn {
  flex: none;
  min-width: 40px; height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.edit-btn.save {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 700;
  font-size: 14px;
}

.title-input {
  flex: 1; min-width: 0;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
}
.title-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

#itemsContainer { list-style: none; display: grid; gap: 8px; }

#itemsContainer li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#itemsContainer li:active { background: var(--surface-2); }

.check {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--text-dim);
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--accent-ink);
}
li.done .check { background: var(--accent); border-color: var(--accent); }

.text { flex: 1; min-width: 0; word-break: break-word; }

li.done .text { text-decoration: line-through; opacity: 0.6; }

.del {
  flex: none;
  background: none; border: 0;
  color: var(--text-dim);
  font-size: 18px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 8px;
}
.del:hover { color: var(--danger); }

/* ── misc ── */
.empty { color: var(--text-dim); text-align: center; padding: 32px 8px; }

/* ── auth overlay ── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 16px;
}
.auth-overlay[hidden] { display: none; }

.auth-card {
  width: min(92vw, 360px);
  display: grid;
  gap: 12px;
  padding: 28px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.auth-logo { font-weight: 700; color: var(--text-dim); text-align: center; }
.auth-card h2 { font-size: 20px; text-align: center; }

.auth-card input {
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
}
.auth-card input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.auth-card input:disabled { opacity: 0.5; }

.auth-card button {
  padding: 12px 20px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.auth-card button:disabled { opacity: 0.4; cursor: default; }
.auth-card button:active:not(:disabled) { transform: scale(0.98); }

.auth-hint { font-size: 12px; color: var(--text-dim); text-align: center; min-height: 1em; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(92vw, 480px);
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--danger);
  color: #fff;
  font-size: 14px;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
