/* ================================================================
   Secret Santa Pandoras – stiluri
   ================================================================ */

:root {
  --sky-top: #081a24;
  --sky-mid: #0d2a2a;
  --sky-low: #12352c;
  --paper: #fdf9f1;
  --paper-2: #f4ecdb;
  --ink: #1d2823;
  --muted: #4b5852;
  --line: #e4d8c0;
  --red: #b3262f;
  --red-2: #d23a44;
  --red-dark: #8c1c24;
  --gold: #c9a45c;
  --gold-2: #e6c27a;
  --green: #1d5c45;
  --green-dark: #154535;
  --ok-bg: #e2f1e7;
  --ok-ink: #1b5a41;
  --wait-bg: #f7ecd3;
  --wait-ink: #7a5a17;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.12);
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --sans: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Consolas, monospace;
  --tap: 48px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  line-height: 1.5;
  background-color: var(--sky-mid);
  background-image: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 45%, var(--sky-low) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ---------------- Scena de iarnă ---------------- */

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

.scene .stars {
  position: absolute; inset: 0 0 40% 0;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, rgba(255,255,255,.8), transparent 60%),
    radial-gradient(1px 1px at 28% 8%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1.4px 1.4px at 46% 22%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1px 1px at 63% 12%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1.6px 1.6px at 78% 28%, rgba(255,255,255,.75), transparent 60%),
    radial-gradient(1px 1px at 88% 6%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1.2px 1.2px at 6% 40%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1px 1px at 36% 44%, rgba(255,255,255,.45), transparent 60%),
    radial-gradient(1.2px 1.2px at 94% 46%, rgba(255,255,255,.5), transparent 60%);
}

.scene .moon {
  position: absolute; top: 7vh; right: 9vw;
  width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffbe9, #f1e3b8 60%, #d9c28b);
  box-shadow: 0 0 60px 18px rgba(241, 227, 184, 0.18);
  opacity: 0.9;
}

/* brazii: lățimea dă înălțimea (raport 1600x420), ca să nu se taie vârfurile */
.scene .trees {
  position: absolute; left: 0; right: 0; bottom: 0; height: 100%;
  background-repeat: no-repeat; background-position: center bottom;
  background-size: max(100%, 960px) auto;
}
.scene .trees.back { background-image: url('/trees-back.svg?v=4'); transform: translateY(-2.5vh); }
.scene .trees.front { background-image: url('/trees-front.svg?v=4'); }

.scene .snow {
  position: absolute; inset: -10% 0 0 0;
  background-image:
    radial-gradient(2.5px 2.5px at 20px 30px, rgba(255,255,255,.9), transparent 70%),
    radial-gradient(2px 2px at 140px 90px, rgba(255,255,255,.75), transparent 70%),
    radial-gradient(3px 3px at 220px 160px, rgba(255,255,255,.85), transparent 70%),
    radial-gradient(2px 2px at 80px 210px, rgba(255,255,255,.7), transparent 70%),
    radial-gradient(2.5px 2.5px at 270px 260px, rgba(255,255,255,.8), transparent 70%);
  background-size: 300px 300px;
  animation: snow 22s linear infinite;
  opacity: 0.7;
}
.scene .snow.s2 {
  background-size: 190px 190px;
  animation-duration: 34s;
  opacity: 0.4;
  filter: blur(0.6px);
}
@keyframes snow {
  from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; }
  to { background-position: 40px 300px, -30px 300px, 20px 300px, -20px 300px, 30px 300px; }
}

/* Moș Crăciun cu sania: traversează cerul de la stânga la dreapta, apoi pauză.
   Desenul e SVG inline (index.html, admin.html); aici sunt doar mișcările. */
.scene .santa-path {
  position: absolute; top: 12vh; left: 0;
  width: clamp(260px, 30vw, 430px);
  transform: translate(-110%, 0);
  animation: santa-x 22s linear 0.5s infinite;
}
.scene .santa { transform: rotate(-4deg); animation: santa-bob 1.6s ease-in-out infinite alternate; }
.santa-svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 0 7px rgba(255, 226, 170, 0.35)); }
.santa-svg .sleigh { animation: sleigh-rock 1.1s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 50%; }
.santa-svg .deer { animation: deer-bob 0.5s ease-in-out infinite alternate; }
.santa-svg .leg { transform-box: fill-box; transform-origin: 50% 0; animation: 0.5s ease-in-out infinite alternate; }
.santa-svg .leg.f { animation-name: leg-f; }
.santa-svg .leg.b { animation-name: leg-b; }
.santa-svg .leg.far { animation-delay: -0.08s; }
.santa-svg .d2, .santa-svg .d2 .leg { animation-delay: -0.12s; }
.santa-svg .d3, .santa-svg .d3 .leg { animation-delay: -0.24s; }
.santa-svg .d4, .santa-svg .d4 .leg { animation-delay: -0.36s; }
.santa-svg .spark { transform-box: fill-box; transform-origin: 50% 50%; animation: twinkle 1.1s ease-in-out infinite; }
.santa-svg .s1 { animation-delay: -0.2s; } .santa-svg .s2 { animation-delay: -0.45s; }
.santa-svg .s3 { animation-delay: -0.7s; } .santa-svg .s4 { animation-delay: -0.9s; }
.santa-svg .wave { transform-box: fill-box; transform-origin: 100% 100%; animation: wave 0.42s ease-in-out infinite alternate; }

/* cadourile care cad din sanie (create din scene.js) */
.scene .gift-drop { position: absolute; pointer-events: none; will-change: transform, opacity; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35)); }
.scene .gift-drop svg { display: block; width: 100%; height: 100%; }

/* „Ho ho ho!” deasupra lui Moș Crăciun */
.santa { position: relative; }
.santa .hohoho {
  position: absolute; left: 14%; bottom: 88%;
  display: flex; gap: 0.28em; white-space: nowrap;
  font-family: var(--serif); font-style: italic; font-weight: 700;
  font-size: clamp(15px, 1.7vw, 24px); color: #fff6dc;
  text-shadow: 0 0 10px rgba(255, 214, 140, 0.8), 0 2px 0 #9e222c;
  animation: ho-fade 2.9s ease forwards;
}
.santa .hohoho span { display: inline-block; opacity: 0; animation: ho-pop 0.45s cubic-bezier(.2, 1.6, .4, 1) forwards; }
.santa .hohoho span:nth-child(2) { animation-delay: 0.32s; }
.santa .hohoho span:nth-child(3) { animation-delay: 0.64s; color: #ffd27a; }
@keyframes ho-pop { from { opacity: 0; transform: translateY(8px) scale(0.4) rotate(-8deg); } to { opacity: 1; transform: translateY(0) scale(1) rotate(0); } }
@keyframes ho-fade { 0%, 75% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-14px); } }
@keyframes wave { from { transform: rotate(-14deg); } to { transform: rotate(16deg); } }
@keyframes leg-f { from { transform: rotate(-48deg); } to { transform: rotate(18deg); } }
@keyframes leg-b { from { transform: rotate(48deg); } to { transform: rotate(-14deg); } }
@keyframes deer-bob { from { transform: translateY(-3px); } to { transform: translateY(3px); } }
@keyframes sleigh-rock { from { transform: rotate(-1.5deg) translateY(-1px); } to { transform: rotate(1.5deg) translateY(2px); } }
@keyframes twinkle { 0%, 100% { opacity: 0.25; transform: scale(0.6); } 50% { opacity: 1; transform: scale(1.15); } }
/* Dubița Pandora's Courier: zboară de la dreapta la stânga, după ce trece Moș Crăciun */
.scene .van-path {
  position: absolute; top: 27vh; left: 0;
  width: clamp(250px, 27vw, 400px);
  transform: translate(calc(100vw + 20%), 0);
  animation: van-x 22s linear 0.5s infinite;
}
.scene .van { animation: van-bob 1.3s ease-in-out infinite alternate; }
.van-svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 0 8px rgba(160, 220, 255, 0.35)); }
.van-svg .vwheel { transform-box: fill-box; transform-origin: 50% 50%; animation: wheel-spin 0.5s linear infinite; }
.van-svg .vwing { transform-box: fill-box; transform-origin: 0% 92%; animation: vwing 0.32s ease-in-out infinite alternate; }
.van-svg .bulb { animation: bulb 1.4s ease-in-out infinite alternate; }
.van-svg .b1 { animation-delay: -0.35s; } .van-svg .b2 { animation-delay: -0.7s; } .van-svg .b3 { animation-delay: -1.05s; }
.van-svg .spark { transform-box: fill-box; transform-origin: 50% 50%; animation: twinkle 1.1s ease-in-out infinite; }
@keyframes van-x {
  0%, 47% { transform: translate(calc(100vw + 20%), 4vh) rotate(3deg); }
  92% { transform: translate(-125%, -3vh) rotate(3deg); }
  100% { transform: translate(-125%, -3vh) rotate(3deg); }
}
@keyframes van-x-m {
  0%, 47% { transform: translate(calc(100vw + 20%), 6px) rotate(3deg); }
  92% { transform: translate(-125%, -2px) rotate(3deg); }
  100% { transform: translate(-125%, -2px) rotate(3deg); }
}
@keyframes van-bob { from { transform: translateY(-4px); } to { transform: translateY(4px); } }
@keyframes wheel-spin { to { transform: rotate(-360deg); } }
@keyframes vwing { from { transform: rotate(-16deg); } to { transform: rotate(10deg); } }
@keyframes bulb { from { opacity: 0.35; } to { opacity: 1; } }

@keyframes santa-x {
  0% { transform: translate(-130%, 5vh); }
  45% { transform: translate(calc(100vw + 30%), -5vh); }
  100% { transform: translate(calc(100vw + 30%), -5vh); }
}
@keyframes santa-x-m {
  0% { transform: translate(-130%, 8px); }
  45% { transform: translate(calc(100vw + 30%), -4px); }
  100% { transform: translate(calc(100vw + 30%), -4px); }
}
@keyframes santa-bob {
  from { transform: rotate(-4deg) translateY(-6px); }
  to { transform: rotate(-3deg) translateY(6px); }
}

/* ---------------- Așezare ---------------- */

.wrap {
  position: relative; z-index: 1;
  max-width: 620px; margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 120px max(16px, env(safe-area-inset-left));
}
.wrap.wide { max-width: 980px; }

.brand {
  display: flex; align-items: center; gap: 12px;
  color: var(--paper);
  margin-bottom: 20px;
  min-height: 44px;
}
.brand .logo {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--red-2), var(--red-dark));
  box-shadow: 0 6px 16px rgba(179, 38, 47, 0.45), inset 0 1px 0 rgba(255,255,255,.25);
  color: #fff;
}
.brand .logo svg { width: 22px; height: 22px; }
.brand .title { display: flex; flex-direction: column; line-height: 1.15; }
.brand .title strong { font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: 0.01em; }
.brand .title span { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold-2); opacity: 0.9; }
.brand .spacer { flex: 1; }

.footer-link { margin-top: 28px; position: relative; z-index: 1; }
.footer-link a {
  display: inline-block;
  color: rgba(253, 249, 241, 0.8); text-decoration: none; font-size: 13px;
  padding: 10px 16px; border-radius: 999px; background: rgba(8, 26, 36, 0.55);
}
.footer-link a:hover { color: #fff; background: rgba(8, 26, 36, 0.8); }

/* ---------------- Carduri ---------------- */

.card {
  position: relative;
  /* sticlă mată luminoasă: fundalul (cerul, Moș Crăciun) se vede prin card, dar textul rămâne lizibil */
  background: rgba(255, 247, 232, 0.7);
  -webkit-backdrop-filter: blur(3px) brightness(2) sepia(0.35) saturate(0.95);
  backdrop-filter: blur(3px) brightness(2) sepia(0.35) saturate(0.95);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
#app > * + * { margin-top: 18px; }

.card.hero { padding-top: 34px; overflow: hidden; }
.card.hero::before {
  /* panglica de cadou de sus */
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px;
  background: repeating-linear-gradient(135deg, var(--red) 0 14px, var(--red-2) 14px 22px, var(--gold) 22px 26px);
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--red); margin-bottom: 6px;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0 0 8px; line-height: 1.15; letter-spacing: -0.005em; }
h1 { font-size: clamp(28px, 6vw, 38px); }
h2 { font-size: clamp(21px, 4.6vw, 25px); }
h3 { font-size: 18px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }

.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.meta li {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--muted);
  background: var(--paper-2); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px;
}
.meta strong { color: var(--ink); }

.note {
  background: var(--paper-2);
  border-left: 3px solid var(--gold);
  padding: 12px 14px;
  border-radius: 8px;
  white-space: pre-wrap;
  font-size: 15px;
  margin: 14px 0 0;
}

/* ---------------- Butoane ---------------- */

button {
  font: inherit; font-weight: 600; font-size: 15px;
  min-height: var(--tap);
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  user-select: none;
  touch-action: manipulation;
  transition: transform 0.08s ease, background-color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, opacity 0.15s;
  background: var(--green); color: #fff;
  box-shadow: 0 4px 12px -4px rgba(21, 69, 53, 0.6), inset 0 1px 0 rgba(255,255,255,.15);
}
button:hover { background: var(--green-dark); }
button:active { transform: translateY(1px) scale(0.99); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
button svg { width: 20px; height: 20px; flex: 0 0 auto; }
button > span:has(> svg) { display: inline-flex; }

button.primary {
  background: linear-gradient(180deg, var(--red-2), var(--red));
  box-shadow: 0 8px 20px -8px rgba(179, 38, 47, 0.75), inset 0 1px 0 rgba(255,255,255,.22);
}
button.primary:hover { background: linear-gradient(180deg, var(--red), var(--red-dark)); }

button.ghost {
  background: #fff; color: var(--ink); border-color: var(--line);
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
button.ghost:hover { background: var(--paper-2); border-color: var(--gold); }

button.danger {
  background: #fff; color: var(--red); border-color: #ebc3c6;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
button.danger:hover { background: #fcecee; border-color: var(--red-2); }

button.big { min-height: 60px; padding: 0 30px; font-size: 18px; border-radius: 16px; }
button.small { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 10px; }

.brand button.ghost {
  background: rgba(255,255,255,.08); color: var(--paper); border-color: rgba(255,255,255,.25); box-shadow: none;
}
.brand button.ghost:hover { background: rgba(255,255,255,.16); }

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

/* ---------------- Formulare ---------------- */

label { display: block; font-size: 14px; font-weight: 650; margin: 0 0 6px; }
input[type='text'], input[type='password'], textarea, select {
  width: 100%;
  font: inherit; font-size: 16px; /* 16px: fără zoom automat pe iPhone */
  min-height: var(--tap);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background-color: #fff;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 164, 92, 0.22); outline: none; }
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
  padding-right: 40px;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.45; }
.field { margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.center-row { justify-content: center; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.error { color: var(--red); font-size: 14px; font-weight: 600; min-height: 1.2em; margin: 4px 0 8px; }
.card > .row.end { margin-top: 12px; }

/* ---------------- Alegerea numelui ---------------- */

.search-field { position: relative; }
.search-field svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input { padding-left: 42px; }

.people {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px;
  max-height: min(460px, 55vh); overflow-y: auto; padding: 2px 2px 4px;
  overscroll-behavior: contain;
}
button.person {
  justify-content: flex-start; text-align: left; font-weight: 550;
  min-height: 54px; padding: 0 14px;
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
button.person:hover { background: #fffaf0; border-color: var(--gold); }
button.person .chev { margin-left: auto; color: var(--muted); display: inline-flex; }
button.person .chev svg { width: 18px; height: 18px; }
.num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 28px; padding: 0 8px; border-radius: 999px;
  background: var(--paper-2); color: var(--ink); font-size: 13px; font-weight: 700;
  border: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.empty { text-align: center; color: var(--muted); padding: 22px 8px; }

/* ---------------- Extragerea ---------------- */

.stage { text-align: center; padding: 6px 0 2px; }
.reel {
  margin: 22px auto;
  height: 96px; max-width: 220px;
  border-radius: 18px;
  border: 2px dashed var(--gold);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 52px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow: hidden; padding: 0 12px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,.05);
}
.reel span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reel.spinning span { filter: blur(0.5px); opacity: 0.85; }
.reel.done { border-style: solid; border-color: var(--red); background: #fff7f2; }

.reveal-label { font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.reveal-number {
  font-family: var(--serif); font-size: clamp(84px, 24vw, 112px); line-height: 1; font-weight: 700;
  color: var(--red); margin: 8px 0 4px; font-variant-numeric: tabular-nums;
  text-shadow: 0 6px 24px rgba(179, 38, 47, 0.2);
}
.reveal-name { font-family: var(--serif); font-size: clamp(24px, 6vw, 30px); color: var(--ink); margin-bottom: 8px; word-break: break-word; }

.pin-box {
  margin: 20px auto 14px; max-width: 380px; padding: 18px 16px;
  border: 2px dashed var(--gold); border-radius: 16px; background: #fffaf0;
}
.pin { font-family: var(--mono); font-size: clamp(32px, 10vw, 42px); font-weight: 700; letter-spacing: 0.1em; color: var(--ink); margin: 4px 0 10px; }
.pin-box p { color: var(--ink); }
#pin { font-family: var(--mono); font-size: 24px; letter-spacing: 0.22em; max-width: 240px; text-align: center; }

.pop { animation: pop 0.55s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.gift-icon { width: 68px; height: 68px; color: var(--red); margin: 4px auto 12px; display: block; }
.gift-icon svg { width: 100%; height: 100%; display: block; }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 30; }
.confetti i { position: absolute; top: -14px; width: 8px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0.9; } }

/* ---------------- Panou organizator ---------------- */

.status-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.status-line > div:first-child { flex: 1 1 320px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; margin-bottom: 8px;
}
.status-pill.open { background: var(--ok-bg); color: var(--ok-ink); }
.status-pill.prep { background: var(--wait-bg); color: var(--wait-ink); }
.status-pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.progress { height: 12px; background: var(--paper-2); border-radius: 999px; overflow: hidden; margin: 16px 0 6px; border: 1px solid var(--line); }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--green), #2f8a67); border-radius: 999px; transition: width 0.4s ease; }

.table-wrap { margin: 8px -8px 0; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
td.actions { text-align: right; }
td.actions .row { justify-content: flex-end; gap: 6px; }
tbody tr:hover { background: #fffaf0; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge.wait { background: var(--wait-bg); color: var(--wait-ink); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 4px; }
.link-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  font-size: 14px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
}
.link-chip code { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }

/* ---------------- Dialoguri și notificări ---------------- */

dialog {
  border: 0; border-radius: var(--radius); padding: 24px; max-width: 460px; width: calc(100% - 32px);
  box-shadow: var(--shadow); background: var(--paper); color: var(--ink);
}
dialog::backdrop { background: rgba(4, 14, 18, 0.62); }
dialog h3 { margin-bottom: 10px; font-size: 21px; }
dialog .row.end { margin-top: 8px; }

.toast {
  position: fixed; left: 50%; bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 550; box-shadow: var(--shadow); z-index: 40;
  width: max-content; max-width: calc(100% - 32px); text-align: center;
}

.hidden { display: none !important; }
.offscreen { position: fixed; left: -9999px; opacity: 0; }

/* ---------------- Telefon ---------------- */

@media (max-width: 640px) {
  .wrap { padding-bottom: 96px; }
  .card { padding: 22px 18px; border-radius: 16px; }
  .card.hero { padding-top: 28px; }
  #app > * + * { margin-top: 14px; }
  .brand { margin-bottom: 14px; }
  /* pe telefon cerul e o fâșie deasupra antetului: luna și Moș Crăciun stau acolo */
  .scene .moon { width: 38px; height: 38px; top: max(14px, env(safe-area-inset-top)); right: 18px; box-shadow: 0 0 34px 10px rgba(241, 227, 184, 0.18); }
  .scene .santa-path { top: max(34px, calc(env(safe-area-inset-top) + 22px)); width: 190px; animation-name: santa-x-m; animation-duration: 22s; }
  .wrap { padding-top: max(84px, calc(env(safe-area-inset-top) + 70px)); }
  .santa .hohoho { font-size: 15px; bottom: 92%; }
  .scene .van-path { top: max(30px, calc(env(safe-area-inset-top) + 18px)); width: 180px; animation-name: van-x-m; }

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

  /* butoanele de acțiune ocupă toată lățimea; cel principal apare primul */
  .card .row { flex-direction: column-reverse; align-items: stretch; }
  .card .row > button { width: 100%; }
  button.big { width: 100%; padding: 0 20px; }

  .people { grid-template-columns: 1fr; max-height: none; overflow: visible; }

  /* tabelul devine o listă de carduri */
  .table-wrap { margin: 8px 0 0; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody tr {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px 10px;
    padding: 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff;
  }
  tbody tr:hover { background: #fff; }
  td { border: 0; padding: 0; width: auto; }
  td.actions { grid-column: 1 / -1; text-align: left; }
  td.actions .row { flex-direction: row; flex-wrap: wrap; }
  td.actions .row > button { flex: 1 1 auto; width: auto; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .status-line > button { width: 100%; }
  .link-chip { flex-wrap: wrap; }

  dialog {
    width: 100%; max-width: none; margin: auto 0 0; border-radius: 20px 20px 0 0;
    padding: 22px 18px max(22px, env(safe-area-inset-bottom));
  }
  dialog .row.end { flex-direction: column-reverse; align-items: stretch; }
  dialog .row.end > button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .pop, .confetti i { animation: none; }
  .scene .snow, .scene .santa-path, .scene .van-path, .scene .gift-drop { display: none; }
}
.error:empty { min-height: 0; margin: 0; }

/* fără suport pentru blur: cardurile rămân opace, ca textul să se citească */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card { background: var(--paper); }
}

/* ---------------- Lista cu căutare (combobox.js) ---------------- */

.card:has(.combo.open) { z-index: 40; }
.combo { position: relative; }
.combo-search { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: inline-flex; z-index: 1; }
.combo-search svg { width: 18px; height: 18px; }
.combo input { padding-left: 42px; padding-right: 48px; }
.combo.open input { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 164, 92, 0.22); }
button.combo-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  min-height: 40px; width: 40px; padding: 0; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); box-shadow: none;
}
button.combo-toggle:hover { background: var(--paper-2); }
button.combo-toggle:active { transform: translateY(-50%); }
button.combo-toggle svg { transition: transform 0.2s ease; }
.combo.open button.combo-toggle svg { transform: rotate(180deg); }

.combo-list {
  display: none;
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 50;
  margin: 0; padding: 6px; list-style: none;
  max-height: min(320px, 46vh); overflow-y: auto; overscroll-behavior: contain;
  background: #fffdf8;
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 22px 50px -14px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(201, 164, 92, 0.15);
}
.combo-list::before {
  /* panglica festivă de sus */
  content: ''; display: block; height: 4px; margin: -6px -6px 6px; border-radius: 16px 16px 0 0;
  background: repeating-linear-gradient(135deg, var(--red) 0 10px, var(--red-2) 10px 16px, var(--gold) 16px 19px);
}
.combo.open .combo-list { display: block; animation: combo-in 0.18s ease-out; }
@keyframes combo-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }

.combo-opt {
  display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 8px 12px; border-radius: 11px;
  cursor: pointer; font-weight: 550; color: var(--ink);
  transition: background-color 0.12s ease;
}
.combo-opt + .combo-opt { margin-top: 2px; }
.combo-opt.active { background: #fff1d6; box-shadow: inset 0 0 0 1px rgba(201, 164, 92, 0.7); }
.combo-opt.active .num { background: var(--red); color: #fff; border-color: var(--red); }
.combo-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-check { display: none; color: var(--green); }
.combo-check svg { width: 18px; height: 18px; display: block; }
.combo-opt[aria-selected='true'] .combo-check { display: inline-flex; }
.combo-empty { padding: 16px 12px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------------- Mini-jocul cu cadouri ---------------- */

.gift-status { font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--muted); margin: 14px 0 0; min-height: 1.4em; }
.gift-status.ready { color: var(--red); animation: pop 0.45s cubic-bezier(.2, 1.4, .4, 1) both; }

.gifts {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 22px 14px; margin: 26px 0 14px; padding: 10px 4px 0;
}
button.gift-pick {
  position: relative; display: block; width: 100%; height: 96px;
  padding: 0; border: 0; border-radius: 0; min-height: 0;
  background: none; box-shadow: none; color: inherit;
  cursor: pointer;
  --c: #c8303b; --r: #f3d27a; --edge: rgba(0, 0, 0, 0.14);
  animation: gp-float 2.6s ease-in-out infinite alternate;
}
button.gift-pick:nth-child(3n + 1) { animation-delay: -0.9s; }
button.gift-pick:nth-child(3n + 2) { animation-delay: -1.7s; }
button.gift-pick:hover { background: none; }
button.gift-pick:disabled { opacity: 1; cursor: default; box-shadow: none; }
.gifts.shuffling button.gift-pick { animation: none; }
.gift-pick.c1 { --c: #2f8a67; --r: #fbf7ee; }
.gift-pick.c2 { --c: #e1b452; --r: #c8303b; }
.gift-pick.c3 { --c: #3d6fb6; --r: #f3d27a; }
.gift-pick.c4 { --c: #8e44ad; --r: #f3d27a; }
.gift-pick.c5 { --c: #fbf7ee; --r: #c8303b; --edge: rgba(0, 0, 0, 0.1); }

.gp-box {
  position: absolute; left: 13%; right: 13%; bottom: 0; height: 58%;
  background: var(--c); border-radius: 5px 5px 8px 8px;
  box-shadow: inset 0 -9px 0 var(--edge), inset 6px 0 0 rgba(255, 255, 255, 0.14), 0 10px 18px -8px rgba(0, 0, 0, 0.55);
}
.gp-box::before { content: ''; position: absolute; left: calc(50% - 6px); width: 12px; top: 0; bottom: 0; background: var(--r); }
.gp-lid {
  position: absolute; left: 6%; right: 6%; bottom: 55%; height: 17%; z-index: 2;
  background: var(--c); border-radius: 5px;
  box-shadow: inset 0 -5px 0 var(--edge), 0 3px 6px rgba(0, 0, 0, 0.25);
  transform-origin: 15% 100%;
  transition: transform 0.55s cubic-bezier(.2, 1.3, .4, 1);
}
.gp-lid::before { content: ''; position: absolute; left: calc(50% - 6px); width: 12px; top: 0; bottom: 0; background: var(--r); }
.gp-bow { position: absolute; left: 50%; bottom: 92%; width: 38px; height: 20px; transform: translateX(-50%); }
.gp-bow::before, .gp-bow::after {
  content: ''; position: absolute; bottom: 0; width: 15px; height: 15px;
  border: 4.5px solid var(--r); border-radius: 50% 50% 0 50%;
}
.gp-bow::before { left: 1px; transform: rotate(-10deg); }
.gp-bow::after { right: 1px; border-radius: 50% 50% 50% 0; transform: rotate(10deg); }

.gp-glow {
  position: absolute; left: 50%; bottom: 40%; width: 170px; height: 170px; z-index: 0;
  transform: translate(-50%, 50%) scale(0.2); opacity: 0; pointer-events: none; border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 236, 180, 0.95) 0 18%, rgba(255, 214, 140, 0.35) 40%, transparent 68%),
    repeating-conic-gradient(rgba(255, 226, 160, 0.55) 0 8deg, transparent 8deg 22deg);
}
.gp-num {
  position: absolute; left: 50%; bottom: 46%; z-index: 3;
  font-family: var(--serif); font-size: 40px; font-weight: 700; color: var(--red);
  text-shadow: 0 2px 0 #fff, 0 0 18px rgba(255, 214, 140, 0.9);
  transform: translate(-50%, 30px) scale(0.3); opacity: 0; pointer-events: none;
}

button.gift-pick:not(:disabled):hover { animation-play-state: paused; }
button.gift-pick:not(:disabled):hover .gp-box,
button.gift-pick:not(:disabled):hover .gp-lid { filter: brightness(1.08); }
button.gift-pick:not(:disabled):hover .gp-lid { transform: translateY(-5px) rotate(-6deg); }
button.gift-pick:focus-visible { outline: 3px solid var(--gold-2); outline-offset: 6px; border-radius: 10px; }

.gifts.done button.gift-pick:not(.picked) { opacity: 0.3; filter: grayscale(0.5); transform: scale(0.88); transition: opacity 0.4s, transform 0.4s, filter 0.4s; animation: none; }
button.gift-pick.picked { z-index: 2; animation: gp-shake 0.6s ease-in-out both; }
button.gift-pick.open .gp-lid { transform: translate(-30px, -50px) rotate(-38deg); }
button.gift-pick.open .gp-glow { animation: gp-glow 1.6s ease-out forwards; }
button.gift-pick.open .gp-num { animation: gp-num 0.7s 0.2s cubic-bezier(.2, 1.5, .4, 1) forwards; }

@keyframes gp-float { from { transform: translateY(0); } to { transform: translateY(-6px); } }
@keyframes gp-shake {
  0%, 100% { transform: rotate(0) scale(1.08); }
  20% { transform: rotate(-8deg) scale(1.1); } 40% { transform: rotate(7deg) scale(1.1); }
  60% { transform: rotate(-5deg) scale(1.1); } 80% { transform: rotate(4deg) scale(1.1); }
}
@keyframes gp-glow {
  0% { opacity: 0; transform: translate(-50%, 50%) scale(0.2) rotate(0deg); }
  30% { opacity: 1; }
  100% { opacity: 0.85; transform: translate(-50%, 50%) scale(1.15) rotate(40deg); }
}
@keyframes gp-num { to { opacity: 1; transform: translate(-50%, -26px) scale(1); } }

@media (max-width: 640px) {
  .gifts { grid-template-columns: repeat(3, 1fr); gap: 20px 10px; }
  button.gift-pick { height: 88px; }
}
@media (prefers-reduced-motion: reduce) {
  button.gift-pick, button.gift-pick.picked { animation: none; }
}

/* ---------------- Sacul lui Moș Crăciun (intrarea în sac) ---------------- */

.game-host { margin-top: 10px; }
.sack-zone { position: relative; margin: 14px 0 12px; border-radius: 22px; overflow: hidden; background-color: transparent; transition: background-color 0.45s ease; }
.sack-zone.diving { background-color: #1d0e06; }
.sack-outside {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center;
  transform-origin: 50% 34%;
  pointer-events: none;
}
.sack-outside svg { display: block; width: 240px; height: auto; overflow: visible; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.35)); }
.sack-outside .sk-spark {
  position: absolute; width: 7px; height: 7px; margin: -3.5px; border-radius: 50%; pointer-events: none;
  background: #fff3c4; box-shadow: 0 0 10px 3px rgba(255, 214, 140, 0.9);
}
.sack-dust {
  /* praf auriu care plutește în lumina din sac */
  position: absolute; inset: 0; pointer-events: none; opacity: 0.7;
  background-image:
    radial-gradient(1.6px 1.6px at 20% 30%, rgba(255, 230, 170, 0.9), transparent 70%),
    radial-gradient(1.2px 1.2px at 70% 20%, rgba(255, 230, 170, 0.8), transparent 70%),
    radial-gradient(2px 2px at 45% 60%, rgba(255, 230, 170, 0.7), transparent 70%),
    radial-gradient(1.4px 1.4px at 85% 70%, rgba(255, 230, 170, 0.8), transparent 70%),
    radial-gradient(1.2px 1.2px at 10% 80%, rgba(255, 230, 170, 0.7), transparent 70%);
  background-size: 180px 160px;
  animation: sack-dust 9s linear infinite;
}
@keyframes sack-dust { to { background-position: 40px -160px, -30px -160px, 20px -160px, -40px -160px, 30px -160px; } }

.sack-inside {
  position: relative; min-height: 330px; opacity: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 50px 14px 20px; border-radius: 22px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 214, 140, 0.45), transparent 55%),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.07) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 5px),
    linear-gradient(180deg, #6b4426, #3d2614);
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.65), inset 0 -20px 40px rgba(0, 0, 0, 0.35);
}
.sack-inside.shown { opacity: 1; }
.sack-light {
  /* gura sacului, văzută din interior */
  position: absolute; left: 50%; top: -70px; width: 74%; height: 150px; transform: translateX(-50%);
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(ellipse, rgba(255, 230, 170, 0.6), rgba(255, 214, 140, 0.15) 55%, transparent 72%);
}
.sack-inside .gifts { position: relative; z-index: 1; width: 100%; margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 22px 16px; }
.sack-inside .gifts button.gift-pick { flex: 0 0 86px; width: 86px; }
@media (max-width: 640px) { .sack-inside .gifts { gap: 18px 10px; } .sack-inside .gifts button.gift-pick { flex-basis: 78px; width: 78px; } }
.gifts.waiting { opacity: 0; }
.sack-inside button.gift-pick:focus-visible { outline-color: #ffe7a0; }

@media (max-width: 640px) {
  .sack-inside { min-height: 300px; padding: 46px 8px 16px; }
  .sack-outside svg { width: 210px; }
}
@media (prefers-reduced-motion: reduce) {
  .sack-dust { animation: none; }
}
