/* Shared presentation layer; loaded after each page's legacy styles. */
.visual-game .game-card {
    border-top: 2px solid var(--game-accent);
    background-image: radial-gradient(ellipse at 100% 0, #24334b55, transparent 55%);
}
.arena-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; text-align: left; }
.arena-symbol { display: grid; place-items: center; width: 48px; height: 48px; flex-shrink: 0; border: 1px solid var(--game-accent); border-radius: 14px; background: #ffffff08; font-size: 25px; color: var(--game-accent); }
.arena-title { font-size: 18px; font-weight: 850; letter-spacing: 2px; color: #f4f7ff; }
.arena-subtitle { font-size: 12px; color: #9facbf; margin-top: 4px; }
.arena-currency { margin-left: auto; border: 1px solid #ffffff1c; border-radius: 20px; padding: 5px 9px; font-size: 10px; letter-spacing: 1.5px; color: var(--game-accent); }
.arena-hint { color: #a2afc4; font-size: 12px; line-height: 1.7; margin-top: 18px; padding: 10px 14px; border-left: 2px solid var(--game-accent); background: #ffffff04; text-align: left; }
.visual-game button:focus-visible, .full-arena-link:focus-visible { outline: 2px solid var(--game-accent); outline-offset: 4px; }
.visual-game .controls-row { margin-top: 18px; }

/* Crash: illuminated instrument frame. The canvas retains all live state. */
.visual-game .crash-canvas-box { border-color: #355567; box-shadow: inset 0 0 60px #092735, 0 14px 35px #0005; }
.visual-game .crash-canvas-box::after { content: ''; position: absolute; inset: 10px; border: 1px solid #80e6ff15; border-radius: 10px; pointer-events: none; background: linear-gradient(90deg, #8be7ff99, #8be7ff00) top left / 90px 2px no-repeat; }
#crashText { padding: 28px 10px; border: 1px solid #315065; border-radius: 14px; background: radial-gradient(ellipse at bottom, #193953, #101927); }

/* Chicken: asphalt texture, illuminated checkpoints and start pad. */
.visual-game .chicken-arena { background: repeating-linear-gradient(0deg, #ffffff02 0 1px, transparent 1px 5px), linear-gradient(#172536 0 12%, #354252 12% 14%, #212c3b 14% 86%, #354252 86% 88%, #172536 88%); border-color: #59606a; }
.visual-game .chicken-lane { border-right-color: #91a2b23d; }
.visual-game .chicken-step-circle { outline: 7px solid #080f1b40; background: radial-gradient(circle at 35% 25%, #385771, #17202e 70%); }
.visual-game .chicken-step-circle.active { background: radial-gradient(circle at 35% 25%, #24674d, #112d28 75%); }
.visual-game .chicken-start-box::before { content: 'START'; position: absolute; top: 26px; color: #ffc97a; font-size: 11px; letter-spacing: 2px; }
.visual-game .chicken-grate { box-shadow: inset 0 0 12px #0008, 0 -3px 16px #ffb45415; }
.visual-game .chicken-char { filter: drop-shadow(0 6px 5px #0007); }

/* Mines: quiet unrevealed cells, unmistakable outcomes and progress. */
.visual-game .mines-arena { padding: 14px; border: 1px solid #24443c; border-radius: 18px; background: radial-gradient(ellipse at top, #18322c, #0c181e); max-width: 480px; }
.visual-game .mine-tile { position: relative; background: linear-gradient(145deg, #2a3b49, #192430); border-color: #3b5260; box-shadow: inset 0 1px #ffffff14, 0 4px 0 #070f17; }
.visual-game .mine-tile:not(.gem):not(.bomb)::after { content: '◇'; color: #778d9b80; font-size: 22px; }
.visual-game .mine-tile.gem { background: radial-gradient(circle, #25634a, #10342d); box-shadow: inset 0 0 18px #67ffd62b; border-color: #7ce8be; }
.visual-game .mine-tile.bomb { background: radial-gradient(circle, #782b40, #301828); border-color: #ff718a; }
.arena-meter { max-width: 480px; display: flex; align-items: center; gap: 16px; margin-bottom: 12px; font-size: 12px; color: #b2d4c8; }
.arena-meter progress { min-width: 50px; height: 6px; flex: 1; accent-color: #7ce8be; border: 0; border-radius: 5px; overflow: hidden; }
.arena-meter progress::-webkit-progress-bar { background: #253d39; }
.arena-meter progress::-webkit-progress-value { background: #7ce8be; }

/* Dice and roulette: physical table surrounds, never simulated outcomes. */
.visual-game .dice-board, .visual-game .roulette-display { border: 1px solid #37415c; border-radius: 20px; padding: 28px 16px; background: radial-gradient(ellipse at 50% 20%, #2b2446, #121a29 75%); }
.visual-game #diceResult { border-radius: 22px; box-shadow: inset 0 2px 0 #ffffff44, 0 12px 0 #161021, 0 22px 35px #0006; text-shadow: 0 2px #0003; }
.mobile-container #diceResult { width: 100px; height: 100px; display: grid; place-items: center; margin: 18px auto; background: linear-gradient(145deg, #554579, #2c2542); }
.dice-faces { display: flex; gap: 8px; justify-content: center; margin: 18px 0; }
.dice-faces span { color: #8b7ba6; font-size: 30px; line-height: 1; padding: 5px; border-radius: 7px; border: 1px solid transparent; }
.dice-faces .is-result { color: #ecdeff; background: #9372be33; border-color: #bda2ff; }
.visual-game .roulette-display { background: radial-gradient(ellipse at top, #3b2433, #131c29 75%); }
.roulette-ring { position: relative; display: grid; place-items: center; width: 220px; height: 220px; margin: 14px auto 28px; border: 8px solid #9b8254; border-radius: 50%; background: repeating-conic-gradient(from -7deg, #bb3653 0deg 15deg, #182232 15deg 30deg); box-shadow: inset 0 0 0 3px #f2d398, inset 0 0 28px #0009, 0 10px 30px #0006; }
.roulette-ring::before { content: ''; position: absolute; inset: 28px; background: #141c29; border: 2px solid #b3a071; border-radius: 50%; }
.visual-game .roulette-ring #rouletteWheel { position: relative; z-index: 1; margin: 0; width: 108px; height: 108px; font-size: 38px; border: 2px solid #ecd5a0; }
.roulette-pointer { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); color: #ffe5a8; text-shadow: 0 2px 4px #000; font-size: 26px; z-index: 2; }
.mobile-container #rouletteWheel.red { background: #bd2e4b !important; }
.mobile-container #rouletteWheel.black { background: #192332 !important; }
.mobile-container #rouletteWheel.green { background: #19845b !important; }

/* Card games: etched felt, empty hand slots and an opponent's hidden fan. */
.visual-game .bj-felt, .visual-game .cards-arena { border: 2px solid #688271; background: radial-gradient(ellipse at 50% 25%, #1c594a, #0b2928 85%); box-shadow: inset 0 0 0 7px #07171455, inset 0 0 80px #0004; }
.visual-game .bj-felt { padding-top: 28px; }
.visual-game .bj-felt::before { content: '♠  ♥  ♣  ♦'; top: 8px; letter-spacing: 12px; color: #e9cf8e44; }
.visual-game .bj-hand { padding: 12px; border: 1px dashed #e9cf8e33; border-radius: 14px; background: #0000000d; }
.visual-game .bj-hand:empty::after, #m-tab-bj #dealerHand:empty::after, #m-tab-bj #playerHand:empty::after { content: '♠'; display: grid; place-items: center; width: 52px; height: 76px; border: 1px solid #c3d8cc33; border-radius: 8px; font-size: 32px; color: #c3d8cc44; }
.visual-game .bj-card { border: 3px double #c8c1aa; }
.visual-game #bjStatus, .visual-game #durakTurnStatus { border-radius: 10px; padding: 9px 12px; background: #04161388; line-height: 1.5; }
.visual-game #durakBattleTable { border: 1px dashed #8fb9ae44; border-radius: 50px; padding: 18px; width: 100%; background: #ffffff03; }
.visual-game #durakPlayerHand { padding: 12px 4px; width: 100%; border-top: 1px solid #ffffff12; }
.visual-game #durakTrumpCard { box-shadow: -4px 3px 0 #283c50, -7px 5px 0 #7895a1, 0 6px 12px #0007; }
.opponent-fan { display: flex; justify-content: center; min-height: 22px; margin: 14px 0 -8px; width: 100%; }
.opponent-card-back { width: 33px; height: 46px; margin: 0 -5px; border: 2px solid #acc6d0; border-radius: 5px; background: repeating-linear-gradient(45deg, #223f60 0 4px, #152c45 4px 8px); transform: rotate(var(--fan-angle)); box-shadow: 0 3px 8px #0005; }
#m-tab-bj .game-card { background: radial-gradient(ellipse at top, #1b4638, #111724 80%); }
.compact-scene { border-radius: 16px; padding: 28px 8px; text-align: center; font-size: 30px; letter-spacing: 5px; background: radial-gradient(ellipse at top, #294563, #101d2c); border: 1px solid #45617b; margin-bottom: 16px; }
.compact-chicken { background: repeating-linear-gradient(90deg, #273547 0 60px, #7893a280 60px 63px); font-size: 23px; letter-spacing: 0; }
.compact-durak { color: #efcf8a; background: radial-gradient(ellipse at top, #245341, #142a28); }
.full-arena-link { display: block; margin-top: 14px; padding: 12px; color: var(--game-accent); text-align: center; border: 1px solid #ffffff25; border-radius: 9px; font-size: 13px; }

/* Chat uses safe DOM nodes, a single aggregate toast, and separate close/open buttons. */
.chat-bubble { display: flex; align-items: flex-start; gap: 10px; }
.chat-avatar { width: 32px; height: 32px; flex-shrink: 0; border: 0; background: transparent; color: inherit; font-size: 22px; padding: 0; overflow: hidden; }
.chat-avatar img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.chat-message-body { min-width: 0; flex: 1; }
.chat-message-heading { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chat-author { border: 0; background: none; color: #c0edff; font: inherit; font-size: 12px; font-weight: 800; padding: 0; text-align: left; overflow-wrap: anywhere; }
/* Purchased name colors: the reset above strips a gradient background, leaving
   transparent text, so purchased gradients are re-applied after the reset. */
.chat-author.text-gold-gradient { background: linear-gradient(90deg, #ffd700, #ff8800, #fff275); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
button.chat-author, button.chat-avatar { cursor: pointer; }

/* === Atmosphere: drifting cats, paws and twinkling sparkles === */
.atmosphere { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
/* Reveal the background between opaque game cards instead of painting over text. */
.app-layout .main-content { background: transparent; }
body { background-image: radial-gradient(ellipse at 80% 15%, #28204466, transparent 60%), radial-gradient(ellipse at 20% 90%, #123b4566, transparent 60%); }
.mobile-container, .mobile-nav { position: relative; z-index: 2; }
.atmosphere-front { pointer-events: none; }
.atmosphere span {
    position: absolute; display: block; top: 0; opacity: var(--base-o, .4);
    filter: drop-shadow(0 0 8px currentColor);
    color: #9fd9f2;
    animation: sprite-drift linear infinite; will-change: transform, opacity;
}
/* Ghost layer above content: rare, very faint, never clickable. */
.atmosphere-front { z-index: 3; }
.atmosphere-front span { opacity: var(--base-o, .12); filter: none; animation-name: cat-fall; }
.atmosphere img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 16px; }
.atmosphere span[data-shape="cat"] { animation-name: cat-fall; filter: none; }
@keyframes cat-fall {
    0% { transform: translate(0, -15vh) rotate(0deg); opacity: 0; }
    8%, 92% { opacity: var(--base-o, .18); }
    50% { transform: translate(var(--sway, 20px), 48vh) rotate(var(--spin, 0deg)); }
    100% { transform: translate(0, 112vh) rotate(0deg); opacity: 0; }
}
.atmosphere span svg { display: block; width: 100%; height: 100%; }
.atmosphere.paused span { animation-play-state: paused; }
.atmosphere span svg { animation-play-state: inherit; }
@keyframes sprite-drift {
    0% { transform: translate(0, 105vh) rotate(0deg); opacity: 0; }
    6% { opacity: var(--base-o, .4); }
    50% { transform: translate(var(--sway, 20px), 52vh) rotate(calc(var(--spin, 0deg) / 2)); }
    94% { opacity: var(--base-o, .4); }
    100% { transform: translate(calc(var(--sway, 40px) * -1), -12vh) rotate(var(--spin, 0deg)); opacity: 0; }
}
@keyframes sprite-twinkle {
    0%, 100% { transform: scale(1); opacity: .35; }
    50% { transform: scale(1.25); opacity: 1; }
}

/* Tab entrances are in motion.css. No permanent transform on modal ancestors. */

/* Sidebar nav glow */
.sidebar .menu-btn { position: relative; transition: border-color .2s, box-shadow .2s, background .2s; }
.sidebar .menu-btn:hover { border-color: var(--accent-cyan); box-shadow: 0 0 18px rgba(0, 240, 255, 0.18); background: rgba(0, 240, 255, 0.04); }

/* Button glow */
.btn-primary:hover:not(:disabled) { box-shadow: 0 0 22px rgba(0, 240, 255, 0.4); }
.btn-bonus:hover:not(:disabled) { box-shadow: 0 0 22px rgba(255, 215, 0, 0.4); }
.btn-cashout:hover:not(:disabled) { box-shadow: 0 0 22px rgba(255, 42, 95, 0.35); }

.chat-message-text { margin-top: 3px; font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; user-select: text; }
.chat-toast-region { position: fixed; top: 22px; right: 22px; z-index: 99990; width: min(390px, calc(100vw - 32px)); pointer-events: none; }
.chat-message-toast { display: flex; align-items: flex-start; background: #142235f5; border: 1px solid #46647c; border-left: 3px solid #7edbf4; border-radius: 14px; box-shadow: 0 12px 35px #0006; pointer-events: auto; animation: chatToastEnter .2s ease-out; }
.chat-toast-action { flex: 1; min-width: 0; border: 0; padding: 16px; background: none; color: #f0f6ff; text-align: left; cursor: pointer; font: inherit; }
.chat-toast-action strong, .chat-toast-action span, .chat-toast-action small { display: block; }
.chat-toast-action strong { font-size: 13px; margin-bottom: 6px; }
.chat-toast-action span { font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chat-toast-action small { color: #7edbf4; font-size: 11px; margin-top: 8px; }
.chat-toast-close { padding: 9px 12px; border: 0; border-radius: 10px; background: none; color: #bac9db; cursor: pointer; font-size: 24px; }
.chat-message-toast button:focus-visible { outline: 2px solid #7edbf4; outline-offset: -4px; border-radius: 12px; }
@keyframes chatToastEnter { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 768px) {
    .arena-header { gap: 10px; margin-bottom: 16px; }
    .arena-title { font-size: 16px; letter-spacing: 1px; }
    .arena-symbol { width: 40px; height: 40px; font-size: 22px; }
    .arena-currency { font-size: 9px; padding: 4px 7px; }
    .visual-game .game-card { margin-left: 0; margin-right: 0; min-width: 0; }
    .visual-game .mines-arena { grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; gap: 7px; padding: 10px; }
    .visual-game .mine-tile { width: 100%; height: auto; aspect-ratio: 1; min-width: 0; }
    .visual-game .dice-board, .visual-game .roulette-display { padding: 18px 10px; }
    .visual-game .dice-options, .visual-game .roulette-buttons { flex-wrap: wrap; justify-content: center; gap: 8px; }
    .visual-game .dice-btn, .visual-game .r-btn { flex: 1 1 120px; padding: 10px; font-size: 12px; }
    .dice-faces { gap: 3px; }
    .dice-faces span { font-size: 26px; padding: 3px; }
    .visual-game .chicken-arena { max-width: 100%; }
    #tab-chicken .controls-row > div { flex-wrap: wrap; width: 100%; gap: 10px !important; }
    #tab-chicken .controls-row > div > div:last-child > div { flex-wrap: wrap; }
    #tab-chicken .controls-row { gap: 12px; }
    #tab-chicken .game-card > div:nth-child(2) { flex-wrap: wrap; gap: 8px; }
    #tab-crash .controls-row > *, #tab-durak .controls-row > * { width: 100% !important; max-width: none !important; min-width: 0 !important; }
    .visual-game .bj-felt { padding: 28px 10px 10px; }
    .visual-game #durakBattleTable { padding: 12px; border-radius: 20px; }
    .chat-toast-region { top: auto; bottom: calc(90px + env(safe-area-inset-bottom)); left: 16px; right: 16px; margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
    .confetti-piece, #bgVisualsCanvas { display: none !important; }
}
