:root {
    --primary-color: #34495e;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --bg-overlay: rgba(20, 25, 30, 0.95);
    --text-color: #ecf0f1;
    --text-muted: #bdc3c7;
    --border-color: rgba(255, 255, 255, 0.1);
    --spacing: 15px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body,
html {
    height: 100%;
    width: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

#game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height for Safari mobile */
    width: 100vw;
    overflow: hidden;
}

#map-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map {
    height: 100%;
    width: 100%;
    z-index: 1;
}

/* Ensure Leaflet attribution is visible above the action button */
.leaflet-control-attribution {
    margin-bottom: 0 !important;
    border-radius: 4px 0 0 0;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to map where not on UI */
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--spacing);
}

#drone-panel.comitans-widget {
    background: linear-gradient(180deg, rgba(20, 25, 30, 0.6) 0%, rgba(10, 15, 20, 0.95) 100%);
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.1), 0 8px 32px rgba(0, 0, 0, 0.8);
    align-self: flex-start;
    pointer-events: auto;
    font-size: 14px;
    color: var(--text-color);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    margin-top: auto;
    margin-bottom: 20px;
    margin-left: 15px;
    z-index: 1500;
    position: relative;
    width: auto;
    max-width: 80vw;
}

#btn-call-drone.metallic-btn {
    background: radial-gradient(circle at 50% 0%, #444, #111);
    border: 2px solid #555;
    color: #ccc;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3), 0 4px 10px rgba(0, 0, 0, 0.5);
    z-index: 10;
    pointer-events: auto;
    flex-shrink: 0;
}

#btn-call-drone.metallic-btn:hover {
    background: radial-gradient(circle at 50% 0%, #555, #222);
    color: var(--accent-color);
    border-color: #777;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.4), 0 0 15px var(--accent-color);
}

#btn-call-drone.metallic-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #222;
    color: #555;
    box-shadow: none;
}

.drone-info-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.drone-header {
    font-size: 13px;
    color: #aaa;
    margin-bottom: 2px;
}

#drone-state-text {
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #2ecc71;
    /* Default green, could be dynamic */
    margin-left: 5px;
}

.drone-stats {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

.highlight-text {
    color: white;
    font-weight: bold;
}

.icon-btn-mini {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

#top-bar-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: var(--spacing);
    padding-top: calc(env(safe-area-inset-top, 20px) + 10px);
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    z-index: 1100;
    pointer-events: none;
    /* Let clicks pass to map */
}

#top-bar {
    pointer-events: auto;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 8px 15px;
    width: 100%;
}

.profile-avatar-btn {
    background: radial-gradient(circle at 30% 30%, #555, #1a1a1a);
    border: 2px solid #888;
    color: #eee;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.2), 0 0 8px rgba(0, 0, 0, 0.5);
    margin-right: 12px;
    flex-shrink: 0;
}

#profile-hud-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

#hud-user-name {
    font-weight: 700;
    color: white;
    font-size: 16px;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

#hud-clan-name {
    font-size: 12px;
    color: #2ecc71;
    /* Neon green or dynamic accent */
    font-weight: 600;
}

.top-bar-spacer {
    flex-grow: 1;
}

.icon-btn-bell {
    background: transparent;
    border: none;
    color: #ccc;
    font-size: 22px;
    cursor: pointer;
    position: relative;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.icon-btn-bell:hover {
    color: white;
}

.notification-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    background-color: #e74c3c;
    border-radius: 50%;
    box-shadow: 0 0 5px #e74c3c;
}

/* Keeping old badge style internally just in case */

#btn-center-map {
    position: absolute;
    bottom: calc(var(--spacing) + 110px);
    /* Move above nav bar */
    right: var(--spacing);
    pointer-events: auto;
    z-index: 1100;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, transparent 20%, rgba(255, 255, 255, 0.1) 21%, rgba(0, 0, 0, 0.8) 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    transition: all 0.2s;
}

#btn-center-map::after {
    content: '';
    position: absolute;
    width: 70%;
    height: 70%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

#btn-center-map:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-color);
    color: white;
}

#bottom-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
    pointer-events: none;
    width: 100%;
}

#bottom-controls>button {
    pointer-events: auto;
    margin-right: 10px;
}



.icon-btn-top {
    background: var(--bg-overlay);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-size: 24px;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
}

.icon-btn-top:active {
    transform: scale(0.9);
}

#drone-info {
    font-size: 11px;
    color: var(--text-muted);
}

/* Bottom Navigation */
#bottom-nav {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    background: linear-gradient(0deg, rgba(10, 15, 20, 0.98) 0%, rgba(20, 25, 30, 0.85) 100%);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.6);
    /* Safe-area support: Optimized for iPhone Safari with extra padding to clear UI */
    padding-top: 0;
    padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 15px);
    box-sizing: content-box;
    height: 100px;
    pointer-events: auto;
    width: 100%;
    position: relative;
    z-index: 100;
}


.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: color 0.2s;
    width: 50px;
}

.nav-item i {
    font-size: 20px;
}

.nav-item:hover,
.nav-item.active {
    color: var(--accent-color);
}


.action-btn-main,
#btn-action-main {
    width: 95px;
    height: 95px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 40%, #2a2c35, #0d1117);
    border: 3px solid #333;
    color: white;
    box-shadow: 0 0 25px rgba(0, 191, 255, 0.6), inset 0 0 15px rgba(0, 191, 255, 0.3);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    position: relative !important;
    overflow: hidden !important;
    z-index: 110;
    margin-top: -30px;
    /* Make it pop out of the nav bar */
}

.action-btn-main::before {
    content: '';
    position: absolute;
    width: 85%;
    height: 85%;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
}

.action-btn-main:active {
    transform: scale(0.95);
    box-shadow: 0 0 15px rgba(0, 191, 255, 0.8), inset 0 0 25px rgba(0, 191, 255, 0.5);
}

#main-action-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 2;
    /* above the before element */
}

#main-action-content i {
    font-size: 32px;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
}

#main-action-text {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    letter-spacing: 0.5px;
}

#btn-action-main.disabled {
    background: radial-gradient(circle at 50% 40%, #222, #000);
    border-color: #222;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.4), inset 0 0 10px rgba(255, 0, 0, 0.2);
    color: #888;
    cursor: not-allowed;
}

#btn-action-main.disabled #main-action-content i {
    filter: none;
}

#btn-action-main.disabled #main-action-text {
    text-shadow: none;
    color: #888;
}

.action-btn-main.claiming {
    background: radial-gradient(circle at 50% 40%, rgba(39, 174, 96, 0.8), #0d1117);
    border-color: #27ae60;
    box-shadow: 0 0 25px rgba(39, 174, 96, 0.8), inset 0 0 15px rgba(39, 174, 96, 0.5);
}

.action-btn-main.attacking {
    background: radial-gradient(circle at 50% 40%, rgba(192, 57, 43, 0.8), #0d1117);
    border-color: #c0392b;
    box-shadow: 0 0 25px rgba(192, 57, 43, 0.8), inset 0 0 15px rgba(192, 57, 43, 0.5);
}

#btn-action-main.reinforcing {
    background: radial-gradient(circle at 50% 40%, rgba(41, 128, 185, 0.8), #0d1117) !important;
    border-color: #2980b9 !important;
    box-shadow: 0 0 25px rgba(41, 128, 185, 0.8), inset 0 0 15px rgba(41, 128, 185, 0.5) !important;
    color: white !important;
}


/* Old controls removal */
#controls {
    display: none;
}


.icon-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: var(--bg-overlay);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

/* Custom Marker Styles (if needed later) */
.user-marker-icon,
.drone-marker-icon {
    font-size: 24px;
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
}

.user-marker-icon {
    color: #3498db;
}

.attack-btn {
    background-color: #c0392b !important;
}

.defend-btn {
    background-color: #27ae60 !important;
}

.sector-label {
    pointer-events: none;
}

.drone-marker-icon {
    color: white;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
    /* Enhanced shadow for visibility */
}

/* Login Overlay */
#login-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.95);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.login-box {
    background: rgba(30, 30, 40, 0.9);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: white;
    backdrop-filter: blur(10px);
}

.login-box h1 {
    margin-bottom: 20px;
    font-size: 2em;
    color: #3498db;
}

/* Toast System */
#toast-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    min-width: 250px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border-left: 5px solid #3498db;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out forwards;
    pointer-events: auto;
}

.toast-success {
    border-left-color: #2ecc71;
}

.toast-error {
    border-left-color: #e74c3c;
}

.toast-warning {
    border-left-color: #f1c40f;
}

.toast-closing {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Modal System */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2500;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-box {
    background: var(--bg-overlay);
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    max-height: 80%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.modal-header h2 {
    color: var(--text-color);
    font-size: 1.5rem;
}

/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--text-color);
    border-bottom-color: var(--accent-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-color);
    border-radius: 6px;
    font-size: 16px;
}

.full-width {
    width: 100%;
    justify-content: center;
}

/* Lists */
.list-container {
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.clan-item {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clan-item:last-child {
    border-bottom: none;
}

.clan-info {
    display: flex;
    flex-direction: column;
}

.clan-name {
    font-weight: bold;
    color: var(--text-color);
}

.clan-tag-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    color: var(--text-muted);
    margin-left: 5px;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

/* Active Clan View */
.clan-header {
    text-align: center;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--primary-color), #34495e);
    color: white;
    padding: 20px;
    border-radius: 8px;
}

.clan-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 5px;
    font-family: monospace;
}

.clan-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-weight: bold;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 8px;
}

.btn-danger {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

/* Color Picker */
.color-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.color-swatch:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.8);
}

.color-swatch.selected {
    border: 3px solid white;
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Notification System */
.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-color);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid var(--bg-overlay);
    min-width: 15px;
    text-align: center;
}

.side-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100%;
    background: var(--bg-overlay);
    backdrop-filter: blur(10px);
    z-index: 3500;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-right: 1px solid var(--border-color);
    animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.icon-btn-small {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.2em;
}

.notif-item {
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid var(--text-muted);
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.notif-item.unread {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: var(--accent-color);
}

.notif-item.victory {
    border-left-color: var(--success-color);
}

.notif-item.defeat {
    border-left-color: var(--accent-color);
}

.notif-item.info {
    border-left-color: #3498db;
}

.notif-title {
    font-weight: bold;
    font-size: 0.95em;
    color: var(--text-color);
}

.notif-body {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 5px;
}

.notif-time {
    font-size: 0.75em;
    color: #777;
    margin-top: 5px;
    text-align: right;
}

/* Faction Selection */
.faction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    padding: 10px;
}

.faction-card {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.faction-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border-color: #666;
}

.faction-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.4);
    background: linear-gradient(135deg, #2980b9, #2c3e50);
}

.faction-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.1em;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faction-check {
    opacity: 0;
    transition: opacity 0.2s;
    color: var(--success-color);
}

.faction-card.selected .faction-check {
    opacity: 1;
}

.modifier-list {
    font-size: 0.9em;
    color: #ccc;
    line-height: 1.4;
}

.mod-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.mod-val {
    font-weight: bold;
}

.mod-pos {
    color: #2ecc71;
}

.mod-neg {
    color: #e74c3c;
}

.mod-neu {
    color: #95a5a6;
}

/* Loading Indicator */
#action-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 4000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    backdrop-filter: blur(3px);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Integrated Cooldown on Action Button */
#cooldown-timer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* Default fallback color if gradient fails */
    background: #333;
    /* Main gradient */
    background-image: conic-gradient(var(--timer-color, var(--accent-color)) 0deg,
            var(--timer-color, var(--accent-color)) var(--timer-progress, 0deg),
            rgba(0, 0, 0, 0.7) var(--timer-progress, 0deg),
            rgba(0, 0, 0, 0.7) 360deg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through if needed, though usually blocked */
}


/* Inner Circle Mask for the Ring Effect */
#cooldown-timer::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    background: #0d1117;
    /* Match background or button center */
    border-radius: 50%;
    z-index: -1;
}

#cooldown-timer .timer-text {
    font-size: 14px;
    color: #fff !important;
    background: transparent !important;
    /* Ensure no white box */
    font-weight: 800;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 11;
}


/* --- Wallet Selector --- */
.wallet-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.wallet-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.wallet-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.wallet-icon {
    width: 32px;
    height: 32px;
    margin-right: 15px;
    border-radius: 6px;
}

.wallet-name {
    font-weight: bold;
    color: #eee;
    font-size: 1.1em;
}

.wallet-status {
    margin-left: auto;
    font-size: 0.8em;
    color: #aaa;
}

/* --- Profile Modal --- */
.profile-box {
    border: 1px solid var(--accent-color);
    background: linear-gradient(145deg, var(--bg-overlay), #1a1f25);
}

.profile-avatar {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 15px rgba(var(--accent-rgb, 231, 76, 60), 0.3);
}

.p-stat label {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.profile-actions .action-btn {
    justify-content: center;
    padding: 15px;
    border-radius: 12px;
}

/* --- Profile HUD (Top Left) --- */
.profile-hud {
    position: absolute;
    top: var(--spacing);
    left: var(--spacing);
    background: rgba(20, 25, 30, 0.85);
    /* Slightly transparent */
    backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    z-index: 1100;
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    max-width: 200px;
}

.profile-hud:hover {
    transform: scale(1.02);
    background: var(--bg-overlay);
}

.hud-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    font-size: 18px;
}

.hud-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.hud-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hud-clan {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Quest System --- */
.quest-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.quest-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.quest-item.completed:not(.claimed) {
    border-color: var(--success-color);
    background: rgba(39, 174, 96, 0.1);
}

.quest-item.claimed {
    opacity: 0.6;
    border-color: rgba(255, 255, 255, 0.05);
}

.quest-info {
    flex: 1;
}

.quest-title {
    font-weight: bold;
    font-size: 14px;
    color: var(--text-color);
    margin-bottom: 4px;
}

.quest-desc {
    font-size: 11px;
    color: var(--text-muted);
}

.quest-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
    width: 100%;
    max-width: 150px;
}

.quest-progress-fill {
    height: 100%;
    background: var(--accent-color);
    width: 0%;
    transition: width 0.3s;
}

.quest-action {
    margin-left: 15px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.quest-reward {
    font-size: 12px;
    font-weight: bold;
    color: #f1c40f;
}

.btn-claim {
    padding: 6px 12px;
    font-size: 11px;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.btn-claim:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-claim.claimed-state {
    background: transparent;
    color: var(--success-color);
    border: 1px solid var(--success-color);
}