
#santa-play{--game-title:clamp(24px,6.1vw,30px);--game-subtitle:17px;--game-body:16px;--game-caption:14px;font:400 var(--game-body)/1.4 Arial,sans-serif;display:grid;justify-items:center;gap:8px;padding:8px 0;color:#fff4db}
#santa-play *,#santa-play *::before,#santa-play *::after{box-sizing:border-box}
#santa-play [hidden]{display:none!important}
#santa-play .game-nav,#santa-play .stage{width:min(100%,390px)}
#santa-play .game-nav{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:6px 12px;border-radius:12px;background:#1a322a;color:#fff5da;font-size:13px}
#santa-play select{font:inherit;color:#fff4de;background:#284b3f;border:1px solid #769286;border-radius:8px;padding:7px;max-width:65%}
#santa-play .stage{height:clamp(530px,169vw,660px);border:5px solid #242521;border-radius:28px;overflow:hidden;background:#103e31}
#santa-play .pane,#santa-play .phone{width:100%;height:100%;margin:0;position:relative}
#santa-play .pane{display:flex;flex-direction:column;gap:14px;padding:clamp(18px,5%,28px);overflow-y:auto;scrollbar-width:thin}
#santa-play h2{margin:0;color:white;font:400 var(--game-title)/1.08 Arial,Helvetica,sans-serif;letter-spacing:-.8px}
#santa-play h3{margin:15px 0 7px;font:600 var(--game-subtitle)/1.25 system-ui,sans-serif;color:inherit}
#santa-play p{margin:0;font:inherit;color:inherit}
#santa-play button{font:inherit;cursor:pointer}
#santa-play .primary,#santa-play .minor,#santa-play .enter{border-radius:24px;padding:12px 16px;min-height:44px}
#santa-play .primary{background:#e8dbbd;color:#193e31;border:0;font-weight:600}
#santa-play .minor{color:#fff3d4;border:1px solid #b2c6af77;background:#ffffff0b}
#santa-play .topics,#santa-play .results{background:linear-gradient(150deg,#127d4b,#07432e)}
#santa-play .topics{gap:9px}
#santa-play .progress-label,#santa-play .demo{color:#eedfc3}
#santa-play .progress-label{font-size:var(--game-body)}
#santa-play .demo,#santa-play .ticket small{font-size:var(--game-caption)}
#santa-play .progress-meter{width:100%;height:4px;accent-color:#f5db9f}
#santa-play .result-scroll{flex:1;min-height:100px;overflow:auto;scrollbar-width:thin}
#santa-play .result-count{color:#e7d8b8}#santa-play ul{padding:0;list-style:none}#santa-play .result-scroll ul{display:flex;flex-wrap:wrap;gap:5px;margin:0}#santa-play .result-scroll li{background:#ffffff14;padding:4px 8px;border-radius:10px;font-size:var(--game-caption)}
#santa-play .wish{background:linear-gradient(155deg,#641f35,#23131c)}
#santa-play .wish-art{min-height:40px;flex:1;width:100%;object-fit:contain;mask-image:radial-gradient(ellipse,#000 52%,transparent 77%)}
#santa-play textarea{resize:vertical;min-height:72px;max-height:150px;width:100%;font:var(--game-body)/1.4 system-ui;padding:10px;border-radius:12px;border:1px solid #c5aa97;background:#fff5de;color:#38251d}
#santa-play .draw{background:linear-gradient(150deg,#12523d,#062c28);text-align:left}
#santa-play .bag{flex:1;min-height:80px;border:0;background:transparent;color:#ffe9bb;display:flex;flex-direction:column;justify-content:center;align-items:center}
#santa-play .bag img{min-height:0;max-height:87%;max-width:100%;object-fit:contain;mask-image:radial-gradient(ellipse,#000 53%,transparent 78%)}
#santa-play .ticket{margin:auto 0;border-radius:14px;background:#f3e5c4;color:#442f22;padding:22px;box-shadow:0 7px 22px #05251b66}
#santa-play .ticket h3{font:var(--game-subtitle) Georgia,serif;margin:8px 0 16px}#santa-play .ticket p+p{margin-top:8px}
#santa-play .demo{text-align:center}#santa-play .phone{background:#114d38;font:var(--game-body)/1.4 system-ui,sans-serif}
#santa-play dl{margin:14px 0 0}#santa-play ol{list-style:none}#santa-play .rules-list li+li{border-top:1px solid}#santa-play .rules-list li p{font:400 var(--game-body)/1.45 system-ui;margin:4px 0 0}#santa-play .rules-list strong{font:650 var(--game-subtitle)/1.4 system-ui}#santa-play .rules-next{border:0}
#santa-play #rules .rules-screen {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  min-height: 0;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  padding: 11px;
  background: url("./assets/rules-tree.webp") 59% center / auto 103% no-repeat, linear-gradient(155deg,#175c46,#06372c);
}
#santa-play #rules .rules-screen::before {
  content: "";
  position: absolute;
  inset: 11px;
  width: auto; height: auto;
  z-index: 0; pointer-events: none;
  border-radius: 23px;
  border: 1px solid rgba(255,239,205,.43);
  background: linear-gradient(105deg, rgba(7,39,31,.85), rgba(11,47,37,.71) 57%, rgba(12,45,36,.58));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 #fff4d829, 0 5px 16px #04231a40;
}
#santa-play #rules .rules-screen::after { content: none; }
#santa-play #rules .rules-content {
  grid-area: 1 / 1;
  position: relative;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  z-index: 1;
  border-radius: 23px 23px 0 0;
  scrollbar-width: none;
  padding: 24px clamp(15px, 5%, 24px) 25px;
}
#santa-play #rules .rules-content::-webkit-scrollbar { display: none; }
#santa-play #rules .rules-scroll-rail {
  grid-area: 1 / 1; position: relative; z-index: 2; justify-self: end;
  width: 14px; margin: 19px 1px; touch-action: none; cursor: pointer;
}
#santa-play #rules .rules-scroll-rail[hidden] { display: none; }
#santa-play #rules .rules-scroll-thumb {
  position: absolute; top: 0; right: 3px; width: 3px; height: 28px; max-height: 100%;
  border-radius: 2px; background: rgba(233, 223, 196, .56); cursor: grab;
}
#santa-play #rules .rules-scroll-rail:active .rules-scroll-thumb { cursor: grabbing; }
@media (forced-colors: active) {
  #santa-play #rules .rules-scroll-thumb { background: CanvasText; }
}
#santa-play #rules .rules-content:focus-visible { outline: 1px solid #d5c994; outline-offset: -2px; }
#santa-play #rules .rules-content header, #santa-play #rules .exchange-details, #santa-play #rules .draw-people, #santa-play #rules .draw-baubles { width: auto; height: auto; max-width: none; }
#santa-play #rules .exchange-details {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  row-gap: 4px;
  align-items: baseline;
}
#santa-play #rules .exchange-details dt, #santa-play #rules .exchange-details dd {
  min-width: 0;
  width: auto;
  margin: 0;
}
#santa-play #rules .exchange-details dt:nth-of-type(2), #santa-play #rules #exchange-place { grid-column: 1/-1; }
#santa-play #rules .exchange-details dt:nth-of-type(2) { margin-top: 12px; }
#santa-play #rules #exchange-place { line-height: 1.4; overflow-wrap: break-word; }
#santa-play #rules #exchange-place small { display: block; margin-top: 3px; }
#santa-play #rules .draw-people { margin: 18px 0 0; }
#santa-play #rules .draw-roster-label { margin: 0 0 7px; }
#santa-play #rules .exchange-details dt, #santa-play #rules .draw-roster-label {
  font: 550 var(--game-caption,0.875rem)/1.35 system-ui, sans-serif;
  color: #e6d3ad; letter-spacing: .045em;
}
#santa-play #rules .exchange-details dd {
  font: 500 var(--game-body,1.055rem)/1.4 system-ui, sans-serif; color: #fff6e5;
}
#santa-play #rules #exchange-place small { font: 400 var(--game-caption,.875rem)/1.4 system-ui, sans-serif; color: #d3ded5; }
#santa-play #rules .rules-content h2 {
  font: 400 var(--game-title,clamp(24px, 6.1vw, 30px))/1.08 Arial, Helvetica, sans-serif;
  letter-spacing: -.8px;
  text-align: start;
  color: #fff;
  margin: 0 0 11px;
  padding: 0;
  border: 0;
}
#santa-play #rules .draw-baubles {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: flex-start;
  gap: 5px 8px; padding: 0; height: auto;
}
#santa-play #rules .roster-ornament {
  --shine: #dc8893; --body: #922f43; --shade: #441627;
  position:relative; isolation:isolate; display:grid; place-items:center;
  flex:0 0 43px; width:43px; height:51px; min-width:0; padding:8px 0 0;
  border:0; background:none; box-shadow:none; transform:none; user-select:none; cursor:pointer;
}
#santa-play #rules .roster-ornament:nth-child(2) { --shine:#8db6a4; --body:#366e59; --shade:#163e32; }
#santa-play #rules .roster-ornament:nth-child(3) { --shine:#f8ce81; --body:#a7732a; --shade:#513815; }
#santa-play #rules .roster-ornament:nth-child(4) { --shine:#9fbfe8; --body:#3b5f99; --shade:#203556; }
#santa-play #rules .roster-ornament:nth-child(5) { --shine:#d5a5d7; --body:#83508d; --shade:#442849; }
#santa-play #rules .roster-ornament[aria-pressed="true"] span { outline:1.5px solid #ffdfa3; outline-offset:2px; }
#santa-play #rules .roster-ornament:focus-visible { outline:2px dashed #fff1c8; outline-offset:1px; border-radius:9px; }
#santa-play #rules .roster-caption { margin:4px 0 0; min-height:1.4em; color:#fff1d2; font:500 var(--game-caption,14px)/1.4 system-ui,sans-serif; }
#santa-play #rules .roster-ornament::before {
  content:""; position:absolute; z-index:0; top:2px; left:50%; transform:translateX(-50%);
  display:block; width:6px; height:7px; border:1.5px solid #d5ab62; border-radius:50%;
  box-sizing:border-box; background:none; box-shadow:none;
}
#santa-play #rules .roster-ornament::after {
  content:""; position:absolute; z-index:1; top:7px; left:50%; transform:translateX(-50%);
  display:block; width:12px; height:6px; border:0; border-radius:3px 3px 2px 2px;
  background:repeating-linear-gradient(90deg,#9c753d 0,#e4c283 2px,#e9cf96 3px,#aa8146 4px);
}
#santa-play #rules .roster-ornament span {
  position:relative; z-index:0; inset:auto; display:grid; place-items:center; box-sizing:border-box;
  width:37px; height:37px; border:1px solid #e8c89c83; border-radius:50%;
  color:#fff5da; font:650 var(--game-subtitle,17px)/1 Georgia,serif; text-shadow:0 1px 2px #321d16;
  background:
    radial-gradient(ellipse 18% 10% at 29% 21%,#fff5dfc2,transparent 100%),
    radial-gradient(ellipse 40% 14% at 63% 88%,#f7d4a94a,transparent 85%),
    radial-gradient(circle at 34% 26%,var(--shine),var(--body) 45%,var(--shade) 82%);
  box-shadow:inset 1px 1px 3px #fff3d64f,inset -2px -2px 4px #1f191b69,0 2px 4px #09291e99;
}
#santa-play #rules .roster-ornament span::before, #santa-play #rules .roster-ornament span::after { content:none; }
#santa-play #rules .rules-list {
  margin:8px 0 0; padding:0; height:auto; width:auto;
  position:relative; background:none; box-shadow:none; border:0; border-radius:0;
}
#santa-play #rules .rules-list::before,#santa-play #rules .rules-list::after { content:none; }
#santa-play #rules .rules-list li { margin: 0; height: auto; padding: 14px 0; border-color: #fff1d335; }
#santa-play #rules .rules-list strong { color: #ffefcf; }
#santa-play #rules .rules-list p { color: #fff8ea; height: auto; }
#santa-play #rules .rules-next {
  grid-area: 2 / 1;
  position: relative; justify-self: stretch; width: auto; height: auto; min-height: 44px;
  margin: 6px 5% max(14px,env(safe-area-inset-bottom)); z-index: 1;
  background: #e6d8b8; color: #183e31; border-radius: 24px; font-weight: 650;
}


body { margin: 0; background: #f2eade; }
#santa-play .wish-art, #santa-play .bag img { mask-image: none; }

/* Телефон: макет целиком помещается в видимую часть экрана, нижняя кнопка не уходит за край. */
@media (max-width: 480px) {
  #santa-play .stage { max-height: calc(100vh - 70px); max-height: calc(100dvh - 70px); }
}

/* Внутри Telegram: игра на весь экран, без рамки и переключателя макета. */
body.live { background: #103e31; }
#santa-play.live { padding: 0; gap: 0; }
#santa-play.live .game-nav, #santa-play.live .demo { display: none; }
#santa-play.live .stage { width: min(100%, 520px); height: var(--tg-viewport-stable-height, 100vh); max-height: none; border: 0; border-radius: 0; }
#santa-play.live .pane { padding-bottom: calc(18px + var(--tg-safe-area-inset-bottom, 0px)); }
#santa-play.live #rules .rules-next { margin-bottom: calc(14px + var(--tg-safe-area-inset-bottom, 0px)); }
#santa-play .bag:disabled { opacity: .6; cursor: default; }
#santa-play .recipient-wish { white-space: pre-line; overflow-wrap: anywhere; }
#santa-play .host { display: grid; gap: 8px; }
#santa-play .host h3 { margin: 0; }
#santa-play .host-players { margin: 0; max-height: 150px; overflow-y: auto; }
#santa-play .host-players li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--game-caption); }
#santa-play .host-players button { width: 36px; height: 36px; flex: none; border: 0; background: none; color: #f3c9bd; font-size: 20px; }

/* Карточка темы: гирлянда лежит поверх карточки и выходит за её края. Все размеры — доли ширины карточки. */
#santa-play .topics { --card: min(64vw, 250px, 28vh); overflow-x: hidden; }
#santa-play.live .topics { --card: min(70vw, 300px, 34vh); }
#santa-play .progress-meter { flex: none; margin-bottom: calc(var(--card) * .4); }
#santa-play .topic-card {
  position: relative; isolation: isolate; flex: none; margin: auto;
  width: var(--card); height: calc(var(--card) * 1.24);
  border-radius: 24px; background: linear-gradient(#e9d3b3, #ffe4c4 22%); color: #2c2320;
  box-shadow: 0 12px 28px #04231f44; text-align: center; touch-action: pan-y; user-select: none;
}
#santa-play .topic-card::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 138%; aspect-ratio: 941 / 800; left: -19%; top: calc(var(--card) * -.57);
  background: url("./assets/holiday-garland.webp") top / 100% auto no-repeat;
  filter: drop-shadow(0 6px 8px #1b2a1c66);
}
#santa-play .home-art { display: block; width: 100%; height: var(--card); margin-top: -2%; object-fit: fill; pointer-events: none; }
#santa-play .topic-emblem { height: var(--card); display: grid; place-items: center; padding-top: 18%; font-size: calc(var(--card) * .36); }
#santa-play .topic-card strong { display: block; font: 400 16px/1.2 Arial, Helvetica, sans-serif; }
#santa-play .topic-card small { display: block; margin-top: 2px; font: 400 14px/1.2 Arial, Helvetica, sans-serif; color: #7d6d61; text-transform: lowercase; }
#santa-play .answers { display: flex; justify-content: center; gap: 76px; }
#santa-play .answers button { display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 1px solid #bfe0c9a6; border-radius: 50%; background: #ffffff1f; color: #f2fff4; }
#santa-play .answers button + button { border-color: #e6b9aca6; background: #b5614a4d; color: #ffd0c2; }
#santa-play .answers button[aria-pressed="true"] { outline: 2px solid #ffdfa3; outline-offset: 2px; }
#santa-play .answers svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Вход: красное свечение, марионетка во всю ширину, кнопка-стекло поверх неё. */
#santa-play .entry {
  gap: 0; padding: clamp(18px, 5vh, 42px) 25px 26px; overflow: hidden; isolation: isolate; text-align: center;
  background: radial-gradient(ellipse 64% 62% at 50% 82%, #ee4512, #cf3512 26%, #842414 54%, #351c17 82%, #191716) #191716;
}
#santa-play .entry h2 { font-size: clamp(28px, 9vw, 36px); line-height: 1.05; }
#santa-play .entry header p { max-width: 280px; margin: 10px auto 0; font-size: 13px; line-height: 1.4; color: #f6e9e0; }
#santa-play .entry-art { flex: 1; min-height: 0; width: calc(100% + 50px); margin: 10px -25px -70px; pointer-events: none; }
#santa-play .enter {
  position: relative; z-index: 1; flex: none; height: 44px; padding: 0 16px 0 54px; border: 0; text-align: left; font-size: 14px;
  background: #ffffff2b; color: #f8e6dc; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); touch-action: pan-y;
}
#santa-play .enter span { position: absolute; left: 4px; top: 3px; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #fff; color: #3c3431; }
#santa-play .enter svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#santa-play.live .entry { padding-bottom: calc(26px + var(--tg-safe-area-inset-bottom, 0px)); }
#santa-play .entry .host-open { margin-top: 10px; min-height: 36px; padding: 6px 16px; font-size: 13px; }
#santa-play .rules .host-open { width: 100%; margin-top: 8px; }
