:root {
  --berry: #b3202a;
  --berry-dark: #8a1820;
  --pine: #1f5e3b;
  --pine-dark: #143f28;
  --gold: #e8b14a;
  --snow: #fffaf3;
  --cream: #fbf1e3;
  --cocoa: #3b2a24;
  --muted: #7a6a62;
  --radius: 18px;
  --shadow: 0 18px 40px rgba(20, 10, 5, 0.35);
  --font: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Georgia", "Times New Roman", serif;
}

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

html {
  min-height: 100%;
  background: radial-gradient(circle at 20% 0%, #2b7a4f 0%, var(--pine) 35%, var(--pine-dark) 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--cocoa);
  line-height: 1.55;
}

a {
  color: var(--berry);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: repeating-linear-gradient(-45deg, var(--berry) 0 18px, var(--berry-dark) 18px 36px);
  box-shadow: 0 4px 0 var(--gold), 0 10px 24px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--snow);
  text-decoration: none;
}

.brand-tree {
  font-size: 2.4rem;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}

.brand-name {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: bold;
  letter-spacing: 0.02em;
}

.brand-tagline {
  display: block;
  font-size: 0.85rem;
  opacity: 0.9;
}

.language-switch {
  display: flex;
  gap: 0.25rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 999px;
  padding: 0.25rem;
}

.language-switch a {
  color: var(--snow);
  text-decoration: none;
  font-weight: bold;
  font-size: 0.85rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

.language-switch a[aria-current="true"] {
  background: var(--snow);
  color: var(--berry);
}

.page {
  flex: 1;
  width: min(100% - 2rem, 860px);
  margin: 2.5rem auto;
  position: relative;
  z-index: 1;
}

.site-footer {
  text-align: center;
  color: var(--cream);
  padding: 1.5rem;
  font-size: 0.9rem;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--snow);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.5rem, 4vw, 2.75rem);
  border: 6px solid var(--snow);
  outline: 3px dashed var(--berry);
  outline-offset: -14px;
  margin-bottom: 2rem;
}

.card-hero {
  text-align: center;
}

.card-ornament {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

h1,
h2 {
  font-family: var(--font-display);
  color: var(--berry);
  margin: 0 0 0.75rem;
  line-height: 1.2;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.lead {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 38rem;
  margin-inline: auto;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.6rem;
  font: inherit;
  font-weight: bold;
  color: var(--snow);
  background: linear-gradient(180deg, var(--berry), var(--berry-dark));
  box-shadow: 0 4px 0 #5e1015;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

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

.button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #5e1015;
}

.button:focus-visible,
.language-switch a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.button-quiet {
  color: var(--pine);
  background: var(--cream);
  box-shadow: 0 3px 0 #d8c7b0;
  padding: 0.5rem 1.1rem;
}

.card-narrow {
  max-width: 30rem;
  margin-inline: auto;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.card-heading h1 {
  margin: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.stack .button {
  align-self: flex-start;
  margin-top: 0.5rem;
}

label {
  font-weight: bold;
  color: var(--pine);
}

input,
textarea {
  font: inherit;
  color: var(--cocoa);
  background: #fff;
  border: 2px solid #e2d3bf;
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  width: 100%;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--pine);
  box-shadow: 0 0 0 4px rgba(31, 94, 59, 0.18);
}

.alert {
  background: #fde8e8;
  color: var(--berry-dark);
  border-left: 6px solid var(--berry);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-weight: bold;
}

.alert p {
  margin: 0 0 0.4rem;
}

.alert ul {
  margin: 0;
  padding-left: 1.2rem;
  font-weight: normal;
}

.hint {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}

.how-to {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.how-to h2 {
  font-size: 1.3rem;
}

.how-to-steps {
  margin: 0;
  padding-left: 1.2rem;
}

.how-to-steps li {
  margin-bottom: 0.35rem;
}

.how-to-steps li::marker {
  content: "❄  ";
  color: var(--pine);
}

.example {
  margin: 0;
  background: var(--cream);
  border-radius: 14px;
  padding: 1rem 1.2rem;
  border: 2px dashed var(--gold);
}

.example figcaption {
  font-weight: bold;
  color: var(--pine);
  margin-bottom: 0.4rem;
}

.example pre {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  line-height: 1.6;
  background: #fff;
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
}

.example p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.name-participant {
  color: var(--pine);
  font-weight: bold;
}

.name-excluded {
  color: var(--berry);
}

.details {
  border: 2px solid #efe2cf;
  border-radius: 14px;
  padding: 1rem 1.2rem 1.2rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.details legend {
  font-weight: bold;
  color: var(--berry);
  padding: 0 0.4rem;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.8rem;
}

.participants-input {
  font-family: ui-monospace, "Cascadia Mono", "Fira Code", Menlo, monospace;
  font-size: 1rem;
  line-height: 1.6;
  min-height: 16rem;
  resize: vertical;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.legend-problem {
  text-decoration: wavy underline #d0021b;
  text-underline-offset: 3px;
}

/* The backdrop repeats the textarea's text in colour; both must share every metric. */
.highlighter {
  position: relative;
  background: #fff;
  border-radius: 12px;
}

.highlighter-backdrop,
.highlighter .participants-input {
  font-family: ui-monospace, "Cascadia Mono", "Fira Code", Menlo, monospace;
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: normal;
  tab-size: 4;
  padding: 0.65rem 0.9rem;
  border: 2px solid transparent;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
}

.highlighter .participants-input {
  border-color: #e2d3bf;
}

.highlighter-backdrop {
  display: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: var(--cocoa);
  pointer-events: none;
}

.highlighter.is-enhanced .highlighter-backdrop {
  display: block;
}

.highlighter.is-enhanced .participants-input {
  position: relative;
  color: transparent;
  caret-color: var(--cocoa);
  background: transparent;
  overflow: hidden;
  resize: none;
}

.highlighter.is-enhanced .participants-input::placeholder {
  color: #b9a99a;
}

.highlighter.is-enhanced .participants-input::selection {
  color: transparent;
  background: rgba(232, 177, 74, 0.45);
}

.hl-participant {
  color: var(--pine);
}

.hl-excluded {
  color: var(--berry);
}

.hl-problem {
  text-decoration: wavy underline #d0021b;
  text-decoration-skip-ink: none;
  text-underline-offset: 3px;
}

/* Out of the text flow so it never shifts the characters the textarea is drawing over. */
.hl-lens {
  position: absolute;
  margin-left: 2ch;
  padding: 0 0.5em;
  border-radius: 6px;
  background: #fde8e8;
  color: var(--berry-dark);
  font-family: var(--font);
  font-size: 0.8rem;
  white-space: nowrap;
}

.lens-list {
  display: none;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--berry-dark);
  font-size: 0.9rem;
}

.lens-list li {
  background: #fde8e8;
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  margin-top: 0.3rem;
}

.link-cell {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.copy-button {
  white-space: nowrap;
}

.button-big {
  font-size: 1.15rem;
  padding: 0.9rem 2.2rem;
}

.event-name {
  color: var(--pine);
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 0.3rem;
}

.event-details {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  margin: 1.5rem 0 0;
}

.event-details > div {
  background: var(--cream);
  border-radius: 14px;
  padding: 0.6rem 1.1rem;
  min-width: 10rem;
}

.event-details dt {
  font-size: 0.85rem;
  color: var(--muted);
}

.event-details dd {
  margin: 0;
  font-weight: bold;
}

.event-message {
  flex-basis: 100%;
}

.event-message dd {
  white-space: pre-line;
  font-weight: normal;
}

.table-wrap {
  overflow-x: auto;
}

.links-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.5rem;
}

.links-table th,
.links-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  vertical-align: middle;
}

.links-table thead th {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.links-table tbody tr {
  background: var(--cream);
}

.links-table tbody th {
  color: var(--pine);
  border-radius: 12px 0 0 12px;
  white-space: nowrap;
}

.links-table tbody td:last-child {
  border-radius: 0 12px 12px 0;
  white-space: nowrap;
}

.link-input {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.85rem;
  min-width: 16rem;
}

.badge {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: bold;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: #efe2cf;
  color: var(--muted);
}

.badge-opened {
  background: #dcefe2;
  color: var(--pine);
}

.admin-link {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.danger-zone summary {
  cursor: pointer;
  font-weight: bold;
  color: var(--berry-dark);
}

.danger-zone summary:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
  border-radius: 6px;
}

.danger-zone p {
  color: var(--muted);
}

.button-danger {
  background: linear-gradient(180deg, #6b1117, #4a0b10);
  box-shadow: 0 4px 0 #2e0609;
}

.present {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  padding: 1rem;
  margin: 1rem auto 0;
  font: inherit;
  cursor: pointer;
  animation: wiggle 3.5s ease-in-out infinite;
}

.present-lid,
.present-box {
  display: block;
  background-image: linear-gradient(90deg, transparent 43%, var(--gold) 43% 57%, transparent 57%);
}

.present-lid {
  position: relative;
  width: 184px;
  height: 42px;
  background-color: var(--berry-dark);
  border-radius: 10px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.15);
  transition: transform 0.25s ease;
  z-index: 1;
}

.present-lid::before,
.present-lid::after {
  content: "";
  position: absolute;
  bottom: 100%;
  width: 46px;
  height: 34px;
  border: 9px solid var(--gold);
  border-radius: 50% 50% 0 50%;
}

.present-lid::before {
  right: 50%;
  transform: rotate(-12deg);
}

.present-lid::after {
  left: 50%;
  border-radius: 50% 50% 50% 0;
  transform: rotate(12deg);
}

.present-box {
  width: 160px;
  height: 124px;
  background-color: var(--berry);
  border-radius: 0 0 14px 14px;
  box-shadow: inset 0 -12px 0 rgba(0, 0, 0, 0.12), var(--shadow);
}

.present-label {
  margin-top: 1.2rem;
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--snow);
  background: var(--pine);
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--pine-dark);
}

.present:hover .present-lid,
.present:focus-visible .present-lid {
  transform: translateY(-14px) rotate(-6deg);
}

.present:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 6px;
  border-radius: 18px;
}

@keyframes wiggle {
  0%, 80%, 100% {
    transform: rotate(0);
  }

  84% {
    transform: rotate(-4deg);
  }

  88% {
    transform: rotate(4deg);
  }

  92% {
    transform: rotate(-2deg);
  }
}

.reveal {
  margin: 1.5rem auto 0;
  animation: pop-in 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.reveal-burst {
  font-size: 2.2rem;
}

.reveal-intro {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.reveal-name {
  margin: 0.2rem 0 0.8rem;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  font-weight: bold;
  color: var(--berry);
  text-shadow: 0 3px 0 rgba(232, 177, 74, 0.45);
}

.reveal-secret {
  display: inline-block;
  background: var(--cream);
  border-radius: 999px;
  padding: 0.4rem 1.1rem;
  font-weight: bold;
  color: var(--pine);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.6);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .present,
  .reveal {
    animation: none;
  }
}

@media (max-width: 700px) {
  .how-to {
    grid-template-columns: 1fr;
  }

  .brand-tree {
    font-size: 1.8rem;
  }

  .brand-name {
    font-size: 1.25rem;
    line-height: 1.2;
  }

  .brand-tagline {
    display: none;
  }

  .hl-lens {
    display: none;
  }

  .lens-list:not([hidden]) {
    display: block;
  }

  .link-input {
    flex: 1 1 auto;
    min-width: 0;
  }

  .links-table thead {
    display: none;
  }

  .links-table tbody {
    display: block;
  }

  .links-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    border-radius: 12px;
    margin-bottom: 0.6rem;
  }

  .links-table tbody th,
  .links-table tbody td:last-child {
    border-radius: 0;
  }

  .links-table tbody td:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
    padding-top: 0;
  }
}

.snow {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
}

/* Moving by transform (not background-position) keeps the snow on the compositor instead of
   repainting the whole viewport every frame; the shift must equal one tile for a seamless loop. */
.snow::before {
  content: "";
  position: absolute;
  inset: -220px 0 0;
  background-image:
    radial-gradient(3px 3px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 80px 120px, #fff 50%, transparent 51%),
    radial-gradient(4px 4px at 150px 60px, rgba(255, 255, 255, 0.9) 50%, transparent 51%),
    radial-gradient(2px 2px at 210px 180px, #fff 50%, transparent 51%),
    radial-gradient(3px 3px at 260px 90px, rgba(255, 255, 255, 0.8) 50%, transparent 51%);
  background-size: 300px 220px;
  animation: snowfall 18s linear infinite;
  will-change: transform;
}

@keyframes snowfall {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(220px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .snow::before {
    animation: none;
  }
}
