/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

:root {
    /* Player 1 (bottom) - warm ember */
    --p1-hue: 15;
    --p1-primary: #e8652c;
    --p1-glow: rgba(232, 101, 44, 0.5);
    --p1-bg-1: #2e1a12;
    --p1-bg-2: #4a2820;
    --p1-surface: rgba(232, 101, 44, 0.12);

    /* Player 2 (top) - cool frost */
    --p2-hue: 210;
    --p2-primary: #3b9eff;
    --p2-glow: rgba(59, 158, 255, 0.5);
    --p2-bg-1: #111e33;
    --p2-bg-2: #1a2e4a;
    --p2-surface: rgba(59, 158, 255, 0.12);

    --glass: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-strong: rgba(255, 255, 255, 0.12);
    --text: #f0f0f5;
    --text-dim: rgba(255, 255, 255, 0.45);
    --radius: 16px;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0a0a1a;
    color: var(--text);
}

/* ===== Particles Canvas ===== */
#particles-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.6;
}

/* ===== Screen ===== */
.screen {
    display: none;
    height: 100%;
    width: 100%;
    position: fixed;
    inset: 0;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

#game-screen {
    height: 100dvh;
    z-index: 1;
}

/* ===== Player Halves ===== */
.player-half {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.player-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

/* Animated gradient orbs */
.player-top .player-bg {
    background:
        radial-gradient(ellipse 80% 60% at 20% 30%, rgba(59, 158, 255, 0.25) 0%, transparent 70%),
        radial-gradient(ellipse 60% 80% at 80% 70%, rgba(100, 60, 255, 0.15) 0%, transparent 70%),
        linear-gradient(180deg, var(--p2-bg-1) 0%, var(--p2-bg-2) 100%);
    animation: bgShift2 12s ease-in-out infinite alternate;
}

.player-bottom .player-bg {
    background:
        radial-gradient(ellipse 80% 60% at 80% 30%, rgba(232, 101, 44, 0.25) 0%, transparent 70%),
        radial-gradient(ellipse 60% 80% at 20% 70%, rgba(255, 60, 60, 0.15) 0%, transparent 70%),
        linear-gradient(0deg, var(--p1-bg-1) 0%, var(--p1-bg-2) 100%);
    animation: bgShift1 12s ease-in-out infinite alternate;
}

@keyframes bgShift1 {
    0% { filter: hue-rotate(0deg) brightness(1); }
    100% { filter: hue-rotate(8deg) brightness(1.05); }
}

@keyframes bgShift2 {
    0% { filter: hue-rotate(0deg) brightness(1); }
    100% { filter: hue-rotate(-8deg) brightness(1.05); }
}

.player-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 12px 20px;
    gap: 4px;
}

.player-content.rotated {
    transform: rotate(180deg);
}

/* ===== Player Label ===== */
.player-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--text-dim);
}

.player-top .player-label { color: rgba(59, 158, 255, 0.4); }
.player-bottom .player-label { color: rgba(232, 101, 44, 0.4); }

/* ===== Life Bar ===== */
.life-bar-track {
    width: 70%;
    max-width: 260px;
    height: 4px;
    background: var(--glass);
    border-radius: 4px;
    overflow: hidden;
    margin: 2px 0;
}

.life-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1), background 0.4s;
    position: relative;
    will-change: width;
}

.player-top .life-bar-fill {
    background: linear-gradient(90deg, var(--p2-primary), #6dd5ff);
    box-shadow: 0 0 12px var(--p2-glow);
}

.player-bottom .life-bar-fill {
    background: linear-gradient(90deg, var(--p1-primary), #ffaa44);
    box-shadow: 0 0 12px var(--p1-glow);
}

/* ===== Life Display ===== */
.life-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    flex: 1;
}

.life-counter-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 130px;
}

.life-count {
    font-family: 'Orbitron', sans-serif;
    font-size: 110px;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    color: var(--text);
    transition: transform 0.15s cubic-bezier(0.22, 1, 0.36, 1),
                text-shadow 0.3s;
    will-change: transform;
}

.player-top .life-count {
    text-shadow:
        0 0 40px rgba(59, 158, 255, 0.3),
        0 0 80px rgba(59, 158, 255, 0.1);
}

.player-bottom .life-count {
    text-shadow:
        0 0 40px rgba(232, 101, 44, 0.3),
        0 0 80px rgba(232, 101, 44, 0.1);
}

.life-count.bump-up {
    animation: bumpUp 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.life-count.bump-down {
    animation: bumpDown 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes bumpUp {
    0% { transform: scale(1); }
    40% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

@keyframes bumpDown {
    0% { transform: scale(1); }
    40% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.life-max {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dim);
    margin-top: 2px;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.life-max:active {
    background: var(--glass);
    border-color: var(--glass-border);
}

/* Inline max editor */
.life-max-edit {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    background: var(--glass);
    border: 1px solid rgba(99, 102, 241, 0.5);
    border-radius: 8px;
    padding: 4px 8px;
    width: 64px;
    text-align: center;
    outline: none;
    margin-top: 2px;
}

/* ===== Remaining Badge ===== */
.remaining-badge {
    position: absolute;
    top: 10px;
    left: 14px;
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 5px 10px;
    border-radius: 10px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 3;
}

.player-top .remaining-badge {
    color: var(--p2-primary);
}

.player-bottom .remaining-badge {
    color: var(--p1-primary);
}

/* ===== Life Change Indicator ===== */
.life-change {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 26px;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.life-change.show {
    opacity: 1;
    animation: floatChange 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.life-change.positive {
    color: #44ffaa;
    text-shadow: 0 0 20px rgba(68, 255, 170, 0.5);
}

.life-change.negative {
    color: #ff4466;
    text-shadow: 0 0 20px rgba(255, 68, 102, 0.5);
}

@keyframes floatChange {
    from { transform: translateX(-50%) translateY(10px) scale(0.8); opacity: 0; }
    to { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}

/* ===== Life Buttons ===== */
.life-btn {
    position: relative;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
}

.life-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.player-top .life-btn::before {
    background: radial-gradient(circle, var(--p2-glow) 0%, transparent 70%);
}

.player-bottom .life-btn::before {
    background: radial-gradient(circle, var(--p1-glow) 0%, transparent 70%);
}

.life-btn:active {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.25);
}

.life-btn:active::before {
    opacity: 1;
}

.btn-icon {
    font-size: 28px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.85);
    position: relative;
    z-index: 1;
    line-height: 1;
}

/* ===== Dice Button ===== */
.dice-btn {
    position: absolute;
    cursor: pointer;
    color: var(--text-dim);
    padding: 10px;
    border-radius: 12px;
    transition: all 0.2s;
    background: transparent;
}

.player-bottom .dice-btn {
    top: 10px;
    right: 14px;
}

.player-top .dice-btn {
    top: 10px;
    right: 14px;
}

.dice-btn:active {
    color: var(--text);
    background: var(--glass);
}

/* ===== Center Bar ===== */
.center-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(10, 10, 26, 0.95);
    padding: 8px 0;
    z-index: 10;
    position: relative;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.center-bar-glow {
    position: absolute;
    inset: -20px 0;
    background: radial-gradient(ellipse 50% 100% at 50% 50%, rgba(255, 255, 255, 0.03), transparent);
    pointer-events: none;
}

.center-btn {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.2s;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.center-btn:active {
    background: var(--glass-strong);
    color: var(--text);
    transform: scale(0.93);
}

.center-btn-main {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.05);
}

.center-btn-main:active {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08));
}

/* ===== Timer ===== */
.timer-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 4px 14px;
    border-radius: 14px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    transition: all 0.2s;
    min-width: 90px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.timer-wrapper:active {
    background: var(--glass-strong);
    transform: scale(0.95);
}

.timer-wrapper.running {
    border-color: rgba(68, 255, 170, 0.3);
}

.timer-wrapper.running .timer-display {
    color: #44ffaa;
    text-shadow: 0 0 12px rgba(68, 255, 170, 0.3);
}

.timer-wrapper.paused .timer-display {
    animation: timerBlink 1s ease-in-out infinite;
}

@keyframes timerBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.timer-display {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 1px;
    transition: color 0.3s;
}

.timer-hint {
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    margin-top: 1px;
    transition: opacity 0.3s;
}

.timer-wrapper.running .timer-hint,
.timer-wrapper.paused .timer-hint {
    opacity: 0;
    height: 0;
    margin: 0;
}

/* ===== Modals ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.25s ease;
}

.modal-content {
    position: relative;
    z-index: 1;
    background: linear-gradient(180deg, #161628 0%, #0e0e1e 100%);
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    padding: 32px 24px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: none;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-compact {
    text-align: center;
    padding: 40px 32px;
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
}

.modal-close {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 20px;
    transition: all 0.2s;
}

.modal-close:active {
    background: var(--glass-strong);
    color: var(--text);
}

.modal-icon {
    color: var(--text-dim);
    margin-bottom: 16px;
}

.modal-content h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.modal-content p {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 28px;
}

/* ===== Settings ===== */
.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    margin-bottom: 10px;
    text-transform: uppercase;
}

.setting-input {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.setting-input input {
    width: 72px;
    text-align: center;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 12px;
    color: var(--text);
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 700;
    outline: none;
    transition: border-color 0.2s;
}

.setting-input input:focus {
    border-color: rgba(255, 255, 255, 0.3);
}

.setting-btn {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 12px 18px;
    color: var(--text);
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.setting-btn:active {
    background: var(--glass-strong);
    transform: scale(0.95);
}

/* ===== Action Buttons ===== */
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.action-btn {
    flex: 1;
    padding: 16px;
    border: none;
    border-radius: 16px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}

.action-btn.primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.3);
}

.action-btn.primary:active {
    transform: scale(0.97);
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.4);
}

.action-btn.ghost {
    background: var(--glass);
    color: var(--text-dim);
    border: 1px solid var(--glass-border);
}

.action-btn.ghost:active {
    background: var(--glass-strong);
}

.action-btn.danger {
    background: rgba(255, 68, 102, 0.1);
    color: #ff4466;
    border: 1px solid rgba(255, 68, 102, 0.2);
}

.action-btn.danger:active {
    background: rgba(255, 68, 102, 0.2);
}

/* ===== History ===== */
.history-list {
    max-height: 50vh;
    overflow-y: auto;
    margin-bottom: 10px;
}

.history-list::-webkit-scrollbar {
    width: 4px;
}
.history-list::-webkit-scrollbar-track {
    background: transparent;
}
.history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.history-game {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 10px;
    transition: background 0.2s;
}

.history-game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.history-game-score {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
}

.history-game-score .p1 { color: var(--p1-primary); }
.history-game-score .p2 { color: var(--p2-primary); }
.history-game-score .vs {
    font-size: 11px;
    color: var(--text-dim);
    font-family: 'Inter', sans-serif;
}

.history-events {
    font-size: 12px;
    color: var(--text-dim);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.history-events.expanded {
    max-height: 300px;
}

.history-event {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-family: 'Inter', sans-serif;
}

.history-toggle {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    letter-spacing: 0.3px;
}

.history-toggle:active {
    opacity: 0.7;
}

/* Current game highlight */
.current-game {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.08);
}

.current-game .history-game-header {
    color: #8b8cf7;
}

.current-game .history-events {
    max-height: 200px;
    overflow-y: auto;
}

.history-separator {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 16px 0 8px;
    text-align: center;
}

/* Structured event rows */
.history-event {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
}

.event-time {
    color: var(--text-dim);
    font-size: 11px;
    min-width: 60px;
}

.event-player {
    font-weight: 600;
    color: var(--text);
    min-width: 24px;
}

.event-delta {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 13px;
    min-width: 36px;
    text-align: right;
}

.event-negative .event-delta { color: #ff4466; }
.event-positive .event-delta { color: #44ffaa; }

.event-life {
    color: var(--text-dim);
    font-size: 11px;
    margin-left: auto;
}

.history-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 40px 0;
    font-size: 13px;
}

/* ===== Dice ===== */
.dice-content {
    text-align: center;
    position: relative;
}

.dice-close {
    position: absolute;
    top: 16px;
    right: 16px;
}

.dice-result {
    font-family: 'Orbitron', sans-serif;
    font-size: 90px;
    font-weight: 900;
    color: white;
    margin: 20px 0 30px;
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 0 40px rgba(99, 102, 241, 0.4);
}

.dice-result.rolling {
    animation: diceRoll 0.08s infinite;
}

@keyframes diceRoll {
    0% { transform: rotate(-12deg) scale(1.1); }
    50% { transform: rotate(12deg) scale(0.9); }
    100% { transform: rotate(-12deg) scale(1.1); }
}

.dice-roll-btn {
    width: 100%;
}

/* ===== Live Feed ===== */
.live-feed {
    position: absolute;
    z-index: 3;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    max-width: 160px;
}

.player-bottom .live-feed {
    bottom: 8px;
    right: 12px;
}

.player-top .live-feed {
    bottom: 8px;
    right: 12px;
}

.feed-entry {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    line-height: 1.3;
    animation: feedIn 0.3s ease-out;
}

.feed-entry .feed-delta {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
}

.feed-entry.feed-positive .feed-delta { color: rgba(68, 255, 170, 0.4); }
.feed-entry.feed-negative .feed-delta { color: rgba(255, 68, 102, 0.4); }

.feed-entry.feed-old {
    opacity: 0.5;
}

@keyframes feedIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Player Logo ===== */
.player-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 92%;
    max-height: 90%;
    object-fit: contain;
    opacity: 0.2;
    z-index: 0;
    pointer-events: none;
    filter: grayscale(0.3);
}

/* ===== Logo Upload (settings) ===== */
.logo-upload {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-preview {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-pick-btn {
    flex: 1;
    padding: 10px 14px !important;
    font-size: 13px !important;
}

.logo-remove {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 68, 102, 0.1);
    border: 1px solid rgba(255, 68, 102, 0.2);
    color: #ff4466;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.logo-remove:active {
    background: rgba(255, 68, 102, 0.25);
}

/* ===== Pulse effect on hit ===== */
.player-half.pulse::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    animation: pulseFlash 0.4s ease-out forwards;
}

.player-top.pulse::after {
    background: radial-gradient(circle at 50% 50%, rgba(59, 158, 255, 0.15), transparent 70%);
}

.player-bottom.pulse::after {
    background: radial-gradient(circle at 50% 50%, rgba(232, 101, 44, 0.15), transparent 70%);
}

.player-half.pulse-damage::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: radial-gradient(circle at 50% 50%, rgba(255, 68, 102, 0.12), transparent 70%);
    animation: pulseFlash 0.4s ease-out forwards;
}

@keyframes pulseFlash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ===== Safe areas ===== */
@supports (padding-top: env(safe-area-inset-top)) {
    .player-top { padding-top: env(safe-area-inset-top); }
    .player-bottom { padding-bottom: env(safe-area-inset-bottom); }
}

/* ===== Responsive ===== */
@media (orientation: landscape) {
    .life-count { font-size: 72px; }
    .life-btn { width: 52px; height: 52px; }
    .btn-icon { font-size: 24px; }
}

@media (max-height: 600px) {
    .life-count { font-size: 72px; }
    .center-bar { padding: 4px 0; }
    .player-label { display: none; }
    .life-bar-track { display: none; }
}

@media (max-height: 500px) {
    .life-count { font-size: 56px; }
    .life-btn { width: 44px; height: 44px; }
    .btn-icon { font-size: 20px; }
}
