/* ===== Weihnachtliches Design: Tannengrün, Kerzenrot, Gold, Creme ===== */
:root {
  --green-950: #0b261c;
  --green-900: #12372a;
  --green-800: #1a4a39;
  --green-700: #245f4a;
  --red: #b3262e;
  --red-dark: #8f1d24;
  --gold: #d6ac55;
  --gold-soft: #f0dca6;
  --cream: #fbf6ea;
  --cream-2: #f3ebd8;
  --ink: #2a2a24;
  --ink-soft: #6a6a5e;
  --line: #e4d9bd;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden], .hidden { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(214, 172, 85, 0.16), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(179, 38, 46, 0.18), transparent 60%),
    linear-gradient(180deg, var(--green-900), var(--green-950));
  background-attachment: fixed;
}

h1, h2 { font-family: var(--serif); font-weight: 700; margin: 0 0 0.35rem; letter-spacing: 0.2px; }
h1 { font-size: 2rem; }
h2 { font-size: 1.55rem; color: var(--green-900); }
.muted { color: var(--ink-soft); margin: 0 0 1.1rem; }
.error { color: var(--red-dark); min-height: 1.3em; margin: 0; font-size: 0.95rem; font-weight: 600; }

/* ===== Schnee ===== */
#snow { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.flake {
  position: absolute; top: -10vh; color: #fff; opacity: 0;
  animation: fall linear infinite;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}
@keyframes fall {
  0%   { transform: translate3d(0, -10vh, 0); opacity: 0; }
  10%  { opacity: var(--o, 0.6); }
  100% { transform: translate3d(var(--drift, 30px), 110vh, 0); opacity: var(--o, 0.6); }
}
@media (prefers-reduced-motion: reduce) { #snow { display: none; } }

#app-view, .auth { position: relative; z-index: 1; }

/* ===== Karten & Formulare ===== */
.card {
  background: var(--cream);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.6rem;
  border: 1px solid rgba(214, 172, 85, 0.55);
  position: relative;
}
.card::before { /* feine goldene Innenlinie */
  content: ""; position: absolute; inset: 6px; border-radius: 13px;
  border: 1px dashed rgba(214, 172, 85, 0.45); pointer-events: none;
}
.card > * { position: relative; }

.stack { display: grid; gap: 0.9rem; }
label > span { display: block; font-size: 0.85rem; font-weight: 700; color: var(--green-800); margin-bottom: 0.25rem; }

input[type="text"], input[type="password"] {
  width: 100%;
  font: inherit;
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus, input[type="password"]:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(214, 172, 85, 0.25);
}
input::placeholder { color: #a9a38f; }

.btn {
  font: inherit; font-weight: 700; cursor: pointer;
  padding: 0.7rem 1.2rem; border-radius: 12px; border: 1.5px solid transparent;
  transition: transform 0.1s, background 0.15s, box-shadow 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--red); color: #fff; box-shadow: 0 3px 0 var(--red-dark); }
.btn.primary:hover { background: #c22d36; }
.btn.ghost { background: transparent; color: var(--gold-soft); border-color: rgba(240, 220, 166, 0.5); }
.btn.ghost:hover { background: rgba(240, 220, 166, 0.12); }
.btn.small { padding: 0.4rem 0.8rem; font-size: 0.9rem; }
.btn.outline { background: #fff; color: var(--green-800); border-color: var(--green-700); }
.btn.outline:hover { background: var(--green-800); color: #fff; }
.btn.danger { background: #fff; color: var(--red-dark); border-color: #e3b7ba; }
.btn.danger:hover { background: var(--red); color: #fff; }
button:focus-visible, .check input:focus-visible, .chip:focus-visible, .tab:focus-visible {
  outline: 3px solid var(--gold); outline-offset: 2px;
}

.note {
  background: var(--cream-2); border-radius: 12px; padding: 0.8rem 1rem;
  color: var(--ink-soft); font-size: 0.93rem; margin: 1rem 0 0;
}
.note.secret { border-left: 4px solid var(--gold); }

/* ===== Anmeldung ===== */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.2rem; }
.auth-card { width: 100%; max-width: 420px; text-align: center; }
.auth-card form { text-align: left; }
.auth-card h1 { color: var(--green-900); }
.auth-icon { font-size: 3.2rem; line-height: 1; margin-bottom: 0.3rem; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2)); }
#login-form .btn, #setup-form .btn { width: 100%; padding: 0.85rem; font-size: 1.05rem; }

/* ===== Kopfzeile & Navigation ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11, 38, 28, 0.9);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--gold);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 1040px; margin: 0 auto; padding: 0.7rem 1.2rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { font-family: var(--serif); font-size: 1.35rem; color: var(--gold-soft); font-weight: 700; white-space: nowrap; }
.tabs { display: flex; gap: 0.4rem; }
.tab {
  font: inherit; font-weight: 700; color: #d9e6dd; background: transparent; border: 0; cursor: pointer;
  padding: 0.55rem 1rem; border-radius: 999px; display: flex; align-items: center; gap: 0.45rem;
  transition: background 0.15s, color 0.15s;
}
.tab:hover { background: rgba(255, 255, 255, 0.08); }
.tab.active { background: var(--gold); color: var(--green-950); }
.user { display: flex; align-items: center; gap: 0.7rem; }
.user-name { color: var(--gold-soft); font-weight: 700; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.container { max-width: 1040px; margin: 0 auto; padding: 1.6rem 1.2rem 3rem; }
.page { animation: rise 0.3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.check { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font-weight: 600; color: var(--green-800); }
.check span { margin: 0; font-size: 0.95rem; }
.check input { width: 1.2rem; height: 1.2rem; accent-color: var(--red); }

/* ===== Meine Wünsche ===== */
.wish-list { display: grid; gap: 0.7rem; margin-top: 0.4rem; }
.wish-row { display: flex; align-items: center; gap: 0.6rem; animation: rise 0.25s ease; }
.wish-row .bullet {
  flex: none; width: 2.1rem; height: 2.1rem; display: grid; place-items: center;
  border-radius: 50%; background: var(--cream-2); font-size: 1.05rem;
}
.wish-row.filled .bullet { background: var(--gold-soft); }
.wish-row input { flex: 1; min-width: 0; }
.wish-row .state { flex: none; width: 1.3rem; text-align: center; color: var(--green-700); font-weight: 800; opacity: 0; transition: opacity 0.2s; }
.wish-row .state.show { opacity: 1; }
.wish-row .del {
  flex: none; width: 2.4rem; height: 2.4rem; border-radius: 10px; cursor: pointer;
  border: 1.5px solid transparent; background: transparent; color: #b9a98a; font-size: 1.1rem;
}
.wish-row .del:hover { color: var(--red); border-color: #e3b7ba; background: #fff; }
.wish-row .del.invisible { visibility: hidden; }

/* ===== Übersicht ===== */
.chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.4rem 0 1.1rem; }
.chip {
  font: inherit; font-weight: 700; font-size: 0.92rem; cursor: pointer;
  padding: 0.35rem 0.9rem; border-radius: 999px;
  background: #fff; color: var(--green-800); border: 1.5px solid var(--line);
}
.chip:hover { border-color: var(--green-700); }
.chip.active { background: var(--green-800); color: #fff; border-color: var(--green-800); }

.wish-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.wish-table th {
  text-align: left; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-soft); padding: 0 1rem 0.2rem;
}
.wish-table td { background: #fff; padding: 0.8rem 1rem; vertical-align: middle; }
.wish-table td:first-child { border-radius: 12px 0 0 12px; border-left: 6px solid var(--pc, var(--green-700)); width: 22%; }
.wish-table td:last-child { border-radius: 0 12px 12px 0; text-align: right; width: 30%; }
.who { font-weight: 800; color: var(--green-900); }
.what { font-size: 1.05rem; overflow-wrap: anywhere; }
.cell-action { display: flex; align-items: center; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; }

.badge { display: inline-block; font-size: 0.85rem; font-weight: 700; padding: 0.25rem 0.7rem; border-radius: 999px; }
.badge.mine { background: #dff0e4; color: #1d6a3a; }
.badge.other { background: var(--cream-2); color: var(--ink-soft); }
.badge.free { background: #fff2cf; color: #8a6414; }
tr.is-taken .what { color: var(--ink-soft); }

.p0 { --pc: #b3262e; } .p1 { --pc: #245f4a; } .p2 { --pc: #d6ac55; }
.p3 { --pc: #6b4f9e; } .p4 { --pc: #2f7fa8; } .p5 { --pc: #c4673d; }

.empty { text-align: center; padding: 2rem 1rem; color: var(--ink-soft); }
.empty .big { font-size: 2.6rem; display: block; margin-bottom: 0.3rem; }

/* ===== Einstellungen ===== */
.inline-form { display: flex; gap: 0.6rem; margin-bottom: 0.4rem; }
.inline-form input { flex: 1; min-width: 0; }
.person-list { list-style: none; padding: 0; margin: 0.6rem 0 0; display: grid; gap: 0.5rem; }
.person-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  background: #fff; border-radius: 12px; padding: 0.6rem 0.9rem; border-left: 6px solid var(--pc, var(--green-700));
}
.person-list .pname { font-weight: 700; color: var(--green-900); overflow-wrap: anywhere; }
.you { font-size: 0.8rem; color: var(--ink-soft); font-weight: 600; margin-left: 0.4rem; }

/* ===== Hinweis-Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 5.5rem; transform: translate(-50%, 20px);
  background: var(--green-950); color: #fff; padding: 0.7rem 1.2rem; border-radius: 999px;
  border: 1.5px solid var(--gold); box-shadow: var(--shadow); font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; z-index: 50; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--red-dark); }

/* ===== Handy ===== */
@media (max-width: 760px) {
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.35rem; }
  .card { padding: 1.2rem 1rem; }
  .container { padding: 1rem 0.8rem 7rem; }

  /* Wichtig: backdrop-filter würde die untere Menüleiste an der Kopfzeile "festhalten" */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--green-950); }
  .topbar-inner { padding: 0.55rem 0.9rem; }
  .brand { font-size: 1.15rem; }
  .user-name { max-width: 9ch; }

  /* Navigation als untere Leiste */
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(11, 38, 28, 0.96); border-top: 2px solid var(--gold);
    padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom));
    justify-content: space-around; gap: 0.2rem;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  }
  .tab { flex: 1; flex-direction: column; gap: 0.1rem; border-radius: 14px; padding: 0.4rem 0.2rem; font-size: 0.78rem; }
  .tab-ico { font-size: 1.3rem; line-height: 1.2; }
  .toast { bottom: 6rem; }

  /* Tabelle wird zu Karten */
  .wish-table, .wish-table tbody, .wish-table tr, .wish-table td { display: block; width: 100%; }
  .wish-table thead { display: none; }
  .wish-table tr {
    background: #fff; border-radius: 14px; margin-bottom: 0.7rem; padding: 0.8rem 0.9rem;
    border-left: 6px solid var(--pc, var(--green-700)); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  }
  .wish-table td, .wish-table td:first-child, .wish-table td:last-child {
    padding: 0; border: 0; border-radius: 0; width: 100%; text-align: left; background: transparent;
  }
  .wish-table td.who { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-soft); }
  .wish-table td.what { font-size: 1.15rem; margin: 0.15rem 0 0.6rem; }
  .cell-action { justify-content: space-between; }
  .cell-action .btn { padding: 0.55rem 1rem; }

  .inline-form { flex-direction: column; }
}
