#loginOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-box {
    background: #111827;
    border: 1px solid #1f2a36;
    padding: 45px 60px;
    border-radius: 10px;
    text-align: center;
    color: white;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(407px, calc(100vw - 32px));
	background: rgba(17, 24, 39, 0.6);
}

.auth-screen-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.game-auth-title {
    color: #f1c40f;
    font-size: clamp(32px, 5vw, 52px);
    font-weight: 800;
    letter-spacing: 1px;
    text-align: center;
    text-shadow: 0 3px 18px rgba(241, 196, 15, 0.35);
}

.login-box h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.login-box p {
    color: #94a3b8;
    font-size: 14px;
}

.login-box input {
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #1f2a36;
    background: #0b1220;
    color: white;
    font-size: 14px;
}

.login-box input:focus {
    outline: 2px solid #f1c40f;
}

.login-box button {
    padding: 10px 12px;
    border-radius: 6px;
    border: none;
    background: #f1c40f;
    color: #111827;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
}

.login-box button:hover {
    background: #d4ac0d;
}




#characterSelectOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
#characterSelectOverlay.hidden { display: none; }

.character-select-box {
    border: 1px solid #1f2a36;
    border-radius: 10px;
    padding: 30px 40px;
    text-align: center;
    color: #e2e8f0;
    width: min(430px, calc(100vw - 32px));
	background: rgba(17, 24, 39, 0.6);
}

.character-select-box h2 {
    color: #f1c40f;
    margin-bottom: 16px;
}

.character-select-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}
.character-select-stats span {
    color: #64748b;
    margin-right: 6px;
}

.training-badge {
    background: #1e3a5f;
    color: #93c5fd;
    border-radius: 6px;
    padding: 8px;
    font-size: 12px;
    margin-bottom: 16px;
}

#enterWorldBtn {
    width: 100%;
    background: #f1c40f;
    color: #111827;
    border: none;
    border-radius: 6px;
    padding: 12px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
}
#enterWorldBtn:hover {
    background: #d4ac0d;
}

#exitGame {
    width: 100%;
    background: #1f2a36;
    color: #e2e8f0;
    border: none;
    border-radius: 6px;
    padding: 10px;
    font-size: 13px;
    cursor: pointer;
    margin-top: 8px;
}
#exitGame:hover {
    background: #2d3f52;
}




#mapInfo {
    grid-column: 1 / -1;
    background: #0f172a;
    color: white;
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border: 2px solid #fff;
    border-left-width: 4px;
    border-bottom-width: 4px;
    border-right-width: 4px;
}

#left, #right {
    min-height: 0;
}

#left {
    display: flex;
    position: relative;
    justify-content: center;
    align-items: center;
    overflow: hidden;
	background: #0f172a;
	position: relative;
    height: min(880px, calc(100dvh - 136px));
    border: 2px solid #fff;
    border-left-width: 4px;
	border-bottom-width: 4px;
}

#right {
    background: #0f172a;
    color: white;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border: 2px solid #fff;
    border-right-width: 4px;
	border-left-width: 4px;
    border-bottom-width: 0px;
}

.login-box .secondary-login-button {
    background: transparent;
    border: 1px solid #475569;
    color: #cbd5e1;
}
.login-box .secondary-login-button:hover { background: #1f2937; }

.character-select-caption {
    color: #94a3b8;
    font-size: 14px;
    margin: -8px 0 16px;
}

.character-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
    max-height: 310px;
    overflow-y: auto;
}

.character-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 24px 12px 12px;
    border: 1px solid #334155;
    border-radius: 7px;
    background: #0b1220;
    color: #e2e8f0;
    cursor: pointer;
    text-align: left;
}
.character-card:hover { border-color: #f8fafc; background: #172033; }
.character-card:focus {
    outline: none;
    border-color: #f1c40f;
    background: rgba(241, 196, 15, 0.16);
    box-shadow: inset 0 0 0 1px rgba(241, 196, 15, 0.38);
}
.character-card strong { color: #f1c40f; font-size: 15px; }
.character-card span, .character-list-empty { color: #94a3b8; font-size: 12px; }
.character-card .character-card-info { color: #94a3b8; }
.character-list-empty { margin: 6px 0; }
.character-card-row { display: flex; align-items: center; gap: 8px; }
.character-card-row .character-card { flex: 1; }
.delete-character-button {
    height: 60px;
    padding: 0 10px;
    border: 1px solid #7f1d1d;
    border-radius: 7px;
    background: #2b1115;
    color: #fca5a5;
    font-size: 12px;
    cursor: pointer;
}
.delete-character-button:hover { background: #7f1d1d; color: #fff; }
.delete-character-button:disabled { cursor: wait; opacity: .6; }
.create-character-form { display: flex; gap: 8px; margin-bottom: 10px; }
.create-character-form input { min-width: 0; flex: 1; }
.create-character-form button { white-space: nowrap; }
.character-select-error { color: #fca5a5; font-size: 12px; margin: 0 0 10px; }

.create-character-button {
    width: 100%;
    margin-bottom: 8px;
    padding: 12px;
    border: 1px solid #64748b;
    border-radius: 7px;
    background: #334155;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
    color: #e2e8f0;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
}
.create-character-button:hover { background: #475569; transform: translateY(-1px); }
.create-character-button span { font-size: 18px; vertical-align: -1px; }
.create-character-button:disabled { cursor: not-allowed; filter: grayscale(1); opacity: .6; transform: none; }

.create-character-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.72);
}
.create-character-overlay.hidden { display: none; }
.create-character-dialog {
    width: min(380px, calc(100vw - 32px));
    padding: 28px;
    border: 1px solid #475569;
    border-radius: 12px;
    background: #111827;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
    color: #e2e8f0;
}
.create-character-dialog h2 { margin: 0 0 8px; color: #f1c40f; }
.takeover-loading-dialog { text-align: center; }
.takeover-loading-spinner { width: 38px; height: 38px; margin: 0 auto 16px; border: 4px solid #374151; border-top-color: #f59e0b; border-radius: 50%; animation: takeover-spin .8s linear infinite; }
@keyframes takeover-spin { to { transform: rotate(360deg); } }
.create-character-dialog p { margin: 0 0 18px; color: #94a3b8; font-size: 13px; }
.create-character-dialog input { width: 100%; margin-bottom: 10px; padding: 11px; border: 1px solid #334155; border-radius: 6px; background: #0b1220; color: #fff; }
.create-character-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.create-character-actions button { border: 0; border-radius: 6px; padding: 10px 14px; font-weight: 700; cursor: pointer; }
.create-character-cancel { background: #334155; color: #e2e8f0; }
.create-character-confirm { background: #f1c40f; color: #172033; }
.delete-character-dialog { border-color: #7f1d1d; }
.delete-character-dialog h2 { color: #fca5a5; }
.confirm-delete-character { background: #b91c1c; color: #fff; }
.confirm-delete-character:hover { background: #dc2626; }
.login-error-dialog { text-align: center; border-color: #7f1d1d; }
.login-error-dialog h2 { color: #fca5a5; }
.login-error-dialog .create-character-actions { justify-content: center; }
.login-error-dialog .create-character-confirm { min-width: 120px; }
.login-error-icon {
    display: grid;
    width: 48px;
    height: 48px;
    margin: 0 auto 14px;
    place-items: center;
    border: 2px solid #ef4444;
    border-radius: 50%;
    background: rgba(127, 29, 29, 0.32);
    color: #fca5a5;
    font-size: 28px;
    font-weight: 800;
}

#rightExtra { display: none; }
#ui.desktop-extra {
    grid-template-columns: 300px minmax(0, 1fr) 300px;
    max-width: 1448px;
}
#ui.desktop-extra #rightExtra { grid-column: 1; grid-row: 3; }
#ui.desktop-extra #left { grid-column: 2; grid-row: 3; border-left-width: 2px; }
#ui.desktop-extra #right { grid-column: 3; grid-row: 3; }
#ui.desktop-extra #rightExtra {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
    overflow-y: auto;
    background: #0f172a;
    color: white;
    border: 2px solid #fff;
    border-left-width: 4px;
	border-right-width: 4px;
    border-bottom-width: 0px;
}
@media (max-width: 1359px) { #ui.desktop-extra { grid-template-columns: 1fr 300px; } #ui.desktop-extra #rightExtra { display: none; } }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1f2a36;
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.panel-header h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.panel-controls {
    display: flex;
    gap: 4px;
}

.panel-controls button {
    background: #1f2a36;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

.panel-controls button:hover {
    background: #2d3f52;
}

.panel-controls button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.dpad {
    display: grid;
    grid-template-columns: repeat(3, 48px);
    grid-template-rows: repeat(3, 48px);
    gap: 6px;
    justify-content: center;
}

.dpad button {
    background: #1f2a36;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    user-select: none;
}

.dpad button:active {
    background: #2d3f52;
}

.dpad button.interact {
    background: #f1c40f;
    color: #111827;
    font-weight: bold;
}

#mobileDpad {
    display: none;
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 90;
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(3, 44px);
    gap: 5px;
    padding: 8px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}
