:root {
  --red: #a3171f;
  --red-dark: #7d1017;
  --green: #1e5b3a;
  --green-dark: #143f28;
  --gold: #d4a62a;
  --cream: #fffaf0;
  --ink: #222;
  --muted: #5b5b5b;
  --radius: 18px;
  --shadow: 0 4px 14px rgba(0, 0, 0, .12);
}

* { box-sizing: border-box; }
html { font-size: 20px; -webkit-text-size-adjust: 100%; }
@media (min-width: 700px) { html { font-size: 22px; } }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  line-height: 1.45;
  background-color: #f3ece0;
  background-image: url("/img/pattern.svg");
  background-size: 220px;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 1.2rem 1rem 3rem;
}

/* ---------- decorations ---------- */
.garland {
  position: relative;
  z-index: 1;
  height: 34px;
  background: url("/img/holly.svg") repeat-x center / auto 34px;
}

.snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.snow span {
  position: absolute;
  top: -2rem;
  color: #fff;
  opacity: .75;
  text-shadow: 0 0 3px rgba(0, 0, 0, .25);
  font-size: 1.1rem;
  animation: fall linear infinite;
}
.snow span:nth-child(1)  { left: 5%;  animation-duration: 14s; animation-delay: -2s; }
.snow span:nth-child(2)  { left: 15%; animation-duration: 18s; animation-delay: -9s; font-size: .8rem; }
.snow span:nth-child(3)  { left: 27%; animation-duration: 16s; animation-delay: -5s; }
.snow span:nth-child(4)  { left: 38%; animation-duration: 20s; animation-delay: -12s; font-size: .9rem; }
.snow span:nth-child(5)  { left: 50%; animation-duration: 15s; animation-delay: -1s; }
.snow span:nth-child(6)  { left: 62%; animation-duration: 19s; animation-delay: -7s; font-size: .8rem; }
.snow span:nth-child(7)  { left: 73%; animation-duration: 17s; animation-delay: -3s; }
.snow span:nth-child(8)  { left: 83%; animation-duration: 21s; animation-delay: -14s; font-size: .9rem; }
.snow span:nth-child(9)  { left: 92%; animation-duration: 16s; animation-delay: -10s; }
.snow span:nth-child(10) { left: 97%; animation-duration: 22s; animation-delay: -4s; font-size: .8rem; }
@keyframes fall {
  from { transform: translateY(0) rotate(0); }
  to   { transform: translateY(110vh) rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) { .snow { display: none; } }

/* ---------- typography ---------- */
h1, h2 { line-height: 1.2; }
h2 { font-size: 1.25rem; margin: 0 0 .6rem; color: var(--green-dark); }
.title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  color: var(--red);
  margin: .2rem 0 0;
  text-shadow: 0 2px 0 #fff;
}
.title-small { font-size: 2rem; }
.subtitle { font-size: 1.2rem; margin: .2rem 0 1.5rem; color: var(--green-dark); }
.help { color: var(--muted); margin: 0 0 .7rem; font-size: .9rem; }
.muted { color: var(--muted); }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 56px;
  padding: .6rem 1.3rem;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .05s, background-color .15s;
}
.btn:active { transform: translateY(2px); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 4px solid var(--gold);
  outline-offset: 2px;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-light { background: #fff; color: var(--red); border: 2px solid var(--red); }
.btn-danger { background: #fff; color: #9b1c1c; border: 2px solid #9b1c1c; }
.btn-big { width: 100%; min-height: 64px; font-size: 1.25rem; }
.btn-small { min-height: 48px; padding: .4rem 1rem; font-size: .95rem; }
.btn-link { background: none; box-shadow: none; color: var(--green-dark); text-decoration: underline; font-weight: 600; }

.big-input, textarea, select, .person-form input {
  width: 100%;
  font: inherit;
  font-size: 1.15rem;
  padding: .8rem 1rem;
  border: 3px solid #b9ac95;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
}
.big-input { min-height: 64px; }
textarea { resize: vertical; min-height: 9rem; line-height: 1.5; }
.big-label { display: block; font-size: 1.25rem; font-weight: 700; margin: .4rem 0 .5rem; }

/* ---------- alerts ---------- */
.alert { padding: .9rem 1rem; border-radius: 14px; margin: 0 0 1rem; font-weight: 600; }
.alert-error { background: #fde7e7; color: #8a1111; border: 2px solid #e5a3a3; }
.alert-ok { background: #e6f4ea; color: var(--green-dark); border: 2px solid #9fd1ae; }

/* ---------- home / login ---------- */
.home {
  min-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
}
.home-icon { width: 96px; height: 96px; }
.login-form, .change-form { width: 100%; }
.login-form {
  background: var(--cream);
  padding: 1.4rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-top: 8px solid var(--green);
  display: grid;
  gap: .8rem;
  text-align: left;
}
.login-form .big-label { text-align: center; }
.hello { font-size: 1.4rem; text-align: center; margin: 0; }
.change-form { margin-top: .8rem; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.topbar-hello { margin: 0; font-size: 1.2rem; }

/* ---------- personal page ---------- */
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
  margin-bottom: 1.2rem;
}
.card {
  min-height: 38vh;
  border-radius: var(--radius);
  padding: 1rem .8rem;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: var(--shadow);
  border: 4px solid rgba(255, 255, 255, .55);
  outline: 3px solid var(--gold);
  outline-offset: -10px;
}
.card-red { background: linear-gradient(160deg, #b81d26, var(--red-dark)); }
.card-green { background: linear-gradient(160deg, #267349, var(--green-dark)); }
.card-label { margin: 0 0 .6rem; font-size: clamp(.95rem, 4vw, 1.3rem); font-weight: 600; opacity: .95; }
.card-value {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(1.6rem, 8vw, 3rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.card-value-small { font-size: clamp(1rem, 4.5vw, 1.4rem); font-family: inherit; }

.box {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1.2rem;
  box-shadow: var(--shadow);
  border-left: 8px solid var(--green);
}
.box-readonly { border-left-color: var(--gold); }
.wishlist-text { white-space: pre-wrap; font-size: 1.15rem; overflow-wrap: anywhere; }
.note-actions { display: flex; align-items: center; gap: 1rem; margin-top: .7rem; flex-wrap: wrap; }
.note-actions .btn-big { width: auto; flex: 1 1 200px; }
.saved { color: var(--green); font-weight: 700; font-size: 1.15rem; opacity: 0; transition: opacity .3s; }
.saved.show { opacity: 1; }
.saved.error { color: #8a1111; }
.logout-bottom { margin-top: 1.5rem; }

/* ---------- admin ---------- */
.status { font-size: 1.1rem; font-weight: 600; }
.status-ok { color: var(--green); }
.row-form, .add-form, .excl-form { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row-form .big-input, .add-form .big-input { flex: 1 1 200px; width: auto; }
.excl-form select { flex: 1 1 160px; width: auto; min-height: 56px; }
.excl-and { font-weight: 700; }
.people, .excl-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.person {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: flex-end;
  padding: .8rem 0;
  border-top: 2px dashed #d8ccb4;
}
.person-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; flex: 1 1 400px; }
.person-form label { flex: 1 1 180px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.person-form input { font-size: 1rem; padding: .6rem .8rem; min-height: 48px; margin-top: .2rem; }
.excl-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .6rem;
  padding: .6rem 0;
  border-top: 2px dashed #d8ccb4;
  font-size: 1.1rem;
}

@media (max-width: 420px) {
  .container { padding: 1rem .7rem 2.5rem; }
  .cards { gap: .5rem; }
  .card { padding: .8rem .4rem; outline-offset: -8px; }
}
