:root {
  --bg: #050008;
  --panel: rgba(13, 3, 25, .94);
  --panel-soft: rgba(34, 8, 59, .78);
  --line: rgba(219, 169, 255, .22);
  --line-gold: rgba(255, 205, 112, .45);
  --violet: #9d4edd;
  --violet-bright: #c56cff;
  --pink: #f08cff;
  --gold: #ffd987;
  --gold-2: #bd7b24;
  --text: #fff8ff;
  --muted: #bba7c8;
  --success: #8fffd0;
  --danger: #ff7ca7;
  --safe-top: max(8px, env(safe-area-inset-top));
  --safe-bottom: max(8px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); }
body {
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 50% -10%, rgba(153, 50, 255, .38), transparent 42%),
    linear-gradient(180deg, #090010 0%, #030006 100%);
}
button, input { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

.cosmos { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.cosmos::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(0, 0, 0, .56) 100%);
}
.cosmos-moon {
  position: absolute;
  width: min(52vw, 720px);
  aspect-ratio: 1;
  left: 50%; top: -26%; transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,.7) 0 2%, transparent 3%),
    radial-gradient(circle at 66% 58%, rgba(50, 3, 92, .7) 0 12%, transparent 13%),
    radial-gradient(circle at 46% 48%, #d390ff 0, #8a26dc 38%, #42116f 70%, #150522 100%);
  box-shadow: 0 0 70px rgba(183, 82, 255, .75), 0 0 180px rgba(111, 24, 196, .58);
  opacity: .68;
}
.cosmos-cloud { position: absolute; width: 70vw; height: 55vh; filter: blur(45px); opacity: .38; }
.cosmos-cloud-a { left: -24vw; top: 12vh; background: radial-gradient(ellipse, #5c168e, transparent 68%); }
.cosmos-cloud-b { right: -26vw; bottom: -12vh; background: radial-gradient(ellipse, #8d1ab6, transparent 68%); }
.cosmos-stars {
  position: absolute; inset: -100px;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.9) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(217,160,255,.8) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(255,215,132,.7) 0 1px, transparent 1.5px);
  background-size: 53px 53px, 87px 87px, 131px 131px;
  background-position: 0 0, 18px 31px, 61px 14px;
  animation: starDrift 32s linear infinite;
}
@keyframes starDrift { to { transform: translateY(131px); } }

.casino-app {
  position: relative;
  z-index: 1;
  width: min(1500px, 100vw);
  height: 100dvh;
  margin: 0 auto;
  padding: var(--safe-top) clamp(8px, 1.2vw, 18px) var(--safe-bottom);
  display: grid;
  grid-template-areas:
    "header"
    "spectator"
    "hud"
    "bonus"
    "machine"
    "controls"
    "footer";
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto auto;
  gap: clamp(6px, .8vh, 10px);
}

.casino-header { grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 5px 8px;
}
.brand-lockup { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-gem {
  width: 43px; height: 43px; display: grid; place-items: center;
  color: #f1bcff; font-size: 27px;
  border: 1px solid var(--line-gold); border-radius: 50%;
  background: radial-gradient(circle, #a74fff, #4b117c 55%, #100119 100%);
  box-shadow: 0 0 22px rgba(194, 83, 255, .55), inset 0 0 12px rgba(255, 225, 158, .22);
}
.brand-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(20px, 2.3vw, 34px);
  line-height: .95; letter-spacing: .12em;
  color: var(--gold); text-shadow: 0 2px 0 #6c330a, 0 0 18px rgba(255, 200, 96, .4);
}
.brand-subtitle { margin-top: 4px; font-size: 9px; letter-spacing: .38em; color: #e7b4ff; }
.header-actions { display: flex; gap: 7px; }
.round-icon {
  position: relative;
  width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(220, 163, 255, .28);
  background: linear-gradient(145deg, rgba(63, 16, 99, .9), rgba(13, 2, 23, .96));
  box-shadow: inset 0 0 13px rgba(218, 125, 255, .1), 0 6px 20px rgba(0,0,0,.3);
}
.round-icon:hover { border-color: rgba(255, 214, 128, .62); transform: translateY(-1px); }
.round-icon.compact { width: 34px; height: 34px; font-size: 21px; }
.action-badge {
  position: absolute; right: -4px; top: -5px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; display: grid; place-items: center; background: #d93c87; color: white; font-size: 10px; font-weight: 800;
}

.spectator-banner { grid-area: spectator;
  border: 1px solid rgba(255, 102, 190, .35);
  background: linear-gradient(90deg, rgba(79, 12, 87, .9), rgba(31, 5, 50, .92));
  border-radius: 14px; padding: 8px 12px; display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: center;
  box-shadow: 0 0 24px rgba(204, 56, 238, .2);
}
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff4b9c; box-shadow: 0 0 0 0 rgba(255,75,156,.55); animation: livePulse 1.3s infinite; }
@keyframes livePulse { 70% { box-shadow: 0 0 0 9px rgba(255,75,156,0); } }
.spectator-banner strong, .spectator-banner small { display: block; }
.spectator-banner small { color: var(--muted); margin-top: 2px; }
.mini-button { border: 1px solid var(--line); background: rgba(255,255,255,.06); border-radius: 10px; padding: 7px 10px; cursor: pointer; }

.casino-hud { grid-area: hud;
  display: grid;
  grid-template-columns: minmax(140px, .8fr) minmax(220px, 1.25fr) minmax(220px, 1.4fr);
  gap: 8px;
}
.hud-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(39, 8, 67, .88), rgba(10, 1, 19, .94));
  padding: 9px 12px;
  box-shadow: inset 0 0 18px rgba(165, 73, 225, .08), 0 7px 22px rgba(0,0,0,.22);
}
.hud-card span { display: block; font-size: 9px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.hud-card strong { display: block; margin-top: 3px; font-size: clamp(15px, 2vw, 22px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jackpot-hud { text-align: center; border-color: var(--line-gold); }
.jackpot-hud strong { color: #ffb7ff; font-size: clamp(18px, 2.6vw, 29px); letter-spacing: .08em; text-shadow: 0 0 18px rgba(234, 105, 255, .6); }
.energy-title-row { display: flex; justify-content: space-between; gap: 8px; }
.energy-title-row b { color: #f3c9ff; font-size: 11px; }
.energy-track { height: 10px; border-radius: 999px; margin: 7px 0 5px; overflow: hidden; border: 1px solid rgba(255,255,255,.08); background: rgba(0,0,0,.55); }
.energy-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #5c1bc3, #b638ef 55%, #ffd18b); box-shadow: 0 0 18px rgba(205, 88, 255, .8); transition: width .5s ease; position: relative; }
.energy-fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 20%, rgba(255,255,255,.7) 48%, transparent 72%); animation: energySweep 1.5s linear infinite; }
@keyframes energySweep { from { transform: translateX(-120%); } to { transform: translateX(120%); } }
.energy-hud small { color: #dfb7ef; font-size: 10px; }
.energy-hud small.active { color: var(--gold); text-shadow: 0 0 10px rgba(255,210,120,.65); }

.bonus-banner { grid-area: bonus;
  padding: 7px 12px; border-radius: 12px; display: flex; justify-content: center; gap: 12px;
  background: linear-gradient(90deg, #5b1bc3, #ad2ed0, #5b1bc3);
  border: 1px solid rgba(255,210,255,.32); box-shadow: 0 0 22px rgba(180, 50, 236, .35); font-size: 11px;
}

.machine-shell { grid-area: machine;
  min-height: 0;
  border: 1px solid rgba(255, 206, 117, .34);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 0, rgba(175, 67, 255, .16), transparent 38%),
    linear-gradient(180deg, rgba(23, 3, 38, .97), rgba(5, 0, 10, .98));
  box-shadow: 0 18px 48px rgba(0,0,0,.48), inset 0 0 38px rgba(105, 22, 157, .12), 0 0 30px rgba(117, 28, 178, .15);
  padding: 0 10px 9px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  position: relative;
}
.machine-shell::before, .machine-shell::after { content: ""; position: absolute; top: 12%; bottom: 8%; width: 2px; background: linear-gradient(transparent, var(--gold), transparent); opacity: .4; }
.machine-shell::before { left: 5px; } .machine-shell::after { right: 5px; }
.machine-crown { height: 44px; display: flex; justify-content: center; align-items: center; gap: 13px; margin-top: -1px; }
.machine-crown div { text-align: center; }
.machine-crown small { display: block; font-size: 8px; letter-spacing: .3em; color: #e5b5ff; }
.machine-crown strong { display: block; font-family: Georgia, serif; font-size: clamp(16px, 2vw, 24px); letter-spacing: .12em; color: var(--gold); text-shadow: 0 0 13px rgba(255,211,128,.44); }
.crown-wing { color: #b853ff; text-shadow: 0 0 13px #b853ff; }
.machine-statusbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 0 4px 6px; font-size: 9px; color: var(--muted); }
.status-text { text-align: center; color: #f0ddff; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-count { color: var(--gold); letter-spacing: .12em; }
.link-button { border: 0; background: transparent; color: #e3b9ff; text-decoration: underline; cursor: pointer; font-size: 9px; }

.reel-stage { position: relative; min-height: 0; overflow: hidden; border-radius: 17px; }
.reel-stage::before {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  box-shadow: inset 0 16px 24px rgba(0,0,0,.54), inset 0 -16px 24px rgba(0,0,0,.6);
  border: 1px solid rgba(233,174,255,.22); border-radius: inherit;
}
.reel-grid {
  height: 100%;
  min-height: 210px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(4px, .55vw, 8px);
  padding: clamp(6px, .7vw, 10px);
  background: linear-gradient(180deg, #040007, #14021f 45%, #040007);
}
.reel {
  min-width: 0; min-height: 0;
  display: grid; grid-template-rows: repeat(var(--row-count, 5), minmax(0, 1fr)); gap: clamp(4px, .5vh, 7px);
  position: relative;
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(11,1,19,.9), rgba(23,4,38,.8));
  box-shadow: inset 0 0 22px rgba(0,0,0,.75);
  transition: filter .25s ease;
}
.reel.spinning { filter: brightness(1.18) saturate(1.25); }
.reel.spinning::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.22), transparent 22%, transparent 72%, rgba(208,84,255,.24));
  animation: reelSweep .32s linear infinite;
}
@keyframes reelSweep { from { transform: translateY(-100%); } to { transform: translateY(100%); } }
.reel.settling { animation: reelSettle .34s cubic-bezier(.2,.9,.25,1.35); }
@keyframes reelSettle { 0% { transform: translateY(-9px); } 65% { transform: translateY(4px); } 100% { transform: translateY(0); } }

.symbol {
  min-height: 0;
  position: relative; display: grid; place-items: center; overflow: hidden;
  border-radius: 11px;
  border: 1px solid rgba(210, 146, 255, .14);
  background:
    radial-gradient(circle at 50% 28%, rgba(114, 33, 173, .25), transparent 45%),
    linear-gradient(180deg, rgba(20,4,34,.96), rgba(7,0,12,.98));
  box-shadow: inset 0 0 20px rgba(109, 22, 166, .12);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, filter .2s ease;
}
.symbol::after { content: ""; position: absolute; inset: 0; background: linear-gradient(125deg, rgba(255,255,255,.1), transparent 26%); pointer-events: none; }
.symbol-art { width: min(84%, 116px); height: min(84%, 116px); filter: drop-shadow(0 0 8px rgba(173,66,255,.42)); }
.symbol-wild, .symbol-jackpot, .symbol-scatter { border-color: rgba(255, 205, 112, .28); }
.symbol.winning { z-index: 4; border-color: #ffd982; box-shadow: 0 0 0 2px rgba(255,217,130,.25), 0 0 26px rgba(255,201,90,.65), inset 0 0 22px rgba(171,52,255,.32); transform: scale(1.035); animation: winningPulse .72s ease-in-out infinite alternate; }
@keyframes winningPulse { to { filter: brightness(1.28) saturate(1.2); transform: scale(1.055); } }
.reel-light { position: absolute; z-index: 5; top: 7%; bottom: 7%; width: 5px; border-radius: 8px; background: linear-gradient(transparent, #ffd884, #b34cff, #ffd884, transparent); box-shadow: 0 0 12px #c04dff; opacity: .8; pointer-events: none; }
.reel-light-left { left: 2px; } .reel-light-right { right: 2px; }
.win-line-glow { position: absolute; left: 1%; right: 1%; top: 50%; height: 2px; background: linear-gradient(90deg, transparent, rgba(255,215,130,.7), transparent); box-shadow: 0 0 12px rgba(255,215,130,.6); opacity: .28; z-index: 2; pointer-events: none; }
.line-win-label { min-height: 24px; padding: 6px 4px 0; text-align: center; color: #ddc4ec; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.casino-controls { grid-area: controls;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  gap: clamp(9px, 1.5vw, 20px);
  min-height: 92px;
  padding: 8px 14px;
  border: 1px solid rgba(255,205,112,.28);
  border-radius: 19px;
  background: linear-gradient(180deg, rgba(29,5,49,.94), rgba(9,1,16,.98));
  box-shadow: 0 11px 30px rgba(0,0,0,.35), inset 0 0 18px rgba(153,55,218,.09);
}
.bet-panel > span, .last-win span { display: block; font-size: 9px; letter-spacing: .14em; color: var(--muted); text-align: center; }
.bet-controls { display: grid; grid-template-columns: 38px minmax(90px,1fr) 38px; gap: 6px; align-items: center; margin-top: 5px; }
.bet-controls strong { text-align: center; color: var(--gold); font-size: clamp(15px, 2vw, 20px); white-space: nowrap; }
.bet-step { height: 38px; border-radius: 10px; border: 1px solid var(--line); background: rgba(88,24,135,.35); cursor: pointer; font-size: 21px; }
.bet-step:disabled { opacity: .35; }
.spin-button {
  position: relative;
  width: clamp(78px, 9.2vw, 112px); aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer;
  background: radial-gradient(circle at 42% 30%, #f5d6ff, #a343e3 28%, #5a167f 59%, #190326 75%);
  box-shadow: 0 0 0 3px #a66f2a, 0 0 0 7px #1b0828, 0 0 0 9px rgba(255,214,126,.5), 0 0 32px rgba(190,64,255,.58), inset 0 0 24px rgba(255,255,255,.2);
  transition: transform .18s ease, filter .18s ease;
}
.spin-button:hover { transform: scale(1.035); filter: brightness(1.1); }
.spin-button:active { transform: scale(.97); }
.spin-button:disabled { opacity: .65; cursor: wait; }
.spin-ring { position: absolute; inset: 10px; border-radius: 50%; border: 2px dashed rgba(255,220,145,.65); animation: ringIdle 7s linear infinite; }
@keyframes ringIdle { to { transform: rotate(360deg); } }
.spin-button.busy .spin-ring { animation-duration: .7s; }
.spin-arrows { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(39px, 5vw, 58px); color: #fff5d8; text-shadow: 0 2px 0 #683109, 0 0 12px white; }
.spin-button strong { position: absolute; left: 0; right: 0; bottom: 14%; font-size: 9px; letter-spacing: .16em; color: #fff6dc; }
.result-panel { display: grid; grid-template-columns: minmax(85px, .8fr) minmax(100px, 1fr); gap: 8px; align-items: center; }
.auto-button { height: 48px; border-radius: 12px; border: 1px solid var(--line-gold); background: rgba(85, 31, 110, .36); color: var(--gold); cursor: pointer; font-weight: 800; font-size: 11px; }
.auto-button.active { background: linear-gradient(135deg, #6d1cb0, #c63fca); color: white; box-shadow: 0 0 18px rgba(199,63,203,.45); }
.last-win { min-width: 0; text-align: center; }
.last-win strong { display: block; margin-top: 4px; color: var(--gold); font-size: clamp(17px, 2.2vw, 25px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.casino-footer { grid-area: footer; display: flex; justify-content: center; gap: 14px; align-items: center; min-height: 16px; color: #8f789e; font-size: 9px; }
.watcher-count { color: #e1b8ff; }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 14px; background: rgba(3,0,7,.78); backdrop-filter: blur(10px); }
.modal-card {
  position: relative; width: min(560px, 100%); max-height: min(86dvh, 760px); overflow: auto;
  border-radius: 22px; border: 1px solid rgba(223,165,255,.28);
  background: linear-gradient(160deg, rgba(43,10,70,.98), rgba(9,1,17,.99));
  box-shadow: 0 20px 70px rgba(0,0,0,.65), 0 0 38px rgba(139,45,204,.2);
  padding: 22px;
}
.modal-card h2 { margin: 0 36px 10px 0; color: var(--gold); font-family: Georgia, serif; }
.modal-card p { color: var(--muted); line-height: 1.45; font-size: 13px; }
.modal-close { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.06); cursor: pointer; font-size: 23px; }
.primary-button, .secondary-button, .danger-button { min-height: 44px; border-radius: 12px; cursor: pointer; font-weight: 800; }
.primary-button { border: 1px solid rgba(255,211,125,.55); background: linear-gradient(135deg, #6a1a9a, #b03bd4); color: white; }
.secondary-button { border: 1px solid var(--line); background: rgba(255,255,255,.06); }
.danger-button { border: 1px solid rgba(255,91,143,.4); background: rgba(177,35,87,.18); color: #ffc3d6; }
.room-code-card { margin: 12px 0; padding: 14px; text-align: center; border-radius: 15px; background: rgba(0,0,0,.25); border: 1px solid var(--line); }
.room-code-card span, .room-code-card small { display: block; color: var(--muted); }
.room-code-card strong { display: block; margin: 5px 0; font-size: 28px; letter-spacing: .2em; color: var(--gold); }
.room-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.room-actions-grid .danger-button { grid-column: 1 / -1; }
.room-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: #8d759b; font-size: 11px; }
.room-divider::before, .room-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.join-room-form label { display: block; margin-bottom: 7px; color: #ddc9e8; font-size: 12px; }
.join-room-form > div { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.join-room-form input, .chat-form input {
  min-width: 0; border-radius: 11px; border: 1px solid var(--line); background: rgba(0,0,0,.32); color: white; outline: none; padding: 11px 12px;
}
.join-room-form input:focus, .chat-form input:focus { border-color: #bd63ff; box-shadow: 0 0 0 3px rgba(189,99,255,.1); }
.join-room-form button, .chat-form button { border: 1px solid var(--line-gold); border-radius: 11px; background: #5e1b85; cursor: pointer; padding: 0 16px; }

.chat-panel {
  position: fixed; z-index: 45; right: max(8px, env(safe-area-inset-right)); top: max(8px, env(safe-area-inset-top)); bottom: max(8px, env(safe-area-inset-bottom));
  width: min(380px, calc(100vw - 16px));
  display: grid; grid-template-rows: auto 1fr auto;
  border-radius: 20px; overflow: hidden;
  border: 1px solid rgba(223,165,255,.28);
  background: rgba(10,1,18,.97); backdrop-filter: blur(16px);
  box-shadow: -18px 0 50px rgba(0,0,0,.5), 0 0 30px rgba(139,45,204,.2);
}
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 13px; border-bottom: 1px solid var(--line); background: rgba(62,15,91,.35); }
.chat-head strong, .chat-head small { display: block; }
.chat-head small { color: var(--muted); margin-top: 2px; }
.chat-messages { min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-message { max-width: 88%; padding: 8px 10px; border-radius: 12px 12px 12px 3px; background: rgba(89,31,127,.4); border: 1px solid rgba(211,150,255,.12); }
.chat-message.own { align-self: flex-end; border-radius: 12px 12px 3px 12px; background: rgba(140,47,177,.42); }
.chat-message b { display: block; font-size: 10px; color: #e6bdff; margin-bottom: 3px; }
.chat-message p { margin: 0; font-size: 12px; line-height: 1.35; white-space: pre-wrap; word-break: break-word; }
.chat-message time { display: block; margin-top: 4px; color: #846f90; font-size: 8px; text-align: right; }
.chat-form { display: grid; grid-template-columns: 1fr 44px; gap: 7px; padding: 11px; border-top: 1px solid var(--line); }
.chat-form button { padding: 0; font-size: 18px; }

.paytable-content { display: grid; gap: 7px; }
.pay-row { display: grid; grid-template-columns: minmax(145px, 1.4fr) repeat(3, .6fr); gap: 6px; align-items: center; padding: 8px; border-radius: 11px; background: rgba(255,255,255,.04); font-size: 11px; }
.pay-symbol { display: flex; align-items: center; gap: 7px; min-width: 0; }
.pay-symbol .symbol-art { width: 34px; height: 34px; flex: 0 0 auto; }
.rules-block { margin-top: 14px; color: var(--muted); font-size: 12px; }
.rules-block h3 { color: var(--gold); }

.win-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; align-content: center; gap: 10px; background: radial-gradient(circle, rgba(108,25,158,.86), rgba(2,0,5,.97) 68%); overflow: hidden; }
.win-rays { position: absolute; width: 130vmax; height: 130vmax; background: repeating-conic-gradient(from 0deg, rgba(255,215,126,.18) 0 7deg, transparent 7deg 15deg); animation: raySpin 12s linear infinite; }
@keyframes raySpin { to { transform: rotate(360deg); } }
.win-orb { position: relative; width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center; font-size: 88px; color: var(--gold); background: radial-gradient(circle, #e9b4ff, #8524c7 55%, #23022f); box-shadow: 0 0 50px rgba(214,91,255,.8); animation: orbFloat 1.2s ease-in-out infinite alternate; }
@keyframes orbFloat { to { transform: translateY(-8px) scale(1.04); } }
.win-title { position: relative; font-family: Georgia, serif; font-size: clamp(42px, 10vw, 100px); color: var(--gold); letter-spacing: .05em; text-shadow: 0 3px 0 #77370c, 0 0 22px rgba(255,218,135,.6); }
.win-amount { position: relative; font-size: clamp(28px, 6vw, 60px); color: #ffb8ff; font-weight: 900; text-shadow: 0 0 24px rgba(233,98,255,.72); }
.win-overlay button { position: relative; margin-top: 16px; min-width: 190px; min-height: 48px; border-radius: 14px; border: 1px solid var(--line-gold); background: linear-gradient(135deg, #741ca1, #bb45d7); cursor: pointer; font-weight: 900; letter-spacing: .12em; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px)); transform: translateX(-50%); max-width: min(520px, calc(100vw - 24px)); padding: 11px 15px; border-radius: 13px; background: rgba(24,4,37,.97); border: 1px solid rgba(225,170,255,.3); box-shadow: 0 10px 40px rgba(0,0,0,.55); text-align: center; font-size: 12px; }

@media (max-width: 720px) {
  .casino-app { grid-template-rows: auto auto auto auto minmax(0, 1fr) auto auto; padding-left: 6px; padding-right: 6px; gap: 5px; }
  .brand-gem { width: 36px; height: 36px; font-size: 22px; }
  .brand-title { font-size: 20px; }
  .brand-subtitle { font-size: 7px; }
  .round-icon { width: 37px; height: 37px; }
  .casino-hud { grid-template-columns: 1fr 1.25fr; gap: 5px; }
  .energy-hud { grid-column: 1 / -1; padding-top: 6px; padding-bottom: 6px; }
  .hud-card { padding: 7px 9px; }
  .machine-shell { padding-left: 5px; padding-right: 5px; border-radius: 16px; }
  .machine-crown { height: 32px; }
  .machine-crown strong { font-size: 15px; }
  .reel-grid { min-height: 180px; gap: 3px; padding: 4px; }
  .reel { gap: 3px; border-radius: 9px; }
  .symbol { border-radius: 7px; }
  .symbol-art { width: 91%; height: 91%; }
  .casino-controls { grid-template-columns: 1fr auto 1fr; min-height: 80px; padding: 6px 7px; gap: 7px; border-radius: 15px; }
  .spin-button { width: 72px; }
  .spin-button strong { bottom: 11%; font-size: 7px; }
  .bet-controls { grid-template-columns: 31px minmax(68px,1fr) 31px; gap: 3px; }
  .bet-step { height: 34px; }
  .bet-controls strong, .last-win strong { font-size: 13px; }
  .result-panel { display: grid; grid-template-columns: 1fr; gap: 3px; }
  .auto-button { height: 34px; font-size: 9px; }
  .last-win span { display: none; }
  .line-win-label { font-size: 8px; min-height: 18px; padding-top: 4px; }
  .machine-statusbar { padding-bottom: 3px; }
  .room-actions-grid { grid-template-columns: 1fr; }
  .room-actions-grid .danger-button { grid-column: auto; }
  .modal-card { padding: 18px; }
}

@media (max-height: 700px) {
  .casino-app { gap: 4px; }
  .casino-header { min-height: 42px; }
  .brand-gem { width: 34px; height: 34px; }
  .casino-hud { display: grid; }
  .hud-card { padding-top: 5px; padding-bottom: 5px; }
  .energy-track { margin-top: 4px; margin-bottom: 2px; }
  .machine-crown { height: 28px; }
  .casino-controls { min-height: 68px; }
  .spin-button { width: 64px; }
  .reel-grid { min-height: 150px; }
}

@media (orientation: landscape) and (max-height: 560px) {
  .casino-app { grid-template-rows: auto auto auto auto minmax(0, 1fr) auto 0; }
  .casino-hud { position: absolute; top: var(--safe-top); left: 220px; right: 190px; z-index: 4; grid-template-columns: .8fr 1.1fr 1.1fr; }
  .bonus-banner { display: none !important; }
  .machine-shell { margin-top: 0; }
  .casino-footer { display: none; }
}

/* Moon Casino 5x5 + daily leaderboard */
.reel {
  grid-template-rows: repeat(var(--row-count, 5), minmax(0, 1fr));
}
.reel-grid {
  min-height: 285px;
}
.symbol-art {
  width: min(76%, 92px);
  height: min(76%, 92px);
}
.symbol-orbit .symbol-art,
.symbol-comet .symbol-art {
  filter: drop-shadow(0 0 10px rgba(207, 109, 255, .55));
}

.leaderboard-card {
  width: min(620px, 100%);
}
.leaderboard-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.leaderboard-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 9px 11px;
  border: 1px solid rgba(218, 158, 255, .16);
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(91, 25, 131, .35), rgba(10, 1, 18, .76));
}
.leaderboard-row.own {
  border-color: rgba(255, 214, 129, .55);
  box-shadow: 0 0 18px rgba(192, 83, 255, .18);
}
.leaderboard-rank {
  text-align: center;
  color: var(--gold);
  font-size: 18px;
  font-weight: 900;
}
.leaderboard-player {
  min-width: 0;
}
.leaderboard-player b,
.leaderboard-player small {
  display: block;
}
.leaderboard-player b {
  overflow: hidden;
  color: #f7e7ff;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.leaderboard-player small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}
.leaderboard-row > strong {
  color: var(--gold);
  white-space: nowrap;
  font-size: 13px;
}
.leaderboard-viewer {
  margin-top: 12px;
  padding: 11px;
  border: 1px solid var(--line-gold);
  border-radius: 12px;
  background: rgba(105, 31, 144, .28);
  color: #ffe5a8;
  text-align: center;
  font-weight: 800;
}
.leaderboard-empty {
  padding: 24px 12px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .header-actions { gap: 4px; }
  .reel-grid { min-height: 230px; }
  .symbol-art { width: 82%; height: 82%; }
  .leaderboard-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }
  .leaderboard-row > strong {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-height: 700px) {
  .reel-grid { min-height: 190px; }
  .symbol-art { width: 72%; height: 72%; }
}

/* Live Sync v2: быстрый спин, эмоджи и список наблюдателей */
.result-panel {
  grid-template-columns: minmax(85px, .75fr) minmax(120px, 1fr);
}
.fast-spin-toggle {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid rgba(218, 158, 255, .18);
  border-radius: 10px;
  background: rgba(99, 30, 137, .2);
  color: #dec3ed;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  user-select: none;
}
.fast-spin-toggle input {
  width: 16px;
  height: 16px;
  accent-color: #bd55ff;
  cursor: pointer;
}
.fast-spin-toggle:has(input:checked) {
  border-color: rgba(255, 212, 125, .48);
  background: linear-gradient(135deg, rgba(111, 34, 157, .52), rgba(57, 15, 82, .72));
  color: #ffe3a4;
  box-shadow: 0 0 14px rgba(181, 67, 255, .18);
}
.fast-spin-toggle:has(input:disabled) {
  opacity: .45;
  cursor: not-allowed;
}

.watchers-panel {
  margin: 14px 0 4px;
  padding: 12px;
  border: 1px solid rgba(218, 158, 255, .16);
  border-radius: 14px;
  background: rgba(0, 0, 0, .2);
}
.watchers-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  color: #efd9fa;
  font-size: 12px;
}
.watchers-panel-head span {
  color: #d99cff;
}
.watcher-list {
  display: grid;
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
}
.watcher-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(112, 34, 151, .18);
  border: 1px solid rgba(223, 165, 255, .08);
}
.watcher-row b {
  overflow: hidden;
  color: #f5e8fb;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.watcher-row small {
  color: #72e2a1;
  font-size: 9px;
}
.watcher-empty {
  padding: 10px;
  color: #8f789e;
  text-align: center;
  font-size: 11px;
}
.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #45db87;
  box-shadow: 0 0 9px rgba(69, 219, 135, .8);
}

.chat-connection {
  font-size: 9px !important;
  font-weight: 800;
}
.chat-connection[data-status="connected"] { color: #64e394; }
.chat-connection[data-status="connecting"] { color: #e8c07d; }
.chat-connection[data-status="fallback"] { color: #d99cff; }
.chat-connection[data-status="offline"] { color: #8f789e; }
.chat-panel {
  grid-template-rows: auto 1fr auto auto;
}
.chat-emoji-bar {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 8px 10px 4px;
  border-top: 1px solid rgba(218, 158, 255, .12);
  scrollbar-width: none;
}
.chat-emoji-bar::-webkit-scrollbar { display: none; }
.chat-emoji-bar button {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(218, 158, 255, .15);
  border-radius: 9px;
  background: rgba(100, 31, 139, .24);
  cursor: pointer;
  font-size: 17px;
  transition: transform .12s ease, background .12s ease;
}
.chat-emoji-bar button:active {
  transform: scale(.9);
  background: rgba(171, 66, 216, .42);
}

@media (max-width: 720px) {
  .fast-spin-toggle {
    min-height: 25px;
    padding: 3px 5px;
    font-size: 8px;
  }
  .fast-spin-toggle input {
    width: 13px;
    height: 13px;
  }
  .chat-panel {
    width: calc(100vw - 12px);
    right: 6px;
    top: 6px;
    bottom: 6px;
  }
}


/* Mobile Landscape v3: обязательный поворот и полная видимость 5 барабанов */
html,
body,
.casino-app,
.machine-shell,
.reel-stage,
.reel-grid,
.reel,
.symbol,
.casino-controls,
.casino-hud {
  min-width: 0;
  max-width: 100%;
}

.casino-app {
  overflow: hidden;
}

.reel-stage,
.reel-grid {
  width: 100%;
}

.orientation-gate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 20%, rgba(173, 62, 255, .35), transparent 38%),
    linear-gradient(180deg, rgba(8, 0, 15, .98), rgba(2, 0, 5, 1));
  overflow: hidden;
}
.orientation-gate::before {
  content: "";
  position: absolute;
  inset: -15%;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.8) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(219,159,255,.65) 0 1px, transparent 1.5px);
  background-size: 47px 47px, 83px 83px;
  opacity: .42;
  animation: orientationStars 22s linear infinite;
}
@keyframes orientationStars { to { transform: translateY(83px); } }
.orientation-card {
  position: relative;
  width: min(420px, 100%);
  padding: 26px 22px;
  border: 1px solid rgba(255, 211, 125, .38);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(53, 12, 83, .98), rgba(10, 1, 18, .99));
  box-shadow: 0 20px 70px rgba(0,0,0,.68), 0 0 42px rgba(155, 52, 230, .28);
  text-align: center;
}
.orientation-card h1 {
  margin: 14px 0 8px;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
}
.orientation-card p {
  margin: 0;
  color: #e2cde9;
  font-size: 13px;
  line-height: 1.5;
}
.orientation-card small {
  display: block;
  margin-top: 11px;
  color: #9e86aa;
  font-size: 10px;
}
.orientation-card button {
  width: 100%;
  min-height: 46px;
  margin-top: 17px;
  border: 1px solid rgba(255, 214, 130, .55);
  border-radius: 14px;
  background: linear-gradient(135deg, #6f1aa4, #bf43d8);
  color: #fff7df;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: .04em;
}
.orientation-phone {
  width: 76px;
  height: 126px;
  margin: 0 auto;
  padding: 7px;
  border: 3px solid #f1ca82;
  border-radius: 17px;
  transform: rotate(90deg);
  animation: rotatePhone 1.8s ease-in-out infinite alternate;
  box-shadow: 0 0 28px rgba(190, 74, 255, .45);
}
.orientation-screen {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: radial-gradient(circle, #c777ff, #641595 58%, #170122);
  color: #ffe0a2;
  font-size: 46px;
  text-shadow: 0 0 16px rgba(255,255,255,.6);
}
@keyframes rotatePhone {
  from { transform: rotate(0deg) scale(.96); }
  to { transform: rotate(90deg) scale(1.03); }
}

body.mobile-device.portrait-mode .orientation-gate {
  display: grid;
}
body.mobile-device.portrait-mode .casino-app,
body.mobile-device.portrait-mode .chat-panel,
body.mobile-device.portrait-mode .modal,
body.mobile-device.portrait-mode .win-overlay,
body.mobile-device.portrait-mode .toast {
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
  html,
  body {
    width: 100vw;
    height: 100dvh;
    overflow: hidden;
  }

  body.landscape-mobile .casino-app {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    margin: 0;
    padding:
      max(2px, env(safe-area-inset-top))
      max(5px, env(safe-area-inset-right))
      max(2px, env(safe-area-inset-bottom))
      max(5px, env(safe-area-inset-left));
    grid-template-areas:
      "header"
      "hud"
      "machine"
      "controls";
    grid-template-rows: 34px 34px minmax(0, 1fr) 66px;
    gap: 3px;
  }

  body.landscape-mobile .casino-header {
    min-height: 0;
    height: 34px;
    padding: 0 3px;
  }
  body.landscape-mobile .brand-lockup { gap: 6px; }
  body.landscape-mobile .brand-gem {
    width: 29px;
    height: 29px;
    font-size: 17px;
  }
  body.landscape-mobile .brand-title {
    font-size: 16px;
    letter-spacing: .1em;
  }
  body.landscape-mobile .brand-subtitle { display: none; }
  body.landscape-mobile .header-actions { gap: 3px; }
  body.landscape-mobile .round-icon {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  body.landscape-mobile .spectator-banner {
    position: fixed;
    z-index: 15;
    left: max(5px, env(safe-area-inset-left));
    top: 38px;
    max-width: 230px;
    padding: 4px 7px;
    border-radius: 9px;
    font-size: 9px;
  }
  body.landscape-mobile .spectator-banner small { display: none; }
  body.landscape-mobile .spectator-banner .mini-button { padding: 4px 7px; }

  body.landscape-mobile .casino-hud {
    position: static;
    display: grid;
    grid-template-columns: .8fr 1fr 1.35fr;
    gap: 4px;
    width: 100%;
  }
  body.landscape-mobile .hud-card {
    min-height: 0;
    height: 34px;
    padding: 3px 7px;
    border-radius: 9px;
  }
  body.landscape-mobile .hud-card span { font-size: 7px; }
  body.landscape-mobile .hud-card strong {
    margin-top: 0;
    font-size: 12px;
    line-height: 15px;
  }
  body.landscape-mobile .jackpot-hud strong { font-size: 14px; }
  body.landscape-mobile .energy-hud {
    grid-column: auto;
    padding: 3px 7px;
  }
  body.landscape-mobile .energy-title-row span { display: none; }
  body.landscape-mobile .energy-title-row b { font-size: 8px; }
  body.landscape-mobile .energy-track {
    height: 5px;
    margin: 2px 0 1px;
  }
  body.landscape-mobile .energy-hud small {
    display: block;
    font-size: 7px;
    line-height: 8px;
  }

  body.landscape-mobile .bonus-banner,
  body.landscape-mobile .casino-footer {
    display: none !important;
  }

  body.landscape-mobile .machine-shell {
    width: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 2px 4px 3px;
    border-radius: 11px;
    grid-template-rows: 0 18px minmax(0, 1fr) 14px;
  }
  body.landscape-mobile .machine-crown {
    height: 0;
    margin: 0;
    overflow: hidden;
    visibility: hidden;
  }
  body.landscape-mobile .machine-statusbar {
    min-width: 0;
    padding: 0 3px 2px;
    gap: 4px;
    font-size: 7px;
  }
  body.landscape-mobile .line-count { letter-spacing: .04em; }
  body.landscape-mobile .link-button { font-size: 7px; }
  body.landscape-mobile .reel-stage {
    width: 100%;
    min-width: 0;
    min-height: 0;
    border-radius: 9px;
    overflow: hidden;
  }
  body.landscape-mobile .reel-grid {
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: 100%;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    padding: 3px;
    overflow: hidden;
  }
  body.landscape-mobile .reel {
    width: 100%;
    min-width: 0;
    min-height: 0;
    gap: 2px;
    border-radius: 6px;
    overflow: hidden;
  }
  body.landscape-mobile .symbol {
    width: 100%;
    min-width: 0;
    min-height: 0;
    border-radius: 5px;
  }
  body.landscape-mobile .symbol-art {
    width: min(74%, 54px);
    height: min(74%, 54px);
  }
  body.landscape-mobile .line-win-label {
    min-height: 0;
    height: 14px;
    padding: 2px 3px 0;
    font-size: 7px;
    line-height: 10px;
  }

  body.landscape-mobile .casino-controls {
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: 66px;
    grid-template-columns: minmax(145px, 1fr) 58px minmax(190px, 1.25fr);
    gap: 6px;
    padding: 4px 8px;
    border-radius: 11px;
  }
  body.landscape-mobile .bet-panel > span,
  body.landscape-mobile .last-win span { font-size: 7px; }
  body.landscape-mobile .bet-controls {
    grid-template-columns: 28px minmax(65px, 1fr) 28px;
    gap: 3px;
    margin-top: 2px;
  }
  body.landscape-mobile .bet-step {
    height: 29px;
    border-radius: 7px;
    font-size: 17px;
  }
  body.landscape-mobile .bet-controls strong,
  body.landscape-mobile .last-win strong { font-size: 12px; }
  body.landscape-mobile .spin-button {
    width: 54px;
  }
  body.landscape-mobile .spin-ring { inset: 6px; }
  body.landscape-mobile .spin-arrows { font-size: 31px; }
  body.landscape-mobile .spin-button strong {
    bottom: 10%;
    font-size: 6px;
  }
  body.landscape-mobile .result-panel {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(75px, .75fr) minmax(80px, 1fr);
    gap: 3px 5px;
  }
  body.landscape-mobile .auto-button {
    height: 27px;
    border-radius: 7px;
    font-size: 8px;
  }
  body.landscape-mobile .fast-spin-toggle {
    grid-column: 1 / -1;
    min-height: 23px;
    padding: 2px 5px;
    font-size: 7px;
    border-radius: 7px;
  }
  body.landscape-mobile .fast-spin-toggle input {
    width: 12px;
    height: 12px;
  }

  body.landscape-mobile .modal {
    padding: 5px;
  }
  body.landscape-mobile .modal-card {
    width: min(760px, calc(100vw - 10px));
    max-height: calc(100dvh - 10px);
    padding: 13px;
    border-radius: 14px;
  }
  body.landscape-mobile .chat-panel {
    top: 4px;
    right: max(4px, env(safe-area-inset-right));
    bottom: 4px;
    width: min(360px, 48vw);
    border-radius: 13px;
  }
  body.landscape-mobile .win-orb {
    width: 78px;
    height: 78px;
    font-size: 50px;
  }
  body.landscape-mobile .win-title { font-size: 42px; }
  body.landscape-mobile .win-amount { font-size: 27px; }
}

@media (orientation: landscape) and (max-height: 430px) and (pointer: coarse) {
  body.landscape-mobile .casino-app {
    grid-template-rows: 30px 30px minmax(0, 1fr) 58px;
    gap: 2px;
  }
  body.landscape-mobile .casino-header { height: 30px; }
  body.landscape-mobile .brand-gem,
  body.landscape-mobile .round-icon { width: 27px; height: 27px; }
  body.landscape-mobile .hud-card { height: 30px; padding: 2px 6px; }
  body.landscape-mobile .hud-card strong { font-size: 11px; line-height: 13px; }
  body.landscape-mobile .casino-controls { height: 58px; padding-top: 3px; padding-bottom: 3px; }
  body.landscape-mobile .spin-button { width: 49px; }
  body.landscape-mobile .machine-shell { grid-template-rows: 0 16px minmax(0, 1fr) 12px; }
  body.landscape-mobile .machine-statusbar,
  body.landscape-mobile .line-win-label { font-size: 6px; }
  body.landscape-mobile .symbol-art { width: min(70%, 46px); height: min(70%, 46px); }
}
