:root {
  --bg: #08150f;
  --bg2: #0f2b1f;
  --card: rgba(255, 255, 255, 0.055);
  --card-hover: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f6f0e4;
  --muted: #b3c0b1;
  --gold: #e9c46a;
  --red: #d6454b;
  --green: #3fb27f;
  --radius: 18px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1100px 560px at 50% -10%, #1d5139 0%, transparent 62%),
    linear-gradient(180deg, var(--bg2), var(--bg));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

#snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

main {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 90px;
}

.hidden { display: none !important; }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; margin: 0; letter-spacing: 0.01em; }

/* ---------- panels, inputs, buttons ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
}

input[type='text'],
input[type='password'] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 13px 14px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input::placeholder { color: rgba(246, 240, 228, 0.4); }

input:focus-visible {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(233, 196, 106, 0.2);
}

.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 12px;
  padding: 13px 20px;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn.primary { color: #2a1b00; background: linear-gradient(180deg, #f3d47f, var(--gold)); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.14); }

.link {
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 4px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link:hover { color: var(--text); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.error { color: #ff9a9d; min-height: 1.2em; margin: 14px 0 0; font-size: 0.9rem; }

/* ---------- login ---------- */
.login {
  max-width: 420px;
  margin: 8vh auto 0;
  text-align: center;
  padding: 32px 24px;
}
.login .tree { font-size: 3.4rem; line-height: 1; margin-bottom: 8px; filter: drop-shadow(0 6px 16px rgba(63, 178, 127, 0.35)); }
.login h1 { font-size: 2.1rem; }
.sub { color: var(--muted); margin: 6px 0 24px; }
.login form { text-align: left; }
.login .btn { width: 100%; margin-top: 4px; }
.ask { font-family: var(--serif); font-size: 1.2rem; margin: 0 0 12px; text-align: center; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.login .chips { justify-content: center; margin-bottom: 18px; }

.chip {
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 15px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.chip:hover { background: rgba(255, 255, 255, 0.13); }
.chip.active { color: #2a1b00; background: var(--gold); border-color: var(--gold); font-weight: 600; }

/* ---------- top bar ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 4px;
}
.brand { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; }
.who { font-size: 0.9rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.who #me { color: var(--gold); font-weight: 600; }

/* ---------- countdown ---------- */
.hero { text-align: center; padding: 26px 0 22px; }
.eyebrow { margin: 0 0 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.75rem; }

.countdown { display: flex; justify-content: center; gap: 10px; }
.countdown div {
  min-width: 70px;
  padding: 14px 8px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.countdown b {
  display: block;
  font-family: var(--serif);
  font-size: 2.1rem;
  line-height: 1.1;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.countdown span { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

.merry { font-family: var(--serif); font-size: 2rem; margin: 8px 0 0; color: var(--gold); }

/* ---------- add form ---------- */
.add h2 { font-size: 1.15rem; margin-bottom: 14px; }
.add form { display: grid; gap: 10px; }
.add input { margin-top: 0 !important; }
.add .btn { justify-self: end; }

/* ---------- filters ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 6px;
}
.toggle { display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; }
.toggle input { accent-color: var(--gold); width: 18px; height: 18px; }

/* ---------- lists ---------- */
.person { margin-top: 26px; }
.person-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.person-head h3 { font-size: 1.4rem; }
.person-head .count { color: var(--muted); font-size: 0.85rem; }
.person.me h3 { color: var(--gold); }
.hint { margin: 0 0 10px; font-size: 0.82rem; color: var(--muted); }
.empty { color: var(--muted); font-style: italic; padding: 14px 4px; }

.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: background 0.15s, opacity 0.2s;
}
.item:hover { background: var(--card-hover); }

.check { margin: 2px 0 0; flex: none; }
.check input { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; margin: 0; border-radius: 8px; border: 2px solid rgba(255,255,255,0.35); background: transparent; cursor: pointer; display: grid; place-items: center; transition: all 0.15s; }
.check input:checked { background: var(--green); border-color: var(--green); }
.check input:checked::after { content: '✓'; color: #04180f; font-weight: 700; font-size: 15px; line-height: 1; }
.check input:disabled { cursor: not-allowed; opacity: 0.55; }

.spark { flex: none; width: 24px; text-align: center; margin-top: 1px; }

.body { flex: 1; min-width: 0; }
.title { font-weight: 600; overflow-wrap: anywhere; }
.note { margin-top: 3px; color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.note a { color: var(--gold); text-underline-offset: 3px; }
.meta { margin-top: 6px; font-size: 0.78rem; color: var(--green); }

.item.done .title { text-decoration: line-through; text-decoration-color: rgba(255,255,255,0.4); }
.item.done { opacity: 0.6; }

.actions { display: flex; gap: 2px; flex: none; }
.icon-btn {
  font: inherit;
  font-size: 1rem;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,0.09); }
.icon-btn.danger:hover { color: #ff9a9d; }

/* ---------- dialog ---------- */
dialog {
  width: min(92vw, 440px);
  color: var(--text);
  background: #12281e;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px); }
dialog h2 { font-size: 1.3rem; margin-bottom: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  max-width: 90vw;
  padding: 12px 18px;
  color: var(--text);
  background: #1b3a2b;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 480px) {
  .countdown { gap: 7px; }
  .countdown div { min-width: 0; flex: 1; padding: 12px 4px 8px; }
  .countdown b { font-size: 1.6rem; }
  .add .btn { justify-self: stretch; }
}

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