@font-face {
  font-family: Fraunces;
  src: url('/fonts/fraunces-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Fraunces;
  src: url('/fonts/fraunces-latin-ext-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;
  --pine: #10302a;
  --pine-deep: #0a211d;
  --pine-raised: #1a4339;
  --line: #2f5c50;
  --cream: #f7f0e1;
  --muted: #b9c9bd;
  --berry: #b92f30;
  --berry-hover: #cf3a3a;
  --gold: #e3b252;
  --paper: #fbf6ea;
  --ink: #2a2118;
  --display: Fraunces, Georgia, 'Times New Roman', serif;
  --body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(120% 70% at 50% 0%, var(--pine-raised), var(--pine) 55%, var(--pine-deep));
  background-attachment: fixed;
  color: var(--cream);
  font: 17px/1.5 var(--body);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url('/hatter.jpg') center / cover no-repeat;
  opacity: 0.7;
}

/* A szöveg a fotó fölött áttetsző sötét lapon marad olvasható. */
.panel, main:not(.draw) {
  background: rgba(10, 33, 29, 0.74);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  border-radius: 16px;
}
.panel { padding: 16px 18px; }
.panel .lead:last-child, .panel .eyebrow + h1:last-child { margin-bottom: 0; }
.lead, .hint, .people .state, .progress-row span, .result-note span { color: #dfe7df; }

#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }

main {
  position: relative;
  z-index: 1;
  width: min(100% - 24px, 560px);
  margin: 12px auto 48px;
  padding: 24px 16px;
}
main.draw { padding: 0; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
}

h1 {
  margin: 0 0 10px;
  font: 600 clamp(34px, 9vw, 46px)/1.08 var(--display);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.lead { margin: 0 0 28px; color: var(--muted); text-wrap: pretty; }

label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 15px; }

input[type='text'] {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--pine-deep);
  color: var(--cream);
  font: inherit;
}
input[type='text']::placeholder { color: #86a093; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.field { margin-bottom: 22px; }

.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; min-width: 0; }

button {
  min-height: 48px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  font: 600 16px var(--body);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: default; }

.primary { width: 100%; background: var(--berry); color: #fff; font-size: 18px; min-height: 56px; }
.primary:hover:not(:disabled) { background: var(--berry-hover); }

.secondary { background: var(--pine-raised); color: var(--cream); border: 1px solid var(--line); white-space: nowrap; }
.secondary:hover:not(:disabled) { background: #235245; }

.hint { margin: 10px 0 0; color: var(--muted); font-size: 14px; text-wrap: pretty; }
.error { margin: 12px 0 0; color: #ffb4a8; font-weight: 600; }
.error:empty { display: none; }

/* A kosár tartalma az új húzás oldalon */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.chips:empty { display: none; }
.chips li {
  display: flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 3px 3px 3px 12px;
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font: 500 16px var(--display);
  overflow-wrap: anywhere;
}
.chips button {
  min-height: 32px;
  width: 32px;
  flex: none;
  padding: 0;
  background: none;
  color: #7a6a58;
  font-size: 18px;
  line-height: 1;
}
.chips button:hover { color: var(--berry); }

/* Szervezői oldal */
.save-note {
  margin-bottom: 26px;
  padding: 14px 16px;
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  background: rgba(227, 178, 82, 0.1);
}
.save-note p { margin: 0 0 12px; font-size: 15px; text-wrap: pretty; }

.progress-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.progress-row h2 { margin: 0; font: 600 22px var(--display); }
.progress-row span { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }

.people { margin: 0 0 18px; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.people li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.people .who { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.people .who strong { display: block; font: 600 18px/1.25 var(--display); }
.people .state { font-size: 14px; color: var(--muted); }
.people .state.done { color: var(--gold); font-weight: 600; }
.people button { min-height: 44px; padding: 8px 14px; font-size: 15px; }

/* Közös link: névválasztás */
.name-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.name-list button {
  width: 100%;
  min-height: 54px;
  padding: 8px 10px;
  font: 600 18px/1.2 var(--display);
  white-space: normal;
  overflow-wrap: anywhere;
}
.name-list button:disabled { opacity: 0.4; text-decoration: line-through; }

.confirm-actions { display: grid; gap: 10px; }

.share-box { margin-bottom: 26px; }
.share-box h2, .backup h2 { margin: 0 0 6px; font: 600 22px var(--display); }
.share-box p, .backup p { margin: 0 0 12px; font-size: 15px; color: #dfe7df; text-wrap: pretty; }
.share-box .primary { min-height: 52px; }
.backup { margin-top: 8px; }

.switch {
  display: inline-block;
  margin-top: 4px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(10, 33, 29, 0.74);
  color: var(--cream);
  font-size: 15px;
  text-underline-offset: 3px;
}

/* Húzás */
.draw { text-align: center; }
.draw .lead { margin-bottom: 0; }

.stage { position: relative; height: 330px; margin: 0 auto 16px; max-width: 340px; }

.basket {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 300px;
  margin-left: -150px;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s;
}
.basket svg { display: block; width: 100%; height: auto; overflow: visible; }
.basket-back { z-index: 1; }
.basket-front { z-index: 3; }

.stage.shaking .basket { animation: shake 0.28s ease-in-out infinite; }
@keyframes shake {
  0%, 100% { rotate: 0deg; }
  25% { rotate: -2.4deg; }
  75% { rotate: 2.4deg; }
}

.basket { transform-origin: 50% 100%; }
.stage.open .basket, .stage.folded .basket { transform: scale(0.7); }

.slip {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 150px;
  width: 280px;
  margin-left: -140px;
  padding: 0;
  min-height: 0;
  border-radius: 3px;
  background: none;
  color: var(--ink);
  transform: translateY(30px) rotate(-3deg) scaleX(0.5) scaleY(0.2);
  opacity: 0;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s;
  cursor: default;
}
.slip-paper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 170px;
  padding: 20px 18px;
  border-radius: 3px;
  background: linear-gradient(180deg, #fff9ec, var(--paper) 49%, #ece3cf 50%, var(--paper) 53%);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}
.slip-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.35s 0.25s;
}
.slip-face {
  display: block;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 3px var(--gold);
}
.slip-face[hidden] { display: none; }
.slip-name {
  font: 600 clamp(30px, 9vw, 40px)/1.12 var(--display);
  overflow-wrap: anywhere;
}
.stage.rising .slip { opacity: 1; transform: translateY(-126px) rotate(-3deg) scaleX(0.5) scaleY(0.2); }
.stage.open .slip { z-index: 4; opacity: 1; transform: translateY(-130px) rotate(-1deg); }
.stage.open .slip-content { opacity: 1; }

/* Korábban már kihúzott, összehajtott cédula: koppintásra nyílik */
.stage.folded .slip { z-index: 4; opacity: 1; transform: translateY(-160px) rotate(-3deg) scaleX(0.62) scaleY(0.25); cursor: pointer; }
.stage.folded .slip-paper { background: linear-gradient(180deg, #fff9ec, #e7dcc6); }

.result-note { margin: 0 auto; max-width: 420px; }
.result-note:empty { display: none; }
.result-note strong { display: block; font: 600 21px/1.25 var(--display); margin-bottom: 4px; }
.result-note span { color: var(--muted); font-size: 15px; text-wrap: pretty; display: block; }

.tally {
  display: inline-block;
  margin: 16px 0 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(10, 33, 29, 0.74);
  color: #dfe7df;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.message-box { text-align: center; padding-top: 60px; }

@media (prefers-reduced-motion: reduce) {
  .stage.shaking .basket { animation: none; }
  .slip, .basket, .slip-content { transition-duration: 0.01s; transition-delay: 0s; }
  #snow { display: none; }
}
