/* ==========================================================================
   css/lottery.css — the Lottery (`#lottery`, DECISIONS 458, js/ui/lottery.js)
   --------------------------------------------------------------------------
   PC (900 px and up): the drum, the clock, the pot and the buy buttons in a sticky column on the left;
   who is in the drum, the last draws and the rules on the right. Phone: one column, drum first, the
   three buy buttons side by side under it. Every trainer has one hue (--h, set per element by
   js/ui/lottery.js): their paper tickets, their swatch and their chance bar. Yours are gold.
   ========================================================================== */

.lt-body { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.lt-side { display: grid; gap: 14px; min-width: 0; }
@media (min-width: 900px) {
  .lt-body { grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); }
  .lt-main { position: sticky; top: 0; }
}

.lt-main { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 16px 16px; }
.lt-label { display: block; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* ---- the drum: a glass bowl with metal rings on a stand ------------------------ */
.lt-stage { position: relative; width: 100%; display: flex; justify-content: center; }
.lt-drum-wrap { width: min(100%, 280px); }
.lt-drum {
  position: relative; width: 100%; aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  border: 6px solid #c9ccd6;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.05) 42%, rgba(140, 180, 255, 0.08) 72%, rgba(255, 255, 255, 0.16) 100%),
    rgba(20, 30, 52, 0.55);
  box-shadow: inset 0 -14px 30px rgba(0, 0, 0, 0.4), 0 12px 24px rgba(0, 0, 0, 0.35);
}
/* The two thin rings of a lottery cage, in front of the paper. */
.lt-drum::before, .lt-drum::after {
  content: ""; position: absolute; z-index: 3; pointer-events: none;
  border: 2px solid rgba(220, 225, 240, 0.35); border-radius: 50%;
}
.lt-drum::before { inset: 40% -2%; }
.lt-drum::after { inset: -2% 40%; }
.lt-shine {
  position: absolute; z-index: 4; left: 16%; top: 12%; width: 30%; height: 18%; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.45), transparent 70%);
  transform: rotate(-24deg); pointer-events: none;
}
.lt-hatch {
  position: absolute; z-index: 4; left: 50%; top: -2px; width: 22%; height: 9%;
  transform: translateX(-50%); border-radius: 0 0 10px 10px;
  background: linear-gradient(#8a90a2, #5b6173); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}
.lt-stand {
  display: block; width: 44%; height: 34px; margin: -8px auto 0;
  background: linear-gradient(180deg, #c9ccd6, #7d8396);
  clip-path: polygon(22% 0, 78% 0, 100% 100%, 0 100%);
  border-radius: 0 0 6px 6px;
}

.lt-tickets { position: absolute; inset: 0; transform-origin: 50% 50%; }
.lt-ticket {
  position: absolute; width: 26px; height: 15px; margin: -7px 0 0 -13px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent 70%, rgba(255, 255, 255, 0.6) 70% 73%, transparent 73%), hsl(var(--h) 70% 62%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transform: rotate(var(--rot));
  animation: ltFloat 3.2s ease-in-out var(--d) infinite alternate;
}
.lt-ticket.mine {
  z-index: 2;
  background: linear-gradient(90deg, transparent 70%, rgba(255, 255, 255, 0.7) 70% 73%, transparent 73%), linear-gradient(135deg, #ffe27a, #f2b400);
  outline: 2px solid #fff3b0;
}
.lt-more {
  position: absolute; right: 16%; bottom: 14%; z-index: 4;
  padding: 1px 7px; border-radius: 999px; background: rgba(12, 18, 32, 0.8); font-size: 0.75rem; font-weight: 700;
}
/* Above the cage rings (z-index 3), with a shadow, so no ring line runs through the words. */
.lt-empty {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; color: var(--text); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* A ticket bought: the drum bumps. The draw: the drum shakes and the paper whirls. */
.lt-drum.bump { animation: ltBump 0.5s ease-out; }
.lt-drum.drawing { animation: ltShake 0.16s ease-in-out infinite alternate; }
.lt-drum.drawing .lt-tickets { animation: ltSpin 0.6s linear infinite; }

/* The winning ticket: it flies out of the drum and opens into a card. */
.lt-winner {
  position: absolute; left: 50%; top: 6%; z-index: 6;
  width: min(92%, 280px); padding: 16px 14px 12px;
  display: grid; justify-items: center; gap: 6px; text-align: center;
  border-radius: 10px; color: #fff;
  background: linear-gradient(160deg, hsl(var(--h) 70% 60%), hsl(var(--h) 60% 38%));
  outline: 2px dashed rgba(255, 255, 255, 0.55); outline-offset: -8px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5);
  transform: translateX(-50%);
  animation: ltPop 0.65s cubic-bezier(0.2, 0.9, 0.3, 1.25);
}
.lt-winner.mine { color: #3a2600; background: linear-gradient(160deg, #ffe890, #f2b400); outline-color: rgba(58, 38, 0, 0.35); }
.lt-winner-kicker { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.9; }
.lt-winner-who { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; font-weight: 800; }
.lt-winner-who a { color: inherit; }
.lt-winner-prize { font-size: 1.7rem; font-weight: 900; }
.lt-winner-odds { color: inherit; opacity: 0.85; }

/* ---- clock, pot, buying ----------------------------------------------------------- */
.lt-clock-box { text-align: center; }
.lt-clock { font-size: 2rem; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.lt-pot { text-align: center; }
.lt-prize { display: block; font-size: 1.6rem; color: #ffd86b; }
.lt-note { margin: 0; max-width: 360px; text-align: center; font-size: 0.82rem; color: var(--warning); }
.lt-buy-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: min(100%, 380px); }
.lt-buy { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; min-width: 0; white-space: nowrap; }
.lt-buy b { font-size: 0.8rem; opacity: 0.9; }
.lt-hint { margin: -4px 0 0; text-align: center; font-size: 0.82rem; color: var(--warning); }
.lt-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 0.8rem; color: var(--muted); }
.lt-meta b { color: var(--text); }

/* ---- who is in the drum ----------------------------------------------------------- */
.lt-player-list, .lt-last-list { display: grid; gap: 6px; }
.lt-player {
  display: grid; grid-template-columns: 6px auto minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 6px 10px 6px 8px; border-radius: var(--radius-sm); background: var(--panel-2);
}
.lt-swatch { width: 6px; height: 30px; border-radius: 3px; background: hsl(var(--h) 70% 62%); }
.lt-player.me .lt-swatch { background: linear-gradient(#ffe27a, #f2b400); }
.lt-player-main { min-width: 0; }
.lt-player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 0.9rem; }
.lt-bar { height: 5px; margin-top: 4px; border-radius: 3px; background: var(--hp-track); overflow: hidden; }
.lt-bar span { display: block; height: 100%; background: hsl(var(--h) 70% 62%); }
.lt-player.me .lt-bar span { background: #f2c94c; }
.lt-player-n { font-family: var(--font-mono); font-size: 0.76rem; color: var(--muted); white-space: nowrap; }

/* ---- last draws, rules -------------------------------------------------------------- */
.lt-last-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: var(--radius-sm); background: var(--panel-2);
}
.lt-last-row.me { background: rgba(246, 201, 69, 0.12); }
.lt-last-main { min-width: 0; }
.lt-last-main > div:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 0.9rem; }
.lt-last-prize { color: #ffd86b; white-space: nowrap; }
.lt-rule-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 0.88rem; line-height: 1.45; }

@media (max-width: 600px) {
  .lt-main { padding: 14px 12px; }
  .lt-drum-wrap { width: min(100%, 240px); }
  .lt-clock { font-size: 1.7rem; }
}

@keyframes ltFloat { to { transform: rotate(calc(var(--rot) + 9deg)) translateY(-4px); } }
@keyframes ltSpin { to { transform: rotate(360deg); } }
@keyframes ltShake { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
@keyframes ltBump { 30% { transform: scale(1.04) rotate(-2deg); } 60% { transform: scale(0.99) rotate(1deg); } }
@keyframes ltPop {
  from { opacity: 0; transform: translateX(-50%) translateY(90px) scale(0.25) rotate(-14deg); }
  60% { opacity: 1; transform: translateX(-50%) translateY(-6px) scale(1.04) rotate(2deg); }
}

@media (prefers-reduced-motion: reduce) {
  .lt-ticket, .lt-drum.bump, .lt-drum.drawing, .lt-drum.drawing .lt-tickets, .lt-winner { animation: none; }
}
