:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f4f3);
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8a8f8d);
  --link: var(--tg-theme-link-color, #1f9d6b);
  --accent: #1f9d6b;          /* festive green */
  --accent-dark: #0d5c3e;
  --accent-text: #ffffff;
  --gold: #f5c542;
  --gold-ink: #4a3500;
  --mint: #2fd3a3;
  --bad: #e5484d;
  --card: var(--tg-theme-section-bg-color, var(--bg2));
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
#app { max-width: 560px; margin: 0 auto; padding: 16px 16px 32px; }
h1 { font-size: 26px; line-height: 1.15; margin: 8px 0 6px; letter-spacing: -0.3px; }
h2 { font-size: 20px; margin: 22px 0 10px; }
p { margin: 6px 0; }
.hint { color: var(--hint); font-size: 14px; }
.center { text-align: center; }
.hero { text-align: center; padding: 18px 0 6px; }
.hero.small { padding: 6px 0 2px; }
.hero .emoji { font-size: 56px; line-height: 1; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.btn {
  display: block; width: 100%; border: 0; border-radius: 14px; padding: 15px 16px; margin: 10px 0 0;
  font-size: 17px; font-weight: 600; cursor: pointer; text-align: center; text-decoration: none;
  background: var(--accent); color: var(--accent-text);
  transition: transform .06s ease, opacity .15s;
}
.btn:active { transform: scale(0.985); }
.btn.secondary { background: var(--bg2); color: var(--text); }
.card .btn.secondary { background: var(--bg); }
.btn.ghost { background: transparent; color: var(--link); padding: 10px; font-weight: 500; }
.btn.mint { background: var(--mint); color: #062e23; }
.btn.gold { background: var(--gold); color: var(--gold-ink); font-weight: 800; }
.btn.danger, .btn.ghost.danger { color: var(--bad); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.row { display: flex; gap: 10px; }
.row > .btn { flex: 1; min-width: 0; }
.av { width: 36px; height: 36px; border-radius: 50%; flex: none; object-fit: cover; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.av.big { width: 72px; height: 72px; font-size: 28px; margin: 0 auto 8px; }
.av.huge { width: 96px; height: 96px; font-size: 40px; margin: 8px auto; border: 4px solid #fff; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.avs { display: flex; justify-content: center; flex-wrap: wrap; margin: 10px 0 2px; }
.avs .av { width: 40px; height: 40px; margin: 0 -5px; border: 3px solid var(--bg); font-size: 15px; }
.avs .more { width: 40px; height: 40px; margin: 0 -5px; border: 3px solid var(--bg); border-radius: 50%; background: var(--bg2); color: var(--hint); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--bg2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: rgba(0,0,0,.84); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 30; max-width: calc(100% - 32px); text-align: center; }
.foot { text-align: center; margin-top: 26px; font-size: 13px; color: var(--hint); }
.foot a { color: var(--hint); }
.logo { width: 88px; height: 88px; border-radius: 22px; box-shadow: 0 8px 24px rgba(31,157,107,.32); display: block; margin: 4px auto 10px; }
.hero.small .logo { width: 64px; height: 64px; border-radius: 16px; }
.inp { width: 100%; box-sizing: border-box; font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--bg2); background: var(--bg); color: var(--text); margin-top: 6px; }
.card .inp { border-color: color-mix(in srgb, var(--hint) 25%, transparent); }
.inp:focus { outline: none; border-color: var(--accent); }
textarea.inp { resize: vertical; min-height: 84px; line-height: 1.35; }
input[type=date].inp { min-height: 50px; }
.lbl { display: block; font-weight: 650; margin-top: 14px; }
.lbl:first-child { margin-top: 0; }
.lbl .hint { font-weight: 400; }
.switch { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-weight: 600; cursor: pointer; }
.card > .switch:first-child { margin-top: 0; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.webback { position: fixed; top: 10px; left: 10px; z-index: 8; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--bg2); color: var(--text); font-size: 20px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
html[dir=rtl] .webback { left: auto; right: 10px; transform: scaleX(-1); }
body.webnav #app { padding-top: 58px; }

/* ---------------- Gift Draw ---------------- */
.promo { display: block; text-decoration: none; color: var(--text); background: var(--bg2); border-radius: 14px; padding: 12px 14px; margin-top: 10px; font-size: 14px; }
.room { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-radius: 16px; padding: 14px; margin: 8px 0; background: var(--bg2); color: var(--text); text-align: start; font: inherit; font-size: 17px; cursor: pointer; }
.room .e { font-size: 30px; }
.room .t { flex: 1; min-width: 0; }
.room .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room small { color: var(--hint); font-size: 14px; }
.badge { background: var(--gold); color: var(--gold-ink); font-size: 13px; font-weight: 800; border-radius: 12px; padding: 4px 10px; flex: none; }
.steps { padding: 0; margin: 0; list-style: none; }
.steps li { display: flex; gap: 12px; padding: 8px 0; align-items: flex-start; }
.steps li .n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.rules { list-style: none; padding: 0; margin: 0; }
.rules li { padding: 5px 0; }
.drawname { font-size: 18px; font-weight: 700; margin: 4px 0; overflow-wrap: anywhere; }
.drawname.big { font-size: 24px; letter-spacing: -.2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 8px 0 4px; }
.chip { background: color-mix(in srgb, var(--accent) 12%, var(--bg2)); color: var(--text); border-radius: 20px; padding: 5px 11px; font-size: 14px; font-weight: 600; }
.chips.lang { justify-content: flex-start; }
.chips.lang button { padding: 8px 12px; border-radius: 12px; border: 2px solid var(--bg); background: var(--bg); color: var(--text); cursor: pointer; font: inherit; font-weight: 600; font-size: 15px; }
.chips.lang button.on { border-color: var(--accent); }
.banner { background: linear-gradient(135deg, #2bc185, #1f9d6b 60%, #0d5c3e); color: #fff; border-radius: var(--radius); padding: 14px 16px; margin: 4px 0 10px; font-weight: 700; font-size: 18px; text-align: center; }
.banner small { font-weight: 500; font-size: 14px; opacity: .95; }
.card.list { padding: 6px 14px; }
.mrow { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid color-mix(in srgb, var(--hint) 18%, transparent); }
.mrow:last-child { border-bottom: 0; }
.mrow .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 9px; background: var(--bg); color: var(--hint); vertical-align: 1px; }
.wishmark { flex: none; }
.x { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--bg); color: var(--hint); cursor: pointer; font-size: 14px; }
.pair { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid color-mix(in srgb, var(--hint) 18%, transparent); }
.pair span { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.pairform { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.pairform select { flex: 1; min-width: 0; font-size: 15px; padding: 10px; }
.drawbox { border: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent); }
.notify p { margin-top: 0; }
.ideas { margin: 0; padding-inline-start: 20px; }
.ideas li { padding: 4px 0; }
.cta { background: color-mix(in srgb, var(--gold) 18%, var(--card)); }
.cta p:first-child { margin-top: 0; }

/* the closed gift */
.giftwrap { display: block; margin: 26px auto 8px; border: 0; background: transparent; cursor: pointer; padding: 20px; }
.gbox { position: relative; display: block; width: 180px; height: 170px; animation: wiggle 2.2s ease-in-out infinite; }
.gbox .body { position: absolute; left: 10px; right: 10px; bottom: 0; height: 120px; border-radius: 12px; background: linear-gradient(160deg, #2bc185, #1f9d6b 60%, #137a52); box-shadow: 0 16px 30px -14px rgba(13,92,62,.8); }
.gbox .lid { position: absolute; left: 0; right: 0; top: 18px; height: 40px; border-radius: 10px; background: linear-gradient(160deg, #34cf90, #1f9d6b); z-index: 2; transition: transform .7s cubic-bezier(.3,1.6,.5,1), opacity .7s; }
.gbox .ribbon { position: absolute; left: 50%; top: 18px; bottom: 0; width: 26px; margin-left: -13px; background: var(--gold); z-index: 3; transition: opacity .5s; }
.gbox .bow { position: absolute; left: 50%; top: -14px; transform: translateX(-50%); font-size: 52px; z-index: 4; transition: transform .7s cubic-bezier(.3,1.6,.5,1), opacity .7s; }
.giftwrap.opening .gbox { animation: shake .45s ease-in-out 2; }
.giftwrap.opening .lid { transform: translateY(-120px) rotate(-24deg); opacity: 0; transition-delay: .55s; }
.giftwrap.opening .bow { transform: translate(-50%, -150px) rotate(30deg); opacity: 0; transition-delay: .55s; }
.giftwrap.opening .ribbon { opacity: 0; transition-delay: .6s; }
.tap { font-weight: 700; font-size: 18px; margin-top: 14px; }
@keyframes wiggle { 0%, 82%, 100% { transform: rotate(0) } 86% { transform: rotate(-5deg) } 90% { transform: rotate(5deg) } 94% { transform: rotate(-3deg) } }
@keyframes shake { 0%, 100% { transform: translateX(0) rotate(0) } 25% { transform: translateX(-6px) rotate(-4deg) } 75% { transform: translateX(6px) rotate(4deg) } }
.burst { position: fixed; left: 50%; top: 42%; width: 0; height: 0; z-index: 25; pointer-events: none; }
.burst i { position: absolute; font-style: normal; font-size: 28px; transform: translate(-50%, -50%); animation: fly 1.4s ease-out .5s forwards; opacity: 0; }
@keyframes fly { 0% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--a)) translateY(0) } 100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(-1 * var(--d))) } }

/* the result */
.result { text-align: center; border-radius: 22px; padding: 20px 16px 18px; margin: 10px 0 12px; color: #fff;
  background: linear-gradient(160deg, #2bc185, #1f9d6b 55%, #0d5c3e); box-shadow: 0 18px 40px -22px #0d5c3e; }
.result.pop { animation: pop .45s cubic-bezier(.3,1.5,.5,1); }
.result .lbl2 { font-size: 15px; font-weight: 600; opacity: .92; text-transform: uppercase; letter-spacing: .6px; }
.result .gname { font-size: 30px; font-weight: 800; letter-spacing: -.3px; overflow-wrap: anywhere; }
.result .chip { background: rgba(255,255,255,.18); color: #fff; }
.result .av { background: var(--gold); color: var(--gold-ink); }
.wishbox { background: rgba(255,255,255,.95); color: #1a1a1a; border-radius: 16px; padding: 12px 14px; margin-top: 12px; text-align: start; }
.wishbox .hint { color: #6b716e; }
.wishbox .w { font-size: 17px; margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
@keyframes pop { from { transform: scale(.85); opacity: 0 } to { transform: scale(1); opacity: 1 } }
