/* Match shell and feature styles: room-views, game-views, game-controls,
   region-skins, chat and battle-log views. Shared tokens/dialogs/music/map
   keyboard presentation have dedicated files; see T16_INTERFACE_ACCESSIBILITY.md. */

/* Core layout */
body {
    font-family: var(--ui-font);
    margin: 0;
    padding: 0;
    background-color: #121212;
    color: var(--ui-text);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Navbar with subtle gradient */
.navbar {
    background: linear-gradient(to right, #1a1a2e, #252538);
    color: white;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    height: 40px;
    z-index: 100;
}

.navbar h1 {
    margin: 0;
    font-family: var(--ui-font-mono);
    color: var(--ui-title);
    font-size: 20px;
    display: flex;
    align-items: center;
}

.navbar h1 i {
    margin-right: 8px;
    color: var(--ui-accent-text);
}

/* Updated navbar sections for better layout */
.navbar-left {
    flex: 0 1 auto;
    min-width: 0;
}

.navbar-center {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 24px;
}

.navbar-right {
    flex: 0 1 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

/* Role indicators for host and spectator status */
.role-indicator {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 0;
    font-size: 11px;
    margin-left: 5px;
    font-weight: bold;
}

.host-indicator {
    color: #FFC107;
    font-weight: bold;
    margin-left: auto;
    flex-shrink: 0;
}

.turn-indicator + .host-indicator {
    margin-left: 5px;
}

.spectator-indicator {
    background-color: rgba(158, 158, 158, 0.2);
    color: #9E9E9E;
    border: 1px solid rgba(158, 158, 158, 0.4);
}

/* Main container with optimal spacing */
.main-container {
    display: flex;
    flex: 1;
    padding: 8px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    gap: 8px;
}

/* Left sidebar with elegant collapsible sections */
.left-sidebar {
    width: 260px;
    background-color: var(--ui-surface);
    border-radius: 0;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
    flex-shrink: 0;
}

.collapsible-section {
    flex-shrink: 0;
    margin-bottom: 8px;
    border-radius: 0;
    overflow: hidden;
    background-color: var(--ui-surface-raised);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 8px 10px;
    transition: background-color 0.2s;
}

.section-header:hover {
    background-color: #2c2c44;
}

.section-header .section-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.section-header .section-title i {
    margin-right: 8px;
    font-size: 12px;
    opacity: 0.7;
}

.toggle-icon {
    transition: transform 0.3s ease;
    font-size: 12px;
    opacity: 0.7;
}

.toggle-icon.rotated {
    transform: rotate(180deg);
}

.section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 10px;
}

.section-content.expanded {
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
}

.room-info-compact {
    font-family: var(--ui-font-mono);
    display: block;
    margin-bottom: 8px;
    padding: 9px 10px;
    border-radius: 0;
    background-color: var(--ui-surface-raised);
    font-size: 13px;
}

.room-info p {
    margin: 5px 0;
    font-size: 13px;
}

.room-info span {
    font-weight: bold;
}

.member-lists {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.member-list-title {
    margin-bottom: 5px;
    color: #aaa;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.member-lists.expanded { max-height: min(38vh, 360px); }
.spectator-disclosure summary {
    padding: 5px 0;
    color: #aab4c5;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
}
.spectator-disclosure[open] summary { margin-bottom: 6px; }

/* Player list styling */
.player-item {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 36px;
    padding: 6px 8px;
    border-radius: 0;
    margin-bottom: 4px;
    background-color: rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
    position: relative;
    overflow: hidden;
}

.player-item:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

  .player-item.add-bot-player {
      width: 100%;
      justify-content: center;
      border: 1px dashed var(--ui-text-muted, #aaa);
      background: transparent;
      color: var(--ui-text-muted, #aaa);
      font: inherit;
      cursor: pointer;
  }

  .player-item.add-bot-player:hover:not(:disabled) {
      color: var(--ui-text, #fff);
      background: rgba(255, 255, 255, 0.06);
  }

  .player-item.add-bot-player:disabled { opacity: 0.5; cursor: default; }

.player-item.player-skin-background {
    --ui-text-muted: var(--ui-text);
    padding: 2px 4px;
    overflow: visible;
    background-clip: padding-box;
    background-position: center;
    box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.player-item.player-skin-background:hover {
    box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.5);
}

.player-item.player-skin-background::after {
    content: '';
    position: absolute;
    inset: -8px;
    background-image: var(--player-row-border);
    background-size: 100% 100%;
    pointer-events: none;
    z-index: 2;
}

.player-item.current {
    background-color: var(--ui-accent-muted);
    border-left: 3px solid var(--ui-accent);
}

/* Current turn styling with gradient */
.player-item.current-turn {
    position: relative;
    z-index: 1;
}

.player-item.current-turn::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 85%;
    background: linear-gradient(to left, rgba(255, 215, 0, 0.25), rgba(255, 215, 0, 0) 100%);
    z-index: -1;
    border-radius: 0;
    animation: pulse-subtle 2s infinite;
}

.turn-indicator {
    margin-left: auto;
    color: #FFD700;
    font-size: 14px;
    animation: pulse-subtle 2s infinite;
}

@keyframes pulse-subtle {
    0% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.7;
    }
}

.player-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-item .player-elo-rating {
    flex-shrink: 0;
    margin-left: 8px;
    color: var(--ui-text-muted, #aaa);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

/* Spectator styling in player list */
.player-list-divider {
    margin-top: 10px;
    margin-bottom: 5px;
    padding: 5px;
    font-size: 12px;
    color: #aaa;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.player-item.spectator {
    opacity: 0.7;
    background-color: rgba(0, 0, 0, 0.05);
}

.player-item.spectator::before {
    content: "👁️";
    font-size: 10px;
    margin-right: 5px;
    opacity: 0.6;
}

.player-color {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 0;
    margin-right: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.player-neutral {
    --player-name-color: var(--neutral-text-color, #000000);
    background-color: var(--neutral-color, #858585);
}

.player1 {
    --player-name-color: var(--player1-text-color, #000000);
    background-color: var(--player1-color, #3f8eef);
}

.player2 {
    --player-name-color: var(--player2-text-color, #000000);
    background-color: var(--player2-color, #4bb06f);
}

.player3 {
    --player-name-color: var(--player3-text-color, #000000);
    background-color: var(--player3-color, #e5c258);
}

.player4 {
    --player-name-color: var(--player4-text-color, #000000);
    background-color: var(--player4-color, #f28e59);
}

/* Game controls with improved usability */
.game-controls {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar-bottom > .btn { width: 100%; box-sizing: border-box; }
.battle-cheatsheet-link { min-height: 36px; }

.phase-control {
    --phase-color: #c5dcfa;
    flex-shrink: 0;
    background: linear-gradient(135deg, #24334a, #1c2433);
    border: 1px solid #3f5573;
    box-shadow: 0 3px 12px #0003;
}
.phase-control[data-urgency="timer-warning"] { --phase-color: #ffcd83; border-color: #85653d; }
.phase-control[data-urgency="timer-critical"] { --phase-color: #ffaaa2; border-color: #94524e; }

.game-status {
    padding: 14px;
    overflow: visible;
}

.game-status p {
    margin: 0;
    padding: 0;
    font-size: 13px;
}

/* Turn timer styles */
.turn-timer {
    font-family: var(--ui-font-mono);
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0;
    margin: 0;
    min-height: 32px;
    border-radius: 0;
    font-weight: bold;
    font-size: 14px;
    position: relative;
}

.turn-timer i {
    margin-right: 6px;
}

.phase-timer-content {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.phase-name {
    font-size: 11px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}
.phase-countdown { font-size: 30px; line-height: 1; letter-spacing: -1px; }
.phase-countdown .phase-clock { font-size: 16px; opacity: 0.6; vertical-align: middle; }
.phase-control .turn-timer { background: none; border: 0; color: var(--phase-color); }
.phase-control .phase-help { align-self: flex-start; }
.phase-control .phase-action {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--phase-color);
    padding: 0;
    font-size: 14px;
    box-shadow: none;
}
.phase-control .phase-action:hover:not(:disabled) { background: #506f9666; transform: none; }
.phase-action .phase-timer-content { padding: 14px; }
.phase-action-caption { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-top: 1px solid #ffffff1c; background: #506f9633; }
.phase-control .phase-action::before, .phase-control .phase-action::after { display: none; }
.phase-action-key { display: flex; align-items: center; gap: 8px; font: 11px var(--ui-font-mono); opacity: 0.65; }

.phase-help {
    position: relative;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: currentColor;
    cursor: help;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
}

.phase-help:hover,
.phase-help:focus-visible {
    background-color: rgba(255, 255, 255, 0.12);
    opacity: 1;
    outline: none;
}

.phase-help i {
    margin-right: 0;
}

.phase-help-tooltip {
    position: absolute;
    display: none;
    right: 0;
    bottom: calc(100% + 8px);
    width: 230px;
    padding: 8px 10px;
    border-radius: 0;
    background-color: #151522;
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #f2f2f2;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    pointer-events: none;
    z-index: 20;
}

.phase-help:hover .phase-help-tooltip,
.phase-help:focus-visible .phase-help-tooltip {
    display: block;
}

.timer-normal {
    background-color: rgba(33, 150, 243, 0.15);
    color: #2196F3;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.timer-warning {
    background-color: rgba(255, 152, 0, 0.15);
    color: #FF9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.timer-critical {
    background-color: rgba(244, 67, 54, 0.15);
    color: #F44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
    animation: timer-critical-pulse 1s infinite;
}

@keyframes timer-critical-pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.btn-small {
    font-size: 12px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: #2c3e50;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn-small:hover {
    background-color: #34495e;
    text-decoration: none;
}

/* Map editor with better layout */
.map-editor-controls {
    background-color: var(--ui-surface-raised);
    border-radius: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    padding: 12px;
    border: 1px solid #ffffff12;
}

.match-settings-section { border-top: 1px solid #ffffff12; padding-top: 12px; }
.match-settings-section h4 { margin: 0 0 12px; font-size: 12px; color: var(--ui-accent-text); }
.match-settings-section .control-label { display: block; margin-bottom: 8px; font-size: 12px; color: #aab4c5; }
.bot-thinking-control { margin-bottom: 16px; }
.bot-thinking-control input[type="range"] { display: block; width: 100%; margin: 0; accent-color: #7c9dff; cursor: pointer; }
.bot-thinking-control input:disabled { cursor: default; opacity: 0.5; }
.bot-thinking-labels { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: #aab4c5; }
.match-settings-section .size-btn { font-size: 12px; padding: 8px 4px; }
.match-settings-section .map-size-buttons { gap: 6px; margin-bottom: 10px; }
.match-settings-section #generateMapBtn { width: 100%; font-size: 12px; padding: 9px 5px; }
.map-dev-panel { margin-bottom: 10px; padding: 8px 0; border-top: 1px solid #ffffff12; }
.map-dev-panel summary { cursor: pointer; font-size: 12px; color: var(--ui-accent-text); }
.map-dev-panel .control-group { margin: 10px 0 0; }
.map-dev-panel select {
    box-sizing: border-box;
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--ui-border);
    color: var(--ui-text);
    background: var(--ui-surface);
    font: inherit;
    font-size: 12px;
}

.map-editor-controls h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 15px;
    display: flex;
    align-items: center;
}

.map-editor-controls h3 i {
    margin-right: 8px;
    font-size: 14px;
    color: var(--ui-accent-text);
}

/* Map size controls styling */
.map-size-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.map-size-buttons {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 15px;
}

.size-btn {
    font-family: var(--ui-font-mono);
    flex: 1;
    padding: 10px 8px;
    background: linear-gradient(to bottom, #252540, var(--ui-surface));
    border: 1px solid #3a3a68;
    border-radius: 0;
    color: var(--ui-text);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.size-btn i {
    font-size: 16px;
    opacity: 0.8;
    transition: all 0.2s;
}

.size-btn:hover {
    background: linear-gradient(to bottom, #2a2a4a, var(--ui-surface-raised));
    border-color: #4a4a88;
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.size-btn.active {
    background: var(--ui-accent-muted);
    border-color: var(--ui-accent);
}

.size-btn.active i {
    color: var(--ui-accent-text);
    opacity: 1;
}

.map-size-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 0;
    margin: 0 5px;
    transition: all 0.2s ease;
}

.map-size-option:hover {
    background-color: var(--ui-accent-muted);
}

.map-size-option input[type="radio"] {
    margin-bottom: 5px;
}

.map-size-option input[type="radio"]:checked+.map-size-label {
    color: var(--ui-accent-text);
    font-weight: bold;
}

.map-size-label {
    font-size: 14px;
}

.map-stats {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 0;
    padding: 10px;
    margin-bottom: 15px;
    font-size: 13px;
}

.map-stats p {
    margin: 5px 0;
    display: flex;
    justify-content: space-between;
}

.control-group {
    margin-bottom: 8px;
}

.control-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    color: #aaaaaa;
}

.control-group input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #444;
    border-radius: 0;
    background-color: var(--ui-surface);
    color: var(--ui-text);
    font-size: 13px;
    transition: border-color 0.2s;
}

.control-group input:focus {
    border-color: var(--ui-focus);
    outline: 2px solid var(--ui-focus);
    outline-offset: 2px;
}

/* Game area - maximize space and add depth */
.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    /* Allow flex shrinking */
}

.canvas-container {
    flex: 1;
    position: relative;
    background-color: var(--ui-surface);
    border-radius: 0;
    margin-bottom: 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #1a1a2a;
}

/* Add hover effect to canvas */
canvas:hover {
    cursor: crosshair;
}

/* Battle log with improved readability */
.battle-log {
    flex: 1;
    min-height: 0;
    background-color: transparent;
    border-radius: 0;
    padding: 0;
    overflow: hidden;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

.battle-log-header {
    padding: 0 0 8px;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #333;
    margin-bottom: 8px;
}

.battle-log-header h3 {
    margin: 0;
    font-size: 14px;
}

.battle-log-header i {
    margin-right: 8px;
    color: #FF5252;
    font-size: 12px;
}

/* Battle log navigation controls */
.battle-log-controls {
    display: flex;
    gap: 5px;
    margin-left: auto;
}

.log-scroll-btn {
    background: linear-gradient(to bottom, #2c2c44, var(--ui-surface-raised));
    border: 1px solid #3a3a68;
    border-radius: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ui-text);
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.log-scroll-btn:hover {
    background: linear-gradient(to bottom, #36365a, #2c2c44);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    border-color: #4a4a88;
}

.log-scroll-btn:active {
    background: var(--ui-accent-muted);
    border-color: var(--ui-accent);
    color: var(--ui-accent-text);
    transform: translateY(0);
}

/* Style for disabled scroll buttons */
.log-scroll-btn.disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
    background: linear-gradient(to bottom, var(--ui-surface-raised), var(--ui-surface));
    border: 1px solid #333;
    box-shadow: none;
}

#battleLogContent {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 8px;
    background-color: var(--ui-surface-raised);
    border-radius: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.log-entry {
    margin-bottom: 6px;
    padding: 4px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    line-height: 1.4;
    border-radius: 0;
    transition: background-color 0.2s;
}

.log-entry:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.log-time {
    font-family: var(--ui-font-mono);
    color: #aaa;
    font-size: 10px;
    margin-right: 5px;
    font-weight: 400;
}

/* Battle outcome styling */
.log-entry.battle-win {
    background-color: rgba(76, 175, 80, 0.1);
    border-left: 3px solid #4CAF50;
    padding-left: 6px;
}

.log-entry.battle-lose {
    background-color: rgba(244, 67, 54, 0.1);
    border-left: 3px solid #f44336;
    padding-left: 6px;
}

.log-entry.battle-attack {
    background-color: rgba(255, 152, 0, 0.1);
    border-left: 3px solid #FF9800;
    padding-left: 6px;
}

.log-entry.battle-casualties {
    color: #bbb;
    font-style: italic;
    font-size: 11px;
    margin-top: -4px;
    border-top: none;
    background-color: rgba(0, 0, 0, 0.1);
    padding-left: 15px;
}

/* Region capture styling */
.log-entry.capture-success {
    background-color: rgba(33, 150, 243, 0.1);
    border-left: 3px solid #2196F3;
    padding-left: 6px;
}

/* Chain attack log entries */
.log-entry.chain-attack {
    background-color: rgba(255, 215, 0, 0.1);
    border-left: 3px solid #FFD700;
    padding-left: 6px;
}

/* Turn changes */
.log-entry.turn-change {
    background-color: rgba(156, 39, 176, 0.1);
    border-left: 3px solid #9C27B0;
    padding-left: 6px;
    font-weight: 500;
}

/* System messages */
.log-entry.system-message {
    background-color: rgba(33, 33, 33, 0.2);
    border-left: 3px solid #777;
    padding-left: 6px;
    color: #ccc;
}

/* Error messages */
.log-entry.error-message {
    background-color: rgba(244, 67, 54, 0.15);
    border-left: 3px solid #f44336;
    padding-left: 6px;
    color: #ff9e9e;
}

/* Important events */
.log-entry.important-event {
    font-weight: 500;
}

/* Player name colors in log */
.player-name {
    color: var(--player-name-color, inherit);
    font-weight: 600;
    padding: 1px 3px;
    border-radius: 0;
}

/* Region highlighting */
.region-highlight {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 1px 3px;
    border-radius: 0;
    font-weight: 500;
}

/* Max troops indicator for battle log */
.log-entry.max-troops {
    background-color: rgba(255, 82, 82, 0.1);
    border-left: 2px solid #FF5252;
    padding-left: 5px;
}

/* Right sidebar - chat container */
.right-sidebar {
    width: 260px;
    background-color: var(--ui-surface);
    border-radius: 0;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    flex-shrink: 0;
}

.activity-overview {
    flex: 1 1 50%;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 10px;
}
.communication-section {
    flex: 0 0 50%;
    height: 50%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-top: 1px solid #ffffff14;
}

.match-sidebar-controls {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    flex-shrink: 0;
    gap: 8px;
    min-height: 44px;
    padding: 7px;
    margin: 0;
    box-sizing: border-box;
    border-radius: 0;
    background-color: var(--ui-surface-raised);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.match-sidebar-controls .user-info {
    display: contents;
}

.match-sidebar-controls #joinRoomBtn {
    flex: 0 0 auto;
    padding: 8px 10px;
    white-space: nowrap;
}

/* A compact forecast for the currently inspected attack. */
.region-info-container {
    flex: 1 0 auto;
    min-height: 230px;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ffffff14;
    background: linear-gradient(150deg, #252c3c, #1c2130);
    display: flex;
    flex-direction: column;
}
.battle-outcomes-title {
    margin: 0;
    padding: 12px;
    border-bottom: 1px solid #ffffff12;
    color: #b9cbe3;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.battle-outcomes-title i { opacity: 0.7; }
.region-info-default {
    flex: 1;
    min-height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 20px;
    color: #a1adc0;
    text-align: center;
    font-size: 12px;
    line-height: 1.6;
}
.region-info-default i { font-size: 24px; color: #718aaa; }
.region-info-default p { margin: 0; max-width: 210px; }
.region-info { padding: 12px; font-size: 12px; }
.battle-matchup { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.battle-matchup > div { display: flex; flex-direction: column; gap: 6px; }
.battle-matchup > div:last-child { text-align: right; }
.battle-matchup strong { font: bold 26px var(--ui-font-mono); color: #e3ebf7; }
.battle-matchup small { font: 11px var(--ui-font); color: #a1adc0; }
.battle-matchup > div > span:last-child { font: 10px var(--ui-font-mono); color: #a1adc0; }
.battle-side-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; color: #a1adc0; }
.battle-versus { color: #718096; font: 11px var(--ui-font-mono); }
.battle-win-summary { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; }
.battle-win-summary strong { font: bold 27px var(--ui-font-mono); }
.battle-win-summary.high { color: #9bd9bb; }
.battle-win-summary.medium { color: #ebcc8f; }
.battle-win-summary.low { color: #f2a09b; }
.battle-odds-track { height: 4px; background: #ffffff0d; margin: 8px 0 16px; }
.battle-odds-track span { display: block; height: 100%; background: #9bd9bb; }
.battle-odds-track .medium { background: #ebcc8f; }
.battle-odds-track .low { background: #f2a09b; }
.battle-losses { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.battle-losses-label { grid-column: 1 / -1; color: #a1adc0; font-size: 11px; }
.battle-losses > div { padding: 9px; background: #0002; display: flex; flex-direction: column; gap: 6px; color: #a1adc0; font-size: 11px; }
.battle-losses strong { color: #dce5f3; font: bold 16px var(--ui-font-mono); }
.region-info .battle-estimate-note { margin: 12px 0 0; color: #a1adc0; font-size: 10px; line-height: 1.5; }

.sidebar-tabs {
    display: grid;
    grid-template-columns: 1fr;
    flex-shrink: 0;
    gap: 4px;
    margin-bottom: 10px;
    border-bottom: 1px solid #333;
}

.sidebar-tab {
    font-family: var(--ui-font-mono);
    min-height: 36px;
    padding: 8px 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    background-color: transparent;
    color: #aaa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 700;
    transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}

.sidebar-tab i {
    font-size: 14px;
}

.sidebar-tab:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.sidebar-tab.active {
    color: var(--ui-accent-text);
    border-bottom-color: var(--ui-accent);
    background-color: var(--ui-accent-muted);
}

.sidebar-tab:focus-visible {
    outline: 2px solid var(--ui-focus);
    outline-offset: -2px;
}

.sidebar-tab-panel {
    flex: 1;
    min-height: 0;
}

.sidebar-tab-panel[hidden] {
    display: none;
}

/* Chat container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
}

.chat-header h3 {
    margin: 0;
    font-size: 15px;
}

.chat-header i {
    margin-right: 8px;
    color: #2196F3;
}

/* Chat options */
.chat-header-options {
    display: flex;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #aaa;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    margin-right: 5px;
}

.toggle-text {
    white-space: nowrap;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    margin-bottom: 8px;
    padding: 8px;
    background-color: var(--ui-surface-raised);
    border-radius: 0;
}

.chat-input {
    display: flex;
    background-color: var(--ui-surface-raised);
    border-radius: 0;
    padding: 4px;
}

.chat-input input {
    flex: 1;
    padding: 8px;
    border: none;
    background-color: transparent;
    color: var(--ui-text);
    font-size: 13px;
}

.chat-input input:focus {
    outline: none;
}

.chat-input button {
    background: none;
    border: none;
    color: var(--ui-accent-text);
    padding: 0 8px;
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s;
}

.chat-input button:hover {
    color: var(--ui-title);
}

.chat-message {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #333;
}

.chat-message .sender {
    font-weight: bold;
    margin-bottom: 2px;
    font-size: 12px;
    display: flex;
    align-items: center;
}

.chat-message .time {
    font-size: 10px;
    color: #aaa;
    margin-left: 5px;
}

.chat-message .content {
    word-break: break-word;
    font-size: 13px;
    padding-left: 18px;
}

.spectator-message {
    opacity: 0.85;
    background-color: rgba(0, 0, 0, 0.1);
    border-left: 2px solid #888;
    padding-left: 5px;
}

.spectator-tag {
    font-size: 10px;
    color: #888;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 2px 4px;
    border-radius: 0;
    margin-left: 5px;
}

.spectator-icon {
    position: relative;
}

.spectator-icon::after {
    content: '\f06e';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    font-size: 8px;
    top: -2px;
    right: -2px;
    color: #888;
}

/* Improved buttons */
.btn {
    font-family: var(--ui-font-mono);
    --button-edge: #adcaef80;
    --button-hover-edge: #d2e5ffc4;
    --button-glow: #8fb3e32e;
    padding: 8px 12px;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow:
        inset 0 0 0 1px var(--button-edge),
        inset 0 2px 0 #ffffff24,
        inset 0 -2px 0 #07132566,
        0 2px 5px #00000026;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 3px;
    border: 1px solid #e2eeff1a;
    pointer-events: none;
    transition: border-color 0.2s ease;
}

.btn:hover:not(:disabled) {
    box-shadow:
        inset 0 0 0 1px var(--button-hover-edge),
        inset 0 2px 0 #ffffff38,
        inset 0 -2px 0 #07132580,
        0 0 0 1px var(--button-glow),
        0 3px 10px #050c1b4d;
}

.btn:hover:not(:disabled)::before {
    border-color: #e2eeff40;
}

.btn:active:not(:disabled) {
    box-shadow:
        inset 0 0 0 1px var(--button-hover-edge),
        inset 0 2px 5px #07132566;
}

.btn:focus-visible {
    outline: 2px solid var(--ui-focus);
    outline-offset: 3px;
}

.size-btn,
.tab-btn {
    box-shadow: inset 0 0 0 1px #adcaef26, inset 0 2px 0 #ffffff0d;
}

.size-btn:hover:not(:disabled),
.tab-btn:hover:not(:disabled),
.size-btn.active,
.tab-btn.active {
    box-shadow: inset 0 0 0 1px #adcaef73, inset 0 2px 0 #ffffff1a;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: transform 0.5s, opacity 0.3s;
}

.btn:active::after {
    transform: translate(-50%, -50%) scale(2);
    opacity: 1;
    transition: 0s;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: inset 0 0 0 1px #adcaef30;
}

.btn-primary {
    background-color: var(--ui-accent);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--ui-accent-hover);
}

.btn-secondary {
    background-color: var(--ui-accent-muted);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--ui-accent);
}

.btn-danger {
    --button-edge: #ffb0aa7a;
    --button-hover-edge: #ffc8c2cc;
    --button-glow: #f4433624;
    background-color: #f44336;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #d32f2f;
}

.btn-success {
    background-color: var(--ui-accent);
    color: white;
    margin-right: 10px;
    transition: all 0.2s ease;
}

.btn-success:hover {
    background-color: var(--ui-accent-hover);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* Join as Player button in victory modal */
#joinAsPlayerBtn {
    background-color: var(--ui-accent);
    color: white;
    margin-right: 10px;
    transition: all 0.2s ease;
}

#joinAsPlayerBtn:hover {
    background-color: var(--ui-accent-hover);
    transform: translateY(-2px);
}

/* Add a subtle animation for the button appearance */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#joinAsPlayerBtn.visible {
    display: inline-flex !important;
    animation: fadeInScale 0.3s ease;
}

/* Generate map button styling */
#generateMapBtn {
    width: 100%;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#generateMapBtn i {
    margin-right: 8px;
}

/* Draw attention with a crisp outline. */
@keyframes highlight-pulse {
    0%, 100% { outline-offset: 2px; }
    50% { outline-offset: 4px; }
}

.highlight-pulse {
    animation: highlight-pulse 1s infinite;
    border-color: var(--ui-focus) !important;
    outline: 2px solid var(--ui-focus);
    outline-offset: 2px;
}

/* Victory modal styling */
.victory-modal .modal-body {
    text-align: center;
}

.victory-title {
    font-size: 24px;
    margin-bottom: 15px;
    color: gold;
}

.victory-title.defeat {
    color: #ff4d4d;
}

.victory-elo-rating {
    margin: 16px 0;
    color: var(--ui-text, #eee);
    font-variant-numeric: tabular-nums;
}

.winner-name {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.winner-name .player-color {
    margin-right: 10px;
    width: 15px;
    height: 15px;
}

/* Region skin shop */
.region-skins-modal {
    max-width: 760px;
    max-height: 86vh;
    overflow: hidden;
}

.region-skins-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(86vh - 86px);
    overflow: hidden;
}

.region-skin-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.region-skin-balance {
    flex: 0 0 auto;
    color: #f4d35e;
    font-weight: 700;
    font-size: 13px;
}

.region-skin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    overflow-y: auto;
    padding-right: 4px;
}

.region-skin-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    padding: 14px;
    border-radius: 0;
    background-color: var(--ui-surface-raised);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.region-skin-card.equipped {
    border-color: var(--ui-accent);
    outline: 1px solid var(--ui-focus);
    outline-offset: 1px;
}

.region-skin-preview {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 160px;
    flex: 0 0 auto;
    border-radius: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    overflow: hidden;
    background-color: #1a1a2a;
}

.region-skin-preview canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.region-skin-counter-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 30px;
    border: 1px solid rgba(215, 189, 99, 0.75);
    border-radius: 0;
    background-color: rgba(4, 10, 9, 0.94);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    color: #ff4d45;
    font-family: "Courier New", monospace;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.embroidered-counter-preview {
    border-color: #1d4f9a;
    border-radius: 0;
    background-color: rgba(255, 253, 244, 0.96);
    box-shadow: 0 0 7px rgba(0, 0, 0, 0.22);
    color: #1d4f9a;
    font-family: Georgia, serif;
    text-shadow: none;
}

.skin-pattern-none {
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.08));
}

.skin-pattern-solid {
    background-image: none;
}

.skin-pattern-pcb {
    background-size: 52px 52px, 26px 26px, 13px 13px, 100% 100%;
    background-image:
        radial-gradient(circle at 18% 24%, var(--skin-accent) 0 4px, var(--skin-secondary) 5px, transparent 7px),
        linear-gradient(90deg, transparent 0 36%, rgba(215, 189, 99, 0.88) 36% 43%, transparent 43%),
        linear-gradient(0deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        repeating-linear-gradient(
            135deg,
            transparent 0,
            transparent 15px,
            rgba(69, 214, 154, 0.42) 15px,
            rgba(69, 214, 154, 0.42) 18px
        );
}

.skin-pattern-kashubian {
    background-size: 68px 68px, 34px 34px, 46px 46px, 100% 100%;
    background-image:
        radial-gradient(circle at 22% 30%, #169bd5 0 6px, #1d4f9a 7px 11px, transparent 12px),
        radial-gradient(circle at 75% 70%, #94c83d 0 5px, transparent 6px),
        radial-gradient(circle at 52% 48%, #e31e2f 0 4px, transparent 5px),
        linear-gradient(135deg, rgba(148, 200, 61, 0.22) 0 2px, transparent 2px);
}

.region-skin-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
}

.region-skin-body h3 {
    margin: 0;
    min-height: 2.4em;
    color: #f5f7fb;
    font-size: 15px;
    line-height: 1.2;
}

.region-skin-body p {
    margin: 0;
    min-height: 2.7em;
    color: #b7c0cf;
    font-size: 12px;
    line-height: 1.35;
}

.region-skin-action {
    align-self: stretch;
    margin-top: auto;
    min-height: 44px;
    padding: 10px 12px;
}

.region-skin-empty {
    grid-column: 1 / -1;
    padding: 24px;
    color: #aaa;
    text-align: center;
    background-color: var(--ui-surface-raised);
    border-radius: 0;
}

/* Toast notifications with animations */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background-color: var(--ui-surface);
    padding: 12px 15px;
    border-radius: 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
    transition: transform 0.3s, opacity 0.3s;
    transform: translateX(0);
    opacity: 1;
    max-width: 300px;
    font-size: 13px;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid #4CAF50;
}

.toast.error {
    border-left: 4px solid #f44336;
}

.toast.info {
    border-left: 4px solid #2196F3;
}

.toast.warning {
    border-left: 4px solid #FF9800;
}

.toast.chain-attack {
    border-left: 4px solid #FFD700;
    background-color: rgba(30, 30, 45, 0.95);
}

.toast.spectator-converted {
    border-left: 4px solid #4CAF50;
    background-color: rgba(76, 175, 80, 0.1);
}

.toast.hiding {
    transform: translateX(120%);
    opacity: 0;
}

/* Loading indicator with smoother animation */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    background-color: rgba(30, 30, 45, 0.8);
    padding: 20px;
    border-radius: 0;
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--ui-accent-text);
    border-radius: 0;
    width: 30px;
    height: 30px;
    animation: spin 1s cubic-bezier(0.6, 0.2, 0.4, 0.8) infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: var(--ui-accent);
    color: white;
    border: none;
    border-radius: 0;
    font-size: 16px;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    transition: background-color 0.2s, transform 0.2s;
}

.sidebar-toggle:hover {
    background-color: var(--ui-accent-hover);
    transform: scale(1.05);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

/* Mobile responsiveness */
@media (max-width: 1100px) {
    .main-container {
        flex-wrap: wrap;
        overflow-y: auto;
        height: calc(100vh - 56px);
    }

    /* Keep the three-section layout in medium screens */
    .navbar-left, 
    .navbar-center, 
    .navbar-right {
        flex: 1;
    }

    .left-sidebar,
    .right-sidebar {
        width: calc(50% - 4px);
        box-sizing: border-box;
        margin: 0 0 8px 0;
        height: 580px;
        max-height: 65vh;
    }

    .game-area {
        order: -1;
        width: 100%;
        height: calc(100vh - 370px);
        margin-bottom: 8px;
    }

    .right-sidebar .battle-log {
        height: auto;
        min-height: 0;
    }

    /* Adjust region info for responsive layout */
    .region-info-container {
        height: auto;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
        padding: 5px;
    }

    /* Adjust navbar for mobile */
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 8px;
    }

    .navbar-left {
        width: 100%;
        margin-bottom: 5px;
        flex: none;
    }

    .navbar-center {
        width: 100%;
        order: 3;
        flex: none;
    }

    .navbar-right {
        order: 2;
        width: 100%;
        justify-content: flex-start;
        margin-bottom: 5px;
        flex: none;
    }

    .region-skins-modal {
        width: calc(100% - 24px);
        max-height: 90vh;
    }

    .region-skin-grid {
        grid-template-columns: 1fr;
    }

    .left-sidebar,
    .right-sidebar {
        width: 100%;
        max-height: 180px;
    }

    .game-area {
        height: calc(100vh - 400px);
    }

    .sidebar-toggle {
        display: block;
    }

    .left-sidebar,
    .right-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        z-index: 90;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        height: 70vh;
        max-height: 70vh;
        box-sizing: border-box;
        margin: 0;
        border-radius: 0;
    }

    .left-sidebar.active,
    .right-sidebar.active {
        transform: translateY(0);
    }

    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px;
        border-bottom: 1px solid #333;
        flex-shrink: 0;
    }
    .sidebar-header h3 { margin: 0; font-size: 14px; }
    .sidebar-close { min-width: 28px; min-height: 28px; border: 0; background: none; color: var(--ui-text); font-size: 24px; cursor: pointer; }
}

/* In-room chrome lives in the sidebars instead of a top bar. */
.main-menu-container.hidden + .navbar {
    display: none;
}

.main-menu-container.hidden ~ .main-container {
    height: 100vh;
}

.main-menu-container.hidden ~ .main-container #joinRoomBtn {
    display: none !important;
}

/* Styles for player list */
.player-item.disconnected {
    opacity: 0.8;
    border-left: 3px solid #ff5252;
    position: relative;
}

.disconnected-icon {
    margin-left: 5px;
    color: #ff5252;
    animation: connection-status-pulse 2s infinite;
}

/* Eliminated player styling */
.player-item.eliminated {
    opacity: 0.5;
    filter: grayscale(100%);
    border-left: 3px solid #888;
    position: relative;
}

.eliminated-icon {
    margin-left: 5px;
    color: #888;
}

/* Enhance existing player-item styling */
.player-item {
    transition: all 0.3s ease;
}

.player-item.disconnected:hover {
    opacity: 0.9;
}

/* Add some animation for the disconnected icon */
@keyframes connection-status-pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

#spectatorJoinBtn {
    background-color: var(--ui-accent);
    color: white;
    border: none;
    padding: 10px 15px;
    margin-top: 10px;
    margin-bottom: 10px;
    width: 100%;
    transition: background-color 0.3s ease;
    animation: spectator-join-pulse 2s infinite;
}

#spectatorJoinBtn:hover {
    background-color: var(--ui-accent-hover);
    animation: none;
}

/* Remove old battle tools styling */
.tools-list {
    display: none;
}

.btn-tool {
    display: none;
}

.tool-description {
    display: none;
}

/* Character counter styling */
.char-counter {
    font-size: 0.75rem;
    margin-top: 2px;
    text-align: right;
    transition: color 0.3s, opacity 0.3s;
    opacity: 0.7;
}

/* Input styles for when limit is reached */
input.limit-reached,
textarea.limit-reached {
    border-color: #ff6b6b !important;
    background-color: rgba(255, 107, 107, 0.05) !important;
}

/* Show counter more prominently when limit is approached */
.char-counter.limit-approaching {
    color: orange;
    opacity: 1;
}

/* Style when limit is reached */
.char-counter.limit-reached {
    color: #ff6b6b;
    font-weight: bold;
    opacity: 1;
}

.alpha-tag {
    position: relative;
    font-size: 0.45em;
    font-weight: 600;
    color: #fff;
    background-color: #ff5722;
    padding: 3px 6px;
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 5px;
    vertical-align: middle;
    top: -5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: alpha-badge-pulse 2s infinite;
}

@keyframes alpha-badge-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

/* Expected losses indicators */
.attacker-losses {
    color: #e74c3c; /* Red for attacker losses */
    font-weight: bold;
}

.defender-losses {
    color: #3498db; /* Blue for defender losses */
    font-weight: bold;
}

/* Discord button in navbar */
.navbar-discord {
    background-color: #5865F2;
    color: white;
    margin-right: 10px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.navbar-discord:hover {
    background-color: #4752C4;
    transform: translateY(-2px);
}

.navbar-discord i {
    font-size: 16px;
}

/* Add styling for disabled regions */
.disabled-region {
    color: #e74c3c;
    font-weight: bold;
    padding: 5px;
    border-left: 3px solid #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
    margin: 5px 0;
}

.auth-status-text {
    font-size: 0.9rem;
    color: #d9e2ef;
}

.auth-action-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.form-hint {
    margin: 6px 0 0;
    color: #aaa;
    font-size: 0.85rem;
}

.form-hint-error {
    color: #ff6b6b;
}

#nicknameInput:disabled {
    color: #cfe8d1;
    cursor: not-allowed;
    opacity: 0.85;
}

#registerModal {
    z-index: 10000;
}

#regionSkinsModal {
    z-index: 10000;
}

@keyframes spectator-join-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.8; } }
/* Native roster disclosure retains its original typography and geometry. */
button.section-header { width: 100%; background: none; border: 0; color: inherit; font: inherit; text-align: left; }
button.section-header:hover { background-color: #2c2c44; }
.sidebar-header { display: none; }
@media (max-width: 768px) { .sidebar-header { display: flex; } }
@media (prefers-reduced-motion: reduce) {
    .alpha-tag, .disconnected-icon, #spectatorJoinBtn, .highlight-pulse { animation: none; }
    .left-sidebar, .right-sidebar, .section-content { transition: none; }
}
