/* =========================================================================
   123LuckyNumber — styles.

   Mobile first. Below 761px the machine is an app screen: the site's top
   bar, the 3D stage filling the viewport with the lottery chip and the
   result floating over its top, a dock with a big Draw button in thumb
   reach, and a bottom sheet for the lotteries, machines, history and
   options. The article follows when you scroll. From 761px up the same
   markup becomes a page card: stage and result side by side, the sheet's
   panels inline below.

   The machine is always on a dark stage, like a televised draw; the rest of
   the page follows the system light/dark preference.

   Written for both directions: sides are logical (inline-start/end) so
   Arabic and Hebrew mirror by themselves. What stays physical on purpose:
   centring with left: 50% + translateX(-50%), safe-area insets (they are
   the device's own sides), the balls and their numbers.
   ========================================================================= */

/* ---- tokens ------------------------------------------------------------- */

:root {
  --bg: #f6f4fb;
  --surface: #ffffff;
  --surface-2: #f0edf7;
  --text: #1c1828;
  --muted: #5d586c;
  --line: #e3dfec;
  --link: #5a3ccf;
  --accent: #e23d3d;
  --gold: #f5c04a;
  --good: #2f9e44;
  --focus: #7c5cff;

  --app-bg: #120f1d;
  --app-surface: #1b1729;
  --app-surface-2: #252036;
  --app-surface-3: #312a47;
  --app-text: #f4f1fb;
  --app-muted: #aaa3bf;
  --app-line: rgba(255, 255, 255, .09);
  --app-accent: #a58cff;

  --radius: 14px;
  --header-h: 60px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --gutter: max(16px, var(--safe-l), var(--safe-r));
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0d16;
    --surface: #181522;
    --surface-2: #221e2f;
    --text: #ece9f4;
    --muted: #a7a1b8;
    --line: #2d283c;
    --link: #b8a5ff;
    color-scheme: dark;
  }
}

@media (max-width: 760px) {
  :root { --header-h: 52px; }
}

/* ---- base ----------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--safe-t) + 12px);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
html.sheet-lock, html.sheet-lock body { overflow: hidden; }

img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--link); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
code, kbd { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 0 .35em; border-radius: 5px; text-align: center;
  border: 1px solid currentColor; border-bottom-width: 2px; font-size: .75em; line-height: 1.5; opacity: .75;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding-left: max(20px, var(--safe-l));
  padding-right: max(20px, var(--safe-r));
}
.muted { color: var(--muted); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100;
  background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 10px;
}
.skip-link:focus { top: calc(10px + var(--safe-t)); }

@media (max-width: 760px) { .only-wide { display: none !important; } }
@media (min-width: 761px) { .only-phone { display: none !important; } }

/* flags (flag-icons, MIT) and the stand-in for a game of no country */
.flag { flex: none; width: 20px; height: 15px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.flag-none {
  display: inline-block; background:
    radial-gradient(circle at 50% 50%, transparent 4px, rgba(255, 255, 255, .5) 4.5px, transparent 5.5px),
    linear-gradient(135deg, #6c5ce7, #00b4d8);
}

/* ---- header ------------------------------------------------------------------ */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(18, 15, 29, .94);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  color: #f4f1fb;
  padding-top: var(--safe-t);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; font-weight: 750; font-size: 1.12rem; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
.brand-name b { color: var(--gold); font-weight: 800; }

.main-nav { margin-inline-start: auto; }
.main-nav > ul { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.main-nav a, .main-nav summary {
  display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-radius: 10px;
  color: rgba(244, 241, 251, .82); text-decoration: none; font-size: .94rem; font-weight: 550;
  cursor: pointer; list-style: none; white-space: nowrap;
}
.main-nav summary::-webkit-details-marker { display: none; }
.main-nav a:hover, .main-nav summary:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.main-nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .1); }
.nav-more { position: relative; }
.nav-more details[open] summary svg { transform: rotate(180deg); }
.mega {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); width: min(620px, 92vw); max-height: min(72vh, 620px); overflow-y: auto;
  background: #1b1729; border: 1px solid rgba(255, 255, 255, .09); border-radius: 18px;
  padding: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
}
.mega-title { margin: 4px 6px 8px; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: #aaa3bf; }
.mega-lotteries { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px; margin: 0; padding: 0; list-style: none; }
.mega-lotteries a { gap: 9px; font-size: .9rem; white-space: normal; line-height: 1.25; }

.nav-toggle {
  display: none; margin-inline-start: auto; width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: transparent; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
}
.nav-toggle span { width: 20px; height: 2px; border-radius: 2px; background: #f4f1fb; transition: transform .2s, opacity .2s; }
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.lang-menu { position: relative; flex: none; }
.lang-menu summary {
  display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border-radius: 10px;
  color: rgba(244, 241, 251, .82); font-size: .82rem; font-weight: 700; letter-spacing: .03em;
  cursor: pointer; list-style: none;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover, .lang-menu[open] summary { background: rgba(255, 255, 255, .08); color: #fff; }
.lang-list {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 50;
  width: min(440px, calc(100vw - 24px)); max-height: min(72vh, 560px); overflow-y: auto;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px;
  margin: 0; padding: 10px; list-style: none;
  background: #1b1729; border: 1px solid rgba(255, 255, 255, .09); border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
}
.lang-list a { display: block; padding: 8px 10px; border-radius: 9px; color: rgba(244, 241, 251, .88); text-decoration: none; font-size: .92rem; text-align: start; }
.lang-list a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.lang-list a[aria-current] { background: rgba(165, 140, 255, .2); color: #fff; font-weight: 700; }

.lang-offer {
  position: fixed; z-index: 70; top: calc(var(--header-h) + var(--safe-t) + 10px); inset-inline: 12px;
  max-width: 560px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding: 10px 14px; padding-inline-end: 46px; border-radius: 14px;
  background: #2a2440; color: #f4f1fb; border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45); font-size: .92rem; line-height: 1.4;
  animation: offer .35s cubic-bezier(.2, .85, .25, 1);
}
@keyframes offer { from { opacity: 0; transform: translateY(-8px); } }
.lang-offer a { padding: 6px 12px; border-radius: 9px; background: var(--app-accent); color: #160f2e; font-weight: 750; text-decoration: none; }
.lang-offer-close {
  position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 1.35rem; line-height: 1;
}
.lang-offer-close:hover { background: rgba(255, 255, 255, .1); }

@media (max-width: 760px) {
  .site-header { background: #120f1d; }
  .brand { font-size: 1.04rem; }
  .brand-mark { width: 27px; height: 27px; }
  .nav-toggle { display: flex; order: 2; margin-inline-start: 0; }
  .lang-menu { position: static; order: 1; margin-inline-start: auto; }
  .lang-menu summary { height: 44px; padding: 0 8px; }
  .lang-list { top: 100%; inset-inline: 12px; width: auto; max-height: calc(100svh - var(--header-h) - var(--safe-t) - 24px); }
  .main-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    background: #120f1d; border-bottom: 1px solid rgba(255, 255, 255, .08);
    padding: 8px var(--gutter) 16px; max-height: calc(100svh - var(--header-h) - var(--safe-t)); overflow-y: auto;
    box-shadow: 0 24px 40px rgba(0, 0, 0, .45);
    display: none;
  }
  .nav-open .main-nav { display: block; }
  .main-nav > ul { flex-direction: column; align-items: stretch; }
  .main-nav a, .main-nav summary { padding: 12px; font-size: 1rem; }
  .mega { position: static; width: auto; max-height: none; border: 0; box-shadow: none; padding: 4px 0 0; background: transparent; }
  .mega-lotteries { grid-template-columns: 1fr 1fr; }
}

/* ---- breadcrumbs and hero ------------------------------------------------------ */

.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 14px 0 0; list-style: none; font-size: .85rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin-inline-end: 4px; opacity: .6; }
[dir="rtl"] .breadcrumbs li + li::before { content: "‹"; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--link); text-decoration: underline; }

.hero { padding: 22px 0 18px; }
.hero h1 { margin: 0 0 6px; font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem); font-weight: 800; }
.hero .lead { margin: 0; max-width: 72ch; color: var(--muted); font-size: 1.06rem; }
.hero-plain { padding-bottom: 8px; }

.machine-wrap { margin-bottom: 36px; }
.machine-heading { font-size: 1.5rem; margin: 8px 0 14px; }

/* ---- the machine: shared ---------------------------------------------------------- */

.lotto {
  position: relative;
  background: var(--app-bg);
  color: var(--app-text);
  color-scheme: dark;
  --link: #c4b5ff;
}
.lotto a { color: var(--link); }

.lotto-stage { position: relative; }

/* The studio: a dark backdrop with a pool of light where the machine stands;
   the canvas over it is transparent. */
.stage {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(60% 34% at 50% 92%, rgba(165, 140, 255, .16), transparent 70%),
    radial-gradient(80% 70% at 50% 38%, #2a2148 0%, #181330 48%, #0d0a18 100%);
  -webkit-user-select: none;
  user-select: none;
  isolation: isolate;
}
.stage::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04), inset 0 0 90px rgba(0, 0, 0, .5);
}
.stage-canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; touch-action: pan-y; }
.is-full .stage-canvas, .is-turning .stage-canvas { touch-action: none; }
.stage-canvas.is-flat { touch-action: manipulation; }

.stage-loading {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  color: rgba(255, 255, 255, .8); font-size: .92rem; text-align: center; padding: 20px;
}
.has-stage .stage-loading { display: none; }
.loader-balls { display: flex; gap: 8px; }
.loader-balls i {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff 0 12%, var(--c, #f7c331) 13% 60%, color-mix(in srgb, var(--c, #f7c331) 60%, #000) 100%);
  animation: loader 1s cubic-bezier(.5, 0, .5, 1) infinite;
}
.loader-balls i:nth-child(2) { --c: #2f80ed; animation-delay: .12s; }
.loader-balls i:nth-child(3) { --c: #e5484d; animation-delay: .24s; }
@keyframes loader { 50% { transform: translateY(-14px); } }
.noscript { display: block; max-width: 34ch; }

.stage-hint {
  position: absolute; left: 50%; bottom: 14px; z-index: 2; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px); text-align: center;
  margin: 0; padding: 6px 12px; border-radius: 99px;
  background: rgba(10, 8, 16, .45); color: rgba(255, 255, 255, .85); font-size: .8rem;
  pointer-events: none; transition: opacity .4s;
}
.stage-hint.is-gone, .is-flat .stage-hint { opacity: 0; }
.stage-banner {
  position: absolute; left: 50%; bottom: 14px; z-index: 3; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 8px 14px; border-radius: 12px;
  background: rgba(245, 192, 74, .95); color: #2a1e00; font-size: .85rem; font-weight: 600; text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}

.stage-tools { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 4; display: flex; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px;
  background: rgba(14, 11, 22, .5); color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: 1.4rem; line-height: 1;
  transition: background .15s, transform .1s;
}
.icon-btn:hover { background: rgba(14, 11, 22, .7); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .off { display: none; }
.icon-btn.is-off .on { display: none; }
.icon-btn.is-off .off { display: inline; }
.icon-btn.is-off { color: rgba(255, 255, 255, .55); }

.debug {
  position: absolute; left: 8px; bottom: 8px; z-index: 6; margin: 0; padding: 6px 8px; border-radius: 8px;
  background: rgba(0, 0, 0, .65); color: #9fffa8; font: 11px/1.4 var(--mono); pointer-events: none;
}

/* ---- the balls of the result (and of the pages) ------------------------------------- */

/* A lottery ball: its colour, a white disc, the number in black, as printed
   on the real ones; this way every colour reads the same. */
.ball {
  --c: #ddd; --bs: 40px;
  position: relative; flex: none; display: inline-grid; place-items: center;
  width: var(--bs); height: var(--bs); border-radius: 50%;
  background:
    radial-gradient(circle at 33% 27%, rgba(255, 255, 255, .8), rgba(255, 255, 255, 0) 30%),
    radial-gradient(circle at 50% 50%, var(--c) 52%, color-mix(in srgb, var(--c) 62%, #000) 100%);
  box-shadow: inset -2px -3px 5px rgba(0, 0, 0, .22), 0 3px 6px rgba(0, 0, 0, .35);
  color: #16141d; font-variant-numeric: tabular-nums;
}
.ball b {
  display: grid; place-items: center; width: 64%; height: 64%; border-radius: 50%;
  background: #f7f5ef; box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
  font-size: calc(var(--bs) * .37); font-weight: 800; line-height: 1; letter-spacing: -.03em;
}
.ball.is-long b { font-size: calc(var(--bs) * .29); }
.ball.is-xlong b { font-size: calc(var(--bs) * .22); width: 76%; height: 64%; border-radius: 40%; }
.ball.is-star b {
  width: 86%; height: 86%; border-radius: 0; padding-top: 6%;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  font-size: calc(var(--bs) * .28);
}
.ball.is-empty { background: rgba(255, 255, 255, .03); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .2); }
.ball.is-new { animation: ball-in .5s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes ball-in { 0% { transform: translateY(-14px) scale(.6); opacity: 0; } 100% { transform: none; opacity: 1; } }
.ball.is-mini { --bs: 24px; box-shadow: inset -1px -2px 3px rgba(0, 0, 0, .22); }

.rack { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; direction: ltr; }
.rack-pool { display: flex; flex-wrap: wrap; gap: 6px; }
.rack-plus { color: var(--app-muted); font-weight: 800; font-size: 1.1rem; }

/* ---- the result ------------------------------------------------------------------------ */

.game-chip {
  display: inline-flex; align-items: center; gap: 9px; max-width: 100%; min-height: 44px; padding: 5px 10px; padding-inline-start: 10px;
  border: 1px solid var(--app-line); border-radius: 13px; background: var(--app-surface-2); color: var(--app-text);
  text-align: start; transition: background .15s;
}
.game-chip:hover { background: var(--app-surface-3); }
.game-chip > svg { flex: none; width: 18px; height: 18px; opacity: .7; }
.chip-flag { display: flex; }
.chip-flag .flag { width: 24px; height: 18px; }
.chip-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.chip-name { font-weight: 750; font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-format { color: var(--app-muted); font-size: .76rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.result-kicker { margin: 0; color: var(--app-muted); font-size: .82rem; font-weight: 650; letter-spacing: .02em; }
.result-meta { margin: 0; color: var(--app-muted); font-size: .84rem; }
.result-meta:empty { display: none; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-soft {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--app-line); border-radius: 11px; background: var(--app-surface-2); color: var(--app-text);
  font-size: .9rem; font-weight: 600; transition: background .15s;
}
.btn-soft:hover { background: var(--app-surface-3); }
.btn-soft svg { width: 18px; height: 18px; flex: none; }
.btn-soft[aria-pressed="true"] { color: var(--gold); border-color: rgba(245, 192, 74, .45); }
.btn-soft[aria-pressed="true"] svg { fill: currentColor; }
.btn-link { border: 0; background: none; padding: 6px 0; color: var(--link); font-size: .9rem; text-decoration: underline; text-underline-offset: .18em; }
.btn-primary {
  min-height: 46px; padding: 10px 18px; border: 0; border-radius: 13px;
  background: var(--app-accent); color: #160f2e; font-weight: 750;
}
.btn-primary:hover { filter: brightness(1.08); }

/* ---- the dock: machine, Draw, lottery --------------------------------------------------- */

.dock { display: flex; align-items: stretch; gap: 8px; background: var(--app-surface); -webkit-user-select: none; user-select: none; }
.dock-btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 64px; padding: 4px 10px;
  border: 1px solid var(--app-line); border-radius: 14px; background: var(--app-surface-2); color: var(--app-text);
  font-weight: 600; transition: background .15s, transform .08s;
}
.dock-btn:hover { background: var(--app-surface-3); }
.dock-btn:active { transform: scale(.95); }
.dock-label { font-size: .72rem; color: var(--app-muted); line-height: 1.1; }

.btn-draw {
  position: relative; flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 58px; padding: 6px 18px; border: 0; border-radius: 16px;
  background: linear-gradient(180deg, #ffd25c, #f5a524);
  color: #2b1700; box-shadow: 0 1px 0 rgba(255, 255, 255, .45) inset, 0 8px 22px rgba(245, 165, 36, .3);
  transition: transform .08s, filter .15s, box-shadow .15s;
}
.btn-draw:hover { filter: brightness(1.05); }
.btn-draw:active { transform: scale(.97); box-shadow: 0 1px 0 rgba(255, 255, 255, .3) inset, 0 3px 10px rgba(245, 165, 36, .3); }
.btn-draw[aria-busy="true"] { filter: saturate(.6) brightness(.85); }
.btn-draw-main { display: inline-flex; align-items: center; gap: 8px; font-size: 1.24rem; font-weight: 850; letter-spacing: .01em; line-height: 1.1; }
.btn-draw-main kbd { border-color: rgba(43, 23, 0, .55); opacity: .7; }
.btn-draw-sub { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; font-weight: 650; opacity: .8; font-variant-numeric: tabular-nums; }
.is-drawing .btn-draw-main::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- the sheet: lotteries, machines, history, options ------------------------------------- */

.sheet { background: var(--app-bg); }
.sheet-grip { display: flex; align-items: center; justify-content: center; }

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--app-surface); }
.tabs [role="tab"] {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 6px 10px;
  border: 0; border-radius: 10px; background: transparent; color: var(--app-muted); font-size: .9rem; font-weight: 650;
  transition: background .15s, color .15s;
}
.tabs [role="tab"] svg { width: 18px; height: 18px; flex: none; }
.tabs [role="tab"] > span { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs [role="tab"]:hover { color: var(--app-text); }
.tabs [role="tab"][aria-selected="true"] { background: var(--app-surface-3); color: var(--app-text); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.panel { padding-top: 16px; }
.panel-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .95rem; }
.panel-title svg { width: 18px; height: 18px; color: var(--app-muted); }

.search {
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  border: 1px solid var(--app-line); border-radius: 13px; background: var(--app-surface-2);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--app-accent); box-shadow: 0 0 0 3px rgba(165, 140, 255, .25); }
.search svg { color: var(--app-muted); flex: none; }
.search input { flex: 1; min-width: 0; height: 48px; border: 0; background: transparent; outline: none; font-size: 16px; color: var(--app-text); }

.game-lists { display: grid; gap: 14px; margin-top: 14px; }
.group-title { margin: 0 0 6px; color: var(--app-muted); font-size: .76rem; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; }
.is-mine .group-title { color: var(--gold); }
.game-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; }
.game-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 6px 10px;
  border: 1px solid transparent; border-radius: 11px; background: var(--app-surface); color: var(--app-text); text-align: start;
  transition: background .15s, border-color .15s;
}
.game-row:hover { background: var(--app-surface-2); }
.game-row[aria-pressed="true"] { border-color: rgba(245, 192, 74, .6); background: rgba(245, 192, 74, .1); }
.game-row-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.game-row-name { font-weight: 680; font-size: .94rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-row-meta { color: var(--app-muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.custom { margin-top: 18px; border: 1px solid var(--app-line); border-radius: 14px; background: var(--app-surface); }
.custom summary { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; cursor: pointer; list-style: none; }
.custom summary::-webkit-details-marker { display: none; }
.custom-title { font-weight: 750; }
.custom-title::after { content: " ▾"; color: var(--app-muted); }
.custom[open] .custom-title::after { content: " ▴"; }
.custom-help { color: var(--app-muted); font-size: .85rem; }
.custom-body { display: grid; gap: 10px; padding: 0 14px 14px; }
.custom-pool { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.custom-pool legend { padding: 0 0 6px; font-weight: 700; font-size: .88rem; color: var(--app-muted); }
.custom-pool > label:not(.toggle) { display: grid; gap: 4px; font-size: .8rem; font-weight: 650; color: var(--app-muted); }
.custom-pool input[type="number"], .select select {
  width: 100%; min-width: 0; height: 46px; padding: 0 10px; border: 1px solid var(--app-line); border-radius: 11px;
  background: var(--app-surface-2); color: var(--app-text); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.custom-pool input:focus, .select select:focus { outline: none; border-color: var(--app-accent); box-shadow: 0 0 0 3px rgba(165, 140, 255, .25); }
.custom-pool .toggle { grid-column: 1 / -1; }
.select { display: grid; gap: 4px; font-size: .8rem; font-weight: 650; color: var(--app-muted); }
.form-error { margin: 0; padding: 8px 12px; border-radius: 10px; background: rgba(201, 42, 42, .18); color: #ffb3b3; font-size: .88rem; }

.machine-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.machine-card {
  display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid var(--app-line); border-radius: 14px;
  background: var(--app-surface); color: var(--app-text); text-align: start; transition: border-color .15s, background .15s;
}
.machine-card:hover { background: var(--app-surface-2); }
.machine-card[aria-pressed="true"] { border-color: rgba(245, 192, 74, .7); box-shadow: 0 0 0 1px rgba(245, 192, 74, .35) inset; }
.machine-name { font-weight: 750; }
.machine-desc { color: var(--app-muted); font-size: .8rem; line-height: 1.4; }
.machine-poster {
  display: block; height: 84px; margin-bottom: 4px; border-radius: 10px;
  background: radial-gradient(80% 90% at 50% 40%, #2a2148, #0d0a18);
  position: relative; overflow: hidden;
}
.machine-poster::before, .machine-poster::after { content: ""; position: absolute; }
.poster-airmix::before {
  left: 50%; top: 10px; width: 54px; height: 54px; margin-left: -27px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .35), rgba(160, 200, 255, .08) 45%, rgba(200, 225, 255, .25) 100%);
  box-shadow: inset 0 0 0 1px rgba(210, 235, 255, .4);
}
.poster-airmix::after {
  left: 50%; top: 32px; width: 30px; height: 26px; margin-left: -15px;
  background:
    radial-gradient(circle at 25% 70%, #f7c331 5px, transparent 5.5px), radial-gradient(circle at 60% 75%, #e5484d 5px, transparent 5.5px),
    radial-gradient(circle at 80% 40%, #2f80ed 5px, transparent 5.5px), radial-gradient(circle at 45% 30%, #30a46c 5px, transparent 5.5px);
}
.poster-drum::before {
  left: 50%; top: 16px; width: 76px; height: 46px; margin-left: -38px; border-radius: 23px;
  background: linear-gradient(90deg, rgba(200, 225, 255, .2), rgba(255, 255, 255, .06) 40%, rgba(200, 225, 255, .25));
  box-shadow: inset 0 0 0 1px rgba(210, 235, 255, .4); transform: rotate(-8deg);
}
.poster-drum::after {
  left: 50%; top: 34px; width: 50px; height: 22px; margin-left: -25px;
  background: radial-gradient(circle at 20% 60%, #f3f1ea 5px, transparent 5.5px), radial-gradient(circle at 50% 70%, #f3f1ea 5px, transparent 5.5px),
    radial-gradient(circle at 80% 55%, #d7263d 5px, transparent 5.5px);
}
.poster-cage::before {
  left: 50%; top: 14px; width: 60px; height: 52px; margin-left: -30px;
  background: repeating-linear-gradient(90deg, #d2a54e 0 2px, transparent 2px 10px), repeating-linear-gradient(0deg, #d2a54e 0 2px, transparent 2px 13px);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  opacity: .85;
}
.poster-digits::before {
  left: 50%; top: 18px; width: 92px; height: 40px; margin-left: -46px;
  background:
    radial-gradient(circle at 12% 50%, rgba(200, 225, 255, .25) 13px, transparent 14px), radial-gradient(circle at 37% 50%, rgba(200, 225, 255, .25) 13px, transparent 14px),
    radial-gradient(circle at 63% 50%, rgba(200, 225, 255, .25) 13px, transparent 14px), radial-gradient(circle at 88% 50%, rgba(200, 225, 255, .25) 13px, transparent 14px);
}

.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.history { margin: 8px 0 0; padding: 0; list-style: none; max-height: 380px; overflow-y: auto; }
.h-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--app-line); }
.history li.muted { display: block; color: var(--app-muted); border: 0; font-size: .9rem; }
.h-show {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 6px 8px;
  border: 0; border-radius: 10px; background: transparent; color: var(--app-text); text-align: start;
}
.h-show:hover { background: var(--app-surface-2); }
.h-name { font-size: .85rem; font-weight: 650; color: var(--app-muted); }
.h-balls { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.h-balls .rack-plus { font-size: .85rem; margin: 0 2px; }
.history time { color: var(--app-muted); font-size: .78rem; flex: none; }
.h-del { width: 32px; height: 32px; font-size: 1.2rem; background: transparent; border-color: transparent; }

.options { display: grid; gap: 8px; }
.seg-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 8px 12px; border: 1px solid var(--app-line); border-radius: 12px; background: var(--app-surface-2); }
.seg-label { font-weight: 650; font-size: .95rem; }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--app-bg); }
.seg button { min-height: 36px; padding: 4px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--app-muted); font-size: .86rem; font-weight: 650; }
.seg button[aria-checked="true"] { background: var(--app-surface-3); color: var(--app-text); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.toggle {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px;
  border: 1px solid var(--app-line); border-radius: 12px; background: var(--app-surface-2); color: var(--app-text);
  font-size: .95rem; font-weight: 600; text-align: start; cursor: pointer;
}
.toggle-ui { position: relative; flex: none; width: 42px; height: 24px; border-radius: 12px; background: #4a4360; transition: background .2s; }
.toggle-ui::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
.toggle input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.toggle input:checked + .toggle-ui { background: var(--good); }
.toggle input:checked + .toggle-ui::after { transform: translateX(18px); }
[dir="rtl"] .toggle input:checked + .toggle-ui::after { transform: translateX(-18px); }
.toggle input:focus-visible + .toggle-ui { outline: 2px solid var(--app-accent); outline-offset: 2px; }
.install-tip { margin: 4px 0 0; font-size: .88rem; color: var(--app-muted); }

/* share sheet */
.share-sheet {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 16px;
  background: rgba(8, 6, 14, .6);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.share-card {
  width: min(440px, 100%); padding: 18px; border-radius: 20px;
  background: var(--app-surface); color: var(--app-text); border: 1px solid var(--app-line);
  box-shadow: 0 30px 60px rgba(0, 0, 0, .5);
}
.share-head { display: flex; align-items: center; justify-content: space-between; }
.share-head h2 { margin: 0; font-size: 1.15rem; }
.share-preview { margin: 10px 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--app-bg); color: var(--app-muted); font-size: .85rem; overflow-wrap: anywhere; }
.share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.share-grid a, .share-grid button {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 8px;
  border: 1px solid var(--app-line); border-radius: 12px; background: var(--app-surface-2);
  color: var(--app-text); font-size: .9rem; font-weight: 650; text-decoration: none;
}
.share-grid a:hover, .share-grid button:hover { background: var(--app-surface-3); }
.share-grid button { grid-column: 1 / -1; }
.share-grid svg { width: 18px; height: 18px; }

/* ---- the machine on a phone: an app screen ------------------------------------------------- */

@media (max-width: 760px) {
  html { overscroll-behavior-y: none; }

  /* The app first, the hero and article after it. DOM order is unchanged,
     so search engines and screen readers still meet the h1 first. */
  .site-main { display: flex; flex-direction: column; }
  .machine-wrap.app-first { order: -1; }
  .breadcrumbs { display: none; }
  .hero { padding: 26px 0 6px; }
  .hero h1 { font-size: 1.65rem; }
  .hero .lead { font-size: 1rem; }

  .machine-wrap {
    max-width: none; margin: 0; padding: 0;
    height: calc(100vh - var(--header-h) - var(--safe-t));
    height: calc(100svh - var(--header-h) - var(--safe-t));
    min-height: 460px;
  }
  .machine-wrap .machine-heading { display: none; }
  .lotto { display: flex; flex-direction: column; height: 100%; }

  .lotto-stage { flex: 1 1 auto; min-height: 0; }
  .stage { position: absolute; inset: 0; }
  .stage-tools { flex-direction: column; top: 10px; right: max(10px, var(--safe-r)); }
  [dir="rtl"] .stage-tools { right: auto; left: max(10px, var(--safe-l)); }
  .stage-tools .icon-btn { width: 38px; height: 38px; }

  /* the lottery chip and the result float over the top of the stage */
  .result {
    position: absolute; top: 0; inset-inline: 0; z-index: 3; pointer-events: none;
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
    padding: 10px max(12px, var(--safe-l)) 0;
    padding-inline-end: 58px;
  }
  .result > * { pointer-events: auto; }
  .game-chip { background: rgba(14, 11, 22, .55); border-color: rgba(255, 255, 255, .12); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  .result-kicker { color: rgba(255, 255, 255, .8); text-shadow: 0 1px 2px rgba(0, 0, 0, .6); margin-top: 2px; }
  .rack .ball { --bs: 36px; }
  .rack:has(.ball:nth-child(9)) .ball { --bs: 31px; }
  .rack:has(.ball:nth-child(13)) .ball { --bs: 27px; }
  .rack .ball.is-empty { background: rgba(10, 8, 16, .35); }
  .result-meta { color: rgba(255, 255, 255, .7); font-size: .78rem; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
  .result-actions { gap: 6px; }
  .result-actions .btn-soft {
    min-height: 34px; padding: 5px 10px; font-size: .8rem; border-radius: 10px;
    background: rgba(14, 11, 22, .55); border-color: rgba(255, 255, 255, .12); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  }
  .result-actions .btn-soft svg { width: 16px; height: 16px; }

  .dock {
    flex: none;
    padding: 10px max(10px, var(--safe-l)) calc(10px + var(--safe-b)) max(10px, var(--safe-r));
    border-top: 1px solid var(--app-line);
    box-shadow: 0 -10px 24px rgba(0, 0, 0, .25);
    position: relative; z-index: 5;
    height: calc(76px + var(--safe-b));
  }
  .dock-btn { min-width: 62px; padding: 0 6px; }

  /* the sheet slides up from the bottom */
  .sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: min(78svh, 700px); overflow-y: auto; overscroll-behavior: contain;
    padding: 0 max(16px, var(--safe-l)) calc(20px + var(--safe-b)) max(16px, var(--safe-r));
    background: var(--app-bg); border-radius: 22px 22px 0 0;
    border-top: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 -16px 50px rgba(0, 0, 0, .5);
    transform: translateY(105%); visibility: hidden;
    transition: transform .3s cubic-bezier(.2, .85, .25, 1), visibility 0s linear .3s;
  }
  .sheet-open .sheet { transform: none; visibility: visible; transition: transform .3s cubic-bezier(.2, .85, .25, 1); }
  .sheet.is-dragging { transition: none; }
  .sheet-grip {
    position: sticky; top: 0; z-index: 2; height: 40px; margin: 0 -16px 6px;
    background: var(--app-bg); touch-action: none; cursor: grab;
  }
  .sheet-grip > span { width: 42px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .28); }
  .sheet-grip .icon-btn { position: absolute; inset-inline-end: 10px; top: 6px; width: 32px; height: 32px; border-radius: 50%; font-size: 1.3rem; background: var(--app-surface-2); }
  .sheet-backdrop {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(8, 6, 14, .55);
    animation: fade .25s ease;
  }
  @keyframes fade { from { opacity: 0; } }
  .tabs { position: sticky; top: 40px; z-index: 1; box-shadow: 0 8px 12px -6px var(--app-bg); }
  .tabs [role="tab"] { flex-direction: column; gap: 2px; font-size: .74rem; min-height: 50px; }
  .game-list { grid-template-columns: 1fr; }
  .history { max-height: none; }

  .share-sheet { place-items: end center; padding: 0; }
  .share-card { width: 100%; border-radius: 22px 22px 0 0; padding-bottom: calc(18px + var(--safe-b)); }
}

@media (max-width: 760px) and (max-height: 560px) {
  .machine-wrap { min-height: 0; }
  .dock { height: calc(62px + var(--safe-b)); padding-top: 6px; padding-bottom: calc(6px + var(--safe-b)); }
  .btn-draw { min-height: 0; }
  .rack .ball { --bs: 28px; }
}
@media (max-width: 360px) {
  .dock-btn { min-width: 52px; }
  .dock-label { font-size: .66rem; }
}

/* ---- the machine on a wide screen: a page card ------------------------------------------------ */

@media (min-width: 761px) {
  .lotto {
    border-radius: 22px; overflow: clip;
    box-shadow: 0 24px 60px -20px rgba(18, 15, 29, .55), 0 0 0 1px rgba(255, 255, 255, .05) inset;
  }
  .lotto-stage { display: grid; grid-template-columns: minmax(0, 1fr); }
  .stage { height: clamp(380px, 58vh, 560px); }
  .result { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px 20px; background: var(--app-surface); border-top: 1px solid var(--app-line); }
  .result-actions { margin-top: auto; }

  .dock { padding: 14px 20px; border-top: 1px solid var(--app-line); height: 88px; }
  .dock-btn { min-width: 96px; flex-direction: row; gap: 8px; }
  .dock-label { font-size: .9rem; color: var(--app-text); }
  .btn-draw { flex: 0 1 420px; margin: 0 auto; }

  .sheet { padding: 20px 20px 24px; border-top: 1px solid var(--app-line); }
  .tabs { max-width: 640px; }
}

/* Wide enough for a side panel: the result and the dock share it, beside the
   stage, so Draw is above the fold; the sheet's panels run underneath. */
@media (min-width: 980px) {
  .lotto {
    display: grid; grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-areas: "stage result" "stage dock" "sheet sheet"; grid-template-rows: 1fr auto auto;
  }
  .lotto-stage { display: contents; }
  .stage { grid-area: stage; height: clamp(440px, calc(100vh - 290px), 620px); }
  .result { grid-area: result; border-top: 0; border-inline-start: 1px solid var(--app-line); padding: 22px; }
  .dock {
    grid-area: dock; flex-wrap: wrap; height: auto; padding: 16px 22px 20px;
    background: var(--app-surface); border-top: 1px solid var(--app-line); border-inline-start: 1px solid var(--app-line);
  }
  .btn-draw { order: -1; flex: 1 1 100%; min-height: 64px; margin: 0; }
  .dock-btn { flex: 1 1 0; min-height: 44px; }
  .sheet { grid-area: sheet; }
  .rack .ball { --bs: 42px; }
  .rack:has(.ball:nth-child(8)) .ball { --bs: 36px; }
}

/* full screen (the whole machine, dock included) */
.lotto:fullscreen { display: flex; flex-direction: column; width: 100%; height: 100%; border-radius: 0; overflow: hidden; }
.lotto:fullscreen .lotto-stage { flex: 1 1 auto; min-height: 0; }
.lotto:fullscreen .stage { height: 100%; min-height: 0; }
@media (min-width: 761px) { .lotto:fullscreen .sheet { display: none; } }

/* ---- articles --------------------------------------------------------------------------- */

.prose { max-width: 760px; margin: 0 auto; padding: 8px 0 24px; font-size: 1.04rem; }
.prose-guide { padding-top: 0; }
.prose h2 { margin: 2em 0 .6em; font-size: 1.55rem; font-weight: 780; }
.prose h3 { margin: 1.6em 0 .4em; font-size: 1.15rem; }
.prose > :first-child { margin-top: .4em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose li::marker { color: var(--muted); }
.prose .ball { --bs: 34px; vertical-align: middle; }

.answer {
  padding: 16px 18px; border-radius: var(--radius); border-inline-start: 4px solid var(--gold);
  background: var(--surface); box-shadow: 0 1px 0 var(--line);
  font-size: 1.08rem;
}
.steps { list-style: none; padding: 0; counter-reset: step; }
.steps > li { position: relative; padding-inline-start: 46px; margin-bottom: 14px; counter-increment: step; }
.steps > li::before {
  content: counter(step); position: absolute; inset-inline-start: 0; top: -1px;
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--text); color: var(--bg); font-weight: 800; font-size: .92rem;
}
.table-wrap { overflow-x: auto; margin: 0 0 1.2em; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: .94rem; font-variant-numeric: tabular-nums; }
.data-table caption { caption-side: top; text-align: start; padding: 12px 14px 4px; font-weight: 700; color: var(--muted); font-size: .85rem; }
.data-table th, .data-table td { padding: 9px 14px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table tbody th { font-weight: 650; }
.data-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.facts { margin: 1.4em 0; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.prose .facts-title { margin: 0 0 10px; font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.facts dl { margin: 0; display: grid; gap: 8px; }
.facts dl > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.facts dl > div:last-child { border-bottom: 0; padding-bottom: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; }
@media (max-width: 520px) { .facts dl > div { grid-template-columns: 1fr; gap: 0; } }

.faq { padding-top: 0; }
.faq-item { padding: 14px 0; border-top: 1px solid var(--line); }
.faq-item h3 { margin: 0 0 6px; font-size: 1.08rem; }
.faq-item p { margin: 0; color: var(--muted); }

/* the no-JavaScript draw on the server */
.server-draw { margin: 1.2em 0; padding: 18px; border-radius: 18px; background: var(--app-bg); color: var(--app-text); }
.rack-server { gap: 8px 12px; }
.rack-server .ball { --bs: 46px; }
.server-rule { margin: 12px 0 0; color: var(--app-muted); font-size: .9rem; }
.server-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 1.4em 0; }
.server-form label { display: grid; gap: 4px; font-weight: 600; }
.server-form select { height: 50px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 1rem; max-width: 100%; }
.server-form .btn-draw { flex: none; min-width: 160px; height: 50px; min-height: 0; }

/* ---- more lotteries, guides -------------------------------------------------------------- */

.more-lotteries { margin-top: 24px; padding: 40px 0 28px; background: var(--surface); border-top: 1px solid var(--line); }
.more-lotteries h2 { margin: 0 0 16px; font-size: 1.4rem; }
.lottery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.lottery-card {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; transition: transform .12s, border-color .12s;
}
.lottery-card:hover { transform: translateY(-2px); border-color: var(--link); }
.lottery-card .flag { grid-row: 1 / 3; width: 26px; height: 19px; }
.lottery-card-title { font-weight: 720; line-height: 1.2; }
.lottery-card-sub { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-top: 18px; }
.guide-card {
  display: grid; gap: 4px; padding: 16px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; transition: transform .12s, border-color .12s;
}
.guide-card:hover { transform: translateY(-2px); border-color: var(--link); }
.guide-card span { color: var(--muted); font-size: .9rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.updated { margin: 22px 0 0; color: var(--muted); font-size: .85rem; }

/* ---- footer ------------------------------------------------------------------------------------- */

.site-footer { background: #120f1d; color: #c9c3d9; padding-top: 40px; font-size: .92rem; }
.site-footer a { color: #e6e1f3; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1.6fr 1fr 1fr; gap: 28px; }
.footer-about .brand { color: #fff; margin-bottom: 10px; }
.footer-about p { margin: 0 0 10px; max-width: 40ch; }
.footer-fair { display: flex; gap: 8px; align-items: flex-start; color: #aaa3bf; }
.footer-fair svg { flex: none; margin-top: 3px; color: #69db7c; }
.footer-col h2 { margin: 0 0 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: #8f88a6; }
.footer-col ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.footer-lotteries { grid-template-columns: 1fr 1fr; column-gap: 16px; }
.footer-disclaimer { margin: 26px 0 0; color: #8f88a6; font-size: .84rem; max-width: 90ch; }
.geo-credit { color: #8f88a6; }
.footer-bottom { margin-top: 26px; padding: 16px 0 calc(16px + var(--safe-b)); border-top: 1px solid rgba(255, 255, 255, .08); color: #8f88a6; font-size: .85rem; }
.footer-bottom .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; }
.footer-bottom p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-langs { margin-top: 30px; }
.footer-langs h2 { margin: 0 0 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: #8f88a6; }
.footer-langs ul { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 0; list-style: none; }
.footer-langs a[aria-current] { color: #fff; font-weight: 700; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-about { grid-column: 1 / -1; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---- scripts ------------------------------------------------------------------------------------ */

/* Numbers and formats read left to right in every language. */
.rack, .h-balls, .btn-draw-sub, .chip-format, .lottery-card-sub { unicode-bidi: isolate; }
html:is([lang|="ar"], [lang|="he"], [lang|="hi"], [lang|="th"], [lang|="ja"], [lang|="ko"], [lang|="zh"]) :is(h1, h2, h3, .brand, .mega-title, .footer-col h2, .footer-langs h2, .group-title, .data-table thead th, .facts-title, .btn-draw-main, .result-kicker) {
  letter-spacing: 0;
}
html:is([lang|="th"], [lang|="hi"]) :is(h1, h2, h3) { line-height: 1.45; }
html:is([lang|="th"], [lang|="hi"]) :is(.btn-draw-main, .result-kicker, .tabs [role="tab"]) { line-height: 1.4; }
html[lang|="ko"] body { word-break: keep-all; overflow-wrap: break-word; }
html[lang|="ja"] :is(h1, h2, h3, .stage-hint) { word-break: auto-phrase; }

/* ---- installed app ---------------------------------------------------------------------------- */

@media (display-mode: standalone) {
  .breadcrumbs { display: none; }
}

/* ---- motion ----------------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
