/* ============================================
   幸运水果机 - 主样式表 v3
   24宫格(7×7) + LCD数字 + 炫彩霓虹
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    width: 100%; min-height: 100vh;
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', sans-serif;
    background: #060612; color: #fff; overflow-x: hidden;
    -webkit-tap-highlight-color: transparent; user-select: none;
}
.lcd-digits, .lcd-bet { font-family: 'Orbitron', 'Courier New', monospace; letter-spacing: 2px; }

/* Game Container */
.game-container {
    width: 100%; max-width: 520px; margin: 0 auto; min-height: 100vh;
    background: linear-gradient(180deg, #0a0a2e 0%, #0d0828 30%, #120a3a 60%, #0a0a2e 100%);
    position: relative; overflow: hidden;
}

/* Header Bar */
.header-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 10px; background: rgba(0,0,0,0.5);
    border-bottom: 1px solid rgba(255,255,255,0.08); position: relative; z-index: 10;
}
.header-left, .header-right { display: flex; align-items: center; gap: 5px; }
.user-name { font-size: 12px; color: #aab; }
.btn-icon {
    background: none; border: 1px solid rgba(255,255,255,0.15); border-radius: 6px;
    padding: 4px 7px; font-size: 14px; cursor: pointer; color: #fff; text-decoration: none; transition: all 0.3s;
}
.btn-icon:hover { background: rgba(255,255,255,0.1); }

/* ============================================
   Premium LCD Score Panels
   ============================================ */
.lcd-bar {
    display: flex; gap: 8px; padding: 8px 10px; justify-content: center; position: relative; z-index: 1;
}
.lcd-panel {
    flex: 1; max-width: 230px; border-radius: 12px; overflow: hidden;
    background: linear-gradient(180deg, #1a1a3e, #0c0c28); position: relative;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
}
.lcd-panel-label {
    font-size: 10px; color: #889; padding: 5px 10px 0; letter-spacing: 2px; text-transform: uppercase;
    font-weight: 700;
}
.lcd-screen {
    margin: 4px 8px 8px; padding: 8px 12px; border-radius: 8px;
    background: #020208; position: relative; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.04);
}
.lcd-screen::before {
    content: ''; position: absolute; inset: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.15) 2px, rgba(0,0,0,0.15) 4px);
    pointer-events: none; opacity: 0.5;
}
.lcd-screen::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent); pointer-events: none;
}
.lcd-digits {
    font-size: clamp(22px, 5.5vw, 32px); font-weight: 900; line-height: 1.2;
    text-align: right; position: relative; z-index: 1;
}
.lcd-win-screen .lcd-digits {
    color: #ff3344;
    text-shadow: 0 0 10px rgba(255,51,68,0.8), 0 0 30px rgba(255,51,68,0.4), 0 0 60px rgba(255,0,0,0.15);
}
.lcd-bal-screen .lcd-digits {
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0,255,136,0.8), 0 0 30px rgba(0,255,136,0.4), 0 0 60px rgba(0,200,100,0.15);
}
.lcd-win-panel { border-color: rgba(255,50,50,0.15); }
.lcd-bal-panel { border-color: rgba(0,255,136,0.1); }

/* ============================================
   Game Board - 24 Grid (7 cols × 7 rows)
   ============================================ */
.board-wrapper { position: relative; padding: 6px 8px; z-index: 1; }
.board-wrapper::before {
    content: ''; position: absolute; inset: 2px; border-radius: 10px;
    border: 2px solid transparent;
    background: linear-gradient(90deg, #ff0055, #ffdd00, #00ff88, #0088ff, #ff00ff, #ff0055) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    opacity: 0.35; animation: borderRainbow 3s linear infinite;
}
@keyframes borderRainbow { to { filter: hue-rotate(360deg); } }

.game-board {
    display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(7, 1fr);
    gap: 3px; aspect-ratio: 1; position: relative;
}

/* Cell */
.cell {
    position: relative; border-radius: 6px; overflow: hidden; cursor: default; transition: all 0.15s ease;
}
.cell-inner {
    width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 1px; background: linear-gradient(145deg, rgba(20,20,60,0.9), rgba(10,10,40,0.95));
    border: 2px solid rgba(255,255,255,0.08); border-radius: 6px; position: relative; z-index: 1;
}
.cell-icon { font-size: clamp(14px, 3.5vw, 24px); line-height: 1; }
.cell-label { font-size: clamp(6px, 1.3vw, 9px); color: #999; margin-top: 1px; }
.cell-label sup { font-size: 0.7em; color: #ff8; }

.cell.small .cell-inner { border-color: rgba(255,255,100,0.15); }
.cell.small .cell-icon { font-size: clamp(11px, 2.8vw, 18px); opacity: 0.8; }

.cell.lucky .cell-inner {
    background: linear-gradient(145deg, rgba(0,180,0,0.15), rgba(0,100,0,0.2));
    border-color: rgba(0,255,0,0.25);
}
.cell.lucky .cell-label { color: #4f4; font-weight: bold; }

.cell::before {
    content: ''; position: absolute; inset: 0; border-radius: 6px; padding: 2px;
    background: linear-gradient(var(--angle, 0deg), #ff0055, #ff8800, #ffdd00, #00ff88, #0088ff, #8800ff, #ff0055);
    background-size: 300% 300%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    opacity: 0.2; animation: borderGlow 4s linear infinite; z-index: 0;
}
@keyframes borderGlow { 0%,100%{background-position:0% 50%} 50%{background-position:100% 50%} }

/* Active cell (marquee light) */
.cell.active { transform: scale(1.06); z-index: 5; }
.cell.active .cell-inner {
    background: linear-gradient(145deg, rgba(255,215,0,0.35), rgba(255,100,0,0.25));
    border-color: #ffd700;
    box-shadow: 0 0 12px rgba(255,215,0,0.7), 0 0 25px rgba(255,215,0,0.3), inset 0 0 8px rgba(255,215,0,0.2);
}
.cell.active::before { opacity: 1; }

/* Winner cell */
.cell.winner { z-index: 5; }
.cell.winner .cell-inner {
    border-color: #ffd700; animation: winnerFade 0.8s ease-in-out infinite;
}
@keyframes winnerFade {
    0%,100% { background: rgba(255,215,0,0.15); box-shadow: 0 0 10px rgba(255,215,0,0.3); }
    50% { background: rgba(255,215,0,0.5); box-shadow: 0 0 25px rgba(255,215,0,0.8), 0 0 50px rgba(255,100,0,0.3); }
}

/* Rapid flash for cat transform final */
.cell.rapid-flash .cell-inner {
    animation: rapidFlash 0.15s ease-in-out infinite alternate;
}
@keyframes rapidFlash {
    from { background:rgba(255,215,0,0.2); box-shadow:0 0 5px rgba(255,215,0,0.3); }
    to { background:rgba(255,50,200,0.5); box-shadow:0 0 20px rgba(255,50,200,0.8); border-color:#ff44cc; }
}

/* Odd/even alternate flash */
.cell.flash-odd .cell-inner, .cell.flash-even .cell-inner {
    animation: oddEvenFlash 0.25s ease-in-out infinite alternate;
}
@keyframes oddEvenFlash {
    from { background:rgba(255,215,0,0.15); border-color:rgba(255,215,0,0.3); }
    to { background:rgba(255,50,50,0.35); border-color:rgba(255,50,50,0.6); box-shadow:0 0 15px rgba(255,215,0,0.6); }
}

.cell.has-bet .cell-inner { border-color: rgba(0,255,128,0.4); box-shadow: 0 0 6px rgba(0,255,128,0.25); }

/* Center Area */
.center-area { display: flex; align-items: center; justify-content: center; }
.center-content { text-align: center; width: 100%; padding: 8px; }
.game-message { font-size: clamp(11px, 2.8vw, 16px); color: #aab; min-height: 20px; transition: all 0.3s; }
.game-message.win-msg { color: #ffd700; text-shadow: 0 0 12px rgba(255,215,0,0.5); font-weight: bold; }
.game-message.lose-msg { color: #ff6b6b; }

/* Special Event */
.special-event {
    margin: 6px 0; padding: 8px 12px; border-radius: 10px;
    font-size: clamp(12px, 3vw, 18px); font-weight: bold;
    animation: specialPop 0.6s cubic-bezier(0.175,0.885,0.32,1.275);
}
@keyframes specialPop {
    0%{opacity:0;transform:scale(0.3) rotate(-10deg)} 50%{transform:scale(1.1) rotate(2deg)} 100%{opacity:1;transform:scale(1)}
}
.special-event.big-three { background:linear-gradient(135deg,rgba(255,0,100,0.3),rgba(255,150,0,0.3)); border:2px solid #ff6464; color:#ff8888; }
.special-event.small-three { background:linear-gradient(135deg,rgba(100,200,255,0.2),rgba(0,255,200,0.2)); border:2px solid #64c8ff; color:#88ddff; }
.special-event.big-four { background:linear-gradient(135deg,rgba(255,215,0,0.3),rgba(255,100,0,0.3)); border:2px solid #ffd700; color:#ffdd44; }
.special-event.train { background:linear-gradient(135deg,rgba(0,255,0,0.2),rgba(0,200,255,0.2)); border:2px solid #00ff88; color:#44ff88; }
.special-event.cat-transform { background:linear-gradient(135deg,rgba(255,100,255,0.2),rgba(255,200,100,0.2)); border:2px solid #ff88ff; color:#ffaaff; }
.special-event.grand-slam { background:linear-gradient(135deg,rgba(255,215,0,0.4),rgba(255,0,0,0.3)); border:3px solid #ffd700; color:#ffd700; font-size:clamp(14px,3.5vw,22px); }
.special-event.nine-lamps { background:linear-gradient(135deg,rgba(255,0,255,0.3),rgba(0,200,255,0.3),rgba(255,200,0,0.3)); border:3px solid #ff88ff; color:#fff; font-size:clamp(14px,3.5vw,22px); }
.special-event.random-light { background:linear-gradient(135deg,rgba(0,200,255,0.2),rgba(200,100,255,0.2)); border:2px solid #88aaff; color:#aaccff; }
.special-event.flash-lucky { background:linear-gradient(135deg,rgba(255,215,0,0.4),rgba(255,0,128,0.3),rgba(0,200,255,0.3)); border:3px solid #ffd700; color:#fff; font-size:clamp(14px,3.5vw,22px); }

/* ============================================
   Betting Panel - Start button on right
   ============================================ */
.bet-panel {
    padding: 8px 10px 12px; background: rgba(0,0,0,0.6);
    border-top: 2px solid rgba(255,255,255,0.06); position: relative; z-index: 10;
}
.bet-panel-body {
    display: flex; gap: 8px; align-items: stretch;
}
.bet-grid {
    flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
}
.bet-item {
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px;
    padding: 5px 2px; text-align: center; cursor: pointer; transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.bet-item:active { transform: scale(0.95); background: rgba(255,215,0,0.1); }
.bet-item.active { border-color: rgba(0,255,128,0.4); background: rgba(0,255,128,0.05); }
.bet-icon { font-size: clamp(16px, 4vw, 24px); }
.bet-name { font-size: clamp(7px, 1.6vw, 10px); color: #aaa; margin: 1px 0; }

.start-area {
    display: flex; align-items: center; flex-shrink: 0;
}
.btn-start {
    width: 60px; height: 100%; min-height: 80px; font-size: 18px; font-weight: bold; color: #fff;
    letter-spacing: 3px; line-height: 1.4;
    background: linear-gradient(180deg, #ff416c, #ff4b2b); border: none; border-radius: 12px;
    cursor: pointer; position: relative; overflow: hidden; transition: all 0.3s;
    box-shadow: 0 0 15px rgba(255,65,108,0.4), 0 3px 10px rgba(0,0,0,0.3);
}
.btn-start:hover { box-shadow: 0 0 25px rgba(255,65,108,0.6); transform: translateY(-1px); }
.btn-start:active { transform: translateY(0); }
.btn-start::before {
    content:''; position:absolute; top:-50%; left:-50%; width:200%; height:200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.15), transparent);
    animation: btnShine 3s linear infinite;
}
@keyframes btnShine { 0%{transform:translateX(-100%) rotate(45deg)} 100%{transform:translateX(100%) rotate(45deg)} }
.btn-start:disabled { opacity:0.4; cursor:not-allowed; background:linear-gradient(180deg,#444,#333); box-shadow:none; }
.btn-start.spinning { animation: spinPulse 1s ease-in-out infinite; }
@keyframes spinPulse { 0%,100%{box-shadow:0 0 15px rgba(255,65,108,0.4)} 50%{box-shadow:0 0 35px rgba(255,65,108,0.8)} }

/* LCD Bet Display */
.lcd-bet {
    font-family: 'Orbitron', 'Courier New', monospace;
    font-size: clamp(11px, 2.5vw, 15px); font-weight: 700; color: #00ccff;
    background: #020215; border: 1px solid rgba(0,200,255,0.15); border-radius: 4px;
    padding: 2px 4px; min-width: 30px; text-align: center;
    text-shadow: 0 0 6px rgba(0,200,255,0.5); letter-spacing: 1px;
}

/* ============================================
   Modals
   ============================================ */
.modal-overlay {
    position:fixed; inset:0; background:rgba(0,0,0,0.7);
    display:flex; align-items:center; justify-content:center; z-index:1000; backdrop-filter:blur(5px);
}
.modal-box {
    background:rgba(20,20,50,0.95); border:1px solid rgba(255,255,255,0.15);
    border-radius:20px; padding:30px; width:90%; max-width:380px; text-align:center;
}
.modal-title { font-size:22px; margin-bottom:20px; color:#ffd700; }
.modal-input {
    width:100%; padding:14px; background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.15);
    border-radius:10px; color:#fff; font-size:16px; outline:none; text-align:center; letter-spacing:2px;
}
.modal-input:focus { border-color:#667eea; box-shadow:0 0 15px rgba(102,126,234,0.3); }
.modal-buttons { display:flex; gap:10px; margin-top:20px; justify-content:center; }
.btn-modal { padding:10px 24px; border:none; border-radius:10px; font-size:16px; font-weight:bold; cursor:pointer; transition:all 0.3s; }
.btn-confirm { background:linear-gradient(135deg,#667eea,#764ba2); color:#fff; }
.btn-confirm:hover { transform:translateY(-2px); box-shadow:0 4px 15px rgba(102,126,234,0.4); }
.btn-cancel { background:rgba(255,255,255,0.1); color:#aaa; border:1px solid rgba(255,255,255,0.15); }
.btn-cancel:hover { background:rgba(255,255,255,0.15); }
.redeem-msg { margin-top:15px; font-size:14px; min-height:20px; }
.redeem-msg.success { color:#6bff6b; }
.redeem-msg.error { color:#ff6b6b; }

/* Celebration */
.celebration { position:fixed; inset:0; z-index:999; pointer-events:none; }
#confettiCanvas { width:100%; height:100%; }

/* ============================================
   Cell State Classes
   ============================================ */
.cell.flash-all .cell-inner { animation: flashAll 0.3s ease-in-out infinite alternate; }
@keyframes flashAll {
    from { background:rgba(255,215,0,0.15); border-color:rgba(255,215,0,0.3); }
    to { background:rgba(255,50,50,0.3); border-color:rgba(255,50,50,0.6); box-shadow:0 0 20px rgba(255,215,0,0.6); }
}
.cell.train-glow .cell-inner {
    border-color:#00ff88; animation: trainGlow 0.4s ease-in-out infinite alternate;
}
@keyframes trainGlow {
    from{box-shadow:0 0 8px rgba(0,255,136,0.4)} to{box-shadow:0 0 20px rgba(0,255,136,0.8),0 0 40px rgba(0,255,136,0.3)}
}
.cell.lamp-glow .cell-inner {
    background:linear-gradient(145deg,rgba(255,0,255,0.3),rgba(255,200,0,0.3)) !important;
    border-color:#ff88ff !important;
    box-shadow:0 0 20px rgba(255,0,255,0.6),0 0 40px rgba(255,200,0,0.3) !important;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 480px) {
    .game-board { gap: 2px; }
    .cell-icon { font-size: 12px; }
    .cell.small .cell-icon { font-size: 10px; }
    .cell-label { font-size: 6px; }
    .bet-grid { gap: 3px; }
    .bet-item { padding: 3px 1px; }
    .bet-icon { font-size: 14px; }
    .bet-name { font-size: 7px; }
    .lcd-bet { font-size: 10px; padding: 1px 2px; }
    .btn-start { width: 50px; min-height: 60px; font-size: 15px; }
    .lcd-bar { padding: 6px 8px; gap: 6px; }
    .lcd-digits { font-size: 18px; }
    .header-bar { padding: 6px 8px; }
    .btn-icon { padding: 3px 5px; font-size: 12px; }
    .user-name { font-size: 10px; }
}
@media (max-width: 360px) {
    .cell-icon { font-size: 10px; }
    .cell.small .cell-icon { font-size: 8px; }
    .cell-label { display: none; }
}

::-webkit-scrollbar { width:4px; }
::-webkit-scrollbar-track { background:rgba(0,0,0,0.3); }
::-webkit-scrollbar-thumb { background:rgba(255,255,255,0.2); border-radius:2px; }
.game-container.spinning .bet-panel { pointer-events:none; opacity:0.5; }
