/* GLOBAL */

body {
    padding: 0;
    margin: 0;
    overflow: hidden;
    line-height: 1.6;
}

hr {
    margin-top: 16px;
    margin-bottom: 16px;
    border: 0;
    border-top: 1px solid hsl(0deg 0% 100% / 10%);
}

.text-muted {
    color: var(--muted);
    font-size: 14px;
}

/* IDs */
#motd {
	text-align: center;
}
#canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 0;
}

#connecting {
    display:none;
    position: fixed;
    inset: 0;
    z-index: 1200;
    background-color: rgba(0,0,0,0.5);
}

#nick {
    width: 100%;
    min-width: 0;
}

#gamemode {
    width: 33%;
    float: right;
}

#helloDialog {
    width: 400px;
    background-color: #FFFFFF;
    margin: 10px auto;
    border-radius: 15px;
    padding: 5px 15px 5px 15px;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-right: -50%;
    -webkit-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
}

.game-chat-wrap {
    position: fixed;
    left: 10px;
    bottom: 10px;
    z-index: 150;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: var(--game-chat-width, 420px);
    max-width: calc(100vw - 20px);
    opacity: 0.9;
    transition: opacity 0.45s ease;
    pointer-events: auto;
}

.game-chat-wrap.game-chat--faded {
    opacity: 0.38;
}

.game-chat-wrap.game-chat--hidden {
    display: none !important;
}

.game-chat-panel {
    position: relative;
    height: var(--game-chat-height, 220px);
    min-height: 96px;
    max-height: min(55vh, 480px);
    background: rgba(12, 14, 18, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.game-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 6px 6px 8px 8px;
    scroll-behavior: smooth;
    font: 13px/1.4 Ubuntu, sans-serif;
    color: #f0f2f5;
}

.game-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.game-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 3px;
}

.game-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.game-chat__msg {
    position: relative;
    padding: 5px 44px 5px 10px;
    margin-bottom: 3px;
    border-radius: 7px;
    border-left: 3px solid rgba(125, 211, 252, 0.55);
    background: rgba(255, 255, 255, 0.05);
    word-break: break-word;
    overflow-wrap: anywhere;
}

.game-chat__msg--vip {
    border-left-color: rgba(255, 200, 60, 0.85);
    background: rgba(48, 38, 10, 0.45);
}

.game-chat__msg--server-red {
    border-left-color: rgba(255, 70, 70, 0.9);
    background: rgba(60, 12, 12, 0.5);
}

.game-chat__msg--server-red .game-chat__nick,
.game-chat__msg--server-red .game-chat__body {
    color: #ff4444 !important;
    font-weight: 600;
}

.game-chat__time {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.32);
    white-space: nowrap;
}

.game-chat__head {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    font-weight: 700;
    line-height: 1.35;
    gap: 0 1px;
}

.game-chat__vip {
    color: #ffe566;
    text-shadow: 0 0 1px #ff8c00;
}

.game-chat__title--legend {
    color: #eab308;
}

.game-chat__vip--plus {
    color: #ffe08a;
    text-shadow: 0 0 8px rgba(255, 224, 138, 0.65);
}

.game-chat__title--champion { color: #fbbf24; }
.game-chat__title--hunter { color: #f87171; }
.game-chat__title--veteran { color: #93c5fd; }
.game-chat__title--donator { color: #c4b5fd; }

.game-chat__title--owner {
    font-weight: 700;
    background: linear-gradient(90deg, #ff2222, #ff7777, #cc1111, #ff5555, #ff3333, #ff2222);
    background-size: 220% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: owner-title-shimmer 1.35s ease-in-out infinite;
}

@keyframes owner-title-shimmer {
    0%, 100% {
        background-position: 0% center;
        filter: brightness(1) saturate(1.1);
    }
    50% {
        background-position: 100% center;
        filter: brightness(1.4) saturate(1.35);
    }
}

.game-chat__clan {
    font-weight: 700;
    display: inline-block;
    line-height: 1;
    position: relative;
    top: -2px;
}

.game-chat__nick {
    font-weight: 700;
    display: inline-block;
    line-height: 1.35;
}

.game-chat__nick--shimmer,
.game-chat__clan--shimmer {
    background: linear-gradient(90deg, currentColor, #ffffff, currentColor, #ffe8a8, currentColor);
    background-size: 240% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: owner-title-shimmer 1.45s ease-in-out infinite;
    line-height: 1;
}

.game-chat__clan--shimmer {
    background: linear-gradient(90deg, currentColor, #ffffff, currentColor, #b8f5ff, currentColor);
    position: relative;
    top: -2px;
}

.game-chat__title--owner,
.game-chat__title--legend,
.game-chat__title--champion,
.game-chat__title--hunter,
.game-chat__title--veteran,
.game-chat__title--donator,
.game-chat__vip,
.game-chat__vip--plus {
    display: inline-block;
    line-height: 1.35;
}

.game-chat__colon {
    color: rgba(255, 255, 255, 0.55);
    font-weight: 400;
}

.game-chat__body {
    color: #f0f2f5;
    font-weight: 400;
}

.game-chat-resize {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    z-index: 2;
    opacity: 0.35;
    background: linear-gradient(135deg, transparent 50%, rgba(125, 211, 252, 0.55) 50%);
    border-bottom-right-radius: 10px;
}

.game-chat-resize:hover {
    opacity: 0.75;
}

#chat_textbox {
    -webkit-transition: background .25s ease-in-out, border-color .25s ease-in-out, box-shadow .25s ease-in-out;
    -moz-transition: background .25s ease-in-out, border-color .25s ease-in-out, box-shadow .25s ease-in-out;
    -o-transition: background .25s ease-in-out, border-color .25s ease-in-out, box-shadow .25s ease-in-out;
    transition: background .25s ease-in-out, border-color .25s ease-in-out, box-shadow .25s ease-in-out;
    position: relative;
    width: 100%;
    height: 34px;
    padding: 0 12px;
    box-sizing: border-box;
    background: rgba(12, 14, 18, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    outline: none;
    color: #f0f2f5;
    font: 13px Ubuntu, sans-serif;
    text-indent: 0;
}

#chat_textbox::placeholder {
    color: rgba(255, 255, 255, 0.38);
}

#chat_textbox:focus {
    background: rgba(12, 14, 18, 0.95);
    border-color: rgba(125, 211, 252, 0.45);
    box-shadow: 0 0 0 2px rgba(125, 211, 252, 0.12);
}

#play-btn {
    width: 85%;
    float: left;
}

#settings-btn {
    width: 13%;
    float: right;
}

/* CLASSES */

.checkbox label {
    margin-right: 10px;
}

.mb-10 {
    margin-bottom: 10px;
}

.loader {
    border: 6px solid #f3f3f3;
    border-top: 6px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
}

.center {
    display: table;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spectate-picker {
    position: fixed;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 12;
    width: min(220px, 28vw);
    max-height: min(52vh, 420px);
    background: rgba(10, 12, 16, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.spectate-picker[hidden] {
    display: none !important;
}

.spectate-picker__title {
    padding: 10px 12px 8px;
    font: 600 13px Ubuntu, sans-serif;
    color: #e8eaed;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.spectate-picker__hint {
    padding: 0 12px 8px;
    font: 11px/1.35 Ubuntu, sans-serif;
    color: rgba(232, 234, 237, 0.55);
}

.spectate-picker__list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 6px 8px;
}

.spectate-picker__list::-webkit-scrollbar {
    width: 5px;
}

.spectate-picker__list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 3px;
}

.spectate-picker__row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 4px;
    padding: 7px 8px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #e8eaed;
    font: 13px Ubuntu, sans-serif;
    text-align: left;
    cursor: pointer;
}

.spectate-picker__row:hover {
    background: rgba(125, 211, 252, 0.18);
}

.spectate-picker__dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.spectate-picker__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spectate-picker__empty {
    padding: 10px 8px;
    font: 12px Ubuntu, sans-serif;
    color: rgba(232, 234, 237, 0.5);
}

/* Mobile touch controls */
body.mobile-play {
    touch-action: none;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
}

body.mobile-play {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
}

body.mobile-play #canvas {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

body.mobile-play #overlays {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.mobile-controls {
    position: fixed;
    inset: 0;
    z-index: 140;
    pointer-events: none;
    touch-action: none;
}

.mobile-controls[hidden] {
    display: none !important;
}

.mobile-joystick {
    position: fixed;
    left: max(10px, env(safe-area-inset-left, 0px));
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
    width: 132px;
    height: 132px;
    pointer-events: auto;
    touch-action: none;
}

.mobile-joystick__base {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(10, 12, 16, 0.45);
    border: 2px solid rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35);
}

.mobile-joystick__stick {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 52px;
    height: 52px;
    margin: -26px 0 0 -26px;
    border-radius: 50%;
    background: rgba(0, 150, 255, 0.35);
    border: 2px solid rgba(100, 200, 255, 0.85);
    box-shadow: 0 4px 14px rgba(0, 120, 255, 0.35);
    transform: translate(0, 0);
    will-change: transform;
    pointer-events: none;
}

.mobile-joystick.mobile-joystick--active .mobile-joystick__base {
    border-color: rgba(100, 200, 255, 0.45);
}

.mobile-actions {
    position: fixed;
    right: max(10px, env(safe-area-inset-right, 0px));
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: auto;
}

.mobile-btn {
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #f0f2f5;
    background: rgba(10, 12, 16, 0.72);
    border: 2px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    pointer-events: auto;
}

.mobile-btn:active,
.mobile-btn.mobile-btn--pressed {
    transform: scale(0.94);
    background: rgba(30, 36, 48, 0.9);
}

.mobile-btn--split {
    color: #7dd3fc;
    border-color: rgba(125, 211, 252, 0.35);
}

.mobile-btn--feed {
    color: #86efac;
    border-color: rgba(134, 239, 172, 0.35);
}

.mobile-btn--feed.mobile-btn--pressed {
    background: rgba(20, 60, 40, 0.85);
}

.mobile-btn--menu {
    position: fixed;
    top: max(10px, env(safe-area-inset-top, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
    width: 48px;
    height: 48px;
    font-size: 18px;
}

.mobile-btn--respawn {
    position: fixed;
    top: max(10px, env(safe-area-inset-top, 0px));
    right: max(68px, calc(env(safe-area-inset-right, 0px) + 58px));
    width: 48px;
    height: 48px;
    font-size: 18px;
    color: #fcd34d;
}

body.mobile-play .game-chat-wrap {
    left: max(8px, env(safe-area-inset-left, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    bottom: max(150px, calc(env(safe-area-inset-bottom, 0px) + 136px));
    width: auto;
    max-width: none;
}

body.mobile-play .game-chat-panel {
    max-height: min(28vh, 200px);
    min-height: 72px;
}

body.mobile-play .spectate-picker {
    top: auto;
    left: max(8px, env(safe-area-inset-left, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    bottom: max(150px, calc(env(safe-area-inset-bottom, 0px) + 136px));
    transform: none;
    width: auto;
    max-width: none;
    max-height: min(32vh, 240px);
}

@media (max-width: 480px) {
    .mobile-joystick {
        width: 118px;
        height: 118px;
    }

    .mobile-btn {
        width: 56px;
        height: 56px;
        font-size: 20px;
    }
}