:root {
  --bg: #14081f;
  --panel: rgba(28, 12, 44, 0.82);
  --panel-edge: rgba(255, 210, 110, 0.55);
  --gold: #ffd76a;
  --gold-deep: #c98a1b;
  --text: #fff6e0;
  --muted: #d9c6ff;
  --danger: #ff6b6b;
  --hud-h: 96px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; }
#game, #game canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

button { font: inherit; color: inherit; cursor: pointer; border: none; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible { outline: 3px solid #5ce1ff; outline-offset: 2px; }

/* ── înapoi în lobby ── */
#lobby { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 12px; z-index: 5; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; text-decoration: none; color: var(--text); font-size: 20px; font-weight: 800;
  background: radial-gradient(circle at 35% 30%, #6a3aa8, #2b1150); border: 2px solid var(--panel-edge); }

/* ── bara de sus (rotiri gratuite) ── */
#top { position: fixed; top: 0; left: 0; right: 0; height: 56px; display: flex; justify-content: center; align-items: center; pointer-events: none; padding-top: env(safe-area-inset-top); }
#fs-panel { display: flex; gap: 18px; align-items: center; padding: 8px 22px; border-radius: 999px; background: var(--panel);
  border: 2px solid var(--panel-edge); box-shadow: 0 6px 24px rgba(0,0,0,.5); font-size: 17px; white-space: nowrap; }
#fs-panel[hidden] { display: none; }
.fs-title { color: var(--gold); font-weight: 900; letter-spacing: .06em; }
.fs-mult { color: #ff8fd0; font-size: 22px; font-weight: 900; }

/* ── bara de jos ── */
#hud { position: fixed; left: 0; right: 0; bottom: 0; height: var(--hud-h); display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 0 16px env(safe-area-inset-bottom); background: linear-gradient(to top, rgba(10,4,18,.96), rgba(10,4,18,.75) 70%, transparent); }
.box { min-width: 150px; padding: 6px 16px; border-radius: 14px; background: var(--panel); border: 1.5px solid var(--panel-edge); text-align: center; }
.box small { display: block; font-size: 11px; letter-spacing: .14em; color: var(--muted); }
.box b { font-size: 20px; color: var(--gold); font-variant-numeric: tabular-nums; }
.bet-row { display: flex; align-items: center; gap: 10px; justify-content: center; }
.round { width: 52px; height: 52px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #6a3aa8, #2b1150); border: 2px solid var(--panel-edge);
  font-size: 20px; font-weight: 800; display: grid; place-items: center; }
.round.small { width: 40px; height: 40px; font-size: 17px; }
.round[aria-pressed="true"] { background: radial-gradient(circle at 35% 30%, #ffe27a, #c98a1b); color: #3a1600; }
.pill { height: 40px; padding: 0 16px; border-radius: 999px; font-weight: 900; letter-spacing: .06em;
  background: linear-gradient(#ff8fd0, #b0287a); border: 2px solid #ffd0ec; box-shadow: 0 4px 14px rgba(255, 80, 170, .35); }
.tools { display: flex; gap: 8px; align-items: center; }
.spin { width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center; margin-top: -18px;
  background: radial-gradient(circle at 35% 30%, #fff1b0, var(--gold) 40%, var(--gold-deep)); border: 4px solid #fff3c4;
  box-shadow: 0 0 0 4px rgba(201,138,27,.45), 0 8px 26px rgba(0,0,0,.6); transition: transform .12s; }
.spin svg { width: 46px; height: 46px; fill: #4a1d00; }
.spin:active:not(:disabled) { transform: scale(.94); }
.spin { position: relative; }
#auto-left { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; font-weight: 900; color: #4a1d00; }
#auto-left:empty { display: none; }
.spin.auto svg { opacity: 0; }
.spin.auto { background: radial-gradient(circle at 35% 30%, #fff1b0, #ffb84d 40%, #c96a1b); animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 4px rgba(255,184,77,.6), 0 0 30px rgba(255,184,77,.8); } }
.auto-btn { background: linear-gradient(#7a52c7, #3b1a63); border-color: var(--panel-edge); box-shadow: none; }
.auto-btn[aria-pressed="true"] { background: linear-gradient(#ffe27a, #c98a1b); color: #3a1600; }
.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice label { cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: inline-block; padding: 8px 14px; border-radius: 10px; background: #3b1a63; border: 1.5px solid var(--panel-edge); font-weight: 700; }
.choice input:checked + span { background: linear-gradient(#ffe27a, #c98a1b); color: #3a1600; }
.choice input:focus-visible + span { outline: 3px solid #5ce1ff; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 16px; color: #eadcff; }
.spin.busy svg { animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ── telefon pe verticală: două rânduri ── */
@media (orientation: portrait), (max-width: 760px) {
  :root { --hud-h: 178px; }
  #hud { flex-wrap: wrap; align-content: center; gap: 10px 10px; }
  .box { min-width: 0; flex: 1 1 28%; padding: 6px 8px; }
  .box b { font-size: 17px; }
  #box-balance { order: 1; } .bet { order: 2; } #box-win { order: 3; }
  .bet-row { gap: 4px; }
  .bet-row b { white-space: nowrap; font-size: 15px; }
  .round.small { width: 36px; height: 36px; font-size: 15px; }
  /* rândul 2: BONUS, turbo, ROTEȘTE (în mijloc), poză, reguli */
  .tools { display: contents; }
  /* rupere de rând fixă după cele 3 casete; rândul 2: BONUS, turbo, sunet, ROTEȘTE, AUTO */
  #hud::before { content: ''; order: 4; flex-basis: 100%; height: 0; }
  #buy { order: 5; } #turbo { order: 6; } #sound { order: 7; } .spin { order: 8; margin-top: 0; width: 76px; height: 76px; } #auto { order: 9; } #photo { order: 10; } #help { order: 11; }
  #buy, #auto { padding: 0 10px; height: 36px; font-size: 13px; }
  /* poza și regulile urcă în colțul din dreapta sus, ca rândul de jos să încapă */
  #photo, #help { position: fixed; top: calc(10px + env(safe-area-inset-top)); z-index: 5; }
  #help { right: 12px; } #photo { right: 56px; }
  #hud { gap: 10px 6px; padding-left: 8px; padding-right: 8px; }
  #hud .spin { flex: 0 0 auto; }
  #fs-panel { gap: 10px; font-size: 14px; padding: 6px 14px; }
}

/* ── mesaje mari (bonus, câștig mare) ── */
#banner { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(8, 2, 16, .55); z-index: 20; }
#banner[hidden] { display: none; }
#banner.bigwin { background: radial-gradient(ellipse at center, rgba(40, 10, 60, .55), rgba(8, 2, 16, .15) 70%); }
#banner.bigwin #banner-title { font-size: clamp(44px, 10vw, 130px); animation: shine 1.2s ease-in-out infinite alternate; }
#banner.bigwin #banner-sub { font-size: clamp(34px, 7vw, 84px); color: var(--gold); font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 0 #7a3a00, 0 0 30px rgba(255,200,80,.6); }
@keyframes shine { from { filter: brightness(1); transform: scale(1); } to { filter: brightness(1.35); transform: scale(1.04); } }
.banner-inner { text-align: center; animation: pop .5s cubic-bezier(.2,1.6,.4,1) both; padding: 0 16px; }
#banner-title { font-size: clamp(40px, 9vw, 110px); font-weight: 900; line-height: 1; color: var(--gold);
  text-shadow: 0 4px 0 #7a3a00, 0 0 40px rgba(255, 200, 80, .7); letter-spacing: .02em; }
#banner-sub { margin-top: 14px; font-size: clamp(20px, 4vw, 40px); font-weight: 800; color: #fff; text-shadow: 0 2px 10px #000; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── jocul cu alegere ── */
#pick { position: fixed; inset: 0; z-index: 15; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(ellipse at center, rgba(70, 20, 110, .92), rgba(10, 2, 20, .96)); padding: 16px; }
#pick[hidden] { display: none; }
#pick h2 { margin: 0; font-size: clamp(26px, 5vw, 52px); color: var(--gold); text-shadow: 0 3px 0 #7a3a00; }
#pick p { margin: 0; color: var(--muted); font-size: 18px; }
#pick-jackpots { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.jp { display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--panel); border: 1.5px solid var(--panel-edge); font-weight: 800; }
.jp img { width: 34px; height: 34px; }
.jp .dots { letter-spacing: 2px; color: var(--gold); min-width: 3ch; }
#pick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(6px, 1.5vw, 16px); width: min(92vw, 720px); }
@media (orientation: portrait) { #pick-grid { grid-template-columns: repeat(3, 1fr); width: min(92vw, 460px); } }
.box-pick { aspect-ratio: 1; background: none; padding: 0; position: relative; transition: transform .15s; }
.box-pick:hover:not(:disabled) { transform: scale(1.06) rotate(-2deg); }
.box-pick img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0,0,0,.6)); }
.box-pick.open img { animation: pop .4s both; }
.box-pick .cash { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(16px, 3vw, 28px); font-weight: 900; color: #8cff5c; text-shadow: 0 2px 6px #000; animation: pop .4s both; }
.box-pick.dim { opacity: .4; }
.box-pick:disabled { opacity: 1; }

/* ── fereastră de dialog ── */
#modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(5, 0, 12, .7); padding: 16px; }
#modal[hidden] { display: none; }
.modal-card { position: relative; width: min(760px, 100%); max-height: 86vh; overflow: auto; padding: 24px; border-radius: 20px;
  background: linear-gradient(#2a1046, #170826); border: 2px solid var(--panel-edge); box-shadow: 0 20px 60px rgba(0,0,0,.7); user-select: text; }
#modal-close { position: absolute; top: 12px; right: 12px; }
.modal-card h2 { margin: 0 0 12px; color: var(--gold); }
.modal-card h3 { color: var(--gold); margin: 22px 0 8px; }
.modal-card p, .modal-card li { color: #eadcff; line-height: 1.5; }
.paytable { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pay { display: flex; gap: 8px; align-items: center; background: rgba(255,255,255,.05); border-radius: 12px; padding: 6px; }
.pay img { width: 64px; height: 64px; }
.pay div { font-size: 14px; line-height: 1.35; font-variant-numeric: tabular-nums; }
.pay b { color: var(--gold); }
.actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.btn { padding: 10px 20px; border-radius: 12px; font-weight: 800; background: #3b1a63; border: 1.5px solid var(--panel-edge); }
.btn.primary { background: linear-gradient(#ffe27a, #c98a1b); color: #3a1600; }
.photo-preview { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.photo-preview img { width: 160px; height: 160px; }
.lines-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.lines-mini svg { width: 100%; background: rgba(255,255,255,.05); border-radius: 6px; }

/* ── notificări și încărcare ── */
#toast { position: fixed; left: 50%; bottom: calc(var(--hud-h) + 16px); transform: translateX(-50%); z-index: 40; padding: 12px 20px; border-radius: 12px;
  background: #3a0f1a; border: 1.5px solid var(--danger); color: #ffe0e0; font-weight: 700; max-width: 92vw; text-align: center; }
#toast[hidden] { display: none; }
#loading { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; background: var(--bg); color: var(--muted); }
#loading.gone { opacity: 0; pointer-events: none; transition: opacity .4s; }
.spinner { width: 54px; height: 54px; border-radius: 50%; border: 5px solid rgba(255,215,106,.2); border-top-color: var(--gold); animation: rot 1s linear infinite; }
