/* Cleaner home screen. Loaded last. */

/* Page fills the viewport: header · content · footer, so the home composition can be centred. */
body{display:flex;flex-direction:column;min-height:100svh}
main{flex:1;display:flex;flex-direction:column;min-height:0}
main>.view{margin:0 auto;width:100%}
.home{flex:1;min-height:0;padding-top:40px;padding-bottom:40px}

/* With WebGL available (flag set in <head> before first paint) the flat fallback cards stay hidden
   from the start, so they never flash before the 3D cards appear. Without WebGL they show as before. */
.webgl .scene-wrap .scene,.webgl .scene-wrap .orbit{visibility:hidden}
.webgl .table .draw-card{opacity:0;box-shadow:none;background:none}
.webgl .table .draw-card .card-face{visibility:hidden}
.webgl .table .draw-card:focus-visible{opacity:1;outline:2px solid var(--accent)}
.webgl .card-viewer:not(.flat) .viewer-card{visibility:hidden}

/* Wide screens: fan and text stay together in the middle instead of drifting to the edges. */
@media(min-width:1200px){
  .home{width:min(100%,1320px);margin-inline:auto;padding-left:40px;padding-right:40px;column-gap:24px}
  .home .nav-arrow.prev{left:16px}
  .home .nav-arrow.next{right:16px}
}

/* Brand icon without glow */
.brand-icon{filter:none}

/* Deck switch above the deck title */
.hero-copy .deck-switch{position:static;display:flex;flex-wrap:wrap;justify-content:flex-start;gap:8px;margin-bottom:22px}
.hero-copy .deck-tab{border:0;background:transparent;transition:background .2s,color .2s}
.hero-copy .deck-tab:hover{color:var(--text);background:#ffffff08}
.hero-copy .deck-tab.active{background:#ffffff12}
.hero-copy h1{margin-top:0}
.hero-copy .intro{margin-bottom:34px}

/* Main button: label on the left, price with the shard icon on the right */
.primary .start-label{font-size:inherit;line-height:1.2}
.primary .start-cost{display:inline-flex;align-items:center;gap:6px;font-size:16px;font-weight:800;font-variant-numeric:tabular-nums}
.primary .start-cost .shard-icon{margin:0;width:18px;height:18px;color:currentColor;filter:none}

/* Shown only when a paid spread is short of Shards */
.funds-note{margin:14px 0 0;font-size:13px;color:#e9c3d2;animation:enter .35s ease}
.funds-note[hidden]{display:none}
.funds-note a{color:var(--accent);text-decoration:underline;text-underline-offset:3px;font-weight:600}
.funds-note a:hover{color:var(--text)}

/* Footer: only the credit, centred, one muted tone for text and logo */
footer{justify-content:center}
.credit{color:#766d80;gap:10px}
.credit .vibe-logo{color:inherit;height:20px}
.credit:hover{color:#a69cb0}

@media(max-width:700px){
  /* Equal space above the 3D cards and below the button */
  /* The 3D view has ~50px of empty sky above the cards, so the bottom gets the matching padding. */
  .home{justify-content:center;padding:0 24px 26px}
  .home .scene-wrap{height:clamp(280px,43svh,370px)}
  .home .camera-controls{bottom:-8px}
  .hero-copy{margin-top:10px}
  .hero-copy{padding-top:6px;padding-bottom:0}
  .hero-copy .deck-switch{margin-bottom:12px}
  .hero-copy .deck-tab{padding:8px 15px}
  .hero-copy h1,.anime .hero-copy h1{font-size:clamp(46px,14vw,58px);margin:0 0 10px}
  .hero-copy .intro{margin-bottom:18px}
  .hero-copy .primary{padding:16px 20px;font-size:15px}
  .primary .start-cost{font-size:14px}
  .primary .start-cost .shard-icon{width:16px;height:16px}
  footer{justify-content:center;min-height:64px;padding:14px 0}
  .credit .vibe-logo{height:17px}
}
@media(prefers-reduced-motion:reduce){.funds-note{animation:none}}

/* One accent for the whole site: the Anime deck keeps its own background, but buttons, icons,
   indicators and highlights stay in the original green. */
.anime,.card-viewer.anime,.card-dialog.anime{--accent:#ddf3a0}

/* Deck change: only the cards and the text block move — the arrows stay put, and the light
   cross-fades between the old and the new 3D scene (two canvases overlap for a moment). */
.home{animation:none}
.home .hero-copy{animation:enter .55s ease both}
.home.leaving{opacity:1;transform:none;transition:none}
/* The enter animation keeps its end state (fill: both), so leaving needs its own animation, not a transition. */
.home.leaving .hero-copy{animation:leaveDown .38s ease forwards}
@keyframes leaveDown{to{opacity:0;transform:translateY(22px)}}
/* Deck arrows never animate with the deck; on hover they only grow a little.
   They keep clear of the screen edge on any width, so the growth is never cut off. */
.home .nav-arrow{transition:transform .2s ease,border-color .2s ease}
.home .nav-arrow.prev{left:max(16px,2.2%)}
.home .nav-arrow.next{right:max(16px,2.2%)}
.home .nav-arrow:hover{background:#211b2770;border-color:#ffffff45;transform:translateY(-50%) scale(1.12)}
/* The canvas itself never fades: the 3D scene lights up from its own dark background, so the lighter
   page backdrop can never show through for a frame between two decks. */
#world canvas{position:absolute;inset:0}
body:has(.webgl-ready){background:var(--bg)}
@media(max-width:700px){.home .nav-arrow.prev{left:10px}.home .nav-arrow.next{right:10px}}
@media(prefers-reduced-motion:reduce){.home .hero-copy,.home.leaving .hero-copy{animation:none}}

/* Primary buttons brighten their accent on hover. */
.primary:hover{background:color-mix(in srgb,var(--accent) 78%,#fff)}
.brand-dot{display:none}

/* ===== Header: login / registration button ===== */
.login-button{white-space:nowrap}
.login-sep{opacity:.45;margin:0 2px}

/* ===== Login / registration dialog ===== */
.auth-mode{display:grid;grid-template-columns:1fr 1fr;margin:0 32px 24px 0;border-bottom:1px solid var(--line)}
.auth-mode button{background:none;padding:10px 0 12px;font-size:14px;font-weight:600;color:#8f8599;border-bottom:2px solid transparent;margin-bottom:-1px;transition:color .2s,border-color .2s}
.auth-mode button:hover{color:var(--text)}
.auth-mode button[aria-selected="true"]{color:var(--text);border-bottom-color:var(--accent)}
/* Compact, evenly spaced: title → method switch → fields → button, all centred. */
.login-dialog{padding:30px 34px 32px}
.login-dialog .auth-title{margin:0 0 18px;text-align:center}
.login-dialog .login-reason{text-align:center;margin:-6px 0 16px;font-size:13px}
.login-dialog .segmented{display:flex;width:fit-content;margin:0 auto 22px}
.login-dialog .login-step label{display:block}
.login-dialog .field-label{margin-bottom:8px}
.login-dialog .code-hint{text-align:center;margin:0 0 14px;font-size:13px}
.login-dialog .primary.wide{margin-top:18px}
.login-dialog .login-step .change{margin:12px auto 0}
.login-dialog .login-note{margin:14px 0 0;min-height:0;text-align:center}
.login-dialog .login-note:empty{display:none}
.login-dialog .ref-field{display:block;margin-top:14px}
.login-dialog .ref-field[hidden]{display:none}
.login-dialog .ref-field input{text-transform:uppercase;letter-spacing:1px}
.login-dialog .ref-field input::placeholder{text-transform:none;letter-spacing:0}
.login-dialog .primary.wide{justify-content:center}

/* ===== How it works ===== */

@media(max-width:700px){
  .help-dialog,.login-dialog{padding:30px 22px 26px;max-height:calc(100svh - 32px);overflow-y:auto}
  .login-button{padding:9px 14px;font-size:12px}
}
@media(max-width:380px){.login-button{padding:8px 11px;font-size:11px}}

/* Deck arrows sit at the vertical centre of the fan (set from JS), at any screen width. */
.home .nav-arrow{top:var(--deck-mid,46%);transform:translateY(-50%);margin-top:0}

/* Camera reset: a single small circular-arrow button under the fan, no captions. */
.camera-controls span{display:none}
.camera-controls .reset-view{width:34px;height:34px;padding:0;display:grid;place-items:center;border-radius:50%;background:#1a1520cc;border:1px solid #ffffff24;color:#cfc6d6;opacity:0;visibility:hidden;transform:scale(.7);transition:opacity .25s,visibility 0s .25s,color .2s,border-color .2s,transform .4s cubic-bezier(.2,.8,.2,1)}
/* Appears only after the camera was moved; fades out again once the view is back to the start. */
.camera-controls.changed .reset-view{opacity:1;visibility:visible;transform:none;transition:opacity .25s,visibility 0s,color .2s,border-color .2s,transform .4s cubic-bezier(.2,.8,.2,1)}
.camera-controls .reset-view svg{width:16px;height:16px}
.camera-controls .reset-view:hover{color:var(--accent);border-color:color-mix(in srgb,var(--accent) 60%,transparent);transform:rotate(-90deg)}

/* Deck arrows are icons, centred in their circles. */
.home .nav-arrow{display:grid;place-items:center;padding:0}
.home .nav-arrow svg{width:20px;height:20px}
.deck-switch-top{display:none}

/* Phones: deck pills centred above the fan, the fan larger, arrows side by side under it,
   and the text with the button reaching closer to the screen edges. */
@media(max-width:700px){
  .home{padding-left:14px;padding-right:14px}
  .home .deck-switch-top{display:flex;position:static;justify-content:center;gap:8px;margin:22px 0 6px}
  .home .deck-switch-top .deck-tab{padding:9px 16px;border:0;background:transparent}
  .home .deck-switch-top .deck-tab.active{background:#ffffff12}
  .hero-copy .deck-switch-side{display:none}
  .home .scene-wrap{height:clamp(270px,41svh,390px);margin-bottom:56px}
  .home .nav-arrow{top:calc(var(--deck-bottom,60%) + 6px);transform:none;width:40px;height:40px}
  .home .nav-arrow.prev{left:calc(50% - 50px);right:auto}
  .home .nav-arrow.next{left:calc(50% + 10px);right:auto}
  .home .nav-arrow:hover{transform:scale(1.12)}
  .home .hero-copy{padding-left:2px;padding-right:2px;max-width:none}
}

/* Wide screens: the fan leans left (the big front card, the moon) and the text is left-aligned, so the
   pair looks off-centre between the arrows. Nudge both right; the 3D camera follows the scene's box. */
@media(min-width:701px){.home .scene-wrap,.home .hero-copy{translate:min(2vw,30px) 0}}

/* Tablets (portrait, or any width up to 900px): the same stacked layout as phones — deck pills,
   the fan, the arrows under it, then the text with the button. three-scene.js reads the column
   direction of .home to keep the 3D fan centred instead of shifted toward the text column. */
@media(min-width:701px) and (max-width:900px),(min-width:701px) and (max-width:1100px) and (orientation:portrait){
  .home{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:0 40px 40px;min-height:0}
  .home .deck-switch-top{display:flex;position:static;justify-content:center;gap:8px;margin:24px 0 76px}
  .home .deck-switch-top .deck-tab{padding:9px 18px;border:0;background:transparent}
  .home .deck-switch-top .deck-tab.active{background:#ffffff12}
  .hero-copy .deck-switch-side{display:none}
  .home .scene-wrap{width:100%;max-width:640px;height:clamp(340px,40svh,520px);margin:0 auto 64px;transform:none;translate:none}
  .home .scene-wrap.webgl-ready .camera-controls{left:50%}
  .home .scene-wrap.webgl-ready .scene-caption{transform:none}
  .home .nav-arrow{top:calc(var(--deck-bottom,60%) + 8px);transform:none;width:44px;height:44px}
  .home .nav-arrow.prev{left:calc(50% - 54px);right:auto}
  .home .nav-arrow.next{left:calc(50% + 10px);right:auto}
  .home .nav-arrow:hover{transform:scale(1.12)}
  .home .hero-copy{width:min(560px,100%);max-width:none;padding:0;margin:0 auto;translate:none;align-self:center;justify-self:auto}
  .hero-copy h1,.anime .hero-copy h1{font-size:clamp(64px,10vw,84px);margin:0 0 12px}
  .hero-copy .intro{margin-bottom:26px}
  .home .primary{width:100%;min-width:0}
  #world::after{background:linear-gradient(180deg,#09070c80,transparent 12%,transparent 46%,#09070ce6 64%,#09070c 100%)}
}
/* Phones: the pills keep a clear gap above the fan instead of touching the cards. */
@media(max-width:700px){.home .deck-switch-top{margin:22px 0 24px}}

/* ===== Headline above the deck and the text ===== */
/* The light sweeping through the headline: the site's green accent on both decks. */
.home-title{--glint:#ddf3a0;--glint-soft:#fff4dc}
.home{align-content:center}
.home-title{grid-column:1/-1;justify-self:center;position:relative;margin:0 0 10px;padding:0 16px;
  font-family:Prata,Georgia,serif;font-weight:400;font-size:clamp(40px,4.6vw,68px);line-height:1.08;letter-spacing:-.01em;text-align:center;
  background:linear-gradient(100deg,#9f93b4 0%,#f4f1f5 28%,var(--glint-soft) 42%,var(--glint) 50%,#f4f1f5 60%,#9f93b4 100%);background-size:260% 100%;background-position:100% 0;
  -webkit-background-clip:text;background-clip:text;color:transparent;
  animation:titleShimmer 10s ease-in-out infinite}
.home-title em{font-style:italic}
/* A thin starred line under the words (no glow behind them). */
.home-title::after{content:'✦';display:block;margin:10px auto 0;width:180px;font-size:11px;line-height:1;color:color-mix(in srgb,var(--glint) 70%,transparent);
  background:linear-gradient(90deg,transparent,color-mix(in srgb,var(--glint) 35%,transparent) 35%,transparent 45%,transparent 55%,color-mix(in srgb,var(--glint) 35%,transparent) 65%,transparent) center/100% 1px no-repeat}
.home-title.intro{animation:titleIn 1.3s cubic-bezier(.2,.8,.2,1) both,titleShimmer 10s ease-in-out 1.3s infinite}
.home-title.intro::after{animation:titleLine 1.1s .5s cubic-bezier(.2,.8,.2,1) both}
@keyframes titleIn{from{opacity:0;letter-spacing:.18em;filter:blur(10px);transform:translateY(14px)}to{opacity:1;letter-spacing:-.01em;filter:blur(0);transform:none}}
@keyframes titleLine{from{opacity:0;width:0}to{opacity:1;width:180px}}
@keyframes titleShimmer{0%,100%{background-position:100% 0}50%{background-position:0 0}}
@media(min-width:701px){.home .home-title{margin-bottom:clamp(8px,2vh,24px)}}
@media(max-width:700px){.home-title{font-size:clamp(26px,8.3vw,40px);margin:18px 0 0;padding:0;white-space:nowrap}.home-title::after{margin-top:8px}.home .deck-switch-top{margin-top:14px}}
@media(min-width:701px) and (max-width:900px),(min-width:701px) and (max-width:1100px) and (orientation:portrait){
  .home-title{font-size:clamp(44px,7vw,60px);margin:28px 0 0}.home .deck-switch-top{margin-top:16px}}
@media(prefers-reduced-motion:reduce){.home-title,.home-title.intro,.home-title.intro::after{animation:none}}
/* Side-by-side layout: the scene gives up a little height to the headline, so everything fits on one screen. */
@media(min-width:1101px),(min-width:901px) and (orientation:landscape){.home .scene-wrap{height:clamp(380px,calc(100svh - 400px),600px)}}
/* More air between the pills and the fan: the anime deck's effects (the «!!» burst, ドキッ) rise higher
   than the tarot moon. The headline and the pills move up instead of the fan moving down. */
@media(max-width:700px){.home-title{margin-top:6px}.home .deck-switch-top{margin:10px 0 46px}}
@media(min-width:701px) and (max-width:900px),(min-width:701px) and (max-width:1100px) and (orientation:portrait){
  .home-title{margin-top:14px}.home .deck-switch-top{margin:12px 0 100px}}

/* ===== Guest call to action: no price yet, so the label is centred and the button gently beckons ===== */
.primary.guest{justify-content:center;text-align:center;position:relative;overflow:hidden;isolation:isolate;
  animation:guestPulse 2.6s ease-in-out infinite}
/* A light sweep crosses the button every few seconds. */
.primary.guest::after{content:'';position:absolute;top:-20%;bottom:-20%;left:-40%;width:32%;z-index:-1;pointer-events:none;
  background:linear-gradient(100deg,transparent,#ffffffb3 50%,transparent);transform:skewX(-20deg) translateX(-120%);
  animation:guestShine 3.4s cubic-bezier(.4,0,.2,1) infinite}
.primary.guest:disabled{animation:none}
.primary.guest:disabled::after{animation:none;opacity:0}
@keyframes guestPulse{
  0%,100%{box-shadow:0 0 0 0 color-mix(in srgb,var(--accent) 45%,transparent),0 0 18px color-mix(in srgb,var(--accent) 22%,transparent);transform:scale(1)}
  50%{box-shadow:0 0 0 10px color-mix(in srgb,var(--accent) 0%,transparent),0 0 34px color-mix(in srgb,var(--accent) 45%,transparent);transform:scale(1.025)}}
@keyframes guestShine{0%,55%{transform:skewX(-20deg) translateX(-120%)}85%,100%{transform:skewX(-20deg) translateX(520%)}}
@media(prefers-reduced-motion:reduce){.primary.guest,.primary.guest::after{animation:none}}
/* Wide screens: the fan sits high in its 3D area, so the text block rises a little to stand level with the cards. */
@media(min-width:1101px),(min-width:901px) and (orientation:landscape){.home .hero-copy{translate:min(2vw,30px) calc(-1 * min(4.5vh,44px))}}

/* Phones and tablets (stacked layout): the shade over the 3D scene begins just below the fan
   (--fan-bottom, set from app.js), so the lower part of the cards and their names stay lit. */
@media(max-width:900px),(max-width:1100px) and (orientation:portrait){
  body:has(.home) #world::after{background:linear-gradient(180deg,#09070c80,transparent 12%,transparent calc(var(--fan-bottom,60%) - 30px),#09070ce6 calc(var(--fan-bottom,60%) + 90px),#09070c calc(var(--fan-bottom,60%) + 220px))}
}

/* More air between the header and the headline on every screen. On wide screens the 3D scene gives up the
   same height, so the whole composition still fits one screen. */
@media(min-width:1101px),(min-width:901px) and (orientation:landscape){
  .home .home-title{margin-top:clamp(14px,3.2vh,34px)}
  .home .scene-wrap{height:clamp(370px,calc(100svh - 430px),590px)}
}
@media(min-width:701px) and (max-width:900px),(min-width:701px) and (max-width:1100px) and (orientation:portrait){.home-title{margin-top:34px}}
@media(max-width:700px){.home-title{margin-top:26px}}

/* Phones and tablets: the home screen is exactly one screen tall. Header, headline, pills, text, button
   and footer take what they need; the 3D fan takes the rest, so the button never falls below the fold.
   (On very short screens the fan stops at its minimum and the page scrolls as a last resort.) */
@media(max-width:900px),(max-width:1100px) and (orientation:portrait){
  body:has(.home){height:100svh;min-height:0}
  body:has(.home) main{min-height:0}
  .home{flex:1 1 auto;min-height:0;justify-content:flex-start}
  .home .scene-wrap{flex:1 1 0;height:auto;min-height:190px;max-height:min(560px,52svh)}
  .home .hero-copy{flex:none}
}
@media(max-width:700px){
  .home{padding-bottom:16px}
  .home .scene-wrap{margin-bottom:54px}
  .hero-copy h1,.anime .hero-copy h1{font-size:clamp(40px,min(13vw,7svh),58px);margin-bottom:6px}
  .hero-copy .intro{margin-bottom:14px;line-height:1.65}
  footer{min-height:0;padding:10px 0 12px}
}
/* Short phones (iPhone SE and the like): tighter headline, pills, text and button. */
@media(max-width:700px) and (max-height:760px){
  .home-title{font-size:clamp(24px,7.4vw,32px);margin-top:14px}
  .home-title::after{margin-top:5px}
  .home .deck-switch-top{margin:6px 0 30px}
  .home .deck-switch-top .deck-tab{padding:7px 14px}
  .home .scene-wrap{min-height:160px;margin-bottom:48px}
  .home .nav-arrow{width:36px;height:36px}
  .hero-copy h1,.anime .hero-copy h1{font-size:clamp(34px,11vw,44px);margin-bottom:4px}
  .hero-copy .intro{font-size:13px;line-height:1.55;margin-bottom:12px}
  .home .hero-copy .primary{padding:13px 18px}
  footer{padding:6px 0 8px}
}
/* Tablets: a little less space under the pills, so the fan gets more of the screen. */
@media(min-width:701px) and (max-width:900px),(min-width:701px) and (max-width:1100px) and (orientation:portrait){
  .home .deck-switch-top{margin-bottom:64px}
}

/* ===== Deck change with the 3D fan: the text slides out and back in, in the direction of travel ===== */
.home .hero-copy>:not(.deck-switch){transition:opacity .26s ease,translate .26s ease}
.home .hero-copy.swapping>:not(.deck-switch){opacity:0;translate:calc(var(--dir,1) * -18px) 0}
.home .hero-copy.arriving>:not(.deck-switch){opacity:0;translate:calc(var(--dir,1) * 18px) 0;transition:none}
@media(prefers-reduced-motion:reduce){.home .hero-copy>:not(.deck-switch){transition:none}}

/* Pointer over the deck waiting in the dark: it can be clicked to bring it into the light. */
body.deck-waiting-hover{cursor:pointer}
/* Wide screens: the shade around the scene is centred under the light (it used to lean on the fan),
   so the deck waiting on the left simply sinks into the dark. */
@media(min-width:1101px),(min-width:901px) and (orientation:landscape){
  body:has(.home) #world::after{background:radial-gradient(ellipse 62% 88% at 50% 40%,transparent 42%,#09070cc4 100%),linear-gradient(180deg,#09070c80,transparent 20%,transparent 82%,#09070cb3)}
}

/* The text beside the fan stands on the living light without a dark block behind it. */
.home .hero-copy{background:none}
/* Headline: plain white with a soft shadow, like the deck title, so it holds on the bright background. */
.home-title{background:none;color:#f4f1f5;-webkit-text-fill-color:currentColor;text-shadow:0 2px 14px #17141c,0 0 30px #09070c99}
.home-title,.home-title.intro{animation-name:none}
.home-title.intro{animation:titleIn 1.3s cubic-bezier(.2,.8,.2,1) both}
.home-title::after{color:#f4f1f5b3;background:linear-gradient(90deg,transparent,#f4f1f559 35%,transparent 45%,transparent 55%,#f4f1f559 65%,transparent) center/100% 1px no-repeat}
/* Deck description on the living light: a heavier weight, lighter colour and a soft dark shadow to read well. */
.home .hero-copy .intro{font-weight:600;color:#e6e0ec;text-shadow:0 1px 3px #09070ccc,0 2px 14px #09070c}

/* Softer shadows under the headline, the deck title and the description: enough to hold on the light, not heavy. */
.home .hero-copy{text-shadow:0 1px 8px #09070c80}
.home-title{text-shadow:0 1px 6px #09070c8c}
.home .hero-copy .intro{text-shadow:0 1px 4px #09070c99}
/* The dot in the active deck pill takes the colour of the light behind the cards. */
body{--deck-light:#a77bff}
body.anime{--deck-light:#dc7cbf}
.home .deck-tab.active::before{background:var(--deck-light)}

/* ===== «Как это работает?»: a calm dark window with three faint coloured glows, a small fanned deck and three steps ===== */
.help-dialog{--lavender:#b9a4f5;--cold:#8fc3ff;--lime:#ddf3a0;--blush:#c98aa8;
  position:relative;max-width:780px;width:calc(100% - 32px);max-height:calc(100svh - 32px);overflow-y:auto;padding:36px 40px 32px;text-align:center;
  border:1px solid #ffffff17;border-radius:22px;box-shadow:0 30px 90px #000000b3;
  /* Deep even base; three wide, weak glows at the edges keep the middle dark and quiet. */
  background:radial-gradient(70% 55% at -5% -10%,color-mix(in srgb,var(--lavender) 15%,transparent),transparent 70%),
    radial-gradient(55% 70% at 108% 45%,color-mix(in srgb,var(--cold) 10%,transparent),transparent 70%),
    radial-gradient(70% 45% at 50% 112%,color-mix(in srgb,var(--blush) 9%,transparent),transparent 72%),#120e17}
.help-dialog[open]{animation:helpIn .5s cubic-bezier(.2,.8,.2,1) both}
.help-dialog::backdrop{background:#07050ab8;backdrop-filter:blur(10px)}
@keyframes helpIn{from{opacity:0;transform:translateY(18px) scale(.97)}to{opacity:1;transform:none}}
/* Close: a quiet round button with a full 44 px target. */
.help-dialog .close{position:absolute;top:12px;right:12px;width:44px;height:44px;display:grid;place-items:center;padding:0;border-radius:50%;
  font-size:24px;line-height:1;color:#b7aec1;background:transparent;transition:background .2s,color .2s}
.help-dialog .close:hover{background:#ffffff12;color:#f4f1f5}
.help-dialog button:focus-visible{outline:2px solid var(--lime);outline-offset:3px}
/* Three card backs in a small fan above the title. */
.help-fan{position:relative;height:66px;width:110px;margin:0 auto 10px}
.help-fan span{position:absolute;left:50%;bottom:0;width:38px;height:58px;margin-left:-19px;border-radius:6px;transform-origin:50% 120%;
  background:linear-gradient(150deg,#2e2339,#16111c 70%);border:1px solid #ffffff2b;box-shadow:0 8px 18px #00000080;transform:translateX(var(--x)) rotate(var(--r))}
.help-fan span::after{content:'✦';position:absolute;inset:0;display:grid;place-items:center;font-size:13px;color:var(--lime)}
.help-fan span:nth-child(1){--r:-18deg;--x:-22px}.help-fan span:nth-child(2){--r:0deg;--x:0px;z-index:1;background:linear-gradient(150deg,#ddf3a0,#a9c178);border-color:#ffffff59}.help-fan span:nth-child(3){--r:18deg;--x:22px}
.help-fan span:nth-child(2)::after{color:#1d2414}
.help-dialog[open] .help-fan span{animation:helpFan .8s .1s cubic-bezier(.2,.9,.25,1.15) both}
@keyframes helpFan{from{transform:translateY(8px);opacity:0}to{transform:translateX(var(--x)) rotate(var(--r));opacity:1}}
.help-eyebrow{margin:0 0 8px;font-size:10px;letter-spacing:3px;text-transform:uppercase;color:#ddf3a0b3}
.help-dialog h2{margin:0 0 12px;font-size:clamp(30px,4vw,40px)}
.help-lead{max-width:470px;margin:0 auto 30px;font-size:15px;line-height:1.6;color:#cfc7d8}
/* Steps: three equal, calm cards on one grid: icon, title and text start at the same lines. */
.help-steps{list-style:none;padding:0;margin:0;display:grid;grid-template-columns:repeat(3,1fr);gap:14px;text-align:left}
.help-steps li{--tone:var(--lavender);position:relative;display:grid;grid-template-rows:46px auto 1fr;row-gap:14px;padding:20px;border-radius:16px;
  background:#ffffff06;border:1px solid #ffffff14;transition:border-color .25s,box-shadow .25s}
/* Hover: the outline lights up in the step's own colour. */
.help-steps li:hover{border-color:color-mix(in srgb,var(--tone) 55%,transparent);box-shadow:0 0 0 1px color-mix(in srgb,var(--tone) 18%,transparent),0 0 22px color-mix(in srgb,var(--tone) 14%,transparent)}
.help-steps .step-ask{--tone:var(--cold)}.help-steps .step-open{--tone:var(--lime)}
.help-dialog[open] .help-steps li{animation:helpStep .55s calc(.25s + var(--i) * .1s) cubic-bezier(.2,.8,.2,1) both}
@keyframes helpStep{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
.help-icon{display:grid;place-items:center;width:46px;height:46px;border-radius:13px;color:var(--tone);
  background:color-mix(in srgb,var(--tone) 12%,transparent);border:1px solid color-mix(in srgb,var(--tone) 24%,transparent)}
.help-icon svg{width:27px;height:27px}
.help-steps h3{margin:0;font-size:16.5px;font-weight:700;line-height:1.3;color:#f4f1f5;align-self:end}
.help-steps p{margin:-6px 0 0;font-size:14px;line-height:1.5;color:#c3bacd}
.help-dialog .help-note{max-width:470px;margin:26px auto 0;font-size:14px;line-height:1.6;color:#aaa1b5}
.help-dialog .close-help{display:flex;justify-content:center;text-align:center;min-width:220px;margin:20px auto 0}
@media(max-width:700px){
  .help-dialog{width:calc(100% - 24px);max-height:calc(100svh - 24px);padding:26px 18px 22px;border-radius:18px}
  .help-fan{height:56px;width:96px;margin-bottom:6px}.help-fan span{width:32px;height:50px;margin-left:-16px}
  .help-dialog h2{font-size:28px;margin-bottom:10px}
  .help-lead{font-size:14px;margin-bottom:22px}
  .help-steps{grid-template-columns:1fr;gap:10px}
  .help-steps li{grid-template-columns:46px 1fr;grid-template-rows:auto auto;column-gap:14px;row-gap:4px;padding:18px 20px}
  .help-icon{grid-row:span 2}
  .help-steps h3{align-self:start}
  .help-steps p{margin:0}
  .help-dialog .close-help{width:100%;min-width:0}
}
@media(prefers-reduced-motion:reduce){.help-dialog[open],.help-dialog[open] .help-fan span,.help-dialog[open] .help-steps li{animation:none}}

/* ===== Page load: everything fades in at once ===== */
/* The page is hidden while the app prepares its first screen (html.booting, index.html), then the whole body fades
   in together with the 3D scene's light; the first home screen has no entrance of its own. */
body{transition:opacity 1s ease}
html.booting body{opacity:0}
.home.first,.home-title.intro,.home-title.intro::after{animation:none}
@media(prefers-reduced-motion:reduce){body{transition:none}}

/* Footer: links to the documents next to the studio credit. */
footer{flex-wrap:wrap;gap:6px 26px}
.legal-links{display:flex;flex-wrap:wrap;justify-content:center;gap:4px 18px;font-size:12px}
.legal-links a{color:#766d80;transition:color .2s}
.legal-links a:hover{color:#c7bed1}
/* Sign-in: the consent box and the note about the offer. */
.consent-check{display:flex;align-items:flex-start;gap:10px;margin:14px 0 4px;font-size:13px;line-height:1.5;color:#c3bacd;cursor:pointer;text-align:left}
.consent-check input{flex:none;width:18px;height:18px;margin:1px 0 0;accent-color:var(--accent);cursor:pointer}
.consent-check a,.offer-note a{color:var(--accent);text-decoration:underline;text-underline-offset:2px}
.offer-note{margin:12px 0 0;font-size:12px;line-height:1.55;color:#8f8599;text-align:center}
.wallet .muted a{color:inherit;text-decoration:underline;text-underline-offset:2px}

/* Sign-in with Telegram: Telegram's own button, shown once consent is given. */
.login-dialog .consent-check{margin:16px 0 4px}
.tg-login{display:grid;place-items:center;min-height:86px;margin:10px 0 4px;padding:16px;border-radius:12px;background:#ffffff06;border:1px solid #ffffff14}
.tg-login-wait{display:flex;align-items:center;gap:10px;margin:0;font-size:13px;line-height:1.5;color:#b7aec1;text-align:left}
.tg-login-wait svg{flex:none;width:22px;height:22px;color:#5fb7ff}
.tg-login-wait[hidden]{display:none}
/* Sign-in ways that are not connected are hidden (account.js). */
.login-dialog .segmented[hidden],.login-dialog [data-kind][hidden]{display:none}

/* ===== Sign-in (as in Syntx): choose Telegram or e-mail, then one step at a time ===== */
.login-dialog{max-width:440px;width:calc(100% - 32px);padding:34px 34px 30px;text-align:center}
.login-dialog .auth-step[hidden]{display:none}
.login-dialog .auth-title{margin:0 0 6px;font-size:clamp(28px,4vw,34px);text-align:center}
.login-dialog .login-reason{margin:4px 0 0;font-size:13px;color:#b7aec1}
.auth-lead{margin:26px 0 14px;font-size:16px;color:#ddd6e5}
.auth-ways{display:grid;gap:12px}
.auth-way{display:flex;align-items:center;justify-content:center;gap:12px;width:100%;padding:16px 20px;border-radius:12px;
  border:1px solid #ffffff2e;background:#ffffff06;font-size:17px;font-weight:600;color:var(--text);transition:border-color .2s,background .2s,transform .2s}
.auth-way:hover{border-color:var(--accent);background:#ffffff0d;transform:translateY(-1px)}
.auth-way[hidden]{display:none}
.auth-way .ui-icon{width:22px;height:22px}
.auth-way[data-way="telegram"] .ui-icon{color:#5fb7ff}
.auth-way[data-way="email"] .ui-icon{color:#ddd6e5}
.login-dialog .offer-note{margin:22px 0 0;font-size:12.5px;line-height:1.55;color:#8f8599;text-align:center}
.login-dialog .offer-note a{color:#cfc7d8;text-decoration:underline;text-underline-offset:2px}
.auth-sub{margin:10px auto 18px;max-width:330px;font-size:13.5px;line-height:1.55;color:#b7aec1}
/* QR code on a light tile, so phone cameras read it reliably. */
.tg-qr{width:200px;height:200px;margin:0 auto 18px;padding:14px;border-radius:16px;background:#f4f1f5;box-shadow:0 0 0 1px #ffffff1f,0 10px 30px #00000066}
.tg-qr svg{display:block;width:100%;height:100%}
.tg-qr.loading{background:linear-gradient(100deg,#ffffff10 30%,#ffffff26 50%,#ffffff10 70%) 0 0/300% 100%;animation:qrLoad 1.2s linear infinite}
@keyframes qrLoad{to{background-position:-300% 0}}
.login-dialog .tg-open{gap:10px}
.login-dialog .tg-open .ui-icon{width:20px;height:20px}
.tg-open.disabled{opacity:.45;pointer-events:none}
.tg-wait{display:flex;align-items:center;justify-content:center;gap:9px;margin:14px 0 0;font-size:13px;color:#b7aec1}
.tg-dot{width:8px;height:8px;border-radius:50%;background:#5fb7ff;animation:tgPulse 1.4s ease-in-out infinite}
@keyframes tgPulse{50%{opacity:.25;transform:scale(.7)}}
.tg-wait .text-button{color:var(--accent);text-decoration:underline;padding:0;font-size:13px}
.login-dialog .auth-back{display:inline-flex;align-items:center;gap:7px;margin:16px auto 0;font-size:14px;font-weight:600;color:#ddd6e5}
.login-dialog .auth-back svg{width:18px;height:18px}
.login-dialog .auth-back:hover{color:var(--text)}
/* E-mail and code steps. */
.login-dialog .step-email,.login-dialog .step-code{text-align:left}
.login-dialog .step-email .auth-title,.login-dialog .step-code .auth-title{margin-bottom:24px}
.login-dialog .step-email .field-label{display:block;margin-bottom:10px;font-size:15px;font-weight:700;color:#ece7f1}
.login-dialog .step-email .auth-back{display:flex}
.code-title{margin:0 0 8px;font-size:17px;font-weight:700;color:#ece7f1}
.login-dialog .code-hint{margin:0 0 18px;font-size:13.5px;line-height:1.55;color:#b7aec1;text-align:left}
.login-dialog .code-hint b{color:var(--accent);font-weight:600}
.code-boxes{display:grid;grid-template-columns:repeat(6,1fr);gap:10px}
.login-dialog .code-boxes input{height:56px;padding:0;text-align:center;font-size:22px;font-weight:700;border-radius:10px;background:#0f0c14;caret-color:var(--accent)}
.login-dialog .resend{display:block;margin:12px 0 0 auto;padding:0;font-size:13px;color:#8f8599}
.login-dialog .resend:not(:disabled){color:var(--accent);text-decoration:underline;text-underline-offset:2px}
.code-actions{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:22px}
.code-actions .auth-back{margin:0}
.code-actions .code-submit{flex:1;max-width:260px;justify-content:center;min-width:0}
@media(max-width:600px){
  .login-dialog{padding:28px 20px 24px}
  /* On the phone the QR code stays (it can be scanned from another device), a little smaller. */
  .tg-qr{width:168px;height:168px;padding:12px;margin-bottom:14px}
  .code-boxes{gap:7px}.login-dialog .code-boxes input{height:50px;font-size:20px}
}
.login-dialog .auth-back,.login-dialog .resend:disabled{text-decoration:none}

/* Telegram-only sign-in: QR code, a filled button for the app, an outlined one for Telegram Web. */
.login-dialog .step-telegram .login-reason{margin:2px 0 0}
.login-dialog .step-telegram .login-reason:empty{display:none}
.tg-refresh{margin:-8px 0 16px;font-size:12px;color:#8f8599;font-variant-numeric:tabular-nums}
.tg-refresh:empty{display:none}
.tg-buttons{display:grid;gap:10px}
.login-dialog .tg-buttons .primary.wide{margin-top:0}
.login-dialog .tg-web{display:flex;align-items:center;justify-content:center;gap:10px;padding:16px 20px;border-radius:8px;border:1px solid #ffffff38;background:transparent;font-size:15px;font-weight:700;color:var(--text);text-decoration:none}
.login-dialog .tg-web:hover{border-color:#5fb7ff;background:#5fb7ff12}
.login-dialog .tg-web .ui-icon{width:20px;height:20px;color:#5fb7ff}
.tg-web.disabled{opacity:.45;pointer-events:none}
.login-dialog .tg-back[hidden]{display:none}
.login-dialog .tg-buttons a span{font-size:15px;line-height:1.2}

/* Sign-in window: the same calm dark ground with faint coloured glows as «Как это работает?». */
.login-dialog{border:1px solid #ffffff17;border-radius:22px;box-shadow:0 30px 90px #000000b3;
  background:radial-gradient(70% 55% at -5% -10%,color-mix(in srgb,#b9a4f5 15%,transparent),transparent 70%),
    radial-gradient(55% 70% at 108% 45%,color-mix(in srgb,#8fc3ff 10%,transparent),transparent 70%),
    radial-gradient(70% 45% at 50% 112%,color-mix(in srgb,#c98aa8 9%,transparent),transparent 72%),#120e17}
.login-dialog::backdrop{background:#07050ab8;backdrop-filter:blur(10px)}
/* Telegram Web: outlined, text centred; its outline lights up in the green of the main button. */
.login-dialog .tg-web{justify-content:center;text-align:center}
.login-dialog .tg-web:hover,.login-dialog .tg-web:focus-visible{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 8%,transparent);box-shadow:0 0 18px color-mix(in srgb,var(--accent) 22%,transparent)}
/* The waiting indicator in the same green. */
.tg-dot{background:var(--accent)}
/* Telegram Web: the green outline and glow fade in and out softly. */
.login-dialog .tg-web{transition:border-color .45s cubic-bezier(.22,.61,.36,1),background-color .45s cubic-bezier(.22,.61,.36,1),box-shadow .6s cubic-bezier(.22,.61,.36,1)}
@media(prefers-reduced-motion:reduce){.login-dialog .tg-web{transition:none}}

/* QR code that could not be made: no empty white tile. */
.tg-qr.failed{display:none}
/* Daily wheel: the card is as tall as the column beside it, so the wheel grows to fill it. */
.profile-grid .panel.roulette{display:flex;flex-direction:column;align-items:center;justify-content:space-between}
.profile-grid .roulette .wheel-wrap{width:min(330px,82%);margin:14px auto 18px}
.profile-grid .roulette .wheel-status{margin-bottom:12px}
@media(max-width:700px){.profile-grid .roulette .wheel-wrap{width:min(280px,78vw)}}
/* Subscription bonus: Telegram logo on «Открыть канал», no arrows. */
.tg-channel{display:inline-flex;align-items:center;gap:8px}
.tg-channel .ui-icon{width:17px;height:17px;color:#5fb7ff}
/* Two columns: the row is as tall as the promo + bonus column (no empty space under the bonus); the wheel card
   takes exactly that height and its wheel fits into what is left after the title, status and button. */
@media(min-width:1001px){
  .profile-grid .panel.roulette{contain:size;container-type:size}
  .profile-grid .roulette .wheel-wrap{width:min(330px,82cqw,calc(100cqh - 250px));margin:10px auto 12px}
}
/* Telegram logo on «Открыть канал» in the site's green. */
.tg-channel .ui-icon{color:var(--accent)}
/* A bigger wheel in the same card: tighter spacing around it gives it the room. */
@media(min-width:1001px){
  .profile-grid .panel.roulette{padding-top:22px;padding-bottom:22px}
  .profile-grid .roulette h3{margin:4px 0 0}
  .profile-grid .roulette .wheel-wrap{width:min(360px,86cqw,calc(100cqh - 178px));margin:6px auto 8px}
  .profile-grid .roulette .wheel-status{min-height:0;margin:0 0 10px}
}

/* Narrow screens: the text lines up with the header's edges (5.4%, at least 16px). The 3D area is never much
   much taller than the fan it holds — the fan is sized by the width there, so extra height only left an empty gap
   between the cards and the arrows. On a screen taller than the composition, it stands in the middle between the
   header and the footer. The description under the deck name is set lighter on phones. */
@media(max-width:700px){
  .home{padding-left:max(16px,5.4%);padding-right:max(16px,5.4%);justify-content:center}
  .home .hero-copy{padding-left:0;padding-right:0}
  .home .scene-wrap{max-height:min(560px,52svh,66vw)}
  .home .hero-copy .intro{font-weight:400;color:#ddd6e4}
}
