:root {
  --night: #0b1021;
  --plate: #0f1630;
  --plate-2: #141c3b;
  --ivory: #ede4cf;
  --dim: #8f98b5;
  --gilt: #d8b66b;
  --line: rgba(237, 228, 207, 0.16);
  --line-strong: rgba(237, 228, 207, 0.32);
  --acc: #e8836f;
  --acc-ink: #1b0f0c;
  --serif: "Alegreya", "Iowan Old Style", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
}
body[data-game="superloto"] { --acc: #e0b050; --acc-ink: #231a05; }
body[data-game="keno"]      { --acc: #52b5a8; --acc-ink: #04211e; }
body[data-game="maxima"]    { --acc: #e8836f; --acc-ink: #2a0f09; }
body[data-game="loto636"]   { --acc: #a190ea; --acc-ink: #130d2e; }

* { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--night); color: var(--ivory);
  font: 400 16px/1.55 var(--sans); min-height: 100vh;
}
#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ivory); color: var(--night); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; margin: 0; letter-spacing: 0.005em; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- шапка и вкладки ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px var(--gutter) 6px; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--gilt); }
.brand-mark { width: 40px; height: 40px; flex: none; animation: slow-turn 90s linear infinite; }
.brand h1 { font-size: 26px; line-height: 1.05; color: var(--ivory); font-weight: 700; }
.brand p { margin: 2px 0 0; font: italic 400 15px var(--serif); color: var(--dim); }
.sound { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent; color: var(--ivory); font-size: 18px; }
.sound[aria-pressed="false"] { color: var(--dim); text-decoration: line-through; }

.tabs { position: relative; display: flex; gap: 0; padding: 18px var(--gutter) 0; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin: 0 var(--gutter); padding-left: 0; padding-right: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 0 auto; min-width: 150px; text-align: left; background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 18px 14px 0; margin-bottom: -1px; color: var(--dim); }
.tab .t-name { display: flex; align-items: center; gap: 10px; font: 500 20px var(--serif); color: inherit; }
.tab .t-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dot); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot) 22%, transparent); }
.tab .t-sub { display: block; margin-top: 2px; font-size: 13px; }
.tab[aria-selected="true"] { color: var(--ivory); border-bottom-color: var(--dot); }
.tab:hover { color: var(--ivory); }

/* ---------- основное ---------- */
main { padding: 28px var(--gutter) 40px; max-width: 1280px; margin: 0 auto; outline: none; }
.loading { color: var(--dim); font-family: var(--serif); font-style: italic; font-size: 20px; padding: 60px 0; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(24px, 5vw, 72px); align-items: start; padding-bottom: 36px; }
.when { margin: 0; color: var(--dim); }
.gname { font-size: clamp(44px, 7.4vw, 96px); line-height: 0.95; font-weight: 700; margin: 8px 0 10px; text-shadow: 0 0 40px color-mix(in srgb, var(--acc) 45%, transparent); }
.rule { color: var(--acc); font: italic 500 22px var(--serif); margin: 0 0 26px; }
.clock { display: flex; gap: clamp(10px, 2vw, 22px); font-variant-numeric: tabular-nums; }
.clock .u { display: flex; flex-direction: column; min-width: 64px; }
.clock b { font: 500 clamp(40px, 6vw, 72px)/1 var(--sans); letter-spacing: -0.02em; }
.clock small { color: var(--dim); font-size: 13px; margin-top: 4px; }
.pending-note { margin: 14px 0 0; color: var(--dim); max-width: 38ch; }
.pending-note.live { color: var(--acc); }

/* орб и способы гадания */
.ritual { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.orb-wrap { position: relative; width: min(300px, 70vw); aspect-ratio: 1; }
.orb { position: absolute; inset: 0; border: 0; background: none; padding: 0; border-radius: 50%; color: var(--ivory); }
.orb svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 0 26px color-mix(in srgb, var(--acc) 40%, transparent)); }
.orb .ring-a { transform-origin: 50% 50%; animation: slow-turn 60s linear infinite; }
.orb .ring-b { transform-origin: 50% 50%; animation: slow-turn 38s linear infinite reverse; }
.orb .core { fill: color-mix(in srgb, var(--acc) 22%, var(--night)); stroke: var(--acc); transition: fill .3s; }
.orb:hover .core, .orb:focus-visible .core { fill: color-mix(in srgb, var(--acc) 42%, var(--night)); }
.orb-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; padding: 0 22%; }
.orb-label b { font: 700 clamp(22px, 3vw, 28px)/1.1 var(--serif); }
.orb-label span { display: block; margin-top: 6px; color: var(--dim); font-size: 13px; }
.orb[disabled] { cursor: progress; }
.orb[disabled] .core { fill: var(--acc); }

.methods { width: 100%; max-width: 520px; border: 1px solid var(--line); background: color-mix(in srgb, var(--night) 55%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.method { display: grid; grid-template-columns: 22px 1fr auto; gap: 4px 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: start; }
.method:last-child { border-bottom: 0; }
.method input[type="checkbox"] { appearance: none; width: 20px; height: 20px; margin: 2px 0 0; border: 1.5px solid var(--line-strong); border-radius: 50%; display: grid; place-content: center; cursor: pointer; background: transparent; }
.method input[type="checkbox"]::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--acc); transform: scale(0); transition: transform .18s; }
.method input[type="checkbox"]:checked { border-color: var(--acc); }
.method input[type="checkbox"]:checked::after { transform: scale(1); }
.method label { cursor: pointer; }
.method .m-title { font: 500 19px/1.2 var(--serif); display: block; }
.method .m-blurb { font-size: 13.5px; color: var(--dim); display: block; margin-top: 2px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); }
.stepper button { width: 28px; height: 28px; background: none; border: 0; font-size: 16px; line-height: 1; }
.stepper button:hover { background: var(--plate-2); }
.stepper output { min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.m-extra { grid-column: 2 / 4; display: none; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.method.on .m-extra { display: flex; }
.m-extra input[type="text"], .m-extra input[type="date"] { flex: 1 1 140px; min-width: 0; background: var(--plate); border: 1px solid var(--line-strong); color: var(--ivory); padding: 7px 10px; font: inherit; font-size: 15px; border-radius: 0; color-scheme: dark; }
.m-extra input:focus-visible { outline-offset: 0; }
.slider-row { display: flex; align-items: center; gap: 10px; width: 100%; font-size: 13px; color: var(--dim); }
.slider-row input { flex: 1; accent-color: var(--acc); }
.global-opts { width: 100%; max-width: 520px; display: flex; gap: 12px; align-items: center; color: var(--dim); font-size: 14px; }
.global-opts select { background: var(--plate); color: var(--ivory); border: 1px solid var(--line-strong); padding: 6px 8px; font: inherit; border-radius: 0; }

/* ---------- шары ---------- */
.balls { display: flex; flex-wrap: wrap; gap: 8px; }
.ball {
  --s: 46px; width: var(--s); height: var(--s); border-radius: 50%; flex: none;
  display: grid; place-content: center; font: 600 calc(var(--s) * 0.4)/1 var(--sans); font-variant-numeric: tabular-nums;
  color: var(--acc-ink);
  background: radial-gradient(circle at 32% 28%, #fff9 0, transparent 38%), var(--acc);
  box-shadow: inset 0 -4px 8px #0003, 0 0 0 1px #0004;
}
.ball.sm { --s: 30px; }
.ball.xs { --s: 24px; }
.ball.lg { --s: 56px; }
.ball.bonus { background: transparent; color: var(--ivory); box-shadow: inset 0 0 0 2px var(--gilt); }
.ball.dim { background: var(--plate-2); color: var(--dim); box-shadow: inset 0 0 0 1px var(--line-strong); }
.ball.hit { outline: 2px solid var(--ivory); outline-offset: 2px; }

/* ---------- плиты со статистикой ---------- */
.plates { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 40px 28px; }
.plate { position: relative; border: 1px solid var(--line); padding: 30px 22px 22px; min-width: 0; grid-column: span 12; background: linear-gradient(180deg, color-mix(in srgb, var(--plate) 62%, transparent), color-mix(in srgb, var(--plate) 28%, transparent)); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.plate > h3 { position: absolute; top: -14px; left: 16px; background: color-mix(in srgb, var(--night) 92%, transparent); padding: 0 10px; font-size: 21px; color: var(--ivory); }
.plate .hint { color: var(--dim); font-size: 14px; margin: 0 0 14px; max-width: 70ch; }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); margin-bottom: 14px; }
.seg button { background: none; border: 0; padding: 5px 12px; font-size: 14px; color: var(--dim); }
.seg button[aria-pressed="true"] { background: var(--acc); color: var(--acc-ink); font-weight: 500; }

.draw-row { display: grid; grid-template-columns: 74px 1fr; gap: 12px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); }
.draw-row:first-child { border-top: 0; }
.draw-row .meta { font-size: 13px; color: var(--dim); line-height: 1.25; }
.draw-row .meta b { color: var(--ivory); font-weight: 500; display: block; font-size: 14px; }
.draw-big { padding-bottom: 14px; }
.draw-big .meta { font-size: 15px; margin-bottom: 12px; color: var(--dim); }
.draw-big .meta b { display: inline; color: var(--ivory); font-family: var(--serif); font-size: 22px; font-weight: 500; margin-right: 8px; }

.fact-list { display: grid; gap: 0; margin: 0; }
.fact { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); align-items: baseline; }
.fact:first-child { border-top: 0; }
.fact dt { color: var(--dim); font-size: 14.5px; }
.fact dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.fact dd b { font: 500 22px var(--serif); }
.fact dd small { display: block; color: var(--dim); font-size: 12.5px; }
.money { color: var(--gilt); }

.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 32px 1fr 76px; gap: 10px; align-items: center; font-size: 14px; }
.bar .n { font: 600 14px var(--sans); text-align: center; }
.bar .track { position: relative; height: 12px; background: var(--plate-2); }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: var(--acc); }
.bar .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ivory); }
.bar .v { color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }

.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; }
.cell { position: relative; aspect-ratio: 1; display: grid; place-content: center; font: 500 14px var(--sans); font-variant-numeric: tabular-nums; background: color-mix(in srgb, var(--acc) calc(var(--h) * 100%), var(--plate-2)); color: var(--ivory); }
.cell small { display: block; font-size: 10px; opacity: .8; text-align: center; }
.cell.cold { background: color-mix(in srgb, #5668b8 calc(var(--h) * 100%), var(--plate-2)); }
.cell.in-last { outline: 2px solid var(--ivory); outline-offset: -2px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--dim); margin-top: 12px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; margin-right: 6px; }

.pairs { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.pairs li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.pairs li:first-child { border-top: 0; }
.pairs .c { color: var(--dim); font-variant-numeric: tabular-nums; text-align: right; }
.pairs .x { color: var(--acc); font-size: 13px; }
.sky { width: 100%; height: auto; max-height: 560px; display: block; }
.sky text { font: 600 12px var(--sans); fill: var(--ivory); text-anchor: middle; dominant-baseline: central; }

.hists { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 26px 28px; }
.hist h4 { font-size: 17px; margin-bottom: 4px; }
.hist p { margin: 0 0 10px; color: var(--dim); font-size: 13.5px; }
.hbars { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.hbars div { flex: 1; background: var(--line-strong); min-height: 2px; position: relative; }
.hbars div.cur { background: var(--acc); }
.hlab { display: flex; gap: 3px; font-size: 11px; color: var(--dim); }
.hlab span { flex: 1; text-align: center; font-variant-numeric: tabular-nums; }

.verdict { font: 500 22px/1.25 var(--serif); margin: 0 0 8px; }
.small { color: var(--dim); font-size: 14px; }

/* ---------- результат гадания ---------- */
.results { margin: 0 0 48px; }
.results[hidden] { display: none; }
.results h3 { font-size: 32px; margin-bottom: 4px; }
.results .sub { color: var(--dim); margin: 0 0 22px; }
.tickets { align-items: start; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 18px; }
.ticket { border: 1px solid var(--line-strong); padding: 16px 18px 14px; background: color-mix(in srgb, var(--plate) 70%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: grid; gap: 12px; }
.ticket header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ticket header h4 { font-size: 22px; }
.ticket header span { color: var(--dim); font-size: 13px; }
.ticket .balls .ball { opacity: 0; transform: scale(.2) translateY(14px); animation: appear .55s cubic-bezier(.2, 1.4, .4, 1) forwards; animation-delay: var(--d, 0s); }
.ticket .note { margin: 0; color: var(--dim); font-size: 14px; }
.ticket footer { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { background: none; border: 1px solid var(--line-strong); padding: 6px 12px; font-size: 14px; }
.btn:hover { border-color: var(--acc); }
.btn.primary { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); font-weight: 500; }
.empty { color: var(--dim); }

.hist-list { display: grid; gap: 0; }
.hist-item { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; padding: 10px 0; border-top: 1px solid var(--line); align-items: center; }
.hist-item:first-child { border-top: 0; }
.hist-item .meta { font-size: 13px; color: var(--dim); }
.hist-item .score { font: 500 18px var(--serif); text-align: right; }

.foot { max-width: 1280px; margin: 0 auto; padding: 24px var(--gutter) 60px; color: var(--dim); font-size: 14px; border-top: 1px solid var(--line); }
.foot p { margin: 0 0 8px; max-width: 80ch; }

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

@keyframes slow-turn { to { transform: rotate(360deg); } }
@keyframes appear { to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .ritual { order: -1; }
  .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; }
  .tab { min-width: 138px; }
}
@media (max-width: 520px) {
  .clock .u { min-width: 0; }
  .brand p { display: none; }
  .ball { --s: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  .brand-mark, .orb .ring-a, .orb .ring-b { animation: none; }
  .ticket .balls .ball { animation-duration: .01s; animation-delay: 0s; }
}

/* ---------- Таро ---------- */
.spread { display: flex; flex-wrap: wrap; gap: 10px 8px; }
.spread { --tw: 56px; }
@media (min-width: 700px) { .spread { --tw: 92px; } }
.tc { width: var(--tw); display: grid; gap: 4px; justify-items: center; text-align: center; }
.tcard { width: var(--tw); aspect-ratio: 120 / 200; perspective: 600px; }
.tcard-in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transform: rotateY(0deg); animation: flip .9s cubic-bezier(.3, .7, .2, 1) forwards; animation-delay: var(--d, 0s); }
.tcard .face, .tcard .back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 6px; overflow: hidden; box-shadow: 0 4px 14px #0008; }
.tcard .face { transform: rotateY(180deg); }
.tcard .face svg, .tcard .back svg { width: 100%; height: 100%; display: block; }
.tcard.rev .face svg { transform: rotate(180deg); }
.tc .pos { font-size: 10.5px; line-height: 1.15; color: var(--dim); min-height: 24px; }
.read { font-size: 14px; color: var(--dim); }
.read summary { cursor: pointer; color: var(--ivory); }
.read ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.read li b { color: var(--ivory); font-weight: 500; }
.ticket .sorted { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ticket .sorted .small { margin-right: 4px; }
@keyframes flip { from { transform: rotateY(0deg); } to { transform: rotateY(180deg); } }
@media (prefers-reduced-motion: reduce) { .tcard-in { animation-duration: .01s; animation-delay: 0s; } }

/* ---------- импорт, вход ---------- */
.export { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 0 0 22px; padding: 12px 14px; border: 1px dashed var(--line-strong); background: color-mix(in srgb, var(--night) 55%, transparent); }
.export label { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; color: var(--dim); }
.export select { background: var(--plate); color: var(--ivory); border: 1px solid var(--line-strong); padding: 5px 8px; font: inherit; border-radius: 0; }
.export .small { flex-basis: 100%; margin: 0; }
.who { display: flex; align-items: center; gap: 10px; }
.who .btn { padding: 5px 12px; }
.who-name { color: var(--dim); font-size: 14px; max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.auth { background: var(--plate); color: var(--ivory); border: 1px solid var(--line-strong); padding: 0; width: min(420px, calc(100vw - 32px)); }
dialog.auth::backdrop { background: rgba(3, 5, 14, 0.72); backdrop-filter: blur(3px); }
.auth form { display: grid; gap: 12px; padding: 22px; }
.auth h2 { font-size: 28px; }
.auth .seg { margin: 0; }
.auth label { display: grid; gap: 4px; font-size: 14px; color: var(--dim); }
.auth input { background: var(--night); color: var(--ivory); border: 1px solid var(--line-strong); padding: 9px 10px; font: inherit; border-radius: 0; }
.auth .err { color: #ff9b8a; min-height: 1.4em; margin: 0; font-size: 14px; }
.auth .row { display: flex; gap: 10px; justify-content: flex-end; }
.sync-note { font-size: 13px; color: var(--dim); margin: 0 0 12px; }

.tc .ball { opacity: 0; transform: scale(.2); animation: appear .5s cubic-bezier(.2, 1.4, .4, 1) forwards; animation-delay: var(--d, 0s); }
.hist-item .score .btn { margin-top: 6px; padding: 1px 9px; font-size: 16px; line-height: 1.3; }
@media (prefers-reduced-motion: reduce) { .tc .ball { animation-duration: .01s; animation-delay: 0s; } }

.ticket.tarot { grid-column: 1 / -1; }
.ticket.tarot .tc .pos { font-size: 12px; }
