﻿#game { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
#game > * { pointer-events: auto; }

.game-table { position: absolute; top: 480px; left: 960px; transform: translate(-50%, -50%); width: 900px; aspect-ratio: 2 / 1; background: var(--table-bg); border-radius: 50% / 40%; border: 8px solid var(--border-color); box-shadow: inset 0 0 30px rgba(0,0,0,0.5), 0 10px 20px rgba(0,0,0,0.3); pointer-events: none; }
.table-center { position: absolute; top: 480px; left: 960px; transform: translate(-50%, -50%); width: 800px; height: 400px; display: flex; justify-content: center; align-items: center; pointer-events: none; }
.center-pile { position: absolute; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; }

.combo-text { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); font-size: 20px; font-weight: normal; font-style: italic; color: #a3d9ad; z-index: 2000; text-shadow: 0 0 2px rgba(0,0,0,0.95), 0 0 2px rgba(0,0,0,0.95), 1px 1px 0 rgba(0,0,0,0.85), -1px -1px 0 rgba(0,0,0,0.85), 1px -1px 0 rgba(0,0,0,0.85), -1px 1px 0 rgba(0,0,0,0.85); }
.combo-text.winner-celebration { top: -40px; font-size: 32px; font-weight: bold; font-style: normal; color: var(--border-color); white-space: nowrap; z-index: 9999; text-shadow: 0 2px 6px rgba(0,0,0,0.95); background: rgba(0, 0, 0, 0.85); padding: 10px 28px; border-radius: 12px; border: 2px solid var(--border-color); box-shadow: 0 0 20px rgba(255, 206, 0, 0.45), 0 4px 12px rgba(0,0,0,0.5); animation: winnerPulse 1.8s ease-in-out infinite; }
@keyframes winnerPulse { 0%, 100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.05); } }

.global-error-toast { position: absolute; top: 100px; left: 50%; transform: translateX(-50%); z-index: 9999; pointer-events: none; max-width: 80%; padding: 20px 40px; background: rgba(0, 0, 0, 0.92); border: 3px solid #ff4444; border-radius: 12px; color: #ff8888; font-size: 28px; font-weight: bold; text-align: center; text-shadow: 0 0 8px rgba(255, 68, 68, 0.5); box-shadow: 0 0 30px rgba(255, 68, 68, 0.6), 0 6px 20px rgba(0,0,0,0.6); animation: errorToastIn 200ms ease-out; }
@keyframes errorToastIn { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }

.p-name-container { position: absolute; display: flex; z-index: 20; }
.p-name-container.top { top: 9px; left: 960px; transform: translateX(-50%); }
.p-name-container.left { top: 480px; left: 324px; transform: translate(-100%, -50%); }
.p-name-container.right { top: 480px; right: 324px; transform: translate(100%, -50%); }
.p-name-container.bottom { position: static; }
.p-badge { display: flex; }
.p-info { padding: 5px 18px 10px 18px; border-radius: 8px; border: 2px solid rgba(255,255,255,0.15); background: var(--panel-bg); min-width: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: all 0.2s; }
.p-name { font-weight: bold; font-size: 18px; color: #fff; margin-bottom: 2px; text-align: center; width: 100%; }
.p-title { font-size: 11px; color: var(--text-dim); font-weight: normal; margin-bottom: 2px; text-align: center; width: 100%; line-height: 1.15; }
.p-amount { font-size: 15px; color: var(--positive); font-weight: bold; text-align: center; width: 100%; }
@keyframes turnGlow { 0%, 100% { box-shadow: 0 0 8px rgba(255, 206, 0, 0.4); } 50% { box-shadow: 0 0 20px rgba(255, 206, 0, 0.9), 0 0 10px rgba(255, 206, 0, 0.6) inset; } }
.p-badge.active-turn .p-info { border-color: var(--border-color); background: rgba(255,206,0,0.15); animation: turnGlow 1.5s infinite ease-in-out; }
.p-badge.last-played .p-info { border-color: #d32f2f; background: rgba(211, 47, 47, 0.15); }
.p-badge.passed .p-info { opacity: 0.4; filter: grayscale(100%); }
.p-name-container.bottom .p-info { width: auto; }

.p-cards-container { position: absolute; display: flex; z-index: 10; }
.p-cards-container.top { top: 115px; left: 960px; transform: translateX(-50%); flex-direction: row; }
.p-cards-container.left { top: 480px; left: 377px; transform: translateY(-50%); flex-direction: column; }
.p-cards-container.right { top: 480px; right: 377px; transform: translateY(-50%); flex-direction: column; align-items: flex-end; }
.p-cards-container.top .card-back { margin-left: -30px; }
.p-cards-container.top .card-back:first-child { margin-left: 0; }
.p-cards-container.left .card-back { transform: rotate(90deg); margin-top: -72px; margin-left: 0; }
.p-cards-container.left .card-back:first-child { margin-top: 0; }
.p-cards-container.right .card-back { transform: rotate(90deg); margin-top: -72px; margin-left: 0; }
.p-cards-container.right .card-back:first-child { margin-top: 0; }

.card-back { width: 72px; height: 108px; background: var(--card-back-bg) !important; border: 2px solid white; border-radius: 6px; box-shadow: -2px 0 4px rgba(0,0,0,0.3); flex-shrink: 0; }
.card-back.revealed { background: var(--card-bg) !important; border: 2px solid white; color: var(--card-black); position: relative; overflow: hidden; }
.card-back.revealed.red { color: var(--card-red); }
.card-back.revealed .revealed-face { position: absolute; inset: 0; padding: 3px 4px; font-size: 13px; font-weight: bold; display: flex; flex-direction: column; justify-content: space-between; align-items: center; line-height: 1; animation: cardFlipIn 0.4s ease-out backwards; }
.card-back.revealed .rv-top { align-self: flex-start; }
.card-back.revealed .rv-suit { font-size: 20px; }
.card-back.revealed .rv-bot { align-self: flex-end; transform: rotate(180deg); }
@keyframes cardFlipIn { 0% { transform: scaleX(0); opacity: 0; } 100% { transform: scaleX(1); opacity: 1; } }

.hand .card { position: absolute; top: 0; left: 0; cursor: grab; will-change: transform; }
.hand .card.selected { box-shadow: 0 8px 15px rgba(0,0,0,0.45), 0 0 0 3px var(--border-color) inset; }
.card { background: var(--card-bg); color: var(--card-black); border-radius: 8px; width: 85px; height: 125px; display: flex; flex-direction: column; justify-content: space-between; padding: 8px; font-weight: bold; font-size: 22px; box-shadow: 0 4px 8px rgba(0,0,0,0.3); user-select: none; overflow: hidden; }
.card > div { line-height: 1; } 
.card.red { color: var(--card-red); }
.card.static { position: relative; display: inline-flex; }

.played-card { transform-origin: center center; will-change: transform; }
.played-card.highlighted .glow-frame { display: block !important; }

.landing-dust { position: absolute; width: 100px; height: 100px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 70%); pointer-events: none; z-index: 5; }
.slide-trail { position: absolute; width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 70%); pointer-events: none; z-index: 1; }

.dealer-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 100; display: flex; justify-content: center; align-items: center; pointer-events: none; }
@keyframes dealPulse { 0% { opacity: 0.5; transform: scale(0.98); } 50% { opacity: 1; transform: scale(1); } 100% { opacity: 0.5; transform: scale(0.98); } }

.chop-popup { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 9999; text-align: center; pointer-events: none; animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.chop-title { font-size: 80px; color: #ff3333; text-shadow: 0 0 20px #000; margin-bottom: 20px; }
.chop-subtitle { font-size: 40px; color: #fff; text-shadow: 0 0 20px #000; }
@keyframes popIn { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

#cards-bottom { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: none; z-index: 5; }
.spectator-mode #cards-bottom { display: flex; }
#cards-bottom .card-back { margin-left: -30px; }
#cards-bottom .card-back:first-child { margin-left: 0; }
.spectator-mode .controls-center { display: none !important; }
.spectator-mode .hand-btns { display: none !important; }
.spectator-mode #myHand { display: none !important; }
.spectator-mode #name-bottom { position: static; transform: none; margin: 0 auto; }

.spectator-badge { position: absolute; top: 75px; left: 40px; padding: 6px 14px; background: rgba(255, 206, 0, 0.15); border: 2px solid var(--border-color); border-radius: 6px; color: var(--border-color); font-weight: bold; font-size: 13px; letter-spacing: 1.5px; z-index: 150; animation: specPulse 2s infinite alternate; }
@keyframes specPulse { 0% { box-shadow: 0 0 8px rgba(255, 206, 0, 0.3); } 100% { box-shadow: 0 0 16px rgba(255, 206, 0, 0.7); } }

.turn-indicator { height: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--border-color); font-weight: bold; font-size: 24px; position: relative; z-index: 2000; text-shadow: 0 0 2px rgba(0,0,0,0.95), 0 0 2px rgba(0,0,0,0.95), 1px 1px 0 rgba(0,0,0,0.85), -1px -1px 0 rgba(0,0,0,0.85), 1px -1px 0 rgba(0,0,0,0.85), -1px 1px 0 rgba(0,0,0,0.85); }
.bottom-ui { z-index: 1500; }

.room-scoreboard { position: absolute; top: 90px; right: 20px; width: 260px; background: var(--panel-bg); border: 2px solid var(--border-color); border-radius: 8px; padding: 10px 14px; z-index: 100; pointer-events: none; text-align: left; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.room-scoreboard h3 { color: var(--border-color); font-size: 12px; letter-spacing: 1.5px; margin-bottom: 6px; text-transform: uppercase; font-weight: bold; }
.room-scoreboard .rs-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; border-top: 1px solid rgba(255,255,255,0.06); }
.room-scoreboard .rs-row:first-child { border-top: none; }
.room-scoreboard .rs-name { color: #fff; font-weight: bold; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-scoreboard .rs-amount { font-weight: bold; font-variant-numeric: tabular-nums; }

.table-drop-indicator { position: absolute; pointer-events: none; z-index: 5; background: rgba(255, 206, 0, 0.08); border: 3px dashed var(--border-color); box-shadow: 0 0 30px rgba(255, 206, 0, 0.4), inset 0 0 30px rgba(255, 206, 0, 0.1); animation: tableDropPulse 1s infinite alternate; }
@keyframes tableDropPulse { from { box-shadow: 0 0 20px rgba(255, 206, 0, 0.3), inset 0 0 20px rgba(255, 206, 0, 0.05); } to { box-shadow: 0 0 40px rgba(255, 206, 0, 0.7), inset 0 0 40px rgba(255, 206, 0, 0.15); } }

.winner-minimize-btn { display: none; position: absolute; top: 12px; right: 12px; width: 60px; height: 60px; font-size: 30px; font-weight: bold; border: none; border-radius: 50%; background: var(--btn-danger); color: #fff; cursor: pointer; align-items: center; justify-content: center; z-index: 5; line-height: 1; padding: 0; }

.chat-toggle-btn { display: none; position: absolute; bottom: 20px; right: 20px; z-index: 2500; padding: 16px 24px; font-size: 26px; font-weight: bold; background: var(--btn-primary); color: var(--btn-primary-text); border: none; border-radius: 12px; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.5); align-items: center; gap: 8px; }
.chat-badge { position: absolute; top: 4px; right: 4px; display: inline-block; width: 16px; height: 16px; background: #ff3333; border-radius: 50%; box-shadow: 0 0 6px rgba(255, 51, 51, 0.8); }
.chat-badge.hidden { display: none; }
.chat-close-btn { display: none; position: absolute; top: 10px; right: 10px; width: 60px; height: 60px; font-size: 30px; font-weight: bold; background: var(--btn-danger); color: #fff; border: none; border-radius: 50%; cursor: pointer; z-index: 10; align-items: center; justify-content: center; }

#leaveConfirmModal, #titleConfirmModal, #buyConfirmModal { z-index: 2800; }
