:root {
    --bg: #080b11;
    --surface: rgba(18, 23, 33, 0.92);
    --surface-strong: rgba(24, 30, 42, 0.97);
    --surface-soft: rgba(32, 39, 53, 0.78);
    --outline: rgba(176, 190, 214, 0.17);
    --outline-bright: rgba(168, 199, 250, 0.42);
    --text: #eef2f8;
    --muted: #a9b2c1;
    --primary: #8cb9ff;
    --primary-strong: #b4d1ff;
    --primary-container: #17345d;
    --energy: #ffd166;
    --danger: #ff766d;
    --success: #72d995;
    --purple: #ddb8ff;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
    --radius-lg: 22px;
    --radius-md: 15px;
    --radius-sm: 10px;
    --font: "Roboto", system-ui, sans-serif;

    /* Compatibility with the Canvas client. */
    --md-sys-color-primary: var(--primary);
    --md-sys-color-tertiary: var(--purple);
    --md-sys-color-outline-variant: #465064;
}

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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.hidden {
    display: none !important;
}

.glass-panel {
    background: linear-gradient(145deg, rgba(28, 35, 48, 0.94), rgba(14, 18, 27, 0.9));
    border: 1px solid var(--outline);
    box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(18px) saturate(130%);
    -webkit-backdrop-filter: blur(18px) saturate(130%);
}

.material-symbols-outlined {
    font-variation-settings: "FILL" 0, "wght" 450, "GRAD" 0, "opsz" 24;
}

/* Join screen */
.modal-overlay,
.cooldown-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 18px;
    background:
        radial-gradient(circle at 50% 25%, rgba(42, 96, 170, 0.2), transparent 38%),
        radial-gradient(circle at 15% 85%, rgba(105, 63, 148, 0.14), transparent 35%),
        #080b11;
}

.modal-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.16;
    background-image:
        linear-gradient(rgba(140, 185, 255, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(140, 185, 255, 0.12) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: linear-gradient(to bottom, black, transparent 75%);
}

.modal-content {
    position: relative;
    width: min(500px, 100%);
    max-height: calc(100dvh - 36px);
    overflow-y: auto;
    border-radius: 30px;
    padding: 38px;
    text-align: center;
}

.join-emblem {
    width: 70px;
    height: 70px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    color: var(--primary-strong);
    background: linear-gradient(145deg, #244c82, #122b50);
    box-shadow: 0 12px 30px rgba(46, 111, 200, 0.35);
}

.join-emblem span {
    font-size: 38px;
}

.logo-text {
    font-size: clamp(1.9rem, 5vw, 2.6rem);
    letter-spacing: 0.08em;
    font-weight: 900;
}

.accent-text {
    color: var(--primary);
}

.modal-tagline {
    margin: 12px auto 26px;
    max-width: 390px;
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.5;
}

.auth-tabs {
    margin-bottom: 14px;
    padding: 4px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    border: 1px solid var(--outline);
    border-radius: 13px;
    background: rgba(5, 8, 13, 0.45);
}

.auth-tab {
    min-height: 36px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 800;
}

.auth-tab.active {
    background: linear-gradient(135deg, rgba(140, 185, 255, 0.24), rgba(136, 99, 190, 0.18));
    color: var(--primary-strong);
    box-shadow: inset 0 0 0 1px rgba(140, 185, 255, 0.2);
}

.password-group {
    margin-top: 11px;
}

.auth-status {
    min-height: 18px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.68rem;
}

.input-group {
    text-align: left;
}

.input-group label {
    display: block;
    margin: 0 0 7px 4px;
    color: var(--muted);
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.input-group input,
.chat-input-area input {
    width: 100%;
    border: 1px solid var(--outline);
    border-radius: 13px;
    background: rgba(5, 8, 13, 0.62);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input {
    padding: 15px 16px;
    font-size: 1rem;
}

.input-group input:focus,
.chat-input-area input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(140, 185, 255, 0.12);
    outline: none;
}

.avatar-picker-row {
    margin-top: 12px;
}

.avatar-picker-button {
    width: 100%;
    min-height: 62px;
    padding: 8px 11px;
    display: grid;
    grid-template-columns: 44px 1fr 24px;
    align-items: center;
    gap: 11px;
    border: 1px solid var(--outline);
    border-radius: 14px;
    background: rgba(5, 8, 13, 0.42);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.18s, background 0.18s;
}

.avatar-picker-button:hover {
    border-color: var(--outline-bright);
    background: rgba(140, 185, 255, 0.075);
}

.avatar-preview {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(140, 185, 255, 0.34);
    border-radius: 50%;
    background: linear-gradient(145deg, #244c82, #132a4d) center / cover;
    color: var(--primary-strong);
}

.avatar-preview .material-symbols-outlined {
    font-size: 21px;
}

.avatar-picker-copy strong,
.avatar-picker-copy small {
    display: block;
}

.avatar-picker-copy strong {
    font-size: 0.78rem;
}

.avatar-picker-copy small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.62rem;
}

.avatar-edit-icon {
    color: var(--muted);
    font-size: 18px;
}

.primary-button {
    width: 100%;
    min-height: 52px;
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #9cc4ff, #6ea6f6);
    color: #07152a;
    font-weight: 900;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(73, 132, 216, 0.3);
}

.primary-button:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
}

.primary-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.connection-error {
    margin-top: 12px;
    color: var(--danger);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.instructions {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--outline);
    text-align: left;
}

.instructions h2,
.panel-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.instructions h2 {
    justify-content: flex-start;
    gap: 7px;
    margin-bottom: 12px;
}

.instruction-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    color: var(--muted);
    font-size: 0.8rem;
}

kbd {
    display: inline-grid;
    min-width: 28px;
    height: 24px;
    place-items: center;
    margin-right: 5px;
    padding: 0 6px;
    border: 1px solid var(--outline);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font: 700 0.68rem monospace;
}

.instructions p {
    margin-top: 13px;
    color: #778293;
    font-size: 0.73rem;
}

/* Full-screen game */
#app-container,
.game-shell {
    position: fixed;
    inset: 0;
}

.game-shell {
    overflow: hidden;
    background: #090c12;
}

.game-shell::before,
.game-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.game-shell::before {
    background:
        radial-gradient(circle at 50% 42%, transparent 38%, rgba(1, 4, 9, 0.32) 100%),
        linear-gradient(120deg, rgba(71, 128, 210, 0.025), transparent 45%, rgba(160, 95, 190, 0.025));
    box-shadow: inset 0 0 110px rgba(0, 0, 0, 0.42);
}

.game-shell::after {
    opacity: 0.13;
    background: repeating-linear-gradient(to bottom, transparent 0 3px, rgba(152, 190, 255, 0.035) 4px);
    mix-blend-mode: screen;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
    touch-action: none;
    outline: none;
}

#game-canvas:focus-visible {
    box-shadow: inset 0 0 0 3px var(--primary);
}

#game-canvas.screen-impact {
    animation: screenImpact 0.62s cubic-bezier(0.22, 0.72, 0.25, 1);
}

.top-hud {
    position: fixed;
    z-index: 100;
    top: 12px;
    left: 12px;
    right: 12px;
    height: 64px;
    display: grid;
    grid-template-columns: 210px 1fr 210px;
    align-items: center;
    border-radius: 19px;
    padding: 0 12px 0 16px;
}

.brand-block,
.profile-heading,
.panel-heading > div,
.stat-val,
.hud-actions,
.board-hud span,
.shield-indicator {
    display: flex;
    align-items: center;
}

.brand-block {
    gap: 10px;
}

.brand-icon {
    color: var(--primary);
    font-size: 29px;
}

.brand-block strong {
    display: block;
    font-size: 0.9rem;
    letter-spacing: 0.12em;
}

.brand-block small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.57rem;
    letter-spacing: 0.12em;
}

.grid-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(18px, 4vw, 56px);
}

.stat-box {
    display: flex;
    min-width: 52px;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    color: #8691a2;
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.stat-val {
    min-height: 24px;
    gap: 4px;
    font-size: 0.92rem;
    font-weight: 800;
}

.stat-val .material-symbols-outlined {
    font-size: 17px;
}

.danger-icon {
    color: var(--danger);
}

.text-danger {
    color: var(--danger);
}

.text-warn {
    color: var(--energy);
}

.online-icon {
    color: var(--success);
}

.hud-actions {
    justify-content: flex-end;
    gap: 7px;
}

.hud-avatar {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: rgba(140, 185, 255, 0.15) center / cover;
    color: var(--primary-strong);
}

.hud-avatar .material-symbols-outlined {
    font-size: 18px;
}

.icon-button,
.mini-icon-button,
.chat-send-btn {
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--outline);
    background: rgba(255, 255, 255, 0.045);
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, transform 0.18s;
}

.icon-button {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.icon-button:hover,
.mini-icon-button:hover,
.chat-send-btn:hover {
    border-color: var(--outline-bright);
    background: rgba(140, 185, 255, 0.12);
}

.danger-button {
    color: var(--danger);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--danger);
    color: #190504;
    font-size: 0.58rem;
    font-weight: 900;
    line-height: 17px;
}

.floating-panel {
    position: absolute;
    z-index: 60;
    border-radius: var(--radius-lg);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}

.profile-panel {
    top: 88px;
    left: 12px;
    width: 278px;
    padding: 16px;
}

.profile-heading {
    gap: 10px;
}

.avatar-glow {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 2px solid rgba(255, 255, 255, 0.24);
    border-radius: 14px;
    background: var(--primary);
    background-position: center;
    background-size: cover;
    box-shadow: 0 0 18px rgba(140, 185, 255, 0.35);
    color: #07152a;
    cursor: pointer;
    overflow: hidden;
    padding: 0;
}

.avatar-fallback {
    font-size: 24px;
}

.profile-identity {
    min-width: 0;
    flex: 1;
}

.profile-identity h2 {
    overflow: hidden;
    font-size: 0.92rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-title {
    display: block;
    margin-top: 3px;
    color: var(--primary);
    font-size: 0.66rem;
}

.level-badge {
    width: 38px;
    height: 38px;
    display: grid;
    place-content: center;
    border: 1px solid rgba(140, 185, 255, 0.28);
    border-radius: 12px;
    background: rgba(23, 52, 93, 0.68);
    text-align: center;
}

.level-badge small {
    color: var(--muted);
    font-size: 0.48rem;
}

.level-badge strong {
    font-size: 0.9rem;
}

.profile-numbers {
    margin: 14px 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--outline);
    border-radius: 13px;
    background: rgba(4, 7, 12, 0.28);
}

.profile-numbers > div {
    min-width: 0;
    padding: 9px 4px;
    display: grid;
    grid-template-columns: auto auto;
    justify-content: center;
    align-items: center;
    gap: 3px;
    text-align: center;
}

.profile-numbers > div + div {
    border-left: 1px solid var(--outline);
}

.profile-numbers span {
    color: var(--energy);
    font-size: 14px;
}

.profile-numbers strong {
    font-size: 0.78rem;
}

.profile-numbers small {
    grid-column: 1 / -1;
    color: #7f8999;
    font-size: 0.53rem;
    text-transform: uppercase;
}

.combo-icon {
    color: #ff9c66 !important;
}

.xp-block > div:first-child {
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 0.59rem;
    font-weight: 700;
}

.progress-track {
    width: 100%;
    height: 6px;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.075);
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
}

.xp-fill {
    width: 0;
    background: linear-gradient(90deg, #7facf2, #c19aff);
    transition: width 0.35s ease;
}

.shield-indicator {
    margin-top: 12px;
    gap: 7px;
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.035);
    color: #778293;
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
}

.shield-indicator.active {
    background: rgba(74, 139, 224, 0.16);
    color: var(--primary-strong);
}

.profile-action-button {
    width: 100%;
    min-height: 34px;
    margin-top: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid rgba(255, 118, 109, 0.18);
    border-radius: 10px;
    background: rgba(255, 118, 109, 0.055);
    color: #d99a96;
    cursor: pointer;
    font-size: 0.62rem;
    font-weight: 700;
}

.profile-action-button:hover {
    border-color: rgba(255, 118, 109, 0.4);
    background: rgba(255, 118, 109, 0.11);
}

.profile-action-button .material-symbols-outlined {
    font-size: 15px;
}

.shield-indicator span:first-child {
    font-size: 16px;
}

.missions-block {
    margin-top: 16px;
    padding-top: 13px;
    border-top: 1px solid var(--outline);
}

.panel-section-title .material-symbols-outlined {
    font-size: 15px;
}

.missions-list {
    margin-top: 9px;
    display: grid;
    gap: 7px;
}

.mission-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 5px 8px;
    color: var(--muted);
    font-size: 0.66rem;
}

.mission-row strong {
    color: var(--text);
    font-size: 0.61rem;
}

.mission-progress {
    grid-column: 1 / -1;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.07);
}

.mission-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--success);
}

.leaderboard-panel {
    top: 88px;
    left: 302px;
    width: 270px;
    max-height: calc(100vh - 200px);
    padding: 14px;
}

.panel-heading {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 9px;
}

.panel-heading > div {
    gap: 7px;
    font-size: 0.77rem;
}

.panel-heading .material-symbols-outlined {
    color: var(--primary);
    font-size: 18px;
}

.mini-icon-button {
    width: 28px;
    height: 28px;
    border-radius: 9px;
}

.mini-icon-button .material-symbols-outlined {
    font-size: 17px;
}

.leaderboard-list {
    max-height: calc(100vh - 260px);
    overflow-y: auto;
    display: grid;
    gap: 6px;
}

.leaderboard-row {
    min-height: 40px;
    padding: 7px 9px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
    font-size: 0.7rem;
}

.leaderboard-user {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
}

.leaderboard-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
}

.leaderboard-name {
    max-width: 135px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-name.self {
    color: var(--primary-strong);
}

.leaderboard-name.dead {
    color: #707988;
    text-decoration: line-through;
}

.leaderboard-score {
    font-weight: 800;
}

.chat-panel {
    top: 88px;
    right: 12px;
    bottom: 108px;
    width: 310px;
    padding: 14px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ability-guide-panel {
    z-index: 86;
    left: 50%;
    bottom: 106px;
    width: min(650px, calc(100vw - 32px));
    max-height: min(430px, calc(100vh - 210px));
    padding: 14px;
    overflow-y: auto;
    transform: translateX(-50%);
}

.ability-guide-panel.panel-hidden {
    transform: translateX(-50%) translateY(14px) scale(0.98);
}

.ability-guide-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.ability-guide-item {
    min-height: 96px;
    padding: 11px;
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.035);
}

.ability-guide-item > .material-symbols-outlined {
    grid-row: 1 / 3;
    color: var(--primary-strong);
    font-size: 26px;
}

.ability-guide-item strong {
    font-size: 0.75rem;
}

.ability-guide-item p {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.65rem;
    line-height: 1.35;
}

.ability-guide-meta {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    color: var(--energy);
    font-size: 0.58rem;
    font-weight: 800;
}

.ability-guide-meta span {
    padding: 3px 6px;
    border-radius: 6px;
    background: rgba(255, 209, 102, 0.08);
}

.chat-panel .panel-heading {
    padding: 0 14px;
}

.chat-messages {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 4px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.chat-message {
    font-size: 0.72rem;
    line-height: 1.42;
    word-break: break-word;
}

.chat-time {
    margin-right: 5px;
    color: #687384;
    font-size: 0.57rem;
}

.chat-user {
    margin-right: 5px;
    font-weight: 800;
}

.chat-message.system-msg {
    padding: 7px 9px;
    border-left: 2px solid var(--primary);
    border-radius: 0 8px 8px 0;
    background: rgba(140, 185, 255, 0.055);
}

.chat-input-area {
    display: grid;
    grid-template-columns: 1fr 38px;
    gap: 7px;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--outline);
}

.chat-input-area input {
    min-width: 0;
    padding: 9px 10px;
    font-size: 0.72rem;
}

.chat-send-btn {
    width: 38px;
    height: 36px;
    border-radius: 11px;
    color: var(--primary);
}

.panel-hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.leaderboard-panel.panel-hidden {
    transform: translateX(-16px) scale(0.98);
}

.team-badge {
    min-width: 17px;
    padding: 2px 4px;
    border-radius: 5px;
    font-size: 0.48rem;
    font-weight: 900;
    text-align: center;
}

.team-badge.team-1 { color: #b4d1ff; background: rgba(83, 145, 232, 0.2); }
.team-badge.team-2 { color: #ffb4ab; background: rgba(231, 92, 82, 0.18); }

.chat-panel.panel-hidden {
    transform: translateX(24px);
}

/* Dock and map overlays */
.ability-dock {
    position: absolute;
    z-index: 90;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    max-width: calc(100vw - 24px);
    min-height: 82px;
    padding: 8px 10px;
    display: flex;
    align-items: stretch;
    gap: 7px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    border-radius: 24px;
}

.ability-dock::-webkit-scrollbar {
    display: none;
}

.energy-core {
    position: relative;
    width: 64px;
    flex: 0 0 64px;
    display: grid;
    place-content: center;
    color: var(--energy);
    text-align: center;
}

.energy-core > .material-symbols-outlined {
    font-size: 17px;
}

.energy-core strong {
    font-size: 1rem;
    line-height: 1;
}

.energy-ring {
    position: absolute;
    inset: 3px;
    overflow: hidden;
    border: 1px solid rgba(255, 209, 102, 0.24);
    border-radius: 18px;
    pointer-events: none;
}

.energy-ring span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 30%;
    background: linear-gradient(to top, rgba(255, 209, 102, 0.2), transparent);
    transition: height 0.3s ease;
}

.dock-divider {
    width: 1px;
    margin: 5px 2px;
    background: var(--outline);
}

.ability-card {
    position: relative;
    width: 76px;
    flex: 0 0 76px;
    min-height: 64px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: 1fr auto;
    align-items: center;
    border: 1px solid transparent;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.045);
    cursor: pointer;
    transition: transform 0.16s, background 0.16s, border-color 0.16s, opacity 0.16s;
}

.ability-card:hover:not(.disabled) {
    transform: translateY(-3px);
    border-color: var(--outline-bright);
    background: rgba(140, 185, 255, 0.1);
}

.ability-card.active-selection {
    border-color: var(--purple);
    background: rgba(145, 93, 184, 0.2);
    box-shadow: 0 0 22px rgba(192, 137, 232, 0.18);
}

.ability-card.disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.ability-key {
    position: absolute;
    top: 5px;
    left: 6px;
    color: #747f91;
    font: 700 0.55rem monospace;
}

.ability-icon {
    grid-column: 1 / -1;
    align-self: end;
    color: var(--primary-strong);
    font-size: 25px;
}

.team-ability .ability-icon {
    color: var(--purple);
}

.ability-name {
    min-width: 0;
    overflow: hidden;
    padding: 0 0 5px 6px;
    color: #bdc6d4;
    font-size: 0.55rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ability-cost {
    padding: 0 6px 5px 2px;
    color: var(--energy);
    font-size: 0.55rem;
    font-weight: 900;
}

.ability-cooldown {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: none;
    place-items: center;
    background: rgba(5, 8, 13, 0.72);
    color: var(--text);
    font-size: 0.84rem;
    font-weight: 900;
}

.ability-card.on-cooldown .ability-cooldown {
    display: grid;
}

.dock-info-button {
    width: 58px;
    min-width: 58px;
    min-height: 64px;
    display: grid;
    place-content: center;
    gap: 2px;
    border: 1px dashed rgba(140, 185, 255, 0.3);
    border-radius: 16px;
    background: rgba(140, 185, 255, 0.045);
    color: var(--primary);
    cursor: pointer;
}

.dock-info-button:hover,
.dock-info-button[aria-pressed="true"] {
    border-style: solid;
    border-color: var(--primary);
    background: rgba(140, 185, 255, 0.13);
}

.dock-info-button .material-symbols-outlined {
    font-size: 22px;
}

.dock-info-button small {
    font-size: 0.46rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.ability-tooltip {
    position: absolute;
    z-index: 88;
    left: 50%;
    bottom: 104px;
    width: min(540px, calc(100vw - 32px));
    min-height: 68px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 10px;
    border-color: rgba(140, 185, 255, 0.34);
    border-radius: 16px;
    transform: translateX(-50%);
    pointer-events: none;
}

.ability-tooltip-icon {
    color: var(--primary-strong);
    font-size: 28px;
}

.ability-tooltip strong,
.ability-tooltip span {
    display: block;
}

.ability-tooltip strong {
    font-size: 0.75rem;
}

#ability-tooltip-description {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.64rem;
    line-height: 1.35;
}

.ability-tooltip-meta {
    display: grid;
    justify-items: end;
    gap: 4px;
    color: var(--energy);
    font-size: 0.58rem;
    font-weight: 800;
}

.board-hud {
    position: absolute;
    z-index: 55;
    right: 334px;
    bottom: 96px;
    min-height: 36px;
    padding: 4px 6px 4px 11px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 13px;
    color: var(--muted);
    font-size: 0.63rem;
}

.board-hud span {
    gap: 4px;
}

.board-hud .material-symbols-outlined {
    font-size: 14px;
}

.board-hud strong {
    color: var(--text);
}

.action-prompt,
.world-event-banner {
    position: absolute;
    z-index: 80;
    left: 50%;
    transform: translateX(-50%);
}

.tactical-readout {
    position: absolute;
    z-index: 89;
    top: 86px;
    left: 50%;
    width: min(420px, calc(100vw - 32px));
    min-height: 64px;
    overflow: hidden;
    padding: 8px 12px;
    display: grid;
    grid-template-columns: 30px 1fr auto;
    align-items: center;
    gap: 8px;
    border-color: rgba(126, 193, 255, 0.48);
    border-radius: 13px;
    background: linear-gradient(120deg, rgba(11, 31, 55, 0.97), rgba(19, 19, 34, 0.96));
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.48), 0 0 22px rgba(84, 155, 255, 0.1), inset 0 1px rgba(255, 255, 255, 0.06);
    transform: translateX(-50%);
    animation: tacticalIn 0.28s cubic-bezier(0.2, 0.9, 0.25, 1.15);
    pointer-events: none;
}

.world-event-banner:not(.hidden) ~ .tactical-readout {
    top: 140px;
}

.readout-scanline {
    position: absolute;
    inset: 0 auto 0 -20%;
    width: 18%;
    background: linear-gradient(90deg, transparent, rgba(121, 196, 255, 0.17), transparent);
    transform: skewX(-18deg);
    animation: readoutScan 1.2s ease-in-out infinite;
}

.readout-icon {
    color: #8fd2ff;
    font-size: 26px;
    filter: drop-shadow(0 0 8px rgba(100, 190, 255, 0.5));
}

.readout-copy small,
.readout-copy strong,
.readout-copy span {
    display: block;
}

.readout-copy small {
    color: #79bde9;
    font-size: 0.45rem;
    font-weight: 900;
    letter-spacing: 0.14em;
}

.readout-copy strong {
    margin-top: 1px;
    font-size: 0.72rem;
}

.readout-copy span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.56rem;
    line-height: 1.25;
}

.readout-value {
    min-width: 46px;
    color: #bde4ff;
    font-size: 1.2rem;
    text-align: right;
    text-shadow: 0 0 18px rgba(100, 190, 255, 0.5);
}

.tactical-readout.success {
    border-color: rgba(114, 217, 149, 0.5);
}

.tactical-readout.success .readout-icon,
.tactical-readout.success .readout-value {
    color: var(--success);
}

.tactical-readout.danger {
    border-color: rgba(255, 118, 109, 0.55);
}

.tactical-readout.danger .readout-icon,
.tactical-readout.danger .readout-value {
    color: var(--danger);
}

.action-prompt {
    top: 86px;
    min-height: 38px;
    max-width: min(440px, calc(100vw - 32px));
    padding: 5px 7px 5px 11px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-color: rgba(221, 184, 255, 0.42);
    border-radius: 12px;
    color: var(--purple);
    font-size: 0.62rem;
    font-weight: 700;
}

.world-event-banner:not(.hidden) + .action-prompt {
    top: 140px;
}

.action-prompt > .material-symbols-outlined {
    font-size: 18px;
}

.world-event-banner {
    top: 86px;
    min-width: 300px;
    max-width: min(460px, calc(100vw - 32px));
    min-height: 44px;
    padding: 5px 9px;
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 9px;
    border-color: rgba(255, 209, 102, 0.35);
    border-radius: 13px;
}

.world-event-banner.buff {
    border-color: rgba(109, 221, 180, 0.34);
    background: linear-gradient(115deg, rgba(12, 37, 35, 0.96), rgba(12, 22, 34, 0.97));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 18px rgba(70, 210, 170, 0.055);
}

.world-event-banner.debuff {
    border-color: rgba(224, 123, 146, 0.4);
    background: linear-gradient(115deg, rgba(43, 17, 29, 0.97), rgba(24, 17, 37, 0.97));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.44), 0 0 18px rgba(220, 86, 124, 0.065);
}

.world-event-banner.buff .event-icon,
.world-event-banner.buff .event-copy strong,
.world-event-banner.buff .event-timer { color: #91dfc3; }

.world-event-banner.debuff .event-icon,
.world-event-banner.debuff .event-copy strong,
.world-event-banner.debuff .event-timer { color: #e7a1b2; }

.event-icon {
    color: var(--energy);
    font-size: 22px;
}

.event-copy {
    min-width: 0;
}

.event-copy strong,
.event-copy span {
    display: block;
}

.event-copy strong {
    color: var(--energy);
    font-size: 0.64rem;
}

.event-copy span {
    margin-top: 2px;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.54rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-timer {
    min-width: 30px;
    color: var(--energy);
    font-size: 0.62rem;
    font-weight: 900;
    text-align: right;
}

.event-feed {
    position: absolute;
    z-index: 45;
    left: 16px;
    bottom: 112px;
    width: min(310px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    pointer-events: none;
}

.feed-item {
    max-width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--outline);
    border-radius: 10px;
    background: rgba(10, 14, 21, 0.82);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
    color: var(--muted);
    font-size: 0.66rem;
    animation: feedIn 0.22s ease-out;
}

.feed-item strong {
    color: var(--text);
}

.cooldown-content {
    width: min(380px, 100%);
    padding: 32px;
    display: grid;
    justify-items: center;
    gap: 12px;
    border-radius: 24px;
    text-align: center;
}

.cooldown-icon,
.cooldown-timer {
    color: var(--danger);
}

.cooldown-icon {
    font-size: 48px;
}

.cooldown-content h2 {
    font-size: 1.1rem;
}

.cooldown-content p {
    color: var(--muted);
    font-size: 0.8rem;
}

.danger-fill {
    width: 50%;
    background: var(--danger);
    animation: loading 1.4s linear infinite;
}

.cooldown-timer {
    font-size: 1.5rem;
    font-weight: 900;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background: rgba(169, 178, 193, 0.25);
}

/* Competitive platform lobby */
.platform-shell {
    position: fixed;
    inset: 0;
    z-index: 500;
    overflow-x: hidden;
    overflow-y: auto;
    background:
        radial-gradient(circle at 22% 5%, rgba(52, 112, 198, 0.16), transparent 30%),
        radial-gradient(circle at 85% 38%, rgba(150, 70, 181, 0.1), transparent 27%),
        #070a0f;
}

.platform-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0.11;
    background-image: linear-gradient(rgba(140, 185, 255, 0.12) 1px, transparent 1px), linear-gradient(90deg, rgba(140, 185, 255, 0.1) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: linear-gradient(to bottom, black, transparent 75%);
    pointer-events: none;
}

.platform-header {
    position: sticky;
    z-index: 20;
    top: 0;
    height: 72px;
    padding: 0 max(24px, calc((100vw - 1480px) / 2));
    display: grid;
    grid-template-columns: 250px 1fr 280px;
    align-items: center;
    border-bottom: 1px solid rgba(151, 175, 211, 0.13);
    background: rgba(7, 10, 15, 0.9);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(20px);
}

.platform-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
    text-decoration: none;
}

.platform-brand > .material-symbols-outlined {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #0a1420;
    background: var(--primary);
    box-shadow: 0 0 24px rgba(140, 185, 255, 0.26);
}

.platform-brand strong,
.platform-brand small {
    display: block;
}

.platform-brand strong {
    letter-spacing: 0.13em;
    font-size: 0.88rem;
}

.platform-brand small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.47rem;
    letter-spacing: 0.12em;
}

.platform-nav {
    height: 100%;
    display: flex;
    justify-content: center;
    gap: 32px;
}

.platform-nav a {
    position: relative;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-decoration: none;
    text-transform: uppercase;
}

.platform-nav a:hover {
    color: var(--text);
}

.platform-nav a:hover::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--primary);
    box-shadow: 0 0 12px var(--primary);
}

.platform-account,
.platform-profile-button {
    display: flex;
    align-items: center;
}

.platform-account {
    justify-content: flex-end;
    gap: 8px;
}

.platform-profile-button {
    min-width: 190px;
    padding: 7px 10px;
    gap: 9px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.platform-profile-button:hover {
    border-color: var(--outline);
    background: rgba(255, 255, 255, 0.035);
}

.platform-profile-button strong,
.platform-profile-button small {
    display: block;
}

.platform-profile-button strong { font-size: 0.72rem; }
.platform-profile-button small { margin-top: 2px; color: var(--muted); font-size: 0.58rem; }

.platform-avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(140, 185, 255, 0.38);
    border-radius: 11px;
    background-position: center;
    background-size: cover;
    color: var(--primary);
    box-shadow: inset 0 0 15px rgba(93, 152, 235, 0.15);
}

.platform-content {
    width: min(1480px, calc(100vw - 48px));
    margin: 0 auto;
    padding: 30px 0 72px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 24px;
}

.platform-main-column {
    min-width: 0;
}

.platform-hero {
    position: relative;
    min-height: 360px;
    overflow: hidden;
    padding: 50px 54px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    align-items: center;
    gap: 30px;
    border: 1px solid rgba(140, 185, 255, 0.22);
    border-radius: 21px;
    background:
        linear-gradient(100deg, rgba(11, 24, 42, 0.98), rgba(10, 15, 25, 0.9)),
        #0d1420;
    box-shadow: 0 28px 75px rgba(0, 0, 0, 0.36), inset 0 1px rgba(255, 255, 255, 0.04);
}

.hero-grid-glow {
    position: absolute;
    inset: 0;
    opacity: 0.42;
    background:
        radial-gradient(circle at 82% 50%, rgba(97, 166, 255, 0.28), transparent 26%),
        linear-gradient(90deg, transparent 60%, rgba(115, 180, 255, 0.06)),
        repeating-linear-gradient(90deg, transparent 0 35px, rgba(140, 185, 255, 0.055) 36px),
        repeating-linear-gradient(0deg, transparent 0 35px, rgba(140, 185, 255, 0.055) 36px);
    transform: perspective(650px) rotateY(-8deg) scale(1.08);
    pointer-events: none;
}

.hero-copy,
.rank-showcase {
    position: relative;
    z-index: 2;
}

.eyebrow {
    color: var(--primary);
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.17em;
}

.hero-copy h1 {
    margin-top: 13px;
    max-width: 710px;
    font-size: clamp(2rem, 4.2vw, 3.75rem);
    line-height: 0.98;
    letter-spacing: -0.04em;
}

.hero-copy h1 span { color: var(--primary); }
.hero-copy p { max-width: 610px; margin-top: 20px; color: var(--muted); font-size: 0.87rem; line-height: 1.6; }
.hero-actions { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 10px; }

.platform-primary-action,
.platform-secondary-action {
    min-height: 42px;
    padding: 0 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-decoration: none;
}

.platform-primary-action {
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #09111c;
    box-shadow: 0 10px 30px rgba(79, 145, 229, 0.2);
}

.platform-secondary-action {
    border: 1px solid rgba(140, 185, 255, 0.3);
    background: rgba(140, 185, 255, 0.08);
    color: var(--primary-strong);
}

.platform-primary-action:hover,
.platform-secondary-action:hover { filter: brightness(1.1); transform: translateY(-1px); }
.platform-primary-action:disabled,
.platform-secondary-action:disabled { opacity: 0.42; cursor: not-allowed; filter: none; transform: none; }

.rank-showcase {
    width: 220px;
    min-height: 242px;
    margin-left: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(140, 185, 255, 0.23);
    clip-path: polygon(12% 0, 88% 0, 100% 12%, 100% 88%, 88% 100%, 12% 100%, 0 88%, 0 12%);
    background: linear-gradient(160deg, rgba(35, 70, 116, 0.6), rgba(10, 18, 30, 0.95));
    text-align: center;
}

.rank-showcase > .material-symbols-outlined { font-size: 52px; color: var(--primary); filter: drop-shadow(0 0 16px rgba(140, 185, 255, 0.45)); }
.rank-showcase > small { margin-top: 11px; color: var(--muted); font-size: 0.5rem; letter-spacing: 0.14em; }
.rank-showcase > strong { margin-top: 2px; font-size: 2.5rem; }
.rank-showcase > span:not(.material-symbols-outlined) { color: var(--primary-strong); font-size: 0.68rem; font-weight: 800; }
.rank-stats { width: 100%; margin-top: 18px; padding-top: 14px; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--outline); }
.rank-stats span { color: var(--muted); font-size: 0.5rem; }
.rank-stats b { display: block; color: var(--text); font-size: 0.72rem; }

.platform-section { margin-top: 26px; padding: 24px; border: 1px solid var(--outline); border-radius: 18px; background: rgba(14, 19, 28, 0.86); box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2); }
.platform-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.platform-section-heading h2 { margin-top: 3px; font-size: 1.3rem; }
.section-note { color: var(--muted); font-size: 0.58rem; }

.matchmaking-modes { margin-top: 18px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.mode-card { position: relative; min-height: 128px; overflow: hidden; padding: 18px 12px; display: flex; flex-direction: column; align-items: flex-start; border: 1px solid rgba(140, 185, 255, 0.13); border-radius: 13px; background: linear-gradient(145deg, rgba(34, 45, 62, 0.75), rgba(15, 20, 29, 0.95)); cursor: pointer; text-align: left; }
.mode-card::after { content: ""; position: absolute; width: 80px; height: 80px; right: -30px; bottom: -35px; border: 12px solid rgba(140, 185, 255, 0.05); border-radius: 50%; }
.mode-card:hover { border-color: rgba(140, 185, 255, 0.48); background: linear-gradient(145deg, rgba(37, 69, 108, 0.8), rgba(15, 22, 34, 0.98)); transform: translateY(-2px); }
.mode-card.active { border-color: var(--primary); box-shadow: inset 0 0 0 1px rgba(140, 185, 255, 0.25), 0 0 24px rgba(92, 153, 236, 0.12); }
.mode-card span { color: var(--primary-strong); font-size: 1.7rem; font-weight: 900; }
.mode-card small { margin-top: 8px; color: var(--text); font-size: 0.56rem; font-weight: 900; letter-spacing: 0.12em; }
.mode-card b { margin-top: auto; color: var(--muted); font-size: 0.48rem; }

.queue-status-card,
.active-match-card { margin-top: 14px; min-height: 74px; padding: 14px 16px; display: grid; grid-template-columns: 42px 1fr auto auto; align-items: center; gap: 13px; border: 1px solid rgba(140, 185, 255, 0.34); border-radius: 13px; background: rgba(16, 36, 61, 0.72); }
.queue-status-card strong, .queue-status-card span, .active-match-card small, .active-match-card strong, .active-match-card span { display: block; }
.queue-status-card span, .active-match-card span { margin-top: 3px; color: var(--muted); font-size: 0.58rem; }
.queue-status-card time { color: var(--primary); font-size: 1.05rem; font-weight: 900; }
.queue-spinner { color: var(--primary); font-size: 30px; animation: radarSpin 1.8s linear infinite; }
.compact-danger-button { min-height: 32px; padding: 0 11px; border: 1px solid rgba(255, 118, 109, 0.35); border-radius: 8px; background: rgba(255, 80, 70, 0.08); color: var(--danger); cursor: pointer; font-size: 0.55rem; font-weight: 900; }
.active-match-card { border-color: rgba(114, 217, 149, 0.42); background: rgba(18, 60, 42, 0.58); }
.active-match-card > .material-symbols-outlined { color: var(--success); font-size: 31px; }
.active-match-card small { color: var(--success); font-size: 0.5rem; letter-spacing: 0.13em; }

.custom-match-grid { margin-top: 17px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.platform-card { position: relative; overflow: hidden; padding: 20px; border: 1px solid var(--outline); border-radius: 14px; background: rgba(8, 12, 18, 0.58); }
.platform-card h3 { font-size: 0.88rem; }
.platform-card p { margin-top: 7px; color: var(--muted); font-size: 0.65rem; line-height: 1.5; }
.platform-card label { margin-top: 14px; display: block; color: var(--muted); font-size: 0.55rem; font-weight: 800; }
.platform-card input, .platform-card select, .rail-card input, .rail-card select { width: 100%; min-height: 38px; margin-top: 6px; padding: 0 10px; border: 1px solid var(--outline); border-radius: 8px; background: rgba(4, 7, 11, 0.65); color: var(--text); }
.platform-card .platform-secondary-action { margin-top: 14px; }
.card-watermark { position: absolute; right: 17px; top: 17px; color: rgba(140, 185, 255, 0.12); font-size: 44px; }
.compact-heading { margin-top: 20px; align-items: center; }
.compact-heading h3 { font-size: 0.74rem; }
.text-action { border: 0; background: transparent; color: var(--primary); cursor: pointer; font-size: 0.6rem; font-weight: 800; }
.open-rooms-list { margin-top: 10px; display: grid; gap: 7px; }
.room-row { min-height: 54px; padding: 9px 12px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; border: 1px solid var(--outline); border-radius: 10px; background: rgba(7, 11, 17, 0.55); }
.room-row strong, .room-row span { display: block; }
.room-row span { margin-top: 2px; color: var(--muted); font-size: 0.55rem; }
.room-row code { color: var(--primary); font-size: 0.65rem; }
.empty-row { padding: 18px; border: 1px dashed var(--outline); border-radius: 10px; color: var(--muted); font-size: 0.62rem; text-align: center; }

.platform-rail { display: flex; flex-direction: column; gap: 14px; }
.rail-card { padding: 18px; border: 1px solid var(--outline); border-radius: 16px; background: rgba(15, 20, 29, 0.92); box-shadow: 0 18px 45px rgba(0, 0, 0, 0.2); }
.rail-heading { display: flex; align-items: center; justify-content: space-between; }
.rail-heading h2 { font-size: 0.82rem; }
.rail-heading > span { color: var(--muted); font-size: 0.62rem; }
.rail-inline-form { margin-top: 12px; display: grid; grid-template-columns: 1fr 38px; gap: 6px; }
.rail-inline-form input { margin: 0; }
.rail-inline-form button { border: 1px solid rgba(140, 185, 255, 0.25); border-radius: 8px; background: rgba(140, 185, 255, 0.08); color: var(--primary); cursor: pointer; }
.compact-list { margin-top: 12px; display: grid; gap: 6px; }
.compact-person, .compact-war { min-height: 46px; padding: 7px 8px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; border: 1px solid rgba(169, 178, 193, 0.1); border-radius: 9px; background: rgba(5, 8, 13, 0.35); }
.compact-person .platform-avatar { width: 32px; height: 32px; flex-basis: 32px; border-radius: 9px; }
.compact-person strong, .compact-person small { display: block; }
.compact-person strong { overflow: hidden; font-size: 0.64rem; text-overflow: ellipsis; white-space: nowrap; }
.compact-person small { margin-top: 2px; color: var(--muted); font-size: 0.5rem; }
.compact-actions { display: flex; gap: 4px; }
.compact-actions button, .room-row button { min-height: 28px; padding: 0 8px; border: 1px solid var(--outline); border-radius: 7px; background: rgba(140, 185, 255, 0.06); color: var(--primary); cursor: pointer; font-size: 0.52rem; font-weight: 800; }
.clan-card p { margin: 12px 0; color: var(--muted); font-size: 0.62rem; line-height: 1.45; }
.clan-card input, .clan-card select { margin-top: 7px; }
.clan-card .platform-secondary-action { width: 100%; margin-top: 8px; }
.clan-avatar-picker { min-height: 38px; margin-top: 7px; padding: 0 10px; display: flex; align-items: center; gap: 8px; border: 1px dashed rgba(140, 185, 255, 0.32); border-radius: 8px; color: var(--primary); cursor: pointer; font-size: 0.57rem; }
.clan-avatar-picker:hover { background: rgba(140, 185, 255, 0.06); }
.rail-divider { margin: 13px 0 5px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.5rem; }
.rail-divider::before, .rail-divider::after { content: ""; height: 1px; flex: 1; background: var(--outline); }
.clan-identity { margin-top: 14px; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; }
.clan-identity .platform-avatar { width: 44px; height: 44px; }
.clan-identity small, .clan-identity strong { display: block; }
.clan-identity small { color: var(--primary); font-size: 0.52rem; font-weight: 900; }
.clan-identity strong { margin-top: 2px; font-size: 0.7rem; }
.clan-identity b { color: var(--energy); font-size: 0.72rem; }
.clan-leave-action { margin-top: 10px; color: #ff9aab; }
.clan-war-controls { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--outline); }
.clan-war-controls h3 { font-size: 0.65rem; }
.compact-war { grid-template-columns: 1fr auto; }
.compact-war strong, .compact-war small { display: block; }
.compact-war strong { font-size: 0.6rem; }
.compact-war small { margin-top: 3px; color: var(--muted); font-size: 0.49rem; }

.platform-toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: 380px; padding: 12px 15px; border: 1px solid rgba(140, 185, 255, 0.35); border-radius: 10px; background: rgba(15, 24, 37, 0.98); box-shadow: var(--shadow); font-size: 0.66rem; animation: feedIn 0.2s ease-out; }
.platform-toast.error { border-color: rgba(255, 118, 109, 0.45); color: #ffb4ab; }
.profile-modal { position: fixed; z-index: 1200; inset: 0; display: grid; place-items: center; padding: 20px; }
.profile-modal-backdrop { position: absolute; inset: 0; background: rgba(2, 4, 8, 0.78); backdrop-filter: blur(8px); }
.profile-modal-card { position: relative; width: min(520px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 28px; border-radius: 20px; }
.profile-modal-card > .mini-icon-button { position: absolute; top: 14px; right: 14px; }
.profile-dialog-head { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 16px; }
.profile-dialog-head .platform-avatar { width: 72px; height: 72px; border-radius: 18px; }
.profile-dialog-head h2 { font-size: 1.15rem; }
.profile-dialog-head span { display: block; margin-top: 4px; color: var(--primary); font-size: 0.65rem; }
.profile-dialog-stats { margin-top: 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.profile-dialog-stats div { padding: 12px 6px; border: 1px solid var(--outline); border-radius: 10px; text-align: center; }
.profile-dialog-stats b, .profile-dialog-stats small { display: block; }
.profile-dialog-stats b { font-size: 0.9rem; }
.profile-dialog-stats small { margin-top: 3px; color: var(--muted); font-size: 0.48rem; }
.profile-dialog-bio { margin-top: 17px; color: var(--muted); font-size: 0.68rem; line-height: 1.5; }

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

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes feedIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes loading {
    from { transform: translateX(-100%); }
    to { transform: translateX(200%); }
}

@keyframes tacticalIn {
    from { opacity: 0; transform: translate(-50%, -8px) scale(0.96); filter: blur(3px); }
    to { opacity: 1; transform: translateX(-50%) scale(1); filter: blur(0); }
}

@keyframes readoutScan {
    from { left: -25%; }
    to { left: 115%; }
}

@keyframes screenImpact {
    0% { transform: translate(0); filter: brightness(1); }
    8% { transform: translate(-7px, 4px); filter: brightness(1.8) saturate(1.7); }
    18% { transform: translate(6px, -4px); }
    32% { transform: translate(-4px, -2px); filter: brightness(1.18); }
    48% { transform: translate(3px, 2px); }
    70% { transform: translate(-1px, 1px); }
    100% { transform: translate(0); filter: brightness(1); }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

@media (max-width: 1050px) {
    .top-hud {
        grid-template-columns: 140px 1fr 190px;
    }

    .brand-block strong {
        font-size: 0.75rem;
    }

    .grid-stats {
        gap: 18px;
    }

    .profile-panel {
        width: 250px;
    }

    .chat-panel {
        width: 280px;
    }

    .board-hud {
        right: 304px;
    }

    .ability-card {
        width: 68px;
        flex-basis: 68px;
    }
}

@media (max-width: 800px) {
    .top-hud {
        top: 7px;
        left: 7px;
        right: 7px;
        height: 58px;
        grid-template-columns: 42px 1fr 164px;
        padding: 0 8px;
        border-radius: 16px;
    }

    #toggle-leaderboard-btn {
        display: none;
    }

    .brand-block > div,
    .size-stat,
    .progress-stat {
        display: none;
    }

    .brand-icon {
        font-size: 25px;
    }

    .grid-stats {
        justify-content: flex-start;
        gap: 14px;
    }

    .stat-box {
        min-width: 44px;
    }

    .stat-label {
        font-size: 0.48rem;
    }

    .stat-val {
        font-size: 0.78rem;
    }

    .icon-button {
        width: 35px;
        height: 35px;
    }

    .profile-panel {
        top: 74px;
        left: 8px;
        width: 196px;
        padding: 10px;
        border-radius: 16px;
    }

    .profile-heading {
        gap: 7px;
    }

    .avatar-glow {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        border-radius: 11px;
    }

    .level-badge {
        width: 32px;
        height: 32px;
    }

    .profile-numbers,
    .xp-block,
    .missions-block,
    .shield-indicator,
    .profile-action-button {
        display: none;
    }

    .profile-panel.profile-expanded {
        right: 8px;
        width: auto;
        max-height: calc(100dvh - 178px);
        padding: 16px;
        overflow-y: auto;
        z-index: 82;
    }

    .profile-panel.profile-expanded .avatar-glow {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }

    .profile-panel.profile-expanded .profile-numbers {
        display: grid;
    }

    .profile-panel.profile-expanded .xp-block,
    .profile-panel.profile-expanded .missions-block {
        display: block;
    }

    .profile-panel.profile-expanded .shield-indicator {
        display: flex;
    }

    .profile-panel.profile-expanded .profile-action-button {
        display: flex;
    }

    .leaderboard-panel {
        top: 74px;
        left: 8px;
        right: 8px;
        width: auto;
        max-height: calc(100dvh - 178px);
    }

    .chat-panel {
        top: 74px;
        right: 8px;
        bottom: 102px;
        width: min(340px, calc(100vw - 16px));
    }

    .ability-dock {
        left: 7px;
        right: 7px;
        bottom: max(7px, env(safe-area-inset-bottom));
        max-width: none;
        min-height: 76px;
        overflow-x: auto;
        transform: none;
        justify-content: flex-start;
        border-radius: 19px;
        scrollbar-width: none;
    }

    .ability-dock::-webkit-scrollbar {
        display: none;
    }

    .energy-core {
        width: 56px;
        flex-basis: 56px;
        position: sticky;
        left: 0;
        z-index: 5;
        background: rgba(18, 23, 33, 0.98);
        border-radius: 15px;
    }

    .ability-card {
        width: 64px;
        min-width: 64px;
        flex-basis: 64px;
        min-height: 58px;
    }

    .ability-name {
        display: none;
    }

    .ability-cost {
        grid-column: 1 / -1;
        padding: 0 0 4px;
        text-align: center;
    }

    .dock-info-button {
        min-height: 58px;
    }

    .board-hud {
        right: 8px;
        bottom: 86px;
    }

    .event-feed {
        left: 8px;
        bottom: 94px;
        width: calc(100vw - 120px);
    }

    .world-event-banner,
    .action-prompt {
        top: 74px;
    }

    .world-event-banner {
        min-width: 0;
        width: calc(100vw - 24px);
    }

    .tactical-readout {
        top: 74px;
        width: calc(100vw - 24px);
        min-height: 58px;
        padding: 7px 10px;
        grid-template-columns: 28px 1fr auto;
        gap: 7px;
    }

    .readout-icon {
        font-size: 24px;
    }

    .readout-value {
        grid-column: auto;
        min-width: 38px;
        font-size: 1rem;
        text-align: right;
    }

    .world-event-banner:not(.hidden) + .action-prompt,
    .world-event-banner:not(.hidden) ~ .tactical-readout {
        top: 126px;
    }

    .ability-tooltip {
        bottom: 88px;
        width: calc(100vw - 16px);
        grid-template-columns: 28px 1fr;
    }

    .ability-tooltip-meta {
        grid-column: 2;
        display: flex;
        justify-items: initial;
        gap: 8px;
    }

    .ability-guide-panel {
        left: 8px;
        right: 8px;
        bottom: 96px;
        width: auto;
        max-height: calc(100dvh - 180px);
        transform: none;
    }

    .ability-guide-panel.panel-hidden {
        transform: translateY(14px) scale(0.98);
    }

    .ability-guide-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .modal-content {
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
        padding: 26px 18px;
    }

    .instruction-grid {
        grid-template-columns: 1fr;
    }

    .world-event-banner {
        grid-template-columns: 28px 1fr auto;
    }

    .event-icon {
        font-size: 23px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 1180px) {
    .platform-header { grid-template-columns: 210px 1fr 230px; }
    .platform-content { grid-template-columns: 1fr; }
    .platform-rail { display: grid; grid-template-columns: repeat(3, 1fr); align-items: start; }
}

@media (max-width: 820px) {
    .platform-header { height: 62px; padding: 0 10px; grid-template-columns: 1fr auto; }
    .platform-nav { position: fixed; z-index: 50; right: 8px; bottom: 8px; left: 8px; height: 54px; padding: 0 8px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; border: 1px solid var(--outline); border-radius: 14px; background: rgba(10, 14, 21, 0.96); box-shadow: var(--shadow); }
    .platform-nav a { font-size: 0.52rem; }
    .platform-brand small, .platform-profile-button > span:nth-child(2), .platform-account > .mini-icon-button { display: none; }
    .platform-profile-button { min-width: 0; padding: 0; }
    .platform-content { width: calc(100vw - 20px); padding-top: 12px; padding-bottom: 80px; }
    .platform-hero { min-height: 0; padding: 28px 22px; grid-template-columns: 1fr; }
    .hero-copy { min-width: 0; overflow-wrap: anywhere; }
    .rank-showcase { width: 100%; min-height: 150px; display: grid; grid-template-columns: 58px minmax(0, 1fr); text-align: left; clip-path: none; border-radius: 14px; }
    .rank-showcase > .material-symbols-outlined { grid-row: 1 / 4; }
    .rank-showcase > small, .rank-showcase > strong, .rank-showcase > span { margin: 0; }
    .rank-stats { grid-column: 1 / 3; margin-top: 8px; }
    .platform-section { padding: 17px 12px; }
    .matchmaking-modes { grid-template-columns: repeat(5, 112px); overflow-x: auto; padding-bottom: 5px; }
    .mode-card { min-height: 110px; }
    .custom-match-grid { grid-template-columns: 1fr; }
    .platform-rail { grid-template-columns: 1fr; }
    .queue-status-card, .active-match-card { grid-template-columns: 36px 1fr; }
    .queue-status-card time, .queue-status-card button, .active-match-card > button { grid-column: span 1; }
}

@media (max-width: 480px) {
    .platform-brand > .material-symbols-outlined { width: 34px; height: 34px; }
    .platform-brand strong { font-size: 0.72rem; }
    .platform-hero { padding: 24px 17px; }
    .hero-copy h1 { font-size: 1.65rem; line-height: 1.04; }
    .hero-copy p { font-size: 0.72rem; }
    .hero-actions { display: grid; }
    .hero-actions > * { width: 100%; }
    .rank-showcase { padding: 16px; }
    .platform-section-heading { align-items: flex-start; }
    .section-note { max-width: 110px; text-align: right; }
    .profile-dialog-stats { grid-template-columns: repeat(2, 1fr); }
}
