:root {
  --background: #07110d;
  --background-light: #0b1812;

  --surface: rgba(16, 30, 23, 0.92);
  --surface-light: #15271e;
  --surface-hover: #1a3025;

  --border: rgba(255, 255, 255, 0.09);
  --border-light: rgba(255, 255, 255, 0.14);

  --text: #f8fafc;
  --muted: #9cad9f;

  --red: #dc2626;
  --red-light: #ef4444;
  --red-dark: #991b1b;

  --green: #166534;
  --green-light: #22c55e;

  --gold: #f5c451;
  --gold-light: #fde68a;

  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;

  background:
    radial-gradient(
      circle at 50% -10%,
      rgba(220, 38, 38, 0.18),
      transparent 35%
    ),
    radial-gradient(
      circle at 100% 30%,
      rgba(22, 101, 52, 0.14),
      transparent 30%
    ),
    var(--background);

  color: var(--text);

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

body::before {
  content: "";

  position: fixed;
  inset: 0;

  pointer-events: none;

  opacity: 0.45;

  background-image: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.7) 1px,
    transparent 1px
  );

  background-size: 70px 70px;
  background-position: 0 0;

  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.container {
  position: relative;
  z-index: 1;

  width: min(920px, calc(100% - 32px));

  margin: 0 auto;

  padding: 50px 0 80px;
}

/* =========================================================
           HEADER
        ========================================================= */

.header {
  position: relative;

  margin-bottom: 36px;

  text-align: center;
}

.christmas-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  margin-bottom: 18px;
  padding: 7px 12px;

  border: 1px solid rgba(245, 196, 81, 0.22);
  border-radius: 999px;

  background: rgba(245, 196, 81, 0.07);

  color: var(--gold-light);

  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

h1 {
  margin: 0 0 14px;

  font-size: clamp(42px, 8vw, 70px);

  line-height: 0.98;

  letter-spacing: -0.06em;
}

h1 .red {
  color: var(--red-light);
}

.header p {
  max-width: 600px;

  margin: 0 auto;

  color: var(--muted);

  font-size: 16px;
  line-height: 1.65;
}

/* =========================================================
           PANELS
        ========================================================= */

.panel {
  position: relative;

  margin-bottom: 18px;
  padding: 24px;

  border: 1px solid var(--border);
  border-radius: var(--radius);

  background: linear-gradient(
    145deg,
    rgba(20, 38, 29, 0.96),
    rgba(10, 21, 15, 0.96)
  );

  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.16);
}

.panel::before {
  content: "";

  position: absolute;

  top: 0;
  left: 24px;
  right: 24px;

  height: 1px;

  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.12),
    transparent
  );
}

.panel-header {
  margin-bottom: 22px;
}

.panel-header h2 {
  margin: 0 0 6px;

  font-size: 20px;

  letter-spacing: -0.02em;
}

.panel-header p {
  margin: 0;

  color: var(--muted);

  font-size: 14px;
  line-height: 1.55;
}

/* =========================================================
           FORM
        ========================================================= */

.form-grid {
  display: grid;

  grid-template-columns: 1.5fr 1fr;

  gap: 14px;

  margin-bottom: 22px;
}

.field {
  min-width: 0;
}

.field-label {
  display: block;

  margin-bottom: 8px;

  color: #d7e2db;

  font-size: 13px;
  font-weight: 700;
}

.input-wrapper {
  position: relative;
}

.input-wrapper .icon {
  position: absolute;

  top: 50%;
  left: 14px;

  transform: translateY(-50%);

  pointer-events: none;
}

input[type="text"],
input[type="number"] {
  width: 100%;

  min-height: 46px;

  padding: 11px 14px 11px 42px;

  border: 1px solid var(--border-light);
  border-radius: 10px;

  outline: none;

  background: #09150f;

  color: var(--text);

  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

input[type="number"] {
  padding-left: 42px;
}

input::placeholder {
  color: #65776b;
}

input:focus {
  border-color: rgba(239, 68, 68, 0.7);

  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

/* =========================================================
           BUTTONS
        ========================================================= */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  min-height: 44px;

  padding: 10px 16px;

  border: 1px solid var(--border-light);
  border-radius: 10px;

  background: var(--surface-light);

  color: var(--text);

  font-weight: 700;

  transition:
    transform 0.15s,
    background 0.2s,
    border-color 0.2s;
}

.button:hover {
  border-color: rgba(255, 255, 255, 0.2);

  background: var(--surface-hover);

  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button-primary {
  border-color: var(--red);

  background: linear-gradient(135deg, var(--red-light), var(--red-dark));

  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.18);
}

.button-primary:hover {
  border-color: var(--red-light);

  background: linear-gradient(135deg, #f04444, #a51d1d);
}

.button-gold {
  border-color: rgba(245, 196, 81, 0.35);

  background: rgba(245, 196, 81, 0.08);

  color: var(--gold-light);
}

.button-danger {
  min-height: 34px;

  padding: 6px 10px;

  color: #fca5a5;
}

/* =========================================================
           PARTICIPANTS
        ========================================================= */

.add-form {
  display: grid;

  grid-template-columns: 1fr auto;

  gap: 10px;

  margin-bottom: 16px;
}

.participants {
  display: grid;

  gap: 8px;
}

.participant {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 12px;

  padding: 11px 12px;

  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;

  background: rgba(6, 17, 11, 0.6);
}

.participant-name {
  display: flex;
  align-items: center;

  min-width: 0;
}

.participant-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 28px;
  height: 28px;

  margin-right: 10px;

  border-radius: 8px;

  background: rgba(255, 255, 255, 0.05);

  color: var(--muted);

  font-size: 11px;
  font-weight: 700;
}

.participant-text {
  overflow: hidden;

  text-overflow: ellipsis;
  white-space: nowrap;

  font-weight: 600;
}

.empty {
  padding: 22px;

  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 10px;

  color: var(--muted);

  font-size: 14px;

  text-align: center;
}

.counter {
  margin-top: 12px;

  color: var(--muted);

  font-size: 12px;
}

.counter strong {
  color: var(--text);
}

/* =========================================================
           MATRIX
        ========================================================= */

.matrix-container {
  overflow-x: auto;

  border: 1px solid var(--border);
  border-radius: 12px;
}

.matrix {
  width: 100%;
  min-width: 600px;

  border-collapse: collapse;
}

.matrix th,
.matrix td {
  padding: 11px 10px;

  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);

  font-size: 13px;

  text-align: center;
}

.matrix th:last-child,
.matrix td:last-child {
  border-right: 0;
}

.matrix tbody tr:last-child td {
  border-bottom: 0;
}

.matrix th {
  background: #0a1710;

  color: var(--muted);

  font-weight: 700;
}

.matrix .participant-column {
  min-width: 140px;

  text-align: left;
}

.matrix input[type="checkbox"] {
  width: 18px;
  height: 18px;

  margin: 0;

  accent-color: var(--red);

  cursor: pointer;
}

.matrix input[type="checkbox"]:disabled {
  cursor: not-allowed;

  opacity: 0.2;
}

.self-cell {
  background: rgba(255, 255, 255, 0.015);
}

/* =========================================================
           MESSAGES
        ========================================================= */

.message {
  display: none;

  margin-top: 14px;

  padding: 12px 14px;

  border-radius: 10px;

  font-size: 14px;

  line-height: 1.5;
}

.message.show {
  display: block;
}

.message.error {
  border: 1px solid rgba(239, 68, 68, 0.3);

  background: rgba(239, 68, 68, 0.08);

  color: #fecaca;
}

.message.success {
  border: 1px solid rgba(34, 197, 94, 0.25);

  background: rgba(34, 197, 94, 0.07);

  color: #bbf7d0;
}

/* =========================================================
           ACTIONS
        ========================================================= */

.actions {
  display: flex;
  flex-wrap: wrap;

  gap: 10px;

  margin-top: 20px;
}

/* =========================================================
           RESULTS
        ========================================================= */

.results {
  display: none;
}

.results.visible {
  display: block;

  animation: resultAppear 0.45s ease;
}

@keyframes resultAppear {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 20px;
}

.result-title-icon {
  font-size: 26px;
}

.result-list {
  overflow: hidden;

  border: 1px solid var(--border);

  border-radius: 12px;
}

.result-row {
  display: grid;

  grid-template-columns: 1fr 40px 1fr;

  align-items: center;

  gap: 10px;

  padding: 15px 18px;

  border-bottom: 1px solid var(--border);

  background: rgba(7, 18, 12, 0.7);
}

.result-row:nth-child(even) {
  background: rgba(16, 30, 23, 0.7);
}

.result-row:last-child {
  border-bottom: 0;
}

.result-person {
  font-weight: 700;
}

.result-arrow {
  color: var(--gold);

  font-size: 18px;

  text-align: center;
}

.result-target {
  color: #e5efe8;

  font-weight: 700;
}

.budget-display {
  display: inline-flex;
  align-items: center;
  gap: 7px;

  margin-bottom: 18px;
  padding: 8px 12px;

  border: 1px solid rgba(245, 196, 81, 0.18);
  border-radius: 999px;

  background: rgba(245, 196, 81, 0.06);

  color: var(--gold-light);

  font-size: 13px;
  font-weight: 700;
}

.privacy {
  margin-top: 14px;

  color: var(--muted);

  font-size: 12px;

  text-align: center;
}

/* =========================================================
           FOOTER
        ========================================================= */

footer {
  margin-top: 36px;

  color: #607168;

  font-size: 12px;

  text-align: center;
}

footer span {
  color: var(--red-light);
}

/* =========================================================
           MOBILE
        ========================================================= */

@media (max-width: 650px) {
  .container {
    width: min(100% - 20px, 920px);

    padding-top: 30px;
  }

  .panel {
    padding: 18px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .add-form {
    grid-template-columns: 1fr;
  }

  .add-form .button {
    width: 100%;
  }

  .actions {
    flex-direction: column;
  }

  .actions .button {
    width: 100%;
  }

  .result-header {
    align-items: center;
  }

  .result-row {
    grid-template-columns: 1fr 24px 1fr;

    padding: 14px 12px;

    font-size: 14px;
  }

  h1 {
    font-size: 46px;
  }
}

/* =========================================================
   EXCLUSIONS MOBILE
========================================================= */

.exclusions-mobile {
  display: none;
}

.exclusion-person {
  margin-bottom: 12px;

  padding: 16px;

  border: 1px solid var(--border);
  border-radius: 14px;

  background: rgba(7, 18, 12, 0.65);
}

.exclusion-person:last-child {
  margin-bottom: 0;
}

.exclusion-person-header {
  display: flex;
  align-items: center;
  gap: 10px;

  margin-bottom: 14px;
}

.exclusion-person-icon {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 34px;
  height: 34px;

  flex-shrink: 0;

  border-radius: 9px;

  background: rgba(220, 38, 38, 0.1);

  font-size: 16px;
}

.exclusion-person-name {
  font-weight: 700;
}

.exclusion-label {
  display: flex;
  align-items: center;
  gap: 11px;

  min-height: 44px;

  padding: 8px 10px;

  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 9px;

  background: rgba(255, 255, 255, 0.025);

  cursor: pointer;

  transition:
    background 0.15s,
    border-color 0.15s;
}

.exclusion-label + .exclusion-label {
  margin-top: 7px;
}

.exclusion-label:has(input:checked) {
  border-color: rgba(220, 38, 38, 0.35);

  background: rgba(220, 38, 38, 0.08);
}

.exclusion-label input {
  width: 20px;
  height: 20px;

  flex-shrink: 0;

  margin: 0;

  accent-color: var(--red);
}

.exclusion-label span {
  font-size: 14px;
  font-weight: 600;
}

.exclusion-hint {
  margin-top: 4px;

  color: var(--muted);

  font-size: 12px;
}

@media (max-width: 650px) {
  .exclusions-desktop {
    display: none;
  }

  .exclusions-mobile {
    display: block;
  }
}
