/* ============================================================================
   Game Common Styles - Shared across all Robomates games
   Include BEFORE game-specific CSS.
   ============================================================================ */

/* ============================================================================
   Toast Notification
   ============================================================================ */

.toast {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    max-width: 90%;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-radius: 6px;
    color: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.35);
    transform: scale(1.1);
}

.toast-icon { font-size: 1.3rem; flex-shrink: 0; }
.toast-message { line-height: 1.4; }

.toast.warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.9), rgba(255, 167, 38, 0.9));
    color: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast.error {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.9), rgba(238, 90, 90, 0.9));
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.toast.success {
    background: linear-gradient(135deg, rgba(38, 222, 129, 0.9), rgba(32, 201, 151, 0.9));
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .toast.warning {
    background: linear-gradient(135deg, rgba(255, 202, 87, 0.95), rgba(255, 179, 71, 0.95));
    color: #3d3020;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}

[data-theme="light"] .toast-close {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .toast-close:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ============================================================================
   Player Card Base (compact row layout, used by all games)
   ============================================================================ */

.pc-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Consolas', 'Monaco', 'Ubuntu Mono', monospace;
    font-size: 0.78rem;
    min-height: 28px;
}

.pc-name {
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 60px;
}

.pc-ctrl {
    color: var(--accent-blue, #4fc3f7);
    font-size: 0.7rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.pc-seen {
    color: var(--text-muted);
    font-size: 0.7rem;
    flex-shrink: 0;
    margin-left: auto;
}

.pc-bat {
    color: var(--accent-green);
    font-size: 0.72rem;
    flex-shrink: 0;
}
.pc-bat.low { color: var(--accent-orange); }
.pc-bat.critical { color: var(--accent-red); }

.pc-temp {
    color: var(--text-muted);
    font-size: 0.7rem;
    flex-shrink: 0;
}

/* Reported state row */
.pc-reported {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding-top: 0.25rem;
    font-family: 'Consolas', 'Monaco', 'Ubuntu Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.led-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #555;
}

.pc-sep { color: var(--text-muted); opacity: 0.4; margin: 0 0.1rem; }
.pc-val { color: var(--accent-blue); }
.fall-down { color: var(--accent-red); font-weight: 700; }
.fall-ago { color: var(--accent-orange); }
.pc-muted { color: var(--text-muted); opacity: 0.6; }
.scan-info { color: var(--accent-purple, #ce93d8); }
.scan-slot { margin: 0 1px; }
.scan-empty { opacity: 0.35; }
.scan-filled { font-weight: 600; }

[data-theme="light"] .pc-reported {
    color: rgba(100, 90, 80, 0.7);
}

/* ============================================================================
   Players Grid / Area Base
   ============================================================================ */

.players-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--card-bg);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid var(--card-border);
    padding: 1.25rem;
    overflow: hidden;
}

.players-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
    gap: 0.75rem;
    align-content: start;
    overflow-y: auto;
    padding: 0.5rem 0.5rem 0.5rem 0;
}

.players-grid-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--text-muted);
    text-align: center;
}

.players-grid-empty .empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.players-grid-empty p { margin: 0.25rem 0; font-size: 1rem; }
.players-grid-empty .empty-hint { font-size: 0.85rem; opacity: 0.7; }

[data-theme="light"] .players-area {
    box-shadow: 0 2px 10px rgba(140, 125, 105, 0.12);
}

/* ============================================================================
   Player Card Base (shared by tag and pushwars; sandbox uses .robot-card)
   ============================================================================ */

.player-card {
    background: var(--card-hover);
    border-radius: 8px;
    border: 2px solid transparent;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.player-card.stale { opacity: 0.5; }

.player-card.is-repeater {
    opacity: 0.6;
    cursor: default;
}

[data-theme="light"] .player-card {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(140, 125, 105, 0.2);
}

/* ============================================================================
   Find Button (card-level, used by all games)
   ============================================================================ */

.find-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 5px;
    font-size: 0.75rem;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    flex-shrink: 0;
    padding: 0;
    line-height: 24px;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
}

.find-btn:active, .find-btn.active {
    animation: find-rainbow 0.5s linear infinite;
}

@keyframes find-rainbow {
    0%   { background: linear-gradient(135deg, #ff6b6b, #ee5a5a); }
    25%  { background: linear-gradient(135deg, #feca57, #ff9f43); }
    50%  { background: linear-gradient(135deg, #26de81, #20c997); }
    75%  { background: linear-gradient(135deg, #4dabf7, #339af0); }
    100% { background: linear-gradient(135deg, #a29bfe, #6c5ce7); }
}

/* ============================================================================
   Game Control Bar Base (used by tag and pushwars)
   ============================================================================ */

.game-control-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background: var(--card-bg);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid var(--card-border);
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.gcb-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.gcb-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-width: 0;
}

.gcb-center h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    white-space: nowrap;
}

.gcb-right {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    align-items: center;
}

[data-theme="light"] .game-control-bar {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(140, 125, 105, 0.2);
    box-shadow: 0 2px 10px rgba(140, 125, 105, 0.12);
}

/* ============================================================================
   Game Buttons Base (start, reset, sound)
   ============================================================================ */

.btn-start {
    padding: 0.5rem 1.8rem;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.btn-start:hover:not(:disabled) {
    transform: translateY(-2px);
}

.btn-start:active:not(:disabled) { transform: translateY(0); }

.btn-start:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-reset {
    padding: 0.5rem 1.2rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    white-space: nowrap;
}

.btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.btn-reset:active { transform: translateY(0); }

.btn-sound {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-hover);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-sound:hover {
    background: var(--card-bg);
    transform: translateY(-1px);
}

.btn-sound.sound-off { opacity: 0.5; }

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-outline.active {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="light"] .btn-sound {
    background: rgba(248, 246, 242, 0.9);
    border-color: rgba(140, 125, 105, 0.2);
}

/* ============================================================================
   Settings Panel Items (shared by tag and pushwars)
   ============================================================================ */

.setting-item { margin-bottom: 0.75rem; }
.setting-item:last-of-type { margin-bottom: 0; }

.setting-item label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.setting-item input[type="number"] {
    width: 100%;
    padding: 0.45rem 0.65rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: 'Consolas', 'Monaco', monospace;
}

.setting-hint {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    line-height: 1.3;
}

/* ============================================================================
   Game Stats Grid (sidebar stat items)
   ============================================================================ */

.game-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.game-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.35rem 0.5rem;
    background: var(--card-hover);
    border-radius: 8px;
}

.stat-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--text-primary);
}

[data-theme="light"] .game-stat-item {
    background: rgba(248, 246, 242, 0.9);
    border: 1px solid rgba(140, 125, 105, 0.1);
}

/* ============================================================================
   Players Hint Text
   ============================================================================ */

.players-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem 0;
    padding: 0 0.5rem;
}

/* ============================================================================
   Countdown Overlay Base
   ============================================================================ */

.countdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    pointer-events: none;
}

.countdown-text {
    font-family: 'Consolas', 'Monaco', 'Ubuntu Mono', monospace;
    font-size: 12rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 40px rgba(255, 255, 255, 0.6), 0 0 80px rgba(255, 255, 255, 0.3);
    animation: countdown-pop 0.3s ease-out;
}

@keyframes countdown-pop {
    0% { transform: scale(1.8); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

/* ============================================================================
   Results Overlay Base
   ============================================================================ */

.results-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    animation: overlay-fade-in 0.3s ease;
}

@keyframes overlay-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.results-card {
    background: var(--card-bg);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: results-slide-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes results-slide-in {
    from { transform: translateY(40px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.results-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1.5rem 0;
}

.results-close-btn {
    display: block;
    margin: 1.5rem auto 0;
    min-width: 120px;
    background: linear-gradient(135deg, var(--accent-blue, #598ca7), #4a7a94);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.results-close-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(89, 140, 167, 0.3);
}

[data-theme="light"] .results-card {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(140, 125, 105, 0.2);
    box-shadow: 0 20px 60px rgba(140, 125, 105, 0.3);
}

/* ============================================================================
   Modal Overlay Base
   ============================================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    animation: overlay-fade-in 0.3s ease;
}

.modal-card {
    background: var(--card-bg);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: results-slide-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-card.modal-large { max-width: 650px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--card-hover);
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: var(--accent-red, #e53935);
    color: white;
}

.modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-loading, .modal-empty, .modal-error {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
    font-size: 0.95rem;
}

.modal-error { color: var(--accent-red); }

[data-theme="light"] .modal-card {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(140, 125, 105, 0.2);
    box-shadow: 0 20px 60px rgba(140, 125, 105, 0.3);
}

[data-theme="light"] .modal-close-btn {
    background: rgba(248, 246, 242, 0.9);
}

/* ============================================================================
   BLE Panel Overrides (compact device list for game pages)
   ============================================================================ */

.device-card { padding: 0.5rem 0.75rem; }
.device-name { font-size: 0.8rem; }
