:root {
  --bg: #fbf4ec;
  --surface: #ffffff;
  --surface-soft: #fff9f3;
  --ink: #241a17;
  --muted: #6f625c;
  --brand: #9b1c31;
  --brand-strong: #7a1426;
  --accent: #0f5132;
  --accent-soft: #e7f2ea;
  --line: #eadbd0;
  --danger: #a12222;
  --focus: #1d4ed8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 12px 30px rgba(74, 35, 25, 0.09);
  --max: 960px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17110f;
    --surface: #211816;
    --surface-soft: #271d1a;
    --ink: #f6ece6;
    --muted: #b8a79f;
    --brand: #ff6b81;
    --brand-strong: #ff8e9f;
    --accent: #7fd1a4;
    --accent-soft: #1b3327;
    --line: #3a2b26;
    --danger: #ff8b8b;
    --focus: #93c5fd;
    --shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(155, 28, 49, 0.1), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(15, 81, 50, 0.1), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

h1 {
  font-size: clamp(1.6rem, 4.2vw, 2.2rem);
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.15rem, 3vw, 1.35rem);
}

p {
  margin: 0 0 0.75rem;
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  padding: 0.6rem 1rem;
  z-index: 50;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* --- Nagłówek ---------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem clamp(1rem, 4vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--brand);
  background: var(--surface-soft);
}

.inline-form {
  display: inline;
  margin: 0;
}

.link-button {
  background: none;
  border: 0;
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-radius: 999px;
}

.link-button:hover {
  color: var(--brand);
  background: var(--surface-soft);
}

/* --- Układ ------------------------------------------------------------- */

.container {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 1.75rem 0 3rem;
  flex: 1;
}

.narrow {
  max-width: 560px;
  margin: 0 auto;
}

.grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 3vw, 1.5rem);
  margin-bottom: 1.25rem;
}

.card--accent {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), var(--surface));
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.hero {
  text-align: center;
  padding: clamp(1.5rem, 6vw, 3rem) 0 1rem;
}

.hero__emoji {
  font-size: clamp(2.5rem, 9vw, 4rem);
  margin: 0 0 0.5rem;
}

.hero .lead {
  margin-inline: auto;
  max-width: 46ch;
}

.hero__actions {
  margin-top: 1.25rem;
}

.lead {
  font-size: 1.05rem;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.hint {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.warning {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line));
  font-weight: 600;
}

.empty {
  text-align: center;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* --- Przyciski --------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.6rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.button:hover {
  background: var(--brand-strong);
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button--secondary {
  background: var(--accent);
  color: #fff;
  list-style: none;
}

.button--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.button--ghost:hover {
  background: var(--surface-soft);
}

.button--danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  color: var(--danger);
}

.button--danger:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

/* --- Formularze -------------------------------------------------------- */

.form {
  display: grid;
  gap: 0.9rem;
}

.form label {
  display: grid;
  gap: 0.3rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.form small {
  font-weight: 400;
  color: var(--muted);
}

.form-row {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

.checkbox {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500 !important;
}

.checkbox input {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
}

.form-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.form-inline select {
  width: auto;
  min-width: 140px;
}

/* --- Komunikaty -------------------------------------------------------- */

.flash {
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  font-weight: 600;
}

.flash--ok {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  color: var(--ink);
}

.flash--error {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  color: var(--ink);
}

/* --- Etykiety ---------------------------------------------------------- */

.pill {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  white-space: nowrap;
}

.pill--ok,
.pill--status-drawn {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  color: var(--accent);
}

.pill--waiting {
  background: color-mix(in srgb, #d97706 12%, var(--surface));
  border-color: color-mix(in srgb, #d97706 35%, var(--line));
  color: #a15c07;
}

.pill--status-open {
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 30%, var(--line));
  color: var(--brand);
}

.pill--must {
  background: color-mix(in srgb, var(--brand) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  color: var(--brand);
}

.pill--idea {
  background: var(--surface-soft);
}

/* --- Listy życzeń ------------------------------------------------------ */

.wishlist,
.people,
.exclusions,
.log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.wishlist__item {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.wishlist__main {
  flex: 1 1 240px;
  min-width: 0;
}

.wishlist__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.wishlist__notes {
  white-space: pre-line;
  color: var(--muted);
  font-size: 0.95rem;
}

.wishlist__actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.wishlist__actions .button {
  min-height: 38px;
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
}

.wishlist--readonly .wishlist__item {
  background: var(--surface);
}

/* --- Uczestnicy -------------------------------------------------------- */

.people__item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.people__main {
  display: grid;
  gap: 0.3rem;
  flex: 1 1 260px;
  min-width: 0;
}

.people__main > strong {
  font-size: 1.05rem;
}

.people__meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.9rem;
}

.people__actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.people__actions .button {
  min-height: 38px;
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
}

.copy-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

.copy-input {
  flex: 1 1 220px;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  background: var(--surface);
}

/* --- Wykluczenia i dziennik -------------------------------------------- */

.exclusions li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
}

.log {
  font-size: 0.9rem;
}

.log li {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
}

.log code {
  font-size: 0.82rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.05rem 0.4rem;
}

.facts {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 0.5rem 0;
}

.facts dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-weight: 700;
}

/* --- Odkrycie ---------------------------------------------------------- */

.reveal {
  text-align: center;
}

.reveal__label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.reveal__name {
  font-size: clamp(2rem, 8vw, 3.2rem);
  color: var(--brand);
  margin-bottom: 1rem;
}

.reveal .card {
  text-align: left;
}

/* --- Rozwijane sekcje -------------------------------------------------- */

.add-item {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.add-item > summary {
  cursor: pointer;
  width: fit-content;
}

.add-item[open] > summary {
  margin-bottom: 0.9rem;
}

/* --- Dodatki ----------------------------------------------------------- */

.inline {
  display: inline;
}

.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 560px) {
  .topbar {
    padding: 0.75rem 1rem;
  }

  .nav {
    width: 100%;
    justify-content: flex-start;
  }

  .people__actions,
  .wishlist__actions {
    width: 100%;
  }

  .people__actions .button,
  .wishlist__actions .button {
    flex: 1 1 auto;
  }
}

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

/* --- Listy losowań ----------------------------------------------------- */

.breadcrumb {
  margin-bottom: 0.75rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--brand);
}

.events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}

.events--compact {
  gap: 0.4rem;
}

.event-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.event-card__head h2 {
  margin-bottom: 0.2rem;
}

.event-card__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.event-card__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.event-card__row a {
  font-weight: 700;
}

.event-card__main {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.pill--status-archived {
  background: var(--surface-soft);
  color: var(--muted);
}

.nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 4px;
}
