:root {
    --bg-0: #070b1a;
    --bg-1: #0b1228;
    --ink: #e8ecf8;
    --ink-dim: #9aa6c8;
    --ink-faint: #5f6b8f;
    --accent: #7aa2ff;
    --accent-2: #b48cff;
    --accent-3: #6ee7d8;
    --success: #4ade80;
    --danger: #f87171;
    --warning: #fbbf24;
    --glass: rgba(13, 19, 42, 0.82);
    --glass-soft: rgba(148, 168, 255, 0.07);
    --glass-strong: rgba(148, 168, 255, 0.14);
    --line: rgba(148, 168, 255, 0.16);
    --line-hover: rgba(122, 162, 255, 0.5);
    --glow: 0 0 0 3px rgba(122, 162, 255, 0.28);
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    --radius: 18px;
    --radius-sm: 10px;
    --font: "Noto Sans TC", "Ubuntu", system-ui, sans-serif;
    --font-game: "Ubuntu", "Noto Sans TC", sans-serif;

    --bs-body-font-family: var(--font);
    --bs-body-bg: var(--bg-0);
    --bs-body-color: var(--ink);
    --bs-border-color: var(--line);
    --bs-link-color-rgb: 122, 162, 255;
    --bs-link-hover-color-rgb: 180, 140, 255;
    --bs-focus-ring-color: rgba(122, 162, 255, 0.28);
}

html,
body {
    position: fixed;
    width: 100%;
    height: 100%;
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg-0);
    overflow: hidden;
    user-select: none;
    -webkit-text-size-adjust: none;
}

body {
    cursor: url("../img/cursor.cur"), auto;
}

a,
button,
select,
label,
.btn {
    cursor: url("../img/cursor.link.cur"), pointer;
}

a {
    text-decoration: none;
    color: var(--accent);
}

a:hover {
    color: var(--accent-2);
}

input,
textarea {
    user-select: text;
}

kbd {
    padding: 2px 7px;
    border: 1px solid var(--line);
    font-family: var(--font-game);
    font-size: 12px;
    color: var(--ink);
    background: var(--glass-strong);
    border-radius: 6px;
    box-shadow: none;
}

code {
    color: var(--accent-3);
}

.announcement code {
    font-family: var(--font-game);
    font-size: inherit;
}

.btn:focus,
.btn:active,
.btn:focus-visible,
button:focus {
    outline: none;
    box-shadow: none;
}

.btn:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: none;
    box-shadow: var(--glow);
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 168, 255, 0.25);
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 168, 255, 0.45);
}

#canvas,
#canvas-gl {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 0;
    display: block;
}

#canvas {
    z-index: 1;
}

#canvas-gl[style*="display: none"] {
    display: none !important;
}

.option-item.disabled {
    opacity: 0.45;
    pointer-events: none;
}

#minimap-layer {
    position: fixed;
    right: 0;
    bottom: 0;
    z-index: 5;
    pointer-events: none;
}

#signal-layer {
    position: fixed;
    inset: 0;
    z-index: 4;
    overflow: hidden;
    pointer-events: none;
}

.signal-marker {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    --signal-color: #facc15;
}

.signal-ping {
    position: absolute;
    top: -18px;
    left: -18px;
    width: 36px;
    height: 36px;
    border: 3px solid var(--signal-color);
    border-radius: 50%;
    animation: signal-ping 1s ease-out infinite;
}

.signal-ping.delayed {
    animation-delay: 0.5s;
}

.signal-arrow {
    position: absolute;
    top: -9px;
    left: -9px;
    display: none;
    width: 18px;
    height: 18px;
    font-size: 18px;
    line-height: 18px;
    text-align: center;
    color: var(--signal-color);
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.8));
    transform: rotate(var(--signal-angle, 0rad));
}

.signal-label {
    position: absolute;
    bottom: 24px;
    left: 0;
    padding: 2px 8px;
    border-left: 3px solid var(--signal-color);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    color: #fff;
    background: rgba(8, 12, 28, 0.78);
    border-radius: 6px;
    transform: translateX(-50%);
}

.signal-marker.offscreen .signal-ping {
    display: none;
}

.signal-marker.offscreen .signal-arrow {
    display: block;
}

.signal-marker.offscreen .signal-label {
    bottom: 14px;
}

@keyframes signal-ping {
    from {
        opacity: 1;
        transform: scale(0.3);
    }

    to {
        opacity: 0;
        transform: scale(1.6);
    }
}

.signal-wheel {
    position: fixed;
    z-index: 30;
    width: 0;
    height: 0;
    pointer-events: none;
}

.signal-wheel::before {
    position: absolute;
    top: -112px;
    left: -112px;
    width: 224px;
    height: 224px;
    background: radial-gradient(circle, rgba(8, 12, 28, 0.55) 0, rgba(8, 12, 28, 0.35) 62%, transparent 72%);
    border-radius: 50%;
    content: "";
}

.signal-option {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border: 1px solid var(--line);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    color: var(--ink-dim);
    background: var(--glass);
    border-radius: 50%;
    transform: translate(-50%, -50%) rotate(var(--angle)) translate(78px) rotate(calc(-1 * var(--angle)));
    transition: color 0.12s, background 0.12s, border-color 0.12s;
}

.signal-option i {
    font-size: 18px;
}

.signal-option.center {
    width: 54px;
    height: 54px;
    transform: translate(-50%, -50%);
}

.signal-option.active {
    border-color: var(--accent);
    color: #fff;
    background: rgba(122, 162, 255, 0.45);
}

.glass-card {
    position: relative;
    padding: 18px;
    border: 1px solid var(--line);
    background: var(--glass);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.card-title {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
}

.card-title i {
    color: var(--accent);
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--line);
    font-size: 16px;
    color: var(--ink-dim);
    background: var(--glass-soft);
    border-radius: 12px;
    transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s;
}

.icon-btn:hover {
    border-color: var(--line-hover);
    color: #fff;
    background: var(--glass-strong);
    transform: translateY(-2px);
}

.btn-glass {
    border: 1px solid var(--line);
    font-weight: 500;
    color: var(--ink);
    background: var(--glass-soft);
    border-radius: 12px;
    transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.2s;
}

.btn-glass:hover,
.btn-glass:active {
    border-color: var(--line-hover);
    color: #fff;
    background: var(--glass-strong);
}

.btn-play {
    width: 100%;
    padding: 12px;
    border: none;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #0b1026;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(122, 162, 255, 0.35);
    transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}

.btn-play:hover,
.btn-play:active {
    color: #0b1026;
    box-shadow: 0 14px 36px rgba(180, 140, 255, 0.45);
    filter: brightness(1.08);
    transform: translateY(-2px);
}

.btn i {
    margin-right: 4px;
}

.form-control,
.input-group-text {
    border-color: var(--line);
    color: var(--ink);
    background-color: rgba(7, 11, 26, 0.6);
}

.form-control:focus {
    border-color: var(--accent);
    color: #fff;
    background-color: rgba(7, 11, 26, 0.8);
    box-shadow: var(--glow);
}

.form-control::placeholder {
    color: var(--ink-faint);
}

.input-group-text {
    color: var(--ink-dim);
}

.form-check-input {
    border-color: var(--line-hover);
    background-color: rgba(7, 11, 26, 0.6);
}

.form-check-input:checked {
    border-color: var(--accent);
    background-color: var(--accent);
}

.form-check-input:focus {
    border-color: var(--accent);
    box-shadow: var(--glow);
}

.form-range::-webkit-slider-thumb {
    background: var(--accent);
}

.form-range::-webkit-slider-runnable-track {
    background: rgba(148, 168, 255, 0.2);
}

.form-range:focus::-webkit-slider-thumb {
    box-shadow: var(--glow);
}

.tag {
    flex-shrink: 0;
    padding: 2px 8px;
    border: 1px solid;
    font-size: 11px;
    font-weight: 600;
    font-style: normal;
    line-height: 1.4;
    white-space: nowrap;
    border-radius: 999px;
}

.tag-party {
    border-color: rgba(180, 140, 255, 0.4);
    color: #cdb4ff;
    background: rgba(180, 140, 255, 0.1);
}

.tag-perf {
    border-color: rgba(110, 231, 216, 0.35);
    color: #9ff0e6;
    background: rgba(110, 231, 216, 0.08);
}

.tag-cost {
    border-color: rgba(251, 146, 60, 0.4);
    color: #fdba74;
    background: rgba(251, 146, 60, 0.1);
}

#overlays {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(ellipse 80% 60% at 70% -10%, rgba(26, 38, 80, 0.75) 0, transparent 60%),
        radial-gradient(ellipse 60% 50% at 10% 110%, rgba(37, 26, 74, 0.75) 0, transparent 60%),
        rgba(7, 11, 26, 0.55);
    opacity: 0;
    overflow-y: auto;
}

.menu-wrap {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
    margin: auto;
}

.ad-card {
    position: relative;
    border: 1px solid var(--line);
    line-height: 0;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.ad-card[hidden] {
    display: none !important;
}

.ad-label {
    position: absolute;
    top: 4px;
    left: 8px;
    z-index: 1;
    font-size: 10px;
    line-height: 1.4;
    color: var(--ink-faint);
    pointer-events: none;
}

.ad-banner {
    width: 730px;
    max-width: 100%;
}

.ad-rect {
    width: 300px;
    height: 250px;
    margin-top: auto;
}

.ad-card:not(.ad-preview):not(:has(ins[data-ad-status="filled"])) {
    visibility: hidden;
}

.ad-card:has(ins[data-ad-status="unfilled"]) {
    display: none !important;
}

.ad-preview {
    border: 2px dashed rgba(251, 191, 36, 0.6);
    background: rgba(251, 191, 36, 0.06);
}

.ad-preview::after {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--font-game);
    font-size: 14px;
    line-height: 1.4;
    color: #fcd34d;
    content: attr(data-preview);
}

#stats {
    overflow-y: auto;
}

.stats-layout {
    display: flex;
    gap: 24px;
    align-items: stretch;
    margin: auto;
}

.stats-layout:not(:has(ins[data-ad-status="filled"])) {
    align-items: center;
}

.ad-skyscraper {
    flex-shrink: 0;
    align-self: center;
    width: 160px;
    height: 600px;
}

@media (max-width: 1100px) {
    .ad-skyscraper {
        display: none !important;
    }
}

.menu-grid {
    display: grid;
    grid-template-columns: 300px 440px 300px;
    gap: 18px;
    align-items: stretch;
    width: max-content;
    max-width: 100%;
    margin: auto;
}

.menu-column {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.profile-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.skin-preview-container {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: center;
}

.skin-preview {
    position: relative;
    width: 96px;
    height: 96px;
    border: 3px solid var(--accent);
    background: radial-gradient(circle at 30% 30%, rgba(122, 162, 255, 0.25), rgba(7, 11, 26, 0.9));
    border-radius: 50%;
    box-shadow: 0 0 24px rgba(122, 162, 255, 0.25);
    overflow: hidden;
}

.skin-preview-sub {
    width: 72px;
    height: 72px;
    border-color: var(--accent-2);
    box-shadow: 0 0 20px rgba(180, 140, 255, 0.2);
}

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

.skin-preview.invalid-skin img {
    display: none;
}

.skin-preview.invalid-skin::after {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Font Awesome 7 Free";
    font-size: 34px;
    font-weight: 900;
    color: var(--ink-faint);
    content: "\f007";
}

.skin-preview-sub.invalid-skin::after {
    font-size: 26px;
}

.profile-name-row {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.profile-name-row.clickable {
    width: fit-content;
    margin-right: auto;
    margin-left: auto;
    padding: 2px 10px;
    border-radius: 10px;
    transition: background 0.2s;
    cursor: pointer;
}

.profile-name-row.clickable:hover {
    background: var(--glass-soft);
}

.profile-card-icon {
    font-size: 15px;
    color: var(--ink-faint);
    transition: color 0.2s;
}

.profile-name-row.clickable:hover .profile-card-icon {
    color: var(--accent);
}

.profile-avatar {
    width: 26px;
    height: 26px;
    border: 1px solid var(--line);
    border-radius: 50%;
}

.profile-name {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
}

.profile-hint {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
    word-break: keep-all;
    overflow-wrap: anywhere;
    color: var(--ink-faint);
}

.friends-btn {
    width: 100%;
    margin-top: 8px;
}

.friends-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 0 7px;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
    color: #03202e;
    background: var(--success);
    border-radius: 999px;
}

.friends-badge.pending {
    color: #fff;
    background: var(--danger);
}

.friends-badge.event {
    position: absolute;
    top: -12px;
    right: -8px;
    margin-left: 0;
    padding: 0 6px 1px;
    font-size: 11px;
    line-height: 15px;
    color: #fff;
    background: #f97316;
    clip-path: inset(0 round 999px);
}

.quality-item {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    margin-bottom: 4px;
}

.quality-item .form-select {
    width: 260px;
    max-width: 100%;
}

.quality-item > .info-tip {
    margin-left: -6px;
}

.quality-item:has(.perf-analyze),
.language-item {
    margin-bottom: 18px;
}

.info-tip {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-left: 6px;
    padding: 0;
    border: none;
    font-size: 15px;
    letter-spacing: 0;
    vertical-align: middle;
    color: var(--ink-faint);
    background: none;
    border-radius: 50%;
    transition: color 0.2s;
    cursor: help;
}

.info-tip:hover,
.info-tip:focus-visible,
.info-tip.open {
    color: var(--accent);
}

.info-pop {
    position: fixed;
    z-index: 1000;
    max-width: min(320px, calc(100vw - 16px));
    padding: 8px 12px;
    border: 1px solid var(--line);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.6;
    white-space: pre-line;
    word-break: keep-all;
    overflow-wrap: anywhere;
    color: var(--ink);
    background: #111a36;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

.info-pop[hidden] {
    display: none;
}

.perf-analyze {
    display: flex;
    align-items: center;
}

.perf-report {
    margin: 0 0 18px;
    padding: 14px;
    border: 1px solid var(--line);
    background: var(--glass-soft);
    border-radius: 12px;
}

.perf-head {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.perf-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.perf-rating {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 3px 10px;
    border: 1px solid;
    font-size: 13px;
    font-weight: 700;
    border-radius: 999px;
}

.perf-good {
    border-color: rgba(74, 222, 128, 0.4);
    color: var(--success);
}

.perf-fair {
    border-color: rgba(251, 191, 36, 0.4);
    color: var(--warning);
}

.perf-poor {
    border-color: rgba(248, 113, 113, 0.4);
    color: var(--danger);
}

.perf-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.perf-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    background: rgba(7, 11, 26, 0.45);
    border-radius: 10px;
}

.perf-metric span {
    font-size: 12px;
    color: var(--ink-dim);
}

.perf-metric strong {
    font-family: var(--font-game);
    font-size: 18px;
}

.perf-chart {
    position: relative;
    margin-bottom: 8px;
}

.perf-chart svg {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
}

.perf-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linejoin: round;
}

.perf-baseline {
    stroke: var(--line);
}

.perf-ref {
    stroke: var(--ink-faint);
    stroke-dasharray: 4 4;
}

.perf-axis {
    font-size: 11px;
    fill: var(--ink-faint);
}

.perf-spike {
    fill: #fb923c;
    stroke: var(--bg-0);
    stroke-width: 2;
}

.perf-peak {
    font-size: 11px;
    font-weight: 700;
    fill: #fdba74;
}

.perf-cursor {
    stroke: var(--ink-dim);
    stroke-width: 1;
}

.perf-dot {
    fill: var(--accent);
    stroke: var(--bg-0);
    stroke-width: 2;
}

.perf-hit {
    fill: transparent;
    cursor: crosshair;
}

.perf-tooltip {
    position: absolute;
    padding: 4px 8px;
    border: 1px solid var(--line);
    font-size: 12px;
    white-space: nowrap;
    background: var(--glass);
    border-radius: 8px;
    transform: translate(-50%, -100%);
    pointer-events: none;
}

.perf-summary {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--ink-dim);
}

.perf-suggestions {
    display: grid;
    gap: 6px;
    margin: 8px 0 10px;
    padding: 0;
    list-style: none;
}

.perf-suggestions li {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: rgba(7, 11, 26, 0.45);
    border-radius: 10px;
}

.perf-suggestions li div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.perf-suggestions li strong {
    font-size: 14px;
}

.perf-suggestions li span {
    font-size: 12px;
    color: var(--ink-faint);
}

.perf-suggestions .btn {
    flex-shrink: 0;
}

.perf-report .settings-hint {
    margin-bottom: 0;
}

.perf-net-head {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.pill-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    background: rgba(7, 11, 26, 0.5);
    border-radius: 12px;
}

.pill-tab {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 6px 14px;
    border: none;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-dim);
    background: transparent;
    border-radius: 9px;
    transition: background 0.2s, color 0.2s;
}

.pill-tab:hover {
    color: #fff;
}

.pill-tab.active {
    color: #fff;
    background: var(--glass-strong);
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    min-width: 20px;
    padding: 0 7px;
    font-family: var(--font-game);
    font-size: 11.5px;
    font-weight: 700;
    color: #0b1026;
    background: var(--accent);
    border-radius: 999px;
}

.tab-count:empty {
    display: none;
}

.settings-tab-panel[data-tab="media"].active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.media-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.media-usage {
    font-size: 12px;
    color: var(--ink-faint);
}

.media-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.media-options .option-item {
    margin: 0;
}

.media-field {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 13px;
    color: var(--ink-dim);
}

.media-field .form-select {
    width: 140px;
}

.media-main {
    flex: 1;
    min-height: 0;
    padding: 4px 4px 0 0;
    overflow-y: auto;
}

.media-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    align-content: start;
    min-height: 100%;
}

.media-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--ink-dim);
    user-select: none;
}

.media-empty-hint {
    font-size: 12.5px;
    text-align: center;
    color: var(--ink-faint);
}

.media-empty-icon {
    margin-bottom: 6px;
    font-size: 34px;
    color: var(--accent);
    opacity: 0.55;
    animation: empty-float 4.2s ease-in-out infinite;
}

@keyframes empty-float {
    0%,
    100% {
        opacity: 0.45;
        transform: translateY(0);
    }

    50% {
        opacity: 0.7;
        transform: translateY(-3px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .media-empty-icon {
        animation: none;
    }
}

.media-notes-box {
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--ink-dim);
}

.media-notes-box summary {
    width: fit-content;
    color: var(--ink-faint);
    cursor: pointer;
}

.media-notes {
    margin: 6px 0 0;
    padding-left: 18px;
    line-height: 1.7;
}

.media-item {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    background: var(--glass-soft);
    border-radius: 12px;
    transition: border-color 0.2s, transform 0.2s;
    overflow: hidden;
}

.media-item:hover {
    border-color: var(--line-hover);
    transform: translateY(-2px);
}

.media-thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    padding: 0;
    border: none;
    background: #05070f;
    cursor: pointer;
    overflow: hidden;
}

.media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-thumb .media-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 30px;
    color: #fff;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity 0.2s;
}

.media-thumb:hover .media-play {
    opacity: 1;
}

.media-label,
.media-duration {
    position: absolute;
    padding: 1px 7px;
    font-size: 11.5px;
    font-weight: 700;
    border-radius: 6px;
}

.media-label {
    top: 8px;
    left: 8px;
    color: #fff;
    background: rgba(122, 162, 255, 0.85);
}

.media-label.death {
    background: rgba(248, 113, 113, 0.9);
}

.media-label.record {
    background: rgba(192, 132, 252, 0.9);
}

.media-label.file {
    background: rgba(148, 163, 184, 0.85);
}

.media-duration {
    right: 8px;
    bottom: 8px;
    font-family: var(--font-game);
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
}

.media-info {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 8px 8px 8px 12px;
}

.media-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.media-date {
    font-size: 12.5px;
    line-height: 1.35;
    text-overflow: ellipsis;
    color: var(--ink-dim);
    overflow: hidden;
}

.media-sub {
    font-family: var(--font-game);
    font-size: 11.5px;
    color: var(--ink-faint);
}

.editor-card {
    display: flex;
    flex-direction: column;
    width: min(1200px, 100%);
    height: min(820px, calc(100vh - 40px));
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
    margin-bottom: 10px;
}

.editor-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.editor-tool {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    color: var(--ink-dim);
    background: transparent;
    border-radius: 9px;
    transition: background 0.2s, color 0.2s;
}

.editor-tool:hover,
.editor-tool.active {
    color: #fff;
    background: var(--glass-strong);
}

.editor-tool.active {
    border-color: var(--accent);
}

#editor-color {
    width: 34px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--line);
    background: transparent;
    border-radius: 9px;
}

#editor-size {
    width: 110px;
}

.editor-stage {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-height: 0;
    background: repeating-conic-gradient(#0b1020 0% 25%, #0f152a 0% 50%) 0 0 / 24px 24px;
    border-radius: 12px;
    overflow: hidden;
}

#editor-canvas {
    max-width: 100%;
    max-height: 100%;
    cursor: crosshair;
    touch-action: none;
}

.export-banner {
    position: fixed;
    top: 104px;
    left: 50%;
    z-index: 2000;
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 10px 8px 16px;
    border: 1px solid var(--line);
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    background: rgba(13, 19, 42, 0.92);
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateX(-50%);
}

.export-dot {
    width: 10px;
    height: 10px;
    background: var(--danger);
    border-radius: 50%;
    animation: export-blink 1s ease-in-out infinite;
}

@keyframes export-blink {
    50% {
        opacity: 0.3;
    }
}

.account-extra {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.account-extra .btn {
    position: relative;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}

.account-extra .friends-badge {
    position: absolute;
    top: -8px;
    right: -6px;
    min-width: 20px;
    margin-left: 0;
    padding: 0 5px;
    border: 2px solid var(--bg-0);
    line-height: 16px;
    text-align: center;
}

.stardust-balance {
    display: inline-flex;
    flex-shrink: 0;
    gap: 6px;
    align-items: center;
    padding: 0 12px;
    border: 1px solid var(--line);
    font-family: var(--font-game);
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    background: var(--glass-soft);
    border-radius: 12px;
}

.stardust-balance-lg {
    height: 38px;
}

.stardust-balance i {
    color: #facc15;
}

.shop-card {
    display: flex;
    flex-direction: column;
    width: 900px;
    height: min(680px, calc(100vh - 40px));
    max-width: 100%;
}

.shop-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    margin-bottom: 14px;
}

.shop-search {
    width: 180px;
}

.shop-hint {
    flex: 1 1 260px;
    font-size: 12.5px;
    word-break: keep-all;
    overflow-wrap: anywhere;
    color: var(--ink-faint);
}

.shop-body {
    flex: 1;
    min-height: 0;
    padding: 4px 4px 0 0;
    overflow-y: auto;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.shop-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    padding: 12px 8px 10px;
    border: 1px solid var(--line);
    background: var(--glass-soft);
    border-radius: 12px;
    transition: border-color 0.2s, background 0.2s;
}

.shop-item:hover {
    border-color: var(--line-hover);
    background: var(--glass);
}

.shop-item.equipped {
    border-color: rgba(250, 204, 21, 0.55);
}

.shop-preview {
    display: flex;
    gap: 4px;
    align-items: center;
    min-height: 26px;
    font-size: 14px;
    font-weight: 700;
}

.shop-preview.has-banner {
    gap: 8px;
    padding: 4px 8px;
    border-radius: 8px;
}

.shop-preview-avatar {
    width: 44px;
    height: 44px;
    margin-right: 4px;
    border-radius: 50%;
}

.shop-preview-avatar.avatar-frame {
    padding: 3px;
}

.shop-preview-virus {
    width: 64px;
    height: 64px;
}

.shop-skin-hint {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 13px;
    color: var(--ink-faint);
}

.shop-item-name {
    font-size: 13px;
    color: var(--ink-dim);
}

.shop-price {
    font-family: var(--font-game);
    font-size: 13px;
    font-weight: 700;
    color: #fde68a;
}

.shop-item .btn {
    width: 100%;
}

.social-card.guild-card {
    width: 540px;
}

.guild-tabs,
.social-tabs {
    align-self: flex-start;
    margin-bottom: 12px;
}

.report-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.report-hint {
    margin: 0;
    font-size: 12.5px;
    color: var(--ink-dim);
}

.explore-head {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.explore-head .social-hint {
    margin: 0;
    text-align: left;
}

.guild-level {
    flex-shrink: 0;
    padding: 1px 8px;
    font-family: var(--font-game);
    font-size: 12px;
    font-weight: 700;
    color: #0b1026;
    background: #6ee7b7;
    border-radius: 999px;
}

.guild-applied-hint {
    margin: 0 0 8px;
    font-size: 12.5px;
    white-space: pre-line;
    color: var(--accent);
}

.guild-list-row .guild-tag {
    flex-shrink: 0;
    font-size: 13px;
}

.guild-list-row .btn {
    flex-shrink: 0;
}

.guild-list-intro {
    display: -webkit-box;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-line;
    word-break: keep-all;
    overflow-wrap: anywhere;
    color: var(--ink-dim);
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.guild-intro-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-top: 8px;
}

.guild-intro-form textarea {
    resize: none;
}

.guild-intro-form .btn {
    flex-shrink: 0;
}

.guild-create {
    display: flex;
    gap: 8px;
}

.guild-create .guild-tag-input {
    flex: 0 0 120px;
}

.guild-create .btn {
    flex-shrink: 0;
}

.guild-create + .guild-option {
    margin-top: 10px;
}

.guild-head {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.guild-tag,
.chat-guild-tag {
    font-family: var(--font-game);
    font-weight: 700;
    color: #6ee7b7;
}

.guild-tag {
    padding: 2px 10px;
    border: 1px solid color-mix(in srgb, currentColor 40%, transparent);
    font-size: 15px;
    background: color-mix(in srgb, currentColor 10%, transparent);
    border-radius: 8px;
}

.guild-head .guild-tag,
.guild-style-preview-head .guild-tag {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    box-sizing: border-box;
    height: 27px;
    padding: 1px 10px 0;
    line-height: 1;
}

.guild-tag-mini {
    padding: 0 6px;
    font-size: 11.5px;
    line-height: 1.6;
    border-radius: 6px;
}

.lb-guild-tag {
    margin-right: 4px;
    padding: 0 5px;
    border-color: color-mix(in srgb, currentcolor 55%, transparent);
    font-size: 11px;
    vertical-align: 1px;
    background: rgba(10, 12, 24, 0.55);
}

.profile-guild {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 2px 8px 2px 4px;
    border: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--ink-dim);
    background: var(--glass-soft);
    border-radius: 8px;
}

.guild-name {
    flex: 1;
    font-size: 20px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.guild-role,
.guild-role-chip {
    flex-shrink: 0;
    padding: 1px 8px;
    border: 1px solid var(--line);
    font-size: 12px;
    color: var(--ink-dim);
    border-radius: 999px;
}

.guild-role-chip {
    margin-left: 6px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 500;
}

.guild-role-chip.owner {
    border-color: rgba(250, 204, 21, 0.4);
    color: #fde68a;
}

.guild-role-chip.officer {
    border-color: rgba(147, 197, 253, 0.4);
    color: #93c5fd;
}

.guild-notice {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 8px 8px 12px;
    font-size: 13px;
    color: var(--ink-dim);
    background: var(--glass-soft);
    border-radius: 10px;
}

.guild-notice-text {
    flex: 1;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.notice-editor {
    text-align: left;
}

.notice-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.notice-tool {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--line);
    color: var(--ink-dim);
    background: var(--glass-soft);
    border-radius: 8px;
    transition: border-color 0.2s, color 0.2s;
}

.notice-tool:hover {
    border-color: var(--line-hover);
    color: #fff;
}

.notice-tool.swatch {
    width: 22px;
    height: 22px;
    border-color: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
}

body .swal2-container .notice-input {
    width: 100%;
    margin: 10px 0 4px;
    resize: vertical;
}

.notice-counter {
    font-size: 12px;
    text-align: right;
    color: var(--ink-faint);
}

.notice-counter.over {
    color: var(--danger);
}

.notice-preview {
    margin-top: 8px;
    padding: 10px 12px;
    font-size: 13px;
    white-space: pre-line;
    overflow-wrap: anywhere;
    color: var(--ink-dim);
    background: var(--glass-soft);
    border-radius: 10px;
}

.rank-select-label {
    margin: 0 0 10px;
    font-size: 14px;
}

.rank-editor {
    overflow-x: auto;
}

.rank-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.rank-table th {
    padding: 6px 4px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--ink-dim);
}

.rank-table td {
    padding: 4px;
    border-top: 1px solid var(--line);
    text-align: center;
}

.rank-table td:first-child {
    font-family: var(--font-game);
    color: var(--ink-faint);
}

.rank-table .form-control {
    min-width: 96px;
}

.rank-table .form-check-input {
    margin: 0;
}

.rank-table-hint {
    margin: 10px 0 0;
    font-size: 12px;
    text-align: left;
    white-space: pre-line;
    color: var(--ink-faint);
}

.guild-option {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--ink-dim);
    cursor: pointer;
}

.guild-option .form-check-input {
    margin: 0;
}

.guild-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 4px;
}

.guild-action {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 9px 12px;
    border: 1px solid var(--line);
    font-size: 13.5px;
    font-weight: 700;
    text-align: left;
    color: var(--ink-dim);
    background: var(--glass-soft);
    border-radius: 10px;
    transition: border-color 0.2s, color 0.2s;
}

.guild-action:hover {
    border-color: var(--line-hover);
    color: #fff;
}

.guild-action i {
    width: 16px;
    text-align: center;
    color: var(--accent);
}

.guild-action .tab-count {
    margin-left: auto;
}

.guild-panel-head {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.guild-panel-head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.guild-panel-hint {
    margin: 0;
    font-size: 13px;
    white-space: pre-line;
    color: var(--ink-faint);
}

.guild-tag-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px;
}

.guild-tag-colors > .guild-panel-hint,
.guild-emblems > .guild-panel-hint {
    margin: -4px;
}

.guild-style-sticky {
    position: sticky;
    top: -4px;
    z-index: 2;
    padding: 12px 0 10px;
    background: rgb(13, 19, 42);
    box-shadow: 0 8px 12px -10px rgba(0, 0, 0, 0.8);
}

.guild-style-sticky > .social-title {
    margin-top: 0;
}

@media (max-height: 560px) {
    .guild-style-sticky {
        position: static;
        box-shadow: none;
    }
}

.guild-style-preview {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
}

.guild-style-preview-head {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.guild-style-preview-head .guild-emblem {
    flex-shrink: 0;
    font-size: 18px;
}

.guild-style-preview-name {
    font-size: 15px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.guild-style-preview-chat {
    font-size: 13px;
    overflow-wrap: anywhere;
}

.guild-tag-colors .swatch {
    width: 26px;
    height: 26px;
}

.guild-tag-colors .swatch.selected {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.tag-gradient-text {
    color: transparent;
    background: var(--tag-gradient);
    -webkit-background-clip: text;
    background-clip: text;
}

.guild-head-emblem {
    flex-shrink: 0;
    font-size: 20px;
}

.guild-emblem {
    color: var(--accent);
}

.guild-emblems,
.guild-palette-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px;
}

.guild-emblem-option {
    width: 34px;
    height: 34px;
    font-size: 16px;
}

.guild-emblem-option.selected,
.guild-palette.selected {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.guild-palette-list {
    margin-top: 8px;
}

.notice-tool.guild-palette {
    width: 26px;
    height: 26px;
}

.guild-pin {
    padding: 0 6px;
    font-size: 11px;
    font-weight: 700;
    color: #fed7aa;
    background: rgba(251, 146, 60, 0.25);
    border-radius: 6px;
}

body .swal2-container .swal-pre-line {
    white-space: pre-line;
}

.guild-skill-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.guild-skill {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--line);
    background: var(--glass-soft);
    border-radius: 10px;
}

.guild-skill.learned {
    border-color: rgba(110, 231, 183, 0.35);
}

.guild-skill-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.guild-skill-name {
    display: flex;
    gap: 8px;
    align-items: baseline;
    font-size: 14px;
    font-weight: 700;
}

.guild-skill-level {
    font-family: var(--font-game);
    font-size: 12px;
    color: #6ee7b7;
}

.guild-skill-desc {
    font-size: 12.5px;
    word-break: keep-all;
    overflow-wrap: anywhere;
    color: var(--ink-dim);
}

.guild-skill-pips {
    display: flex;
    gap: 4px;
    margin-top: 2px;
}

.guild-skill-pips span {
    width: 18px;
    height: 4px;
    background: var(--line);
    border-radius: 2px;
}

.guild-skill-pips span.on {
    background: #6ee7b7;
}

.guild-skill .btn {
    flex-shrink: 0;
}

.guild-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.guild-danger:hover {
    color: var(--danger);
}

.profile-modal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 8px;
}

.profile-modal-badges .chat-title {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 2px 8px;
    font-size: 12.5px;
    vertical-align: 0;
}

.profile-modal-badges {
    align-items: stretch;
}

.profile-modal-badges:empty {
    display: none;
}

.profile-modal-habits {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 8px;
}

.profile-modal-habits:empty {
    display: none;
}

.profile-habit {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--ink-dim);
    background: var(--glass-soft);
    border-radius: 8px;
}

.profile-habit i {
    margin-right: 2px;
    font-size: 11px;
    color: var(--accent);
}

.profile-habit.rank-1 i {
    color: #facc15;
}

.profile-habit.rank-2 i {
    color: #cbd5e1;
}

.profile-habit.rank-3 i {
    color: #d97706;
}

.profile-habit-hint {
    font-size: 12px;
    word-break: keep-all;
    color: var(--ink-faint);
}

.social-card {
    display: flex;
    flex-direction: column;
    width: 480px;
    max-width: 100%;
    max-height: min(680px, calc(100vh - 40px));
}

.social-body {
    margin-top: -4px;
    padding: 4px 4px 0 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.social-hint {
    margin: 0 0 12px;
    padding: 10px 12px;
    font-size: 13px;
    white-space: pre-line;
    word-break: keep-all;
    overflow-wrap: anywhere;
    color: var(--ink-dim);
    background: var(--glass-soft);
    border-radius: 10px;
}

.friend-add {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.friend-add .btn {
    flex-shrink: 0;
}

.guild-sort {
    width: auto;
    margin-left: auto;
    padding-top: 2px;
    padding-bottom: 2px;
    font-size: 12px;
}

.social-title {
    display: flex;
    gap: 8px;
    align-items: baseline;
    margin: 16px 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-dim);
}

.social-count {
    font-size: 12px;
    font-weight: 400;
    color: var(--ink-faint);
}

.social-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.social-row {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 6px 8px;
    border: 1px solid var(--line);
    background: var(--glass-soft);
    border-radius: 10px;
}

.social-row .social-name {
    flex: 1;
}

.social-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.social-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.social-name {
    font-size: 14px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.social-status {
    font-size: 12px;
    color: var(--ink-faint);
}

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

.guild-contribution {
    font-size: 11px;
    color: var(--ink-dim);
}

.guild-contribution span {
    white-space: nowrap;
}

.social-action {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--line);
    color: var(--ink-dim);
    background: transparent;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}

.social-action:hover {
    color: #fff;
    background: var(--glass-strong);
}

.social-action.danger:hover {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.15);
}

.party-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.party-head .card-title {
    margin: 0;
}

.party-head-actions {
    display: flex;
    gap: 6px;
}

.party-head .party-help {
    font-size: 13px;
    color: var(--ink-faint);
    cursor: help;
}

.icon-btn.party-leave:hover {
    color: var(--danger);
}

.party-link-row .form-control {
    min-width: 0;
    font-size: 13px;
}

.party-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.party-actions .btn {
    padding-inline: 8px;
    white-space: nowrap;
}

.party-join-form,
.party-link-row {
    display: flex;
    gap: 8px;
}

.party-join-form .btn,
.party-link-row .btn {
    flex-shrink: 0;
}

.party-members-head {
    display: flex;
    justify-content: space-between;
    margin: 10px 0 6px;
    font-size: 13px;
    color: var(--ink-dim);
}

.party-members {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.party-member {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 3px 10px;
    border: 1px solid var(--line);
    font-size: 13px;
    background: var(--glass-soft);
    border-radius: 999px;
}

.party-member.self {
    border-color: var(--accent);
}

.party-member .fa-crown {
    color: var(--warning);
}

.party-actions .party-public-btn {
    grid-column: 1 / -1;
}

.party-public-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--ink-dim);
}

.icon-btn.party-refresh {
    width: 30px;
    height: 30px;
    font-size: 13px;
}

.party-public-list,
.party-invite-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
}

.party-invite-list {
    margin-top: 8px;
}

.party-public-item {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 4px 4px 4px 10px;
    border: 1px solid var(--line);
    font-size: 13px;
    background: var(--glass-soft);
    border-radius: 10px;
}

.party-public-item .fa-crown {
    color: var(--warning);
}

.party-public-leader {
    flex: 1;
    min-width: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.party-public-count {
    color: var(--ink-dim);
}

.party-public-item .btn {
    flex-shrink: 0;
}

.party-public-empty {
    padding: 8px 0;
    font-size: 13px;
    text-align: center;
    color: var(--ink-faint);
}

.party-public-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.party-public-actions .btn:first-child {
    flex: 1;
}

.party-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.party-setting {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 13px;
    white-space: nowrap;
    color: var(--ink-dim);
}

.party-setting .form-select {
    width: auto;
    min-width: 0;
}

.party-code-form {
    display: flex;
    grid-column: 1 / -1;
    gap: 8px;
}

.party-code-form .form-control {
    min-width: 0;
    font-size: 13px;
    text-transform: uppercase;
}

.party-code-form .form-control::placeholder {
    text-transform: none;
}

.party-code-form .btn {
    flex-shrink: 0;
}

.party-ranking {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.party-ranking-title {
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-dim);
}

.party-ranking-list {
    margin: 0;
    padding: 0;
    font-size: 13px;
    list-style: none;
}

.party-ranking-list li {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.party-ranking-list li.self {
    color: var(--accent);
}

.party-ranking-name {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.party-ranking-mass {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.session-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--ink-dim);
    background: var(--glass-strong);
}

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

.sessions-revoke-others {
    width: 100%;
    margin-top: 12px;
}

.social-empty {
    padding: 8px 4px;
    font-size: 13px;
    color: var(--ink-faint);
}

@property --frame-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

.avatar-frame {
    padding: 2px;
    border-color: transparent !important;
    background: var(--frame) border-box;
    border-radius: 50%;
    box-shadow: 0 0 10px var(--frame-glow, transparent);
    animation: frame-spin var(--frame-speed, 6s) linear infinite;
}

.profile-modal-avatar.avatar-frame {
    padding: 4px;
    box-shadow: 0 0 22px var(--frame-glow, transparent);
}

@keyframes frame-spin {
    to {
        --frame-angle: 360deg;
    }
}

.frame-moon {
    --frame: linear-gradient(135deg, #f8fafc, #94a3b8 45%, #e2e8f0);
    --frame-glow: rgba(226, 232, 240, 0.35);

    animation: none;
}

.frame-aurora {
    --frame: conic-gradient(from var(--frame-angle), #34d399, #22d3ee, #818cf8, #34d399);
    --frame-glow: rgba(52, 211, 153, 0.45);
}

.frame-sakura {
    --frame: conic-gradient(from var(--frame-angle), #fbcfe8, #f472b6, #fff1f2, #f9a8d4, #fbcfe8);
    --frame-glow: rgba(244, 114, 182, 0.45);
    --frame-speed: 9s;
}

.frame-flame {
    --frame: conic-gradient(from var(--frame-angle), #ef4444, #f97316, #facc15, #f97316, #ef4444);
    --frame-glow: rgba(249, 115, 22, 0.6);
    --frame-speed: 2.5s;
}

.frame-gold {
    --frame: conic-gradient(from var(--frame-angle), #a16207, #facc15, #fef9c3, #facc15, #a16207);
    --frame-glow: rgba(250, 204, 21, 0.55);
    --frame-speed: 4s;
}

.frame-galaxy {
    --frame: conic-gradient(from var(--frame-angle), #f472b6, #a78bfa, #60a5fa, #34d399, #facc15, #f472b6);
    --frame-glow: rgba(167, 139, 250, 0.65);
    --frame-speed: 3.5s;
}

.banner-night {
    --banner: radial-gradient(1px 1px at 18% 30%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 62% 70%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 84% 24%, #c7d2fe 50%, transparent 51%), linear-gradient(100deg, rgba(30, 41, 99, 0.85), rgba(15, 23, 42, 0.6));
}

.banner-nebula {
    --banner: linear-gradient(100deg, rgba(126, 34, 206, 0.55), rgba(219, 39, 119, 0.4) 55%, rgba(37, 99, 235, 0.45));
}

.banner-aurora {
    --banner: linear-gradient(100deg, rgba(5, 150, 105, 0.5), rgba(8, 145, 178, 0.45) 50%, rgba(79, 70, 229, 0.4));
}

.banner-sunset {
    --banner: linear-gradient(100deg, rgba(234, 88, 12, 0.5), rgba(219, 39, 119, 0.45) 60%, rgba(124, 58, 237, 0.4));
}

.banner-gold {
    --banner: linear-gradient(100deg, rgba(161, 98, 7, 0.55), rgba(250, 204, 21, 0.4) 40%, rgba(254, 240, 138, 0.5) 50%, rgba(250, 204, 21, 0.4) 60%, rgba(161, 98, 7, 0.55));
    --banner-size: 250% 100%;
    --banner-motion: banner-shine 5s linear infinite;
}

.banner-galaxy {
    --banner: linear-gradient(100deg, rgba(236, 72, 153, 0.5), rgba(139, 92, 246, 0.5), rgba(59, 130, 246, 0.5), rgba(16, 185, 129, 0.45), rgba(236, 72, 153, 0.5));
    --banner-size: 300% 100%;
    --banner-motion: banner-shine 8s linear infinite;
}

.has-banner {
    background: var(--banner) !important;
    background-size: var(--banner-size, 100% 100%) !important;
    animation: var(--banner-motion, none);
}

.profile-modal-card.has-banner {
    background: var(--glass) !important;
    animation: none;
}

.profile-modal-card.has-banner::before {
    position: absolute;
    inset: 0 0 auto;
    height: 120px;
    background: var(--banner);
    background-size: var(--banner-size, 100% 100%);
    border-radius: var(--radius) var(--radius) 0 0;
    animation: var(--banner-motion, none);
    content: "";
    pointer-events: none;
    -webkit-mask-image: linear-gradient(#000 40%, transparent);
    mask-image: linear-gradient(#000 40%, transparent);
}

.profile-modal-card.has-banner > * {
    position: relative;
}

.profile-modal-card.has-banner > .profile-modal-close {
    position: absolute;
}

@keyframes banner-shine {
    to {
        background-position: 100% 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .avatar-frame,
    .has-banner,
    .profile-modal-card.has-banner::before {
        animation: none;
    }
}

.profile-modal-card {
    width: 360px;
    max-width: 100%;
    text-align: center;
}

.icon-btn.profile-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
}

.profile-modal-avatar {
    width: 88px;
    height: 88px;
    border: 3px solid var(--line-hover);
    border-radius: 50%;
}

.profile-modal-name {
    margin: 12px 0 2px;
    font-size: 22px;
    font-weight: 700;
}

.profile-modal-username {
    font-size: 13px;
    color: var(--ink-faint);
}

.profile-modal-status {
    margin-top: 6px;
    font-size: 13px;
    color: var(--ink-faint);
}

.profile-modal-status.online {
    color: var(--success);
}

.profile-modal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 16px 0;
}

.profile-modal-grid div {
    padding: 8px 4px;
    border: 1px solid var(--line);
    background: var(--glass-soft);
    border-radius: 10px;
}

.profile-modal-grid dt {
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-faint);
}

.profile-modal-grid dd {
    margin: 2px 0 0;
    font-family: var(--font-game);
    font-size: 14px;
    font-weight: 700;
}

.profile-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.btn-discord {
    border: none;
    font-weight: 700;
    color: #fff;
    background: #5865f2;
    border-radius: 12px;
    transition: background 0.2s, transform 0.2s;
}

.btn-discord:hover,
.btn-discord:active {
    color: #fff;
    background: #4752c4;
    transform: translateY(-2px);
}

.xp-bar {
    position: relative;
    height: 26px;
    margin: 0 14px 0 0;
    border: 1px solid var(--line);
    background: rgba(7, 11, 26, 0.6);
    border-radius: 13px;
    overflow: visible;
}

.xp-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-3), var(--accent));
    border-radius: 13px;
    transition: width 0.6s ease;
}

.xp-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    color: #fff;
}

.xp-level {
    position: absolute;
    top: 50%;
    right: -16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 2px solid var(--bg-0);
    font-family: var(--font-game);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    color: #3b2500;
    background: linear-gradient(135deg, var(--warning), #f59e0b);
    border-radius: 50%;
    transform: translateY(-50%);
}

.profile-actions {
    display: flex;
    gap: 8px;
}

.profile-actions .btn {
    flex: 1;
}

.ranking-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    padding: 4px;
    background: rgba(7, 11, 26, 0.5);
    border-radius: 12px;
}

.ranking-tab {
    flex: 1;
    padding: 5px 0;
    border: none;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-dim);
    background: transparent;
    border-radius: 9px;
    transition: background 0.2s, color 0.2s;
}

.ranking-tab.active {
    color: #fff;
    background: var(--glass-strong);
}

.ranking-card {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.ranking-card .ranking-list {
    flex: 1 1 0;
    height: 0;
    max-height: none;
    min-height: 160px;
}

.ranking-list {
    max-height: 260px;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: hidden;
    overflow-y: auto;
}

.ranking-list li {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    font-size: 14px;
    border-radius: 8px;
}

.ranking-list li:nth-child(odd) {
    background: rgba(148, 168, 255, 0.04);
}

.ranking-list li.clickable {
    transition: background 0.2s;
    cursor: pointer;
}

.ranking-list li.clickable:hover {
    background: var(--glass-soft);
}

.ranking-rank {
    width: 24px;
    font-family: var(--font-game);
    font-weight: 700;
    text-align: center;
    color: var(--ink-dim);
}

.ranking-list li:nth-child(1) .ranking-rank {
    color: #fcd34d;
}

.ranking-list li:nth-child(2) .ranking-rank {
    color: #e5e7eb;
}

.ranking-list li:nth-child(3) .ranking-rank {
    color: #fdba74;
}

.ranking-avatar {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
}

.ranking-avatar.empty {
    background: var(--glass-soft);
}

.ranking-name {
    flex: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.ranking-score {
    font-family: var(--font-game);
    font-weight: 700;
    color: var(--accent-3);
}

.ranking-empty {
    justify-content: center;
    text-align: center;
    white-space: pre-line;
    color: var(--ink-faint);
}

.ranking-season {
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fbbf24;
}

.ranking-season-info {
    flex-shrink: 0;
    padding: 1px 10px;
    border: 1px solid var(--line);
    font: inherit;
    color: var(--ink-dim);
    background: var(--glass-soft);
    border-radius: 999px;
    transition: color 0.2s, border-color 0.2s;
    cursor: pointer;
}

.ranking-season-info:hover {
    border-color: var(--line-hover);
    color: var(--ink);
}

.main-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 22px 26px 24px;
}

.main-card-top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: center;
}

.main-card-top > :last-child {
    justify-self: end;
}

.status-badge {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 6px 12px;
    border: 1px solid var(--line);
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-dim);
    background: var(--glass-soft);
    border-radius: 999px;
}

.status-badge:hover {
    color: #fff;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
}

.discord-btn:hover {
    color: #8b9dff;
}

.logo {
    margin: 0;
    padding-bottom: 4px;
    font-family: "McLaren", var(--font);
    font-size: 42px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 2px;
    text-align: center;
    color: transparent;
    background: linear-gradient(135deg, #fff 15%, var(--accent) 55%, var(--accent-2) 90%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: logo-shine 6s ease-in-out infinite alternate;
}

.logo[data-holiday-icon]:not([data-holiday-icon=""])::after {
    display: inline-block;
    margin-left: 10px;
    font-size: 0.8em;
    color: #fff;
    animation: holiday-bob 2.4s ease-in-out infinite;
    content: attr(data-holiday-icon);
    -webkit-text-fill-color: initial;
}

@keyframes holiday-bob {
    0%,
    100% {
        transform: translateY(0) rotate(-6deg);
    }

    50% {
        transform: translateY(-4px) rotate(6deg);
    }
}

@keyframes logo-shine {
    from {
        background-position: 0% 50%;
    }

    to {
        background-position: 100% 50%;
    }
}

.skin-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.sub-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.instructions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--ink-dim);
}

.instructions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    justify-content: center;
}

.instructions span {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

[data-tip] {
    position: relative;
}

[data-tip]::after {
    --tip-x: -50%;
    --tip-y: -6px;
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    z-index: 50;
    width: max-content;
    max-width: 260px;
    padding: 5px 10px;
    border: 1px solid var(--line);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    text-align: left;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: anywhere;
    color: #fff;
    background: #111a36;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translate(var(--tip-x), var(--tip-y));
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
    content: attr(data-tip);
    pointer-events: none;
}

[data-tip-pos="top"]::after,
[data-tip-v="top"]::after {
    --tip-y: 6px;
    top: auto;
    bottom: calc(100% + 8px);
}

[data-tip-align="start"]::after {
    --tip-x: 0;
    left: 0;
}

[data-tip-align="end"]::after {
    --tip-x: 0;
    right: 0;
    left: auto;
}

[data-tip]:hover::after,
[data-tip]:focus-visible::after {
    --tip-y: 0;
    opacity: 1;
    visibility: visible;
}

[data-tip]:hover,
[data-tip]:focus-visible {
    z-index: 60;
}

.btn-outline-danger {
    border: 1px solid var(--line);
    color: var(--ink-dim);
    background: var(--glass-soft);
    border-radius: 10px;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.btn-outline-danger i {
    color: #f87171;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus-visible,
.btn-outline-danger:active {
    border-color: rgba(248, 113, 113, 0.5);
    color: #fecaca;
    background: rgba(248, 113, 113, 0.14);
}

.icon-btn:active,
.chat-btn:active,
.replay-btn:active {
    transform: scale(0.92);
}

.btn-glass:hover {
    transform: translateY(-2px);
}

.btn-glass:active,
.btn-play:active {
    transform: scale(0.97);
}

#settings-btn i,
.icon-btn .fa-xmark,
.chat-popup-close i {
    transition: transform 0.3s ease;
}

#settings-btn:hover i {
    transform: rotate(90deg);
}

.icon-btn:hover .fa-xmark,
.chat-popup-close:hover i {
    transform: rotate(90deg);
}

.replay-btn:hover {
    transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
    [data-tip]::after,
    #settings-btn i,
    .icon-btn .fa-xmark,
    .chat-popup-close i {
        transition: none;
    }
}

.gamemode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.gm-card {
    --gm-color: var(--accent);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    padding: 10px 4px 8px;
    border: 2px solid var(--line);
    background: var(--glass-soft);
    border-radius: 14px;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.gm-card:hover {
    border-color: var(--line-hover);
    transform: translateY(-2px);
}

.gm-card.selected {
    border-color: var(--gm-color);
    background: color-mix(in srgb, var(--gm-color) 22%, transparent);
    box-shadow: 0 0 18px color-mix(in srgb, var(--gm-color) 35%, transparent);
}

.gm-card.offline {
    opacity: 0.5;
}

.gm-icon {
    position: relative;
    width: 46px;
    height: 46px;
}

.gm-blob {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    opacity: 0.85;
    transform: translate(-50%, -50%);
}

.gm-card.selected .gm-blob {
    opacity: 1;
}

.gm-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
}

.gm-players {
    font-family: var(--font-game);
    font-size: 11px;
    color: var(--ink-dim);
}

.gm-status {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--success);
}

.gm-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 1px 6px 2px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.5;
    color: #fff;
    background: var(--gm-color);
    border-radius: 999px;
    overflow: hidden;
}

.chat-title.title-exclusive {
    position: relative;
    z-index: 0;
    overflow: hidden;
    overflow: clip;
}

.chat-title.title-exclusive::after {
    z-index: -1;
}

.gm-badge::after,
.task-tag::after,
.friends-badge.event::after,
.title-exclusive::after {
    position: absolute;
    top: 0;
    left: 0;
    width: 40%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.7), transparent);
    transform: translateX(-150%);
    animation: gm-badge-shine 3s ease-in-out infinite;
    content: '';
}

@keyframes gm-badge-shine {
    0% {
        transform: translateX(-150%);
    }

    40%,
    100% {
        transform: translateX(350%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .gm-badge::after,
    .task-tag::after,
    .friends-badge.event::after,
    .title-exclusive::after {
        animation: none;
    }
}

.gm-card.offline .gm-status {
    background: var(--danger);
    box-shadow: 0 0 6px var(--danger);
}

.gm-card.unknown .gm-status {
    background: var(--ink-faint);
    box-shadow: none;
}

.announcement {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.announcement > p:last-of-type {
    flex-grow: 1;
}

.announcement p {
    margin: 0 0 6px;
    font-size: 14px;
    line-height: 1.7;
    word-break: keep-all;
    overflow-wrap: anywhere;
    color: var(--ink-dim);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 2px;
    justify-content: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.footer-links a {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 6px 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--ink-dim);
    border-radius: 8px;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.footer-links a:hover {
    color: #fff;
    background: var(--glass-soft);
}

html.touch .footer-links a {
    padding: 6px 5px;
}

.modal-layer {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(4, 7, 18, 0.6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

#settings[style*="display: none"],
#gallery[style*="display: none"],
#stats[style*="display: none"],
#connecting[style*="display: none"],
#social[style*="display: none"],
#profile-modal[style*="display: none"] {
    display: none !important;
}

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

.settings-header h2 {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.settings-header h2 i {
    color: var(--accent);
}
.settings-search {
    position: relative;
    flex: 1;
    max-width: 260px;
    margin: 0 10px 0 auto;
}

.settings-search i {
    position: absolute;
    top: 50%;
    left: 10px;
    font-size: 12px;
    color: var(--ink-faint);
    transform: translateY(-50%);
    pointer-events: none;
}

.settings-search input {
    padding-left: 30px;
}

.settings-sidebar.searching .settings-tab-btn.active {
    border-color: transparent;
    color: var(--ink-dim);
    background: transparent;
}

.settings-sidebar.searching .settings-tab-btn.active i {
    color: inherit;
}

.settings-tab-content.searching .settings-tab-panel:is([data-tab="general"], [data-tab="keybind"], [data-tab="color"]) {
    display: block;
}

.settings-tab-content.searching .settings-tab-panel:not([data-tab="general"], [data-tab="keybind"], [data-tab="color"]),
.settings-tab-content.searching .search-miss,
.settings-tab-content.searching :is(.settings-actions, .settings-hint, .reset-button, .perf-report) {
    display: none !important;
}

.settings-tab-content.searching .settings-tab-panel::before {
    display: block;
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    content: attr(data-label);
}

.settings-tab-content.searching .settings-tab-panel + .settings-tab-panel::before {
    margin-top: 6px;
}

.settings-search-empty {
    margin: 40px 0;
    font-size: 14px;
    text-align: center;
    color: var(--ink-faint);
}

.settings-card {
    display: flex;
    flex-direction: column;
    width: 960px;
    height: min(680px, calc(100vh - 40px));
    max-width: 100%;
}

.settings-body {
    display: flex;
    flex: 1;
    gap: 16px;
    min-height: 0;
}

.settings-sidebar {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 6px;
    width: 170px;
}

.settings-tab-btn {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 700;
    text-align: left;
    color: var(--ink-dim);
    background: transparent;
    border-radius: 12px;
    transition: background 0.2s, color 0.2s;
}

.settings-tab-btn i {
    width: 18px;
    text-align: center;
}

.settings-tab-btn:hover {
    color: #fff;
    background: var(--glass-soft);
}

.settings-tab-btn.active {
    border-color: var(--line);
    color: #fff;
    background: var(--glass-strong);
}

.settings-tab-btn.active i {
    color: var(--accent);
}

.settings-tab-content {
    flex: 1;
    min-width: 0;
    margin-top: -4px;
    padding: 4px 6px 0 0;
    overflow-y: auto;
}

.settings-tab-panel {
    display: none;
}

.settings-tab-panel.active {
    display: block;
}

.settings-group-title {
    margin: 4px 0 10px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--ink-faint);
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.option-item {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 0;
    padding: 9px 12px;
    border: 1px solid var(--line);
    font-size: 14px;
    font-weight: 500;
    background: var(--glass-soft);
    border-radius: 12px;
    transition: border-color 0.2s;
}

.option-item:hover {
    border-color: var(--line-hover);
}

.option-item .form-check-input,
.party-setting .form-check-input {
    flex-shrink: 0;
    width: 2.2em;
    height: 1.2em;
    margin: 0;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%28154, 166, 200, 0.9%29'/%3e%3c/svg%3e");
    background-size: contain;
    background-position: left center;
    background-repeat: no-repeat;
    border-radius: 2em;
    transition: background-position 0.15s ease-in-out, background-color 0.15s;
}

.option-item .form-check-input:checked,
.party-setting .form-check-input:checked {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
    background-position: right center;
}

.option-item span {
    flex: 1;
}

.option-item[hidden] {
    display: none;
}

.choice-item {
    padding-top: 5px;
    padding-bottom: 5px;
}

.choice-item > span {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.choice-group {
    display: inline-flex;
    flex-shrink: 0;
    gap: 2px;
    padding: 3px;
    background: rgba(7, 11, 26, 0.5);
    border-radius: 9px;
}

.choice-btn {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 3px 10px;
    border: none;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-dim);
    background: transparent;
    border-radius: 7px;
    transition: background 0.2s, color 0.2s;
}

html.touch .choice-btn {
    padding: 3px 8px;
}

.choice-btn:hover {
    color: var(--ink);
}

.choice-btn.active {
    color: #fff;
    background: rgba(122, 162, 255, 0.32);
}

.choice-btn .tag {
    padding: 0 5px;
    font-size: 10px;
}

.slider-item.muted {
    opacity: 0.45;
}

.background-url-item {
    margin-bottom: 18px;
}

.background-url-item .form-label {
    font-size: 13px;
    color: var(--ink-dim);
}

.background-url-item .settings-hint {
    margin: 6px 0 0;
}

.slider-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 18px;
    margin-bottom: 18px;
}

.slider-item label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
    font-size: 14px;
    font-weight: 500;
}

.slider-value {
    font-family: var(--font-game);
    font-size: 13px;
    color: var(--accent-3);
}

.keybind-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.keybind-item {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid var(--line);
    font-size: 14px;
    font-weight: 500;
    background: var(--glass-soft);
    border-radius: 12px;
}

.keybind-item > span {
    flex: 1;
}

.keybind-item input {
    flex-shrink: 0;
    width: 150px;
    font-family: var(--font-game);
    font-weight: 700;
    text-align: center;
    cursor: pointer;
}

.keybind-reset {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    font-size: 13px;
    color: var(--ink-dim);
    background: transparent;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}

.keybind-reset:hover {
    color: #fff;
    background: var(--glass-strong);
}

.keybind-reset:disabled {
    visibility: hidden;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.color-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--line);
    font-size: 14px;
    font-weight: 500;
    background: var(--glass-soft);
    border-radius: 12px;
}

.color-item input[type="color"] {
    width: 42px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--line);
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
}

.color-item input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-item input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.settings-hint {
    margin: 10px 0;
    font-size: 13px;
    color: var(--ink-faint);
}

.settings-tab-panel[data-tab="importexport"].active {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.import-textarea {
    flex: 1;
    min-height: 220px;
    margin: 12px 0;
    font-family: Consolas, monospace;
    font-size: 12px;
    resize: vertical;
}

.gallery-card {
    display: flex;
    flex-direction: column;
    width: 900px;
    height: min(680px, calc(100vh - 40px));
    max-width: 100%;
}

.gallery-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.gallery-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: rgba(7, 11, 26, 0.5);
    border-radius: 12px;
}

.tab-button {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 6px 14px;
    border: none;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-dim);
    background: transparent;
    border-radius: 9px;
}

.tab-button.active {
    color: #fff;
    background: var(--glass-strong);
}

.tab-button .badge {
    color: #0b1026;
    background: var(--accent);
}

.tab-button .badge:empty {
    display: none;
}

.gallery-search {
    width: 220px;
}

#gallery-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.skins-ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 4px;
    list-style: none;
}

.skin {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    min-width: 0;
    padding: 10px 6px;
    border: 1px solid var(--line);
    background: var(--glass-soft);
    border-radius: 14px;
    transition: border-color 0.2s, transform 0.2s, background 0.2s;
}

.skin:hover {
    border-color: var(--line-hover);
    background: var(--glass-strong);
    transform: translateY(-3px);
}

.skin-image {
    position: relative;
    width: 84px;
    height: 84px;
}

.skin-image .circular {
    width: 100%;
    height: 100%;
    background: rgba(7, 11, 26, 0.6);
    border-radius: 50%;
    object-fit: cover;
}

.disabled-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: rgba(7, 11, 26, 0.6);
    border-radius: 50%;
}

.skinName {
    max-width: 100%;
    margin: 0;
    font-family: var(--font-game);
    font-size: 13px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink-dim);
    overflow: hidden;
}

.item-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    font-size: 12px;
    color: var(--ink-dim);
    background: rgba(7, 11, 26, 0.65);
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
}

.item-action:hover {
    color: #fff;
    background: rgba(7, 11, 26, 0.9);
}

.skin .item-action {
    position: absolute;
    top: 6px;
}

.skin .item-fav {
    left: 6px;
}

.skin .item-remove {
    right: 6px;
}

.skin .item-rename {
    top: 34px;
    right: 6px;
}

.item-fav.active {
    color: #facc15;
}

.item-remove:hover {
    color: #f87171;
}

.skin .item-fav:not(.active),
.skin .item-rename,
.skin .item-remove {
    opacity: 0;
    transition: opacity 0.2s;
}

.skin:hover .item-action,
.skin.tour-hover .item-action,
.skin .item-action:focus-visible {
    opacity: 1;
}

@media (hover: none) {
    .skin .item-action {
        opacity: 1;
    }
}

.my-skins-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding: 4px;
}

.my-skins-bar .form-control {
    flex: 1 1 240px;
    min-width: 0;
}

.my-skins-title {
    margin: 8px 4px 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-dim);
}

.my-skins-empty {
    margin: 24px 4px;
    line-height: 1.7;
    text-align: center;
    color: var(--ink-dim);
    text-wrap: balance;
}

.my-skins-empty .nowrap {
    white-space: nowrap;
}

.sync-status {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: var(--glass-soft);
    border-radius: 12px;
}

.sync-status-row {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    font-size: 13px;
    color: var(--ink-dim);
}

.sync-status-row strong {
    font-weight: 600;
    text-align: right;
    color: var(--ink);
}

.sync-status-row.ok strong {
    color: #4ade80;
}

.sync-status-row.pending strong {
    color: var(--accent);
}

.sync-status-row.warn strong {
    color: var(--warning);
}

.sync-login-note {
    margin: 0;
    font-size: 13px;
    color: var(--ink-dim);
}

.sync-controls .option-item small {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-dim);
}

.sync-auto {
    margin-bottom: 4px;
}

.sync-category.disabled {
    opacity: 0.5;
}

.sync-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sync-restore-list {
    display: grid;
    gap: 6px;
    max-height: 320px;
    text-align: left;
    overflow-y: auto;
}

.sync-restore-list label {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
}

.sync-restore-list label:has(input:checked) {
    border-color: var(--accent);
}

.sync-restore-list small {
    display: block;
    font-size: 12px;
    color: var(--ink-dim);
}

.nick-row {
    position: relative;
    display: flex;
    gap: 8px;
}

.nick-row .form-control {
    flex: 1;
    min-width: 0;
}

.nick-menu-btn {
    flex: none;
    width: auto;
    height: auto;
    aspect-ratio: 1;
}

.nick-menu-btn.active {
    border-color: var(--line-hover);
    color: #fff;
}

.nick-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    z-index: 30;
    padding: 10px;
    border: 1px solid var(--line-hover);
    background: var(--bg-1);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.nick-menu-head {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--ink-dim);
}

.nick-menu-list {
    max-height: 240px;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
}

.nick-menu-item {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    border-radius: 10px;
    cursor: pointer;
}

.nick-menu-item:hover,
.nick-menu-item:focus-visible {
    background: var(--glass-strong);
}

.nick-menu-item.current .nick-menu-name {
    color: var(--accent);
}

.nick-menu-name {
    flex: 1;
    min-width: 0;
    font-family: var(--font-game);
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
    overflow: hidden;
}

.nick-menu-empty {
    padding: 12px 6px;
    font-size: 13px;
    line-height: 1.7;
    text-align: center;
    color: var(--ink-dim);
    text-wrap: balance;
}

.stats-card {
    width: 420px;
    max-width: 100%;
    padding: 22px;
    text-align: center;
}

.stats-title {
    margin: 0 0 14px;
    font-size: 26px;
    font-weight: 900;
}

.stats-graph-wrap {
    position: relative;
    border: 1px solid var(--line);
    background: rgba(7, 11, 26, 0.5);
    border-radius: 14px;
    overflow: hidden;
}

#statsGraph {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 170px;
}

.stats-grid {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 10px;
    padding: 16px 12px 70px;
}

.stats-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stats-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-dim);
}

.stats-value {
    font-family: var(--font-game);
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.stats-xp {
    margin-top: 12px;
    padding: 8px 12px;
    font-weight: 700;
    color: var(--warning);
    background: rgba(251, 191, 36, 0.12);
    border-radius: 12px;
}

.stats-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.stats-sub-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stats-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    font-size: 12px;
    color: var(--ink-faint);
}

.stats-footer i {
    color: var(--warning);
}

.connecting-card {
    width: 380px;
    max-width: 100%;
    text-align: center;
}

.connecting-card h2 {
    margin: 12px 0 8px;
    font-size: 22px;
    font-weight: 700;
}

.connecting-card p {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--ink-dim);
}

.connecting-status {
    min-height: 22px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #7dd3fc;
}

.connecting-card #turnstile-container {
    margin-bottom: 12px;
}

.connecting-switch {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.connecting-switch > span {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--ink-faint);
}

#connecting-servers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.connecting-server {
    padding: 5px 12px;
    border: 1px solid var(--line);
    font-size: 13px;
    color: var(--ink);
    background: var(--glass-soft);
    border-radius: 999px;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.connecting-server:hover {
    border-color: var(--accent-3);
    transform: translateY(-1px);
}

.connecting-server.selected {
    border-color: var(--accent-3);
    background: rgba(110, 231, 216, 0.14);
}

.connecting-cancel {
    margin-top: 12px;
    padding: 0;
    border: none;
    font-size: 12px;
    text-decoration: underline;
    color: var(--ink-faint);
    background: none;
}

.connecting-cancel:hover {
    color: var(--ink);
}

#turnstile-container {
    justify-content: center;
}

#hud {
    position: fixed;
    inset: 0;
    z-index: 10;
    font-family: var(--font-game);
    pointer-events: none;
}

.hud-panel {
    position: absolute;
}

#hud-stats {
    top: 8px;
    left: 10px;
    font-size: 15px;
    line-height: 1.5;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.hud-score {
    font-size: 22px;
    font-weight: 700;
}

.hud-perf {
    font-size: 14px;
    opacity: 0.85;
}

.hud-server {
    font-size: 13px;
    white-space: pre-line;
    opacity: 0.8;
}

#leaderboard {
    top: 10px;
    right: 10px;
    width: 220px;
    padding: 10px 12px 12px;
    border-radius: 14px;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    pointer-events: auto;
}

.leaderboard-actions {
    display: flex;
    gap: 6px;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.hud-action {
    flex: 1;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-size: 14px;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    transition: background 0.2s, transform 0.15s;
}

.hud-action:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.hud-action:active {
    transform: scale(0.92);
}

#hud-settings-btn i {
    transition: transform 0.3s ease;
}

#hud-settings-btn:hover i {
    transform: rotate(90deg);
}

.leaderboard-title {
    margin-bottom: 6px;
    font-family: var(--font);
    font-size: 22px;
    font-weight: 900;
    text-align: center;
}

.leaderboard-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.leaderboard-list li {
    position: relative;
    padding: 2px 6px;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 6px;
}

.lb-name {
    display: block;
    margin: -3px 0;
    padding: 3px 0;
    text-overflow: ellipsis;
    overflow: hidden;
}

.leaderboard-list li.me {
    font-weight: 700;
}

.leaderboard-list.leaderboard-text li {
    text-align: center;
    white-space: normal;
}

.leaderboard-list li.watching {
    background: rgba(74, 222, 128, 0.2);
}

#leaderboard.clickable .leaderboard-list li.player {
    cursor: pointer;
}

#leaderboard.clickable .leaderboard-list li.player:hover {
    background: rgba(255, 255, 255, 0.15);
}

.lb-profile {
    position: absolute;
    top: 50%;
    right: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    padding: 0 7px;
    border: 0;
    font-size: 11px;
    line-height: 1;
    color: #fff;
    background: #6366f1;
    border-radius: 6px;
    transform: translateY(-50%);
    cursor: pointer;
}

.lb-profile:hover {
    background: #4f46e5;
}

.lb-avatar {
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    margin-right: 0.3em;
    vertical-align: -0.2em;
    border-radius: 50%;
    object-fit: cover;
}

.lb-avatar.avatar-frame {
    padding: 1.5px;
    box-shadow: none;
}

.lb-avatar.empty {
    background: rgba(255, 255, 255, 0.16);
}

#leaderboard.clickable .lb-avatar-profile {
    cursor: pointer;
}

@media (hover: hover) {
    #leaderboard.clickable .lb-avatar-profile:hover {
        box-shadow: 0 0 0 2px #818cf8;
        filter: brightness(1.15);
    }
}

.leaderboard-list li.has-profile {
    padding-right: 36px;
}

@media (hover: hover) {
    .leaderboard-list li.has-profile {
        padding-right: 6px;
    }

    .lb-profile {
        right: calc(100% + 6px);
        height: 22px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
        opacity: 0;
        pointer-events: none;
    }

    .lb-profile::after {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 100%;
        width: 6px;
        content: "";
    }

    #leaderboard.clickable .leaderboard-list li.player:hover .lb-profile,
    .lb-profile:focus-visible {
        opacity: 1;
        pointer-events: auto;
    }
}

#leaderboard-pie {
    display: none;
    width: 180px;
    height: 180px;
    margin: 4px auto 0;
}

.leaderboard-tip {
    display: none;
    margin-top: 6px;
    font-family: var(--font);
    font-size: 11px;
    text-align: center;
    opacity: 0.7;
}

#leaderboard.clickable .leaderboard-tip {
    display: block;
}

.leaderboard-tip span {
    display: block;
}

.hud-position {
    position: absolute;
    right: 10px;
    font-size: 14px;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.spectate-hint {
    position: absolute;
    bottom: 64px;
    left: 50%;
    padding: 10px 24px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: rgba(13, 19, 42, 0.6);
    border-radius: 999px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transform: translateX(-50%);
}

.minion-hint {
    position: absolute;
    top: 6px;
    left: 50%;
    font-family: var(--font);
    font-size: 16px;
    font-weight: 700;
    color: #eea236;
    transform: translateX(-50%);
}

.referral-prompt p {
    margin: 0;
    white-space: pre-line;
    word-break: keep-all;
}

.referral-prompt .referral-prompt-later {
    margin-top: 8px;
    font-size: 13px;
    opacity: 0.75;
}

.royale-intro {
    text-align: left;
}

.royale-intro h4 {
    margin: 14px 0 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--warning);
}

.royale-intro h4:first-child {
    margin-top: 0;
}

.royale-intro ul {
    margin: 0;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.7;
}

.leaderboard-royale {
    margin-top: 10px;
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-family: var(--font);
    text-align: center;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.leaderboard-royale.danger {
    border-color: rgba(239, 68, 68, 0.9);
    background: rgba(127, 29, 29, 0.7);
}

.royale-title {
    font-size: 15px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.royale-detail {
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-line;
    word-break: keep-all;
    overflow-wrap: anywhere;
    opacity: 0.85;
}

.royale-call {
    position: absolute;
    top: 8px;
    left: 50%;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: calc(100% - 32px);
    padding: 8px 22px;
    border: 1px solid rgba(250, 204, 21, 0.6);
    font-family: var(--font);
    text-align: center;
    color: #fff;
    background: rgba(13, 19, 42, 0.6);
    border-radius: 14px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transform: translateX(-50%);
    animation: royale-call-in 0.3s ease-out;
    cursor: pointer;
    pointer-events: auto;
}

.royale-call[hidden] {
    display: none;
}

.royale-call:hover {
    border-color: rgba(250, 204, 21, 0.95);
    background: rgba(13, 19, 42, 0.75);
}

html:not(.touch) body:has(#replay-bar:not([style*="display: none"])) .royale-call {
    top: 96px;
}

.royale-call-title {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
}

.royale-call-detail {
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.5;
    word-break: keep-all;
    opacity: 0.85;
}

.royale-alert {
    position: absolute;
    top: 8px;
    left: 50%;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: calc(100% - 32px);
    padding: 8px 22px;
    border: 1px solid rgba(239, 68, 68, 0.9);
    font-family: var(--font);
    text-align: center;
    color: #fff;
    background: rgba(127, 29, 29, 0.75);
    border-radius: 14px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transform: translateX(-50%);
    animation: royale-alert-pulse 0.8s ease-in-out infinite alternate;
    pointer-events: none;
}

.royale-alert[hidden] {
    display: none;
}

html:not(.touch) body:has(#replay-bar:not([style*="display: none"])) .royale-alert {
    top: 96px;
}

.royale-alert-title {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
}

.royale-alert-detail {
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.5;
    word-break: keep-all;
    opacity: 0.9;
}

@keyframes royale-alert-pulse {
    from {
        box-shadow: 0 0 0 rgba(239, 68, 68, 0);
    }

    to {
        box-shadow: 0 0 18px rgba(239, 68, 68, 0.75);
    }
}

@keyframes royale-call-in {
    from {
        opacity: 0;
        transform: translate(-50%, -8px);
    }
}

.leaderboard-event {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border: 1px solid rgba(249, 115, 22, 0.7);
    box-sizing: border-box;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    color: #fdba74;
    border-radius: 14px;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.leaderboard-event[hidden] {
    display: none;
}

.leaderboard-event.upcoming {
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
}

.leaderboard-event-time {
    font-family: var(--font-game);
    font-variant-numeric: tabular-nums;
    color: #fff;
}

.replay-bar {
    position: fixed;
    top: 8px;
    left: 50%;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    background: rgba(13, 19, 42, 0.85);
    border-radius: 14px;
    box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transform: translateX(-50%);
}

body:has(> #overlays:not([style*="display: none"])) #replay-bar {
    display: none !important;
}

.replay-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.replay-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    font-size: 15px;
    color: var(--ink);
    background: var(--glass-soft);
    border-radius: 10px;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.replay-btn.small {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.replay-btn:hover {
    border-color: var(--line-hover);
    color: #fff;
    background: var(--glass-strong);
}

.replay-btn.active {
    border-color: var(--accent-3);
    color: var(--accent-3);
}

.replay-btn.recording {
    border-color: var(--danger);
    color: #fff;
    background: rgba(248, 113, 113, 0.25);
    animation: replay-blink 1s ease-in-out infinite;
}

@keyframes replay-blink {
    50% {
        background: rgba(248, 113, 113, 0.05);
    }
}

.replay-sep {
    width: 1px;
    height: 24px;
    margin: 0 4px;
    background: var(--line);
}

.replay-speed,
.replay-count,
.replay-time {
    min-width: 42px;
    font-family: var(--font-game);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    color: var(--ink-dim);
}

.replay-status {
    min-width: 110px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-3);
}

.replay-seek {
    flex: 1;
}

.replay-time {
    min-width: 90px;
}

body.replaying::after {
    position: fixed;
    inset: 0;
    z-index: 35;
    border: 3px solid rgba(110, 231, 216, 0.55);
    content: "";
    pointer-events: none;
}

.chat-block {
    position: fixed;
    bottom: 8px;
    left: 8px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 440px;
    max-width: calc(100vw - 16px);
    font-family: var(--font-game);
}

.chat-log {
    max-height: 230px;
    padding: 4px 6px;
    font-size: 15px;
    line-height: 1.45;
    word-break: break-word;
    transition: opacity 0.3s;
    overflow-y: auto;
}

@supports not selector(::-webkit-scrollbar) {
    .chat-log {
        scrollbar-width: thin;
        scrollbar-color: rgba(148, 168, 255, 0.3) transparent;
    }
}

.chat-log:empty {
    display: none;
}

.chat-line {
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.85);
}

.chat-time {
    margin-right: 4px;
    opacity: 0.55;
}

.chat-name {
    font-weight: 700;
}

.chat-guild-tag {
    display: inline-block;
    margin-right: 4px;
    padding: 0 5px;
    border: 1px solid color-mix(in srgb, currentColor 45%, transparent);
    font-size: 11px;
    line-height: 16px;
    text-shadow: none;
    vertical-align: 1px;
    background: color-mix(in srgb, currentColor 14%, transparent);
    border-radius: 4px;
}

.chat-level {
    display: inline-block;
    min-width: 3em;
    margin-right: 4px;
    padding: 0 5px;
    font-family: var(--font-game);
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    text-shadow: none;
    vertical-align: 1px;
    border-radius: 4px;
}

.chat-level.tier-1 {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.25);
}

.chat-level.tier-2 {
    color: #0b1026;
    background: #7aa2ff;
}

.chat-level.tier-3 {
    color: #1e0a33;
    background: #c084fc;
}

.chat-level.tier-4 {
    color: #fff;
    background: linear-gradient(135deg, #fb7185, #f97316);
}

.chat-title {
    display: inline-block;
    margin-right: 4px;
    padding: 0 5px;
    font-family: var(--font-game);
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-shadow: none;
    vertical-align: 1px;
    color: #1f1300;
    background: linear-gradient(135deg, #fde68a, #f59e0b);
    border-radius: 4px;
}

.chat-verified {
    margin-right: 4px;
    font-size: 12px;
    color: #8f9bff;
}

.chat-avatar {
    display: inline-block;
    width: 1.15em;
    height: 1.15em;
    margin-right: 4px;
    vertical-align: -0.22em;
    border-radius: 50%;
    object-fit: cover;
}

.chat-avatar.avatar-frame {
    padding: 1.5px;
    box-shadow: none;
    animation: none;
}

.chat-role {
    display: inline-block;
    margin-right: 4px;
    padding: 0 6px;
    font-family: var(--font);
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-shadow: none;
    vertical-align: 1px;
    border-radius: 4px;
}

.chat-role i {
    margin-right: 3px;
    font-size: 9px;
    vertical-align: 1px;
}

.chat-role.server {
    color: #fff;
    background: #ef4444;
}

.chat-role.owner {
    color: #2a0430;
    background: #e879f9;
}

.chat-role.coowner {
    color: #0f1240;
    background: #818cf8;
}

.chat-role.admin {
    color: #1f1300;
    background: #f59e0b;
}

.chat-role.mod {
    color: #04210f;
    background: #22c55e;
}

.chat-role.channel-private {
    color: #1e0a33;
    background: #c084fc;
}

.chat-role.channel-guild {
    color: #022c1c;
    background: #34d399;
}

.chat-role.channel-friends {
    color: #03202e;
    background: #38bdf8;
}

.chat-role.channel-world {
    color: #3b0a24;
    background: #f472b6;
}

.chat-role.channel-team {
    color: #2b1200;
    background: #fb923c;
}

.chat-mode {
    display: inline-block;
    margin-right: 4px;
    padding: 0 5px;
    font-family: var(--font);
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-shadow: none;
    vertical-align: 1px;
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.24);
    border-radius: 4px;
}

.chat-mode.other {
    color: #fde68a;
    background: rgba(251, 191, 36, 0.24);
}

.chat-scope {
    margin-left: auto;
    padding: 3px 9px;
    border: 1px dashed var(--line-hover);
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(13, 19, 42, 0.65);
    border-radius: 999px;
}

.chat-scope:hover {
    color: #fff;
}

.chat-role.channel-party {
    color: #2a2100;
    background: #facc15;
}

.chat-name.clickable {
    cursor: pointer;
}

.chat-name.clickable:hover {
    text-decoration: underline;
}

.chat-empty {
    padding: 4px 2px;
    font-family: var(--font);
    font-size: 13px;
    color: var(--ink-faint);
}

.chat-line.history {
    opacity: 0.6;
}

.chat-divider {
    display: flex;
    gap: 6px;
    align-items: center;
    margin: 4px 0 2px;
    font-family: var(--font);
    font-size: 11px;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.85);
    color: var(--ink-faint);
}

.chat-divider::before,
.chat-divider::after {
    flex: 1;
    height: 1px;
    background: var(--line);
    content: "";
}

.chat-divider span + span::before {
    margin-right: 6px;
    content: "·";
}

.chat-line.self {
    padding-left: 6px;
    box-shadow: inset 2px 0 0 rgba(122, 162, 255, 0.7);
}

.chat-tabs {
    display: flex;
    gap: 4px;
}

.chat-tab {
    position: relative;
    padding: 3px 10px;
    border: 1px solid var(--line);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-dim);
    background: rgba(13, 19, 42, 0.65);
    border-radius: 999px;
    transition: background 0.2s, color 0.2s;
}

.chat-tab:hover {
    color: #fff;
}

.chat-tab.active {
    border-color: transparent;
    color: #0b1026;
    background: var(--accent);
}

.chat-unread {
    position: absolute;
    top: -7px;
    right: -6px;
    height: 16px;
    min-width: 16px;
    padding: 0 4px;
    font-family: var(--font-game);
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    color: #fff;
    background: var(--danger);
    border-radius: 999px;
    pointer-events: none;
}

.chat-send-channel {
    flex-shrink: 0;
    height: 26px;
    padding: 0 4px;
    border: 1px solid var(--line);
    outline: none;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-dim);
    background: rgba(13, 19, 42, 0.8);
    border-radius: 8px;
}

.chat-send-channel option {
    color: var(--ink);
    background: var(--bg-1);
}

.chat-send-channel[data-channel="world"] {
    color: #f9a8d4;
}

.chat-send-channel[data-channel="team"] {
    color: #93c5fd;
}

.chat-send-channel[data-channel="party"] {
    color: #fde68a;
}

.chat-send-channel[data-channel="friends"] {
    color: #86efac;
}

.chat-send-channel[data-channel="guild"] {
    color: #6ee7b7;
}

.chat-send-channel[data-channel="private"] {
    color: #e9d5ff;
}

.chat-whisper-row {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 4px 6px 4px 10px;
    border: 1px solid rgba(192, 132, 252, 0.3);
    font-family: var(--font);
    font-size: 12px;
    background: rgba(13, 19, 42, 0.65);
    border-radius: 12px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: opacity 0.3s;
}

.chat-whisper-label {
    flex-shrink: 0;
    color: #c4b5fd;
}

.chat-whisper-input {
    flex: 1;
    height: 24px;
    max-width: 240px;
    min-width: 0;
    padding: 0 8px;
    border: 1px solid rgba(192, 132, 252, 0.45);
    outline: none;
    font-family: var(--font);
    font-size: 12px;
    color: #fff;
    background: rgba(192, 132, 252, 0.12);
    border-radius: 999px;
}

.chat-block.faded .chat-whisper-row {
    opacity: var(--chat-faded-alpha, 0.3);
}

html.touch .chat-block:not(.chat-open) .chat-whisper-row {
    display: none !important;
}

.chat-whisper-input::placeholder {
    color: #c4b5fd;
    opacity: 0.7;
}

.chat-block.faded .chat-tabs {
    opacity: var(--chat-faded-alpha, 0.3);
}

.chat-target {
    display: inline-flex;
    flex-shrink: 0;
    gap: 4px;
    align-items: center;
    max-width: 240px;
    padding: 2px 4px 2px 10px;
    font-family: var(--font);
    font-size: 12px;
    white-space: nowrap;
    color: #e9d5ff;
    background: rgba(192, 132, 252, 0.2);
    border-radius: 999px;
}

#chat-target-name {
    text-overflow: ellipsis;
    overflow: hidden;
}

#chat-target-clear {
    padding: 0 4px;
    border: none;
    color: inherit;
    background: none;
}

.chat-name-menu {
    position: absolute;
    z-index: 30;
    display: flex;
    flex-direction: column;
    min-width: 180px;
    padding: 6px;
    border: 1px solid var(--line);
    font-family: var(--font);
    background: rgba(13, 19, 42, 0.97);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.chat-name-menu-title {
    margin-bottom: 4px;
    padding: 4px 8px 6px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}

.chat-name-menu-hint {
    padding: 4px 8px;
    font-size: 12px;
    color: var(--ink-faint);
}

.chat-name-menu button {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    border: none;
    font-size: 13px;
    text-align: left;
    color: var(--ink);
    background: none;
    border-radius: 8px;
}

.chat-name-menu button:hover {
    background: var(--glass-strong);
}

.chat-name-menu button i {
    width: 16px;
    color: var(--ink-dim);
}

.chat-bar {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 4px;
    border: 1px solid var(--line);
    background: rgba(13, 19, 42, 0.65);
    border-radius: 14px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: opacity 0.3s;
}

.chat-input {
    flex: 1;
    height: 32px;
    min-width: 0;
    padding: 0 8px;
    border: none;
    outline: none;
    font-family: var(--font);
    font-size: 14px;
    color: #fff;
    background: transparent;
}

.chat-input::placeholder {
    color: var(--ink-faint);
}

.chat-btn {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    font-size: 15px;
    color: var(--ink-dim);
    background: transparent;
    border-radius: 10px;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}

.chat-btn:hover,
.chat-btn.active {
    color: #fff;
    background: var(--glass-strong);
}

.chat-block.faded .chat-log,
.chat-block.faded .chat-bar {
    opacity: var(--chat-faded-alpha, 0.3);
}

.chat-block.auto-hide:not(.chat-shown, .chat-open) {
    pointer-events: none;
}

.chat-block.auto-hide:not(.chat-shown, .chat-open) .chat-tabs,
.chat-block.auto-hide:not(.chat-shown, .chat-open) .chat-whisper-row,
.chat-block.auto-hide:not(.chat-shown, .chat-open) .chat-bar,
.chat-block.auto-hide:not(.chat-shown, .chat-open) .chat-log > :not(.chat-pop) {
    visibility: hidden;
}

.chat-block.auto-hide:not(.chat-shown, .chat-open) .chat-log {
    overflow: hidden;
}

.chat-block.auto-hide:not(.chat-shown, .chat-open) .chat-pop {
    animation: chat-pop-fade 6s forwards;
}

@keyframes chat-pop-fade {
    0%,
    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.chat-popup {
    position: absolute;
    right: 0;
    bottom: 50px;
    display: flex;
    flex-direction: column;
    width: 340px;
    height: 300px;
    max-width: 100%;
    border: 1px solid var(--line);
    font-family: var(--font);
    background: rgba(13, 19, 42, 0.95);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chat-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    font-weight: 700;
}

.chat-popup-close {
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    color: var(--ink-dim);
    background: transparent;
    border-radius: 8px;
}

.chat-popup-close:hover {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.2);
}

.emoji-tabs {
    display: flex;
    gap: 2px;
    padding: 4px 6px;
    border-bottom: 1px solid var(--line);
}

.emoji-tab {
    flex: 1;
    min-width: 0;
    padding: 4px 0;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 17px;
    line-height: 1.3;
    background: transparent;
    border-radius: 6px 6px 0 0;
    transition: background 0.2s, border-color 0.2s;
}

.emoji-tab:hover {
    background: var(--glass-soft);
}

.emoji-tab.active {
    border-color: var(--accent-3);
    background: var(--glass-strong);
}

.emoji-clear {
    grid-column: 1 / -1;
    height: auto !important;
    margin-bottom: 4px;
    padding: 5px 0 !important;
    font-size: 12px !important;
    color: var(--ink-dim);
}

.emoji-clear:hover {
    color: var(--danger);
    transform: none !important;
}

.emoji-grid {
    display: grid;
    flex: 1;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    align-content: start;
    padding: 6px;
    overflow-y: auto;
}

.emoji-grid button {
    height: 36px;
    padding: 0;
    border: none;
    font-size: 22px;
    line-height: 1;
    background: transparent;
    border-radius: 8px;
    transition: background 0.15s, transform 0.15s;
}

.emoji-grid button:hover {
    background: var(--glass-strong);
    transform: scale(1.15);
}

.emoji-empty {
    grid-column: 1 / -1;
    padding: 20px 0;
    font-size: 13px;
    text-align: center;
    color: var(--ink-faint);
}

.command-list {
    flex: 1;
    overflow-y: auto;
}

.command-row {
    display: flex;
    gap: 10px;
    width: 100%;
    padding: 7px 12px;
    border: none;
    border-bottom: 1px solid rgba(148, 168, 255, 0.07);
    font-size: 13px;
    text-align: left;
    color: var(--ink);
    background: transparent;
}

.command-row:hover {
    background: var(--glass-soft);
}

.command-row code {
    flex-shrink: 0;
    width: 132px;
    font-weight: 700;
}

.command-row span {
    color: var(--ink-dim);
}

.command-row small {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    overflow-wrap: anywhere;
    color: var(--ink-faint);
}

.command-group {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 6px 12px 4px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--accent);
    background: rgba(13, 19, 42, 0.95);
}

body,
body .swal2-container,
body .swal2-container .swal2-popup {
    --swal2-background: #0d132a;
    --swal2-color: #e8ecf8;
    --swal2-border: 1px solid rgba(148, 168, 255, 0.16);
    --swal2-border-radius: 18px;
    --swal2-toast-border: 1px solid rgba(148, 168, 255, 0.16);
    --swal2-toast-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --swal2-input-background: rgba(7, 11, 26, 0.6);
    --swal2-input-border: 1px solid rgba(148, 168, 255, 0.25);
    --swal2-input-focus-border: 1px solid #7aa2ff;
    --swal2-confirm-button-background-color: #7aa2ff;
    --swal2-confirm-button-color: #0b1026;
    --swal2-cancel-button-background-color: rgba(148, 168, 255, 0.14);
    --swal2-backdrop: rgba(4, 7, 18, 0.6);
}

.swal2-popup {
    font-family: var(--font);
}

body .swal2-container .swal2-popup {
    color: #e8ecf8 !important;
    background: #0d132a !important;
}

body .swal2-container .swal2-title {
    color: #e8ecf8 !important;
}

.swal2-input {
    font-size: 15px;
    color: var(--ink);
}

.swal2-title,
.swal2-html-container,
.connecting-card p,
#toast-container .toast-title,
#toast-container .toast-message {
    word-break: keep-all;
    overflow-wrap: anywhere;
    text-wrap: pretty;
}

.update-card {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 10001;
    width: 340px;
    max-width: calc(100vw - 32px);
    padding: 16px 18px;
    border: 1px solid rgba(148, 168, 255, 0.2);
    color: var(--ink);
    background: #0d132a;
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    animation: update-card-in 0.25s ease-out;
}

.update-card[hidden] {
    display: none;
}

@keyframes update-card-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

.update-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.update-head h3 {
    margin: 0;
    font-size: 16px;
}

.update-close {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    color: var(--ink-dim);
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
}

.update-close:hover {
    color: var(--ink);
    background: rgba(148, 168, 255, 0.12);
}

.update-card p {
    margin: 0;
}

.update-version {
    margin-top: 6px !important;
    font-size: 13.5px;
    color: var(--ink-dim);
}

.update-title {
    margin-top: 12px !important;
    font-size: 13px;
    font-weight: 700;
}

.update-card ul {
    max-height: 160px;
    margin: 4px 0 0;
    padding-left: 18px;
    font-size: 13.5px;
    line-height: 1.7;
    overflow-y: auto;
}

.update-hint {
    margin-top: 10px !important;
    font-size: 12px;
    color: var(--ink-faint);
}

.update-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 14px;
}

.update-actions .btn {
    flex: 0 0 auto;
    width: auto;
    padding: 6px 16px;
    font-size: 14px;
    letter-spacing: 0;
    border-radius: 10px;
}

.update-actions .btn-play {
    box-shadow: none;
}

body.has-update-card #toast-container.toast-bottom-right {
    bottom: calc(var(--update-card-height, 0px) + 28px);
}

.announcement-body {
    font-size: 14px;
    line-height: 1.7;
    text-align: left;
    word-break: normal;
    line-break: strict;
}

.announcement-body p {
    margin: 0 0 10px;
}

.announcement-body ul {
    margin: 0 0 10px;
    padding-left: 20px;
}

.announcement-body li {
    margin-bottom: 4px;
}

.help-dialog {
    font-size: 14px;
    line-height: 1.7;
    text-align: left;
    color: var(--ink);
}

.help-dialog h3 {
    margin: 16px 0 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--ink-dim);
}

.help-dialog h3:first-child {
    margin-top: 0;
}

.help-dialog code {
    padding: 1px 6px;
    font-size: 12.5px;
    white-space: nowrap;
    color: #9fc0ff;
    background: rgba(148, 168, 255, 0.12);
    border-radius: 6px;
}

.help-dialog a {
    color: #7aa2ff;
}

.help-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.help-steps li {
    position: relative;
    padding: 0 0 8px 34px;
    counter-increment: step;
}

.help-steps li::before {
    position: absolute;
    top: 1px;
    left: 0;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    font-size: 12px;
    font-weight: 700;
    color: #9fc0ff;
    background: rgba(122, 162, 255, 0.18);
    border-radius: 50%;
    content: counter(step);
}

.help-rules {
    margin: 0;
    padding: 0;
    border: 1px solid rgba(148, 168, 255, 0.14);
    list-style: none;
    border-radius: 10px;
    overflow: hidden;
}

.help-rules li {
    display: flex;
    gap: 12px;
    padding: 7px 12px;
}

.help-rules li + li {
    border-top: 1px solid rgba(148, 168, 255, 0.1);
}

.help-rules span {
    flex-shrink: 0;
    width: 32px;
    color: var(--ink-dim);
}

.help-note {
    margin: 14px 0 6px;
    padding: 8px 12px;
    color: #fcd34d;
    background: rgba(251, 191, 36, 0.1);
    border-radius: 10px;
}

.help-tip {
    margin: 0;
    font-size: 13px;
    color: var(--ink-dim);
}

body.swal2-toast-shown .swal2-container:has(.swal2-toast) {
    width: 460px;
    max-width: calc(100% - 32px);
}

.connection-toast {
    --swal2-timer-progress-bar-background: rgba(122, 162, 255, 0.45);
}

.connection-toast .swal2-timer-progress-bar {
    height: 2px;
}

.connection-toast .swal2-icon.swal2-success {
    border-color: var(--success);
    color: var(--success);
}

.connection-toast .swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(74, 222, 128, 0.35);
}

.connection-toast .swal2-icon.swal2-success [class^="swal2-success-line"] {
    background-color: var(--success);
}

.connection-toast .swal2-icon.swal2-error {
    border-color: var(--danger);
    color: var(--danger);
}

.connection-toast .swal2-icon.swal2-error [class^="swal2-x-mark-line"] {
    background-color: var(--danger);
}

.connection-toast .swal2-icon.swal2-info {
    border-color: var(--accent);
    color: var(--accent);
}

.connection-toast .swal2-icon.swal2-warning {
    border-color: var(--warning);
    color: var(--warning);
}

.connection-toast .swal2-title {
    margin: 2px 12px 0;
    font-size: 15px;
    font-weight: 700;
}

.connection-toast .swal2-html-container {
    margin: 4px 12px 2px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--ink-dim);
}

#toast-container > div {
    font-family: var(--font);
    opacity: 0.95;
}

@media (max-width: 800px) {
    .ad-banner {
        display: none !important;
    }
}

@media (max-width: 1100px) {
    .menu-grid {
        grid-template-columns: minmax(0, 440px);
    }

    .menu-center {
        order: -1;
    }
}

@media (max-width: 640px) {
    .perf-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    #overlays {
        padding: 12px;
    }

    .settings-body {
        flex-direction: column;
    }

    .settings-sidebar {
        flex-direction: row;
        width: 100%;
        overflow-x: auto;
    }

    .option-grid,
    .slider-grid,
    .color-grid {
        grid-template-columns: 1fr;
    }

    #leaderboard {
        width: 170px;
    }

    .gallery-tabs {
        width: 100%;
    }

    .tab-button {
        flex: 1;
        justify-content: center;
        padding: 6px 8px;
        font-size: 13px;
        white-space: nowrap;
    }

    .gallery-search {
        width: 100%;
    }
}

.device-gate {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
        radial-gradient(ellipse 80% 60% at 70% -10%, rgba(26, 38, 80, 0.9) 0, transparent 60%),
        radial-gradient(ellipse 60% 50% at 10% 110%, rgba(37, 26, 74, 0.9) 0, transparent 60%),
        var(--bg-0);
}

#fullscreen-gate:not([style*="display: none"]) {
    display: flex;
    background: rgba(4, 7, 18, 0.75);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

@media (orientation: portrait) {
    html.touch #rotate-gate {
        display: flex;
    }
}

.gate-card {
    width: min(360px, 100%);
    padding: 28px 24px;
    border: 1px solid var(--line);
    text-align: center;
    background: var(--glass);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.gate-card h2 {
    margin: 18px 0 8px;
    font-size: 22px;
    font-weight: 900;
}

.gate-card p {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    word-break: keep-all;
    overflow-wrap: anywhere;
    color: var(--ink-dim);
}

.gate-card .btn {
    margin-top: 18px;
}

.gate-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.gate-icon {
    font-size: 44px;
    color: var(--accent);
}

.rotate-phone {
    position: relative;
    display: grid;
    place-items: center;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.phone-body {
    position: relative;
    width: 46px;
    height: 80px;
    border: 4px solid var(--accent);
    border-radius: 10px;
    box-shadow: 0 0 24px rgba(122, 162, 255, 0.35);
    animation: rotate-phone 2.4s ease-in-out infinite;
}

.phone-body span {
    position: absolute;
    bottom: 5px;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    transform: translateX(-50%);
}

.rotate-arrow {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 26px;
    color: var(--accent-2);
    animation: rotate-arrow 2.4s ease-in-out infinite;
}

@keyframes rotate-phone {
    0%,
    20% {
        transform: rotate(0deg);
    }

    55%,
    80% {
        transform: rotate(90deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

@keyframes rotate-arrow {
    0%,
    20% {
        opacity: 0;
        transform: rotate(-40deg);
    }

    45% {
        opacity: 1;
    }

    55%,
    100% {
        opacity: 0;
        transform: rotate(40deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .phone-body,
    .rotate-arrow {
        animation: none;
    }

    .phone-body {
        transform: rotate(90deg);
    }
}

.touch-controls,
.touch-only {
    display: none;
}

html.touch .touch-only,
html.touch .touch-controls {
    display: block;
}

body:has(> #overlays:not([style*="display: none"])) .touch-controls,
body:has(> #stats:not([style*="display: none"])) .touch-controls {
    display: none !important;
}

html.touch #canvas {
    touch-action: none;
}

html.touch,
html.touch body {
    overscroll-behavior: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.joystick {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 15;
    width: 112px;
    height: 112px;
    margin: -56px 0 0 -56px;
    border: 2px solid rgba(255, 255, 255, 0.28);
    background: rgba(13, 19, 42, 0.3);
    border-radius: 50%;
    pointer-events: none;
}

.joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    background: rgba(122, 162, 255, 0.45);
    border-radius: 50%;
}

.touch-point {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 15;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    pointer-events: none;
}

.touch-buttons {
    position: fixed;
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 25;
    display: none;
    grid-template-columns: auto auto;
    grid-template-areas:
        "dual double"
        "eject split";
    gap: 10px 14px;
    align-items: end;
    justify-items: center;
}

.touch-controls.alive .touch-buttons {
    display: grid;
}

.touch-btn {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
    font-family: var(--font);
    font-size: 20px;
    color: #fff;
    background: rgba(13, 19, 42, 0.45);
    border-radius: 50%;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    transition: transform 0.08s, background 0.08s;
    user-select: none;
    touch-action: none;
}

.touch-btn span {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.touch-btn b {
    font-family: var(--font-game);
    font-size: 16px;
    line-height: 1;
}

.touch-btn.pressed {
    background: rgba(122, 162, 255, 0.55);
    transform: scale(0.9);
}

.touch-btn.big {
    grid-area: split;
    width: 84px;
    height: 84px;
    border-color: rgba(122, 162, 255, 0.7);
    font-size: 28px;
    background: rgba(122, 162, 255, 0.25);
}

#touch-eject {
    grid-area: eject;
}

#touch-double {
    grid-area: double;
}

#touch-dual {
    grid-area: dual;
}

.touch-btn.small {
    width: 50px;
    height: 50px;
    font-size: 16px;
}

.touch-btn.mini {
    position: fixed;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    z-index: 25;
    width: 40px;
    height: 40px;
    font-size: 16px;
}

body:has(.chat-block.chat-open) #touch-chat {
    display: none;
}

@media (hover: none) {
    [data-tip]::after {
        display: none !important;
    }
}

html.touch #replay-bar,
html.touch #hud-position,
html.touch .hud-server {
    display: none !important;
}

html.touch #minimap-layer {
    top: 52px;
    right: auto;
    bottom: auto;
    left: max(6px, env(safe-area-inset-left));
}

html.touch #hud-stats {
    left: max(10px, env(safe-area-inset-left));
}

html.touch .chat-block {
    bottom: max(56px, env(safe-area-inset-bottom));
    left: max(8px, env(safe-area-inset-left));
    width: min(360px, 45vw);
    pointer-events: none;
}

html.touch .chat-block .chat-tabs,
html.touch .chat-block .chat-bar {
    display: none;
}

html.touch .chat-block .chat-log {
    max-height: 66px;
    font-size: 12px;
    line-height: 1.4;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
    mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
}

html.touch .chat-block.chat-open {
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 60;
    width: min(520px, calc(100vw - 16px));
    padding: 8px;
    border: 1px solid var(--line);
    background: rgba(13, 19, 42, 0.92);
    border-radius: 14px;
    pointer-events: auto;
}

html.touch .chat-block.chat-open .chat-tabs,
html.touch .chat-block.chat-open .chat-bar {
    display: flex;
}

html.touch .chat-block.chat-open .chat-log {
    max-height: 30vh;
    overflow-y: auto;
    -webkit-mask-image: none;
    mask-image: none;
}

@media (max-height: 540px) {
    #hud-stats {
        top: max(6px, env(safe-area-inset-top));
        font-size: 12px;
        line-height: 1.35;
    }

    .hud-score {
        font-size: 16px;
    }

    .hud-perf {
        font-size: 11px;
    }

    #leaderboard {
        top: max(6px, env(safe-area-inset-top));
        right: max(6px, env(safe-area-inset-right));
        width: 150px;
        padding: 6px 8px 8px;
        border-radius: 10px;
    }

    .leaderboard-title {
        margin-bottom: 2px;
        font-size: 13px;
    }

    .leaderboard-list li {
        padding: 0 4px;
        font-size: 11.5px;
    }

    .leaderboard-list:not(.leaderboard-text) li:nth-child(n + 6):not(.me) {
        display: none;
    }

    .leaderboard-actions {
        gap: 4px;
        margin-top: 6px;
        padding-top: 6px;
    }

    .hud-action {
        height: 26px;
        font-size: 12px;
    }

    .spectate-hint {
        bottom: 12px;
        padding: 6px 16px;
        font-size: 12px;
    }

    .leaderboard-royale {
        margin-top: 6px;
        padding: 4px 6px;
    }

    .leaderboard-event {
        gap: 4px;
        padding: 3px 4px;
        font-size: 10px;
        border-radius: 10px;
    }

    .royale-title {
        font-size: 11px;
    }

    .royale-detail {
        font-size: 10.5px;
    }

    .royale-call {
        padding: 4px 14px;
    }

    html:not(.touch) body:has(#replay-bar:not([style*="display: none"])) .royale-call {
        top: 90px;
    }

    .royale-call-title {
        font-size: 14px;
    }

    .royale-call-detail {
        font-size: 11px;
    }

    .royale-alert {
        padding: 4px 14px;
    }

    html:not(.touch) body:has(#replay-bar:not([style*="display: none"])) .royale-alert {
        top: 90px;
    }

    .royale-alert-title {
        font-size: 14px;
    }

    .royale-alert-detail {
        font-size: 11px;
    }
}

.menu-tabs {
    display: none;
}

@media (orientation: landscape) and (max-height: 540px), (orientation: landscape) and (max-width: 1099px) {
    #overlays {
        align-items: stretch;
        padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
        overflow: hidden;
    }

    .menu-wrap {
        width: 100%;
        height: 100%;
        margin: 0;
    }

    .menu-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
        gap: 10px 12px;
        width: 100%;
        height: 100%;
        max-width: 980px;
        max-height: 620px;
        margin: auto;
    }

    .menu-column {
        display: contents;
    }

    .menu-grid .ad-card {
        display: none !important;
    }

    .main-card {
        grid-column: 1;
        grid-row: 1 / 3;
        justify-content: center;
        min-height: 0;
        overflow-y: auto;
    }

    .menu-tabs {
        display: flex;
        grid-column: 2;
        grid-row: 1;
        gap: 4px;
        padding: 4px;
        border: 1px solid var(--line);
        background: var(--glass);
        border-radius: 14px;
    }

    .menu-tab {
        display: flex;
        flex: 1;
        gap: 6px;
        align-items: center;
        justify-content: center;
        padding: 7px 4px;
        border: none;
        font-size: 13px;
        font-weight: 700;
        white-space: nowrap;
        color: var(--ink-dim);
        background: transparent;
        border-radius: 10px;
    }

    .menu-tab.active {
        color: #fff;
        background: var(--glass-strong);
    }

    .menu-tab[hidden] {
        display: none;
    }

    .menu-pane {
        display: none;
        grid-column: 2;
        grid-row: 2;
        min-height: 0;
        overflow-y: auto;
    }

    .menu-grid[data-pane="mode"] .menu-pane[data-pane="mode"],
    .menu-grid[data-pane="party"] .menu-pane[data-pane="party"]:not([hidden]),
    .menu-grid[data-pane="news"] .menu-pane[data-pane="news"] {
        display: block;
    }

    .menu-grid[data-pane="account"] .menu-pane[data-pane="account"],
    .menu-grid[data-pane="ranking"] .menu-pane[data-pane="ranking"] {
        display: flex;
    }

    .menu-pane > .card-title {
        display: none;
    }

    .ranking-card .ranking-list {
        min-height: 0;
    }

    .instructions {
        display: none;
    }
}

@media (orientation: landscape) and (max-width: 759px) {
    html:lang(en) .menu-tab i {
        display: none;
    }
}

@media (orientation: landscape) and (max-height: 540px) {
    .glass-card {
        padding: 12px 14px;
        border-radius: 14px;
    }

    .main-card {
        gap: 8px;
        padding: 10px 14px;
    }

    .main-card .icon-btn {
        width: 32px;
        height: 32px;
    }

    .status-badge {
        padding: 4px 10px;
        font-size: 12px;
    }

    .logo {
        padding-bottom: 2px;
        font-size: clamp(24px, 8vh, 36px);
        line-height: 1.25;
    }

    .main-card .form-control,
    .main-card .input-group-text {
        padding-top: 5px;
        padding-bottom: 5px;
        font-size: 14px;
    }

    .main-card .form-control-lg {
        padding-top: 7px;
        padding-bottom: 7px;
        font-size: 16px;
    }

    .main-card .btn-play {
        padding: 8px;
        font-size: 18px;
    }

    .main-card .sub-actions .btn {
        padding: 6px;
        font-size: 14px;
    }

    .profile-card {
        gap: 10px;
    }

    .skin-preview {
        width: 64px;
        height: 64px;
    }

    .skin-preview-sub {
        width: 50px;
        height: 50px;
    }

    .ranking-list li {
        padding: 4px 8px;
        font-size: 13px;
    }

    .modal-layer {
        padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    }

    .settings-card,
    .shop-card,
    .gallery-card,
    .editor-card {
        height: 100%;
    }

    .social-card,
    .profile-modal-card {
        max-height: 100%;
    }

    .profile-modal-card {
        overflow-y: auto;
    }

    .settings-header {
        margin-bottom: 8px;
    }

    .settings-header h2 {
        font-size: 17px;
    }

    .settings-sidebar {
        gap: 2px;
        width: 132px;
    }

    .settings-tab-btn {
        gap: 8px;
        padding: 7px 10px;
        font-size: 13px;
    }

    .stats-card {
        width: min(620px, 100%);
        max-height: 100%;
        padding: 12px 16px;
        overflow-y: auto;
    }

    .stats-title {
        margin: 0 0 8px;
        font-size: 18px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px 8px;
        padding: 8px 8px 50px;
    }

    .stats-label {
        font-size: 12px;
    }

    .stats-value {
        font-size: 17px;
    }

    #statsGraph {
        height: 46px;
    }

    .stats-xp {
        margin-top: 8px;
        padding: 6px 10px;
    }

    .stats-actions {
        flex-direction: row;
        gap: 8px;
        margin-top: 10px;
    }

    .stats-sub-actions {
        display: contents;
    }

    .stats-actions .btn {
        flex: 1 1 auto;
        width: auto;
        height: 40px;
        min-width: 0;
        padding: 0 8px;
        font-size: 14px;
        letter-spacing: 0;
        white-space: nowrap;
    }

    .stats-footer {
        margin-top: 8px;
    }
}

.gate-actions .btn {
    white-space: nowrap;
}

html.touch #toast-container {
    top: max(8px, env(safe-area-inset-top));
    right: auto;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
}

html.touch #toast-container > div {
    width: min(340px, 60vw);
    padding: 10px 12px 10px 44px;
    font-size: 13px;
    background-position: 12px center;
}

@media (orientation: landscape) and (max-height: 540px), (orientation: landscape) and (max-width: 1099px) {
    body:has(> #overlays:not([style*="display: none"])) #hud,
    body:has(> #overlays:not([style*="display: none"])) #minimap-layer,
    body:has(> #overlays:not([style*="display: none"])) .chat-block {
        visibility: hidden;
    }
}

body .swal2-container .swal2-popup:not(.swal2-toast) .swal2-icon {
    margin-top: 1.6em;
    font-size: 12px;
}

body .swal2-container .swal2-popup .swal2-icon.swal-context-icon {
    border-color: rgba(122, 162, 255, 0.45);
    color: var(--accent);
    background: rgba(122, 162, 255, 0.08);
}

body .swal2-container .swal2-popup .swal2-icon.swal-context-icon .swal2-icon-content {
    font-size: 2.4em;
}

body .swal2-container .swal2-popup .swal2-icon.swal-context-icon .fa-star {
    transform: translateY(0.083em);
}

body .swal2-container .swal2-popup .swal2-icon.swal-context-icon .fa-shield-halved {
    transform: translateY(0.035em);
}

body .swal2-container .swal2-popup .swal2-icon.swal-context-icon.stardust {
    border-color: rgba(250, 204, 21, 0.45);
    color: #facc15;
    background: rgba(250, 204, 21, 0.08);
}

.shop-item.limited {
    position: relative;
    padding-top: 26px;
    border-color: rgba(251, 146, 60, 0.4);
}

.shop-item.locked {
    opacity: 0.55;
    filter: grayscale(0.6);
}

.shop-item.locked .shop-limited {
    color: var(--ink-dim);
    background: var(--glass-soft);
}

.shop-limited {
    position: absolute;
    top: 0;
    left: 0;
    padding: 2px 9px 3px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    color: #fed7aa;
    background: rgba(251, 146, 60, 0.25);
    border-radius: 11px 0 10px 0;
}

.guild-fund-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 10px 14px;
    border: 1px solid rgba(250, 204, 21, 0.3);
    background: rgba(250, 204, 21, 0.06);
    border-radius: 10px;
}

.guild-fund-label {
    font-size: 13px;
    color: var(--ink-dim);
}

.guild-fund-amount {
    font-family: var(--font-game);
    font-size: 18px;
    font-weight: 700;
    color: #fde68a;
}

.guild-fund-amount i,
.guild-shop-price i {
    color: #facc15;
}

#guild-donate-form {
    margin-top: 8px;
}

.guild-shop-icon {
    flex-shrink: 0;
    width: 22px;
    font-size: 18px;
    text-align: center;
    color: var(--accent);
}

.guild-shop-price {
    font-family: var(--font-game);
    font-size: 12px;
    color: #fde68a;
}

.guild-skill.learned .guild-shop-price {
    color: #6ee7b7;
}

.guild-skill .guild-skill-desc {
    white-space: pre-line;
}

.guild-fund-log {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.guild-fund-log li:not(.social-empty) {
    display: flex;
    gap: 8px;
    align-items: baseline;
    padding: 5px 10px;
    font-size: 13px;
    background: var(--glass-soft);
    border-radius: 8px;
}

.guild-fund-name {
    max-width: 40%;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.guild-fund-note {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink-dim);
    overflow: hidden;
}

.guild-fund-value {
    margin-left: auto;
    font-family: var(--font-game);
    font-weight: 700;
    color: #6ee7b7;
}

.guild-fund-value.spend {
    color: #fca5a5;
}

.guild-skin-form,
.guild-skin-option {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}

.guild-skin-option .guild-option {
    margin: 0;
}

.guild-skin-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.guild-skin-self {
    display: flex;
    gap: 6px;
    align-items: center;
}

.guild-skin-preview {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 2px solid var(--line);
    background: var(--glass-soft);
    border-radius: 50%;
    object-fit: cover;
}

.guild-skin-preview.empty {
    visibility: hidden;
}

.guild-skin-form .btn {
    flex-shrink: 0;
}

.social-hint,
.guild-panel-hint,
.guild-applied-hint,
.rank-table-hint,
.settings-hint,
.shop-hint,
.profile-hint,
.media-empty-hint,
.help-dialog li,
.help-dialog p {
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.touch-only-inline {
    display: none;
}

html.touch .touch-only-inline {
    display: inline;
}

html.touch .pc-only,
html.touch .instructions {
    display: none !important;
}

.touch-btn.spectate {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 25;
    display: none;
    width: 68px;
    height: 68px;
    font-size: 20px;
}

.touch-controls.spectating .touch-btn.spectate {
    display: flex;
}

@media (orientation: landscape) and (max-height: 540px) {
    .settings-tab-panel[data-tab="media"].active {
        display: block;
        height: auto;
    }

    .media-main {
        padding: 0;
        overflow: visible;
    }

    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        min-height: 140px;
    }

    .media-head,
    .media-options {
        margin-bottom: 8px;
    }

    .connecting-card {
        max-height: 100%;
        padding: 12px 16px;
        overflow-y: auto;
    }

    .connecting-card .spinner-border {
        width: 24px;
        height: 24px;
        border-width: 3px;
    }

    .connecting-card h2 {
        margin: 6px 0 4px;
        font-size: 18px;
    }

    .connecting-status {
        margin-bottom: 6px;
    }

    .connecting-card #turnstile-container {
        margin-bottom: 6px;
    }

    .connecting-card p {
        font-size: 12px;
        line-height: 1.55;
    }

    .connecting-switch {
        margin-top: 8px;
        padding-top: 8px;
    }

    .connecting-switch > span {
        margin-bottom: 6px;
    }

    .connecting-server {
        padding: 4px 10px;
        font-size: 12px;
    }

    .connecting-cancel {
        margin-top: 8px;
    }
}

.touch-extra {
    position: fixed;
    right: calc(max(14px, env(safe-area-inset-right)) + 176px);
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 25;
    display: none;
    flex-direction: column-reverse;
    gap: 10px;
}

.touch-controls.alive.extra .touch-extra {
    display: flex;
}

.touch-extra .party {
    display: none;
}

.touch-controls.party .touch-extra .party {
    display: flex;
}

.touch-extra-option {
    margin: 8px 0 18px;
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.settings-actions .btn {
    border-radius: 10px;
}

.tour-layer {
    position: fixed;
    inset: 0;
    z-index: 9000;
}

.tour-spot {
    position: fixed;
    border: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    box-shadow: 0 0 0 9999px rgba(3, 6, 18, 0.72), var(--glow);
    transition: left 0.25s, top 0.25s, width 0.25s, height 0.25s;
    pointer-events: none;
}

.tour-card {
    position: fixed;
    width: min(340px, calc(100vw - 24px));
    padding: 16px 18px 14px;
    border: 1px solid var(--line-hover);
    color: var(--ink);
    background: var(--bg-1);
    border-radius: 14px;
    box-shadow: var(--shadow);
    transition: left 0.25s, top 0.25s;
}

.tour-head {
    display: flex;
    gap: 12px;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 6px;
}

.tour-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.tour-step {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--ink-faint);
}

.tour-text {
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-line;
    word-break: keep-all;
    overflow-wrap: anywhere;
    color: var(--ink-dim);
}

.tour-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tour-skip {
    margin-right: auto;
    padding: 4px 0;
    border: none;
    font-size: 13px;
    color: var(--ink-faint);
    background: none;
    cursor: pointer;
}

.tour-skip:hover,
.tour-skip:focus-visible {
    color: var(--ink);
}

.tour-actions .btn {
    border-radius: 10px;
}

@media (prefers-reduced-motion: reduce) {
    .tour-spot,
    .tour-card {
        transition: none;
    }
}

.referral-code-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    background: var(--glass-soft);
    border-radius: var(--radius-sm);
}

.referral-code-label {
    font-size: 12px;
    color: var(--ink-faint);
}

.referral-code {
    font-family: var(--font-game);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--ink);
}

.referral-copy {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.referral-copy .btn {
    border-radius: 10px;
}

.referral-title {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    align-items: baseline;
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
}

.referral-count {
    font-size: 12px;
    font-weight: 400;
    color: var(--ink-dim);
}

.referral-tiers {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
}

.referral-tier {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    padding: 8px 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    opacity: 0.55;
}

.referral-tier.reached {
    border-color: var(--line-hover);
    background: var(--glass-strong);
    opacity: 1;
}

.referral-tier .chat-title {
    margin-right: 0;
}

.referral-tier-count {
    font-size: 12px;
    color: var(--ink-dim);
}

.referral-own {
    margin: 12px 0 8px;
    font-size: 13px;
    color: var(--ink-dim);
}

.referral-body .social-hint {
    white-space: pre-line;
    word-break: keep-all;
}

.referral-form {
    display: flex;
    gap: 8px;
}

.referral-form .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

@media (max-width: 420px) {
    .referral-tiers {
        grid-template-columns: repeat(2, 1fr);
    }
}

.account-links {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.account-links .friends-btn {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    margin-top: 0;
    white-space: nowrap;
}

.account-links #tasks-btn {
    position: relative;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
}

.task-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: var(--glass-soft);
    border-radius: var(--radius-sm);
}

.task-item > i {
    margin-top: 2px;
    font-size: 18px;
    color: var(--ink-faint);
}

.task-item.done > i {
    color: var(--success);
}

.task-body {
    flex: 1;
    min-width: 0;
}

.task-head {
    display: flex;
    gap: 8px;
    align-items: baseline;
    justify-content: space-between;
}

.task-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.task-tag {
    position: relative;
    display: inline-block;
    margin-right: 2px;
    padding: 0 6px 2px;
    font-size: 11px;
    font-weight: 600;
    vertical-align: 1px;
    color: #fff;
    background: #f97316;
    border-radius: 6px;
    clip-path: inset(0 round 6px);
}

.task-item.event {
    border-color: rgba(249, 115, 22, 0.45);
}

.task-reward {
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    color: #facc15;
}

.task-bar {
    height: 6px;
    margin: 8px 0 4px;
    background: rgba(148, 168, 255, 0.12);
    border-radius: 999px;
    overflow: hidden;
}

.task-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: inherit;
    transition: width 0.3s;
}

.task-item.done .task-fill {
    background: var(--success);
}

.task-count {
    font-size: 12px;
    color: var(--ink-dim);
}

.task-bonus,
.task-streak {
    font-size: 13px;
    color: var(--ink-dim);
}

.task-bonus {
    margin-bottom: 4px;
}

.task-bonus.done {
    color: var(--success);
}

.warning-dialog p {
    margin: 0 0 8px;
    line-height: 1.6;
}

.warning-dialog p:last-child {
    margin-bottom: 0;
}

.warning-dialog .warning-reason {
    font-weight: 700;
    color: var(--ink);
}

.warning-dialog .warning-mute {
    font-weight: 700;
    color: #f87171;
}
