/* Eclipse Reborn — UI Styles */

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

body {
    background: #111;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Johnsen AI site header ────────────────────────────────── */

.eclipse-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #fff;
    box-shadow: 0 2px 10px rgb(0 0 0 / 10%);
    z-index: 50;
    border-bottom: 1px solid rgb(0 0 0 / 12%);
}

.eclipse-header__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 100%;
}

.eclipse-header__logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.eclipse-header__logo > a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.eclipse-header__logo > a:hover {
    color: #06c;
}

.eclipse-header__logo > a svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.eclipse-header__breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #4d4d4d;
}

.eclipse-header__breadcrumb a {
    color: #4d4d4d;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.eclipse-header__breadcrumb a:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
}

.eclipse-header__breadcrumb span[aria-current] {
    color: #333;
    font-weight: 500;
    padding: 4px 8px;
}

.eclipse-header__separator {
    color: #767676;
    font-size: 12px;
}

@media (max-width: 600px) {
    .eclipse-header__logo > a span {
        display: none;
    }

    .eclipse-header__separator:first-child {
        display: none;
    }

    .eclipse-header__breadcrumb {
        font-size: 12px;
    }

    .eclipse-header__separator {
        font-size: 10px;
    }
}

/* ── Game container ────────────────────────────────────────── */

#game-container {
    width: 100vw;
    height: calc(100vh - 56px);
    margin-top: 56px;
}

/* Login scene overlay */
.login-form {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #555;
    border-radius: 8px;
    padding: 2rem;
    color: #eee;
    min-width: 320px;
    z-index: 10;
}

.login-form h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: #ffd700;
}

.login-form label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    color: #aaa;
}

.login-form input {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.75rem;
    background: #222;
    border: 1px solid #444;
    border-radius: 4px;
    color: #eee;
    font-size: 0.95rem;
}

.login-form input:focus {
    outline: none;
    border-color: #ffd700;
}

.login-form button {
    width: 100%;
    padding: 0.6rem;
    margin-top: 0.5rem;
    background: #444;
    border: 1px solid #666;
    border-radius: 4px;
    color: #eee;
    font-size: 0.95rem;
    cursor: pointer;
}

.login-form button:hover {
    background: #555;
}

.login-form button.primary {
    background: #2a5a2a;
    border-color: #3a7a3a;
}

.login-form button.primary:hover {
    background: #3a7a3a;
}

.login-form .error-msg {
    color: #f44;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.login-form .toggle-link {
    display: block;
    text-align: center;
    margin-top: 1rem;
    color: #88f;
    cursor: pointer;
    font-size: 0.85rem;
}

.login-form .toggle-link:hover {
    color: #aaf;
}

/* Hide password manager injected elements (LastPass, 1Password, etc.) */
.login-form [data-lastpass-icon-root],
.login-form div[data-lastpass-root],
.login-form div[data-lastpass-infield] {
    display: none !important;
}

/* Login form divider */
.login-form__divider {
    display: flex;
    align-items: center;
    margin: 1rem 0;
    color: #666;
    font-size: 0.8rem;
}

.login-form__divider::before,
.login-form__divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #444;
}

.login-form__divider span {
    padding: 0 0.75rem;
}

/* Federated login (Johnsen AI) */
.login-form__federated-btn {
    width: 100%;
    padding: 0.6rem;
    background: #1a3a5a;
    border: 1px solid #2a5a8a;
    border-radius: 4px;
    color: #8abfef;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.login-form__federated-btn:hover {
    background: #2a5a8a;
    color: #cde;
}

.login-form__federated-user {
    font-size: 0.8rem;
    color: #cde;
    font-weight: bold;
}

.login-form__federated-hint {
    margin: 0.25rem 0 0;
    font-size: 0.8rem;
    color: #999;
    text-align: center;
}

.login-form__federated-fields label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    color: #aaa;
}

.login-form__federated-fields input {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.75rem;
    background: #222;
    border: 1px solid #444;
    border-radius: 4px;
    color: #eee;
    font-size: 0.95rem;
}

.login-form__federated-fields input:focus {
    outline: none;
    border-color: #2a5a8a;
}

.login-form__federated-fields button.primary {
    background: #1a3a5a;
    border-color: #2a5a8a;
}

.login-form__federated-fields button.primary:hover {
    background: #2a5a8a;
}

.login-form__federated-fields button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Character select */
.char-select {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(170deg, rgba(18, 18, 28, 0.96), rgba(8, 8, 16, 0.98));
    border: 1px solid #3a3a50;
    border-radius: 12px;
    padding: 2rem;
    color: #eee;
    min-width: 400px;
    z-index: 10;
    box-shadow:
        0 0 40px rgba(0, 0, 0, 0.6),
        0 0 1px rgba(255, 215, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.char-select h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #ffd700;
    font-size: 1.4rem;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.25);
    letter-spacing: 0.04em;
}

.char-select--create h1 {
    margin-bottom: 1rem;
}

.char-slot {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #333;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.char-slot:hover {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.04);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.08);
}

.char-slot--empty {
    justify-content: center;
    color: #555;
    font-style: italic;
    border-style: dashed;
}

.char-slot--empty:hover {
    color: #ffd700;
}

.char-slot__name {
    font-weight: bold;
    margin-right: 1rem;
}

.char-slot__details {
    flex: 1;
    display: flex;
    align-items: center;
}

.char-slot__info {
    color: #aaa;
    font-size: 0.85rem;
}

.char-slot__delete {
    background: none;
    border: 1px solid #444;
    color: #ff4444;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.5;
    margin-left: 0.5rem;
    flex-shrink: 0;
    transition: opacity 0.2s, border-color 0.2s, background 0.2s;
}

.char-slot__delete:hover {
    opacity: 1;
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.15);
}

/* ── Character creation form ── */

.char-create__sprite-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.25rem;
}

.char-create__field {
    margin-bottom: 1rem;
}

.char-create__field label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.char-create__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.char-create__btn {
    width: 100%;
    padding: 0.65rem;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.1s;
    border: 1px solid;
}

.char-create__btn:active {
    transform: scale(0.98);
}

.char-create__btn--create {
    background: linear-gradient(180deg, #2e6e2e, #1e4e1e);
    border-color: #3a8a3a;
    color: #e0ffe0;
    font-weight: 600;
    letter-spacing: 0.03em;
    box-shadow: 0 2px 8px rgba(46, 110, 46, 0.25);
}

.char-create__btn--create:hover {
    background: linear-gradient(180deg, #38843a, #266a26);
    border-color: #4aa04a;
    box-shadow: 0 2px 12px rgba(46, 110, 46, 0.4);
}

.char-create__btn--back {
    background: transparent;
    border-color: #444;
    color: #888;
}

.char-create__btn--back:hover {
    border-color: #666;
    color: #ccc;
    background: rgba(255, 255, 255, 0.03);
}

.char-select__logout {
    display: block;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.6rem;
    background: #3a1a1a;
    border: 1px solid #633;
    border-radius: 4px;
    color: #f88;
    cursor: pointer;
    font-size: 0.9rem;
}

.char-select__logout:hover {
    background: #4a2020;
    border-color: #f44;
}

.char-select__hint {
    display: block;
    text-align: center;
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.75rem;
}

/* Name input row (input + randomize button) */
.name-input-row {
    display: flex;
    gap: 0.5rem;
}

.name-input-row input {
    flex: 1;
    margin-bottom: 0;
}

.name-input-row__randomize {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: #222;
    border: 1px solid #444;
    border-radius: 6px;
    color: #eee;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s, border-color 0.2s;
}

.name-input-row__randomize:hover {
    background: #333;
    border-color: #ffd700;
}

/* Sprite picker */
.sprite-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
}

.sprite-picker__arrow {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid #3a3a50;
    border-radius: 50%;
    color: #aaa;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.sprite-picker__arrow:hover {
    background: rgba(255, 215, 0, 0.08);
    border-color: #ffd700;
    color: #ffd700;
}

.sprite-picker__preview-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.sprite-picker__preview {
    width: 128px;
    height: 192px;
    background-size: 512px 768px;
    background-position: 0 0;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    background-color: transparent;
    position: relative;
    z-index: 1;
}

.sprite-picker__platform {
    width: 80px;
    height: 12px;
    background: radial-gradient(ellipse, rgba(255, 215, 0, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    margin-top: -8px;
}

.sprite-picker__label {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.25rem;
    letter-spacing: 0.1em;
}

/* Admin toggle */
.admin-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    background: rgba(80, 20, 20, 0.2);
    border: 1px solid rgba(120, 40, 40, 0.3);
    border-radius: 6px;
    transition: background 0.2s, border-color 0.2s;
}

.admin-toggle:hover {
    background: rgba(80, 20, 20, 0.3);
    border-color: rgba(120, 40, 40, 0.5);
}

.admin-toggle input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.admin-toggle__label {
    font-size: 0.8rem;
    color: #c66;
}

/* Class picker */
.class-picker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.class-picker__card {
    padding: 0.6rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.class-picker__card:hover {
    border-color: #666;
    background: rgba(255, 255, 255, 0.04);
}

.class-picker__card--selected {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.06);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.1);
}

.class-picker__name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #eee;
    margin-bottom: 0.15rem;
}

.class-picker__card--selected .class-picker__name {
    color: #ffd700;
}

.class-picker__desc {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 0.2rem;
}

.class-picker__stats {
    display: block;
    font-size: 0.7rem;
    color: #6a9;
    letter-spacing: 0.02em;
}

/* Character select form controls */
.char-select label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    color: #aaa;
}

.char-select input[type="text"] {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #3a3a50;
    border-radius: 6px;
    color: #eee;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.char-select input[type="text"]:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.1);
}

.char-select .error-msg {
    color: #f66;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    text-align: center;
    padding: 0.4rem;
    background: rgba(255, 60, 60, 0.08);
    border-radius: 4px;
}

/* Chat box */
.chat-box {
    position: absolute;
    bottom: 8px;
    left: 8px;
    width: 400px;
    z-index: 10;
}

.chat-box__messages {
    max-height: 160px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.6);
    padding: 0.5rem;
    border-radius: 4px 4px 0 0;
    font-size: calc(0.8rem * var(--game-ui-scale, 1));
    color: #ddd;
}

.chat-box__input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #444;
    border-radius: 0 0 4px 4px;
    color: #eee;
    font-size: calc(0.85rem * var(--game-ui-scale, 1));
}

.chat-box__input:focus {
    outline: none;
    border-color: #ffd700;
}

.chat-box__line {
    padding: 1px 0;
    word-wrap: break-word;
}

.chat-box__sender {
    font-weight: bold;
}

.chat-box__msg {
    color: #ddd;
}

/* Scrollbar styling for chat */
.chat-box__messages::-webkit-scrollbar {
    width: 4px;
}

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

.chat-box__messages::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 2px;
}

/* HP bar overlay */
.hp-bar {
    position: absolute;
    width: 40px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
    pointer-events: none;
}

.hp-bar__fill {
    height: 100%;
    background: #2a2;
    transition: width 0.2s;
}

/* Stats HUD */
.stats-hud {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    color: #eee;
    font-size: 0.8rem;
    z-index: 10;
    pointer-events: none;
}

.stats-hud__bar {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
}

.stats-hud__bar-label {
    width: 25px;
    font-weight: bold;
}

.stats-hud__bar-track {
    flex: 1;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
    margin: 0 0.4rem;
}

.stats-hud__bar-fill--hp { background: #2a2; }
.stats-hud__bar-fill--mp { background: #22a; }
.stats-hud__bar-fill--exp { background: #aa2; }

.stats-hud__bar-fill {
    height: 100%;
    transition: width 0.3s;
}

/* Editor toolbar */
.editor-toolbar {
    position: absolute;
    top: 64px;
    right: 8px;
    width: 180px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #555;
    border-radius: 6px;
    padding: 0.5rem;
    color: #eee;
    font-size: 0.8rem;
    z-index: 20;
    user-select: none;
}

.editor-toolbar__title {
    text-align: center;
    font-weight: bold;
    color: #ffd700;
    padding-bottom: 0.4rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid #444;
    font-size: 0.9rem;
}

.editor-toolbar__section {
    margin-bottom: 0.5rem;
}

.editor-toolbar__label {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.editor-toolbar__btn {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    margin: 2px;
    background: #333;
    border: 1px solid #555;
    border-radius: 3px;
    color: #ccc;
    font-size: 0.75rem;
    cursor: pointer;
}

.editor-toolbar__btn:hover {
    background: #444;
    color: #fff;
}

.editor-toolbar__btn--active {
    background: #2a5a2a;
    border-color: #3a7a3a;
    color: #fff;
}

.editor-toolbar__btn--save {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    background: #2a4a6a;
    border-color: #3a6a9a;
    color: #cdf;
    text-align: center;
}

.editor-toolbar__btn--save:hover {
    background: #3a6a9a;
}

.editor-toolbar__btn--action {
    background: #444;
}

.editor-toolbar__btn--layer {
    flex: 1;
    text-align: left;
}

.editor-toolbar__layer-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
}

.editor-toolbar__layer-check {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.editor-toolbar__layer-check input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #3a7a3a;
    margin: 0;
}

.editor-toolbar__layer-actions {
    display: flex;
    gap: 2px;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #333;
}

.editor-toolbar__btn--small {
    flex: 1;
    text-align: center;
    font-size: 0.65rem;
    padding: 0.15rem 0.25rem;
}

.editor-toolbar__opacity-slider {
    width: 36px;
    height: 12px;
    cursor: pointer;
    accent-color: #3a7a3a;
    flex-shrink: 0;
}

.editor-toolbar__dim-row {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #333;
}

.editor-toolbar__dim-label {
    font-size: 0.7rem;
    color: #aaa;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.editor-toolbar__dim-label input[type="checkbox"] {
    width: 12px;
    height: 12px;
    accent-color: #3a7a3a;
    margin: 0;
}

.editor-toolbar__info {
    padding-top: 0.4rem;
    border-top: 1px solid #444;
    font-size: 0.7rem;
    color: #999;
    word-wrap: break-word;
}

/* Tile palette */
.tile-palette {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 260px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #555;
    border-radius: 6px;
    padding: 0.5rem;
    color: #eee;
    font-size: 0.8rem;
    z-index: 20;
    user-select: none;
}

.tile-palette__header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding-bottom: 0.4rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid #444;
}

.tile-palette__label {
    font-size: 0.75rem;
    color: #aaa;
}

.tile-palette__id {
    font-weight: bold;
    color: #ffd700;
    min-width: 2rem;
    text-align: center;
}

.tile-palette__nav {
    padding: 0.15rem 0.4rem;
    background: #333;
    border: 1px solid #555;
    border-radius: 3px;
    color: #ccc;
    cursor: pointer;
    font-size: 0.8rem;
}

.tile-palette__nav:hover {
    background: #444;
    color: #fff;
}

.tile-palette__canvas-wrap {
    position: relative;
    max-height: 256px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #444;
    border-radius: 3px;
}

.tile-palette__canvas {
    display: block;
    width: 100%;
    image-rendering: pixelated;
    cursor: crosshair;
}

.tile-palette__highlight {
    position: absolute;
    border: 2px solid #ffff00;
    pointer-events: none;
    box-shadow: 0 0 4px rgba(255, 255, 0, 0.5);
}

/* Palette scrollbar */
.tile-palette__canvas-wrap::-webkit-scrollbar {
    width: 4px;
}

.tile-palette__canvas-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.tile-palette__canvas-wrap::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 2px;
}

/* Map properties panel */
.map-props {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid #555;
    border-radius: 8px;
    padding: 1rem;
    color: #eee;
    font-size: 0.85rem;
    z-index: 30;
}

.map-props__title {
    text-align: center;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #444;
}

.map-props__row {
    display: flex;
    align-items: center;
    margin-bottom: 0.4rem;
}

.map-props__label {
    width: 90px;
    font-size: 0.75rem;
    color: #aaa;
    flex-shrink: 0;
}

.map-props__input {
    flex: 1;
    padding: 0.25rem 0.4rem;
    background: #222;
    border: 1px solid #444;
    border-radius: 3px;
    color: #eee;
    font-size: 0.8rem;
}

.map-props__input:focus {
    outline: none;
    border-color: #ffd700;
}

.map-props__apply,
.map-props__close {
    display: inline-block;
    width: 48%;
    padding: 0.35rem;
    margin-top: 0.5rem;
    background: #333;
    border: 1px solid #555;
    border-radius: 4px;
    color: #eee;
    font-size: 0.8rem;
    cursor: pointer;
    text-align: center;
}

.map-props__apply {
    background: #2a5a2a;
    border-color: #3a7a3a;
    margin-right: 4%;
}

.map-props__apply:hover {
    background: #3a7a3a;
}

.map-props__close:hover {
    background: #444;
}

/* Attribute type picker */
.attr-picker {
    position: absolute;
    top: 64px;
    right: 196px;
    width: 140px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #555;
    border-radius: 6px;
    padding: 0.5rem;
    color: #eee;
    font-size: 0.8rem;
    z-index: 20;
    user-select: none;
}

.attr-picker__title {
    text-align: center;
    font-weight: bold;
    color: #ffd700;
    padding-bottom: 0.4rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid #444;
    font-size: 0.85rem;
}

.attr-picker__btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.3rem 0.4rem;
    margin-bottom: 2px;
    background: #333;
    border: 1px solid #555;
    border-radius: 3px;
    color: #ccc;
    font-size: 0.75rem;
    cursor: pointer;
    text-align: left;
}

.attr-picker__btn:hover {
    background: #444;
    color: #fff;
}

.attr-picker__btn--active {
    background: #2a5a2a;
    border-color: #3a7a3a;
    color: #fff;
}

.attr-picker__swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.attr-picker__label {
    flex: 1;
}

/* Inspect legend panel */
.inspect-legend {
    position: absolute;
    top: 64px;
    right: 196px;
    width: 140px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #555;
    border-radius: 6px;
    padding: 0.5rem;
    color: #eee;
    font-size: 0.8rem;
    z-index: 20;
    user-select: none;
}

.inspect-legend__title {
    text-align: center;
    font-weight: bold;
    color: #ffd700;
    padding-bottom: 0.4rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid #444;
    font-size: 0.85rem;
}

.inspect-legend__row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.4rem;
    font-size: 0.75rem;
    color: #ccc;
}

.inspect-legend__swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.inspect-legend__label {
    flex: 1;
}

/* Attribute configuration dialog */
.attr-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 260px;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid #555;
    border-radius: 8px;
    padding: 1rem;
    color: #eee;
    font-size: 0.85rem;
    z-index: 30;
}

.attr-dialog__title {
    text-align: center;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #444;
}

.attr-dialog__fields {
    margin-bottom: 0.5rem;
}

.attr-dialog__row {
    display: flex;
    align-items: center;
    margin-bottom: 0.4rem;
}

.attr-dialog__label {
    width: 80px;
    font-size: 0.75rem;
    color: #aaa;
    flex-shrink: 0;
}

.attr-dialog__input {
    flex: 1;
    padding: 0.25rem 0.4rem;
    background: #222;
    border: 1px solid #444;
    border-radius: 3px;
    color: #eee;
    font-size: 0.8rem;
}

.attr-dialog__input:focus {
    outline: none;
    border-color: #ffd700;
}

.attr-dialog__buttons {
    display: flex;
    gap: 4%;
}

.attr-dialog__apply,
.attr-dialog__cancel {
    flex: 1;
    padding: 0.35rem;
    background: #333;
    border: 1px solid #555;
    border-radius: 4px;
    color: #eee;
    font-size: 0.8rem;
    cursor: pointer;
    text-align: center;
}

.attr-dialog__apply {
    background: #2a5a2a;
    border-color: #3a7a3a;
}

.attr-dialog__apply:hover {
    background: #3a7a3a;
}

.attr-dialog__cancel:hover {
    background: #444;
}

/* Inventory panel */
.inventory-panel {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 240px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #555;
    border-radius: 6px;
    padding: 0.5rem;
    color: #eee;
    font-size: 0.8rem;
    z-index: 15;
    user-select: none;
}

.inventory-panel__section-title {
    text-align: center;
    font-weight: bold;
    color: #ffd700;
    padding-bottom: 0.3rem;
    margin-bottom: 0.3rem;
    border-bottom: 1px solid #444;
    font-size: 0.85rem;
}

.inventory-panel__eq-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-bottom: 0.4rem;
}

.inventory-panel__eq-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.3rem;
    background: #1a1a2e;
    border: 1px solid #444;
    border-radius: 3px;
    cursor: pointer;
    min-height: 40px;
}

.inventory-panel__eq-slot:hover {
    border-color: #ffd700;
}

.inventory-panel__eq-slot--filled {
    background: #1e2a1e;
    border-color: #3a7a3a;
}

.inventory-panel__eq-label {
    font-size: 0.65rem;
    color: #888;
    text-transform: uppercase;
}

.inventory-panel__eq-icon {
    font-size: 0.75rem;
    color: #ccc;
    margin-top: 2px;
}

.inventory-panel__stats {
    display: flex;
    justify-content: space-around;
    padding: 0.3rem 0;
    margin-bottom: 0.4rem;
    font-size: 0.7rem;
    color: #aaa;
    border-bottom: 1px solid #333;
}

.inventory-panel__grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
}

.inventory-panel__slot {
    aspect-ratio: 1;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    min-height: 34px;
}

.inventory-panel__slot:hover {
    border-color: #888;
}

.inventory-panel__slot--filled {
    background: #1e1e2a;
    border-color: #555;
}

.inventory-panel__slot--selected {
    border-color: #ffd700;
    background: #2a2a1a;
}

.inventory-panel__item-name {
    font-size: 0.55rem;
    text-align: center;
    line-height: 1.1;
    color: #ccc;
    padding: 1px;
    word-break: break-word;
}

.inventory-panel__item-qty {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 0.6rem;
    color: #ffd700;
    font-weight: bold;
}

.inventory-panel__tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid #ffd700;
    border-radius: 4px;
    padding: 0.4rem;
    font-size: 0.75rem;
    color: #eee;
    pointer-events: none;
    z-index: 20;
    max-width: 180px;
}

/* Disconnect overlay */
.disconnect-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.disconnect-overlay__box {
    background: #1a1a1a;
    border: 2px solid #555;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    min-width: 280px;
}

.disconnect-overlay__title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #f44;
    margin-bottom: 0.75rem;
}

.disconnect-overlay__msg {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 1.25rem;
}

.disconnect-overlay__btn {
    padding: 0.6rem 1.5rem;
    background: #2a5a2a;
    border: 1px solid #3a7a3a;
    border-radius: 4px;
    color: #eee;
    font-size: 0.95rem;
    cursor: pointer;
}

.disconnect-overlay__btn:hover {
    background: #3a7a3a;
}

/* Spell bar */
.spell-bar {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    z-index: 12;
    user-select: none;
}

.spell-bar__slot {
    position: relative;
    width: 64px;
    height: 52px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #444;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}

.spell-bar__slot:hover {
    border-color: #888;
}

.spell-bar__slot--filled {
    border-color: #4466aa;
    background: rgba(20, 20, 50, 0.85);
}

.spell-bar__key {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: calc(0.6rem * var(--game-ui-scale, 1));
    color: #888;
    font-weight: bold;
}

.spell-bar__name {
    font-size: calc(0.6rem * var(--game-ui-scale, 1));
    color: #ccc;
    text-align: center;
    line-height: 1.2;
    padding: 0 2px;
    word-break: break-word;
}

.spell-bar__mp {
    font-size: calc(0.55rem * var(--game-ui-scale, 1));
    color: #6688cc;
    margin-top: 1px;
}

.spell-bar__cooldown {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    pointer-events: none;
    display: none;
}

.spell-bar__hint {
    position: absolute;
    bottom: 58px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid #4488ff;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    color: #88bbff;
    white-space: nowrap;
}

/* Ping overlay */
.ping-overlay {
    position: fixed;
    top: 64px;
    right: 8px;
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: calc(0.75rem * var(--game-ui-scale, 1));
    font-family: monospace;
    color: #44ff44;
    z-index: 40;
    pointer-events: none;
}

/* ---------- Time Clock ---------- */

.time-clock {
    position: fixed;
    top: 84px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #333;
    border-radius: 4px;
    padding: 4px 8px 3px;
    z-index: 40;
    pointer-events: none;
    min-width: 100px;
}

.time-clock__top {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.time-clock__icon {
    font-size: 0.8rem;
    font-weight: bold;
    line-height: 1;
    color: #ffdd44;
}

.time-clock__time {
    font-family: monospace;
    font-size: calc(0.8rem * var(--game-ui-scale, 1));
    font-weight: bold;
    color: #eee;
    letter-spacing: 0.05em;
}

.time-clock__period {
    font-size: calc(0.65rem * var(--game-ui-scale, 1));
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.time-clock__countdown {
    font-size: calc(0.6rem * var(--game-ui-scale, 1));
    color: #999;
    margin-top: 1px;
    white-space: nowrap;
}

.time-clock__bar {
    position: relative;
    height: 3px;
    margin-top: 3px;
    border-radius: 2px;
    background: linear-gradient(
        to right,
        #334 0%,
        #446 20%,
        #cc9 25%,
        #ffa 33%,
        #ffd700 50%,
        #ffa 66%,
        #c84 75%,
        #649 80%,
        #334 100%
    );
    overflow: visible;
}

.time-clock__bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px 0 0 2px;
}

.time-clock__bar-marker {
    position: absolute;
    top: -2px;
    width: 3px;
    height: 7px;
    background: #fff;
    border-radius: 1px;
    transform: translateX(-1px);
    box-shadow: 0 0 3px rgba(255, 255, 255, 0.6);
}

/* ---------- Online Stats Badge ---------- */

.online-stats {
    margin-left: auto;
    padding: 2px 8px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
    color: #065f46;
    white-space: nowrap;
    user-select: none;
}

/* ---------- Version Badge ---------- */

.version-badge {
    margin-left: auto;
    padding: 2px 8px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
    color: #6b7280;
    white-space: nowrap;
    user-select: none;
}

/* When online stats badge is present, version badge sits beside it */
.online-stats ~ .version-badge {
    margin-left: 6px;
}

/* ---------- Deployment Banner ---------- */

.deploy-banner {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 4px 12px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 4px;
    font-size: 13px;
    color: #92400e;
    font-weight: 500;
    animation: deploy-banner-in 0.3s ease;
}

.deploy-banner__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    flex-shrink: 0;
    animation: deploy-dot-pulse 1.5s ease-in-out infinite;
}

.deploy-banner__text {
    white-space: nowrap;
}

@keyframes deploy-banner-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes deploy-dot-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@media (max-width: 600px) {
    .deploy-banner__text {
        display: none;
    }

    .deploy-banner {
        padding: 4px 8px;
    }
}

/* ---------- Escape Menu ---------- */

.escape-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.escape-menu__box {
    background: #1a1a1a;
    border: 2px solid #555;
    border-radius: 8px;
    padding: 1.5rem 2rem;
    min-width: 240px;
    text-align: center;
}

.escape-menu__title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #ffd700;
    margin: 0 0 1.25rem;
}

.escape-menu__btn {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    margin-bottom: 0.5rem;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #eee;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.escape-menu__btn:hover {
    background: #333;
    border-color: #ffd700;
}

.escape-menu__btn:last-child {
    margin-bottom: 0;
}

.escape-menu__btn--danger {
    background: #3a1a1a;
    border-color: #633;
    color: #f88;
}

.escape-menu__btn--danger:hover {
    background: #4a2020;
    border-color: #f44;
}

/* ---------- Controls Overlay ---------- */

.controls-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.controls-overlay__box {
    background: #1a1a1a;
    border: 2px solid #555;
    border-radius: 8px;
    padding: 1.5rem 2rem;
    min-width: 320px;
    max-width: 400px;
    text-align: center;
}

.controls-overlay__title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #ffd700;
    margin: 0 0 1rem;
}

.controls-overlay__list {
    text-align: left;
    margin-bottom: 1.25rem;
}

.controls-overlay__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    border-bottom: 1px solid #2a2a2a;
}

.controls-overlay__row:last-child {
    border-bottom: none;
}

.controls-overlay__key {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 0.15rem 0.5rem;
    font-family: monospace;
    font-size: 0.85rem;
    color: #ffd700;
    min-width: 110px;
    text-align: center;
}

.controls-overlay__desc {
    color: #ccc;
    font-size: 0.9rem;
    margin-left: 1rem;
}

.controls-overlay__close {
    padding: 0.6rem 2rem;
    background: #2a5a2a;
    border: 1px solid #3a7a3a;
    border-radius: 4px;
    color: #eee;
    font-size: 0.95rem;
    cursor: pointer;
}

.controls-overlay__close:hover {
    background: #3a6a3a;
}

/* ---------- Shop Window ---------- */

.shop-window {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    background: rgba(0, 0, 0, 0.92);
    border: 1px solid #555;
    border-radius: 6px;
    color: #eee;
    font-size: 0.8rem;
    z-index: 25;
    user-select: none;
}

.shop-window__title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #444;
}

.shop-window__title {
    font-weight: bold;
    color: #ffd700;
    font-size: 0.9rem;
}

.shop-window__close {
    background: #333;
    border: 1px solid #555;
    border-radius: 3px;
    color: #f88;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
}

.shop-window__close:hover {
    background: #4a2020;
    border-color: #f44;
}

.shop-window__tabs {
    display: flex;
    border-bottom: 1px solid #333;
}

.shop-window__tab {
    flex: 1;
    padding: 0.35rem;
    background: #1a1a1a;
    border: none;
    color: #888;
    font-size: 0.8rem;
    cursor: pointer;
    text-align: center;
}

.shop-window__tab:hover {
    color: #ccc;
    background: #222;
}

.shop-window__tab--active {
    color: #ffd700;
    background: #222;
    border-bottom: 2px solid #ffd700;
}

.shop-window__grid {
    padding: 0.4rem;
    max-height: 240px;
    overflow-y: auto;
}

.shop-window__item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.4rem;
    margin-bottom: 3px;
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 3px;
}

.shop-window__item:hover {
    border-color: #555;
}

.shop-window__item-name {
    flex: 1;
    color: #ccc;
    font-size: 0.75rem;
}

.shop-window__item-price {
    color: #ffd700;
    font-size: 0.75rem;
    font-weight: bold;
}

.shop-window__item-stock {
    color: #888;
    font-size: 0.7rem;
}

.shop-window__buy-btn {
    padding: 0.15rem 0.5rem;
    background: #2a5a2a;
    border: 1px solid #3a7a3a;
    border-radius: 3px;
    color: #eee;
    font-size: 0.7rem;
    cursor: pointer;
}

.shop-window__buy-btn:hover {
    background: #3a7a3a;
}

.shop-window__empty {
    text-align: center;
    color: #666;
    padding: 1rem;
    font-style: italic;
}

.shop-window__grid::-webkit-scrollbar {
    width: 4px;
}

.shop-window__grid::-webkit-scrollbar-track {
    background: transparent;
}

.shop-window__grid::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 2px;
}

/* ---------- Trade Window ---------- */

.trade-window {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    background: rgba(0, 0, 0, 0.92);
    border: 1px solid #555;
    border-radius: 6px;
    color: #eee;
    font-size: 0.8rem;
    z-index: 25;
    user-select: none;
}

.trade-window__title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #444;
}

.trade-window__title {
    font-weight: bold;
    color: #ffd700;
    font-size: 0.9rem;
}

.trade-window__close {
    background: #333;
    border: 1px solid #555;
    border-radius: 3px;
    color: #f88;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
}

.trade-window__close:hover {
    background: #4a2020;
    border-color: #f44;
}

.trade-window__panels {
    display: flex;
    gap: 1px;
    background: #333;
}

.trade-window__panel {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.4rem;
}

.trade-window__panel-title {
    text-align: center;
    font-weight: bold;
    color: #aaa;
    font-size: 0.75rem;
    margin-bottom: 0.3rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid #333;
}

.trade-window__offer-grid {
    min-height: 80px;
    max-height: 120px;
    overflow-y: auto;
}

.trade-window__slot {
    padding: 0.25rem 0.3rem;
    margin-bottom: 2px;
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 2px;
    font-size: 0.7rem;
    color: #ccc;
}

.trade-window__empty {
    text-align: center;
    color: #555;
    padding: 0.5rem;
    font-size: 0.7rem;
    font-style: italic;
}

.trade-window__status {
    text-align: center;
    padding: 0.3rem;
    font-size: 0.7rem;
    color: #888;
    border-top: 1px solid #333;
}

.trade-window__actions {
    display: flex;
    gap: 4px;
    padding: 0.4rem;
    border-top: 1px solid #333;
}

.trade-window__btn {
    flex: 1;
    padding: 0.3rem;
    background: #333;
    border: 1px solid #555;
    border-radius: 3px;
    color: #eee;
    font-size: 0.75rem;
    cursor: pointer;
    text-align: center;
}

.trade-window__btn:hover {
    background: #444;
}

.trade-window__btn--accept {
    background: #2a5a2a;
    border-color: #3a7a3a;
}

.trade-window__btn--accept:hover {
    background: #3a7a3a;
}

.trade-window__btn--accept:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.trade-window__btn--cancel {
    background: #3a1a1a;
    border-color: #633;
    color: #f88;
}

.trade-window__btn--cancel:hover {
    background: #4a2020;
}

/* Trade request popup */
.trade-request {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trade-request__box {
    background: #1a1a1a;
    border: 2px solid #555;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    min-width: 260px;
}

.trade-request__text {
    color: #eee;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.trade-request__actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.trade-request__accept {
    padding: 0.4rem 1rem;
    background: #2a5a2a;
    border: 1px solid #3a7a3a;
    border-radius: 4px;
    color: #eee;
    cursor: pointer;
}

.trade-request__accept:hover {
    background: #3a7a3a;
}

.trade-request__decline {
    padding: 0.4rem 1rem;
    background: #3a1a1a;
    border: 1px solid #633;
    border-radius: 4px;
    color: #f88;
    cursor: pointer;
}

.trade-request__decline:hover {
    background: #4a2020;
}

/* ---------- Bank Window ---------- */

.bank-window {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 280px;
    background: rgba(0, 0, 0, 0.92);
    border: 1px solid #555;
    border-radius: 6px;
    color: #eee;
    font-size: 0.8rem;
    z-index: 25;
    user-select: none;
}

.bank-window__title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #444;
}

.bank-window__title {
    font-weight: bold;
    color: #ffd700;
    font-size: 0.9rem;
}

.bank-window__close {
    background: #333;
    border: 1px solid #555;
    border-radius: 3px;
    color: #f88;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
}

.bank-window__close:hover {
    background: #4a2020;
    border-color: #f44;
}

.bank-window__section-title {
    text-align: center;
    font-weight: bold;
    color: #aaa;
    font-size: 0.8rem;
    padding: 0.3rem 0;
}

.bank-window__grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
    padding: 0 0.4rem;
}

.bank-window__slot {
    aspect-ratio: 1;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    min-height: 34px;
}

.bank-window__slot:hover {
    border-color: #888;
}

.bank-window__slot--filled {
    background: #1e1e2a;
    border-color: #555;
}

.bank-window__item-name {
    font-size: 0.55rem;
    text-align: center;
    line-height: 1.1;
    color: #ccc;
    padding: 1px;
    word-break: break-word;
}

.bank-window__item-qty {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 0.6rem;
    color: #ffd700;
    font-weight: bold;
}

.bank-window__actions {
    padding: 0.4rem;
    border-top: 1px solid #333;
}

.bank-window__btn {
    display: block;
    width: 100%;
    padding: 0.3rem;
    background: #2a4a6a;
    border: 1px solid #3a6a9a;
    border-radius: 3px;
    color: #cdf;
    font-size: 0.75rem;
    cursor: pointer;
    text-align: center;
}

.bank-window__btn:hover {
    background: #3a6a9a;
}

/* ---------- Party Panel ---------- */

.party-panel {
    position: absolute;
    top: 64px;
    left: 8px;
    width: 180px;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid #444;
    border-radius: 6px;
    color: #eee;
    font-size: 0.75rem;
    z-index: 12;
    user-select: none;
}

.party-panel__title-bar {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #333;
}

.party-panel__title {
    font-weight: bold;
    color: #ffd700;
    font-size: 0.8rem;
}

.party-panel__members {
    padding: 0.3rem;
}

.party-panel__member {
    padding: 0.2rem 0.3rem;
    margin-bottom: 3px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 2px;
}

.party-panel__member-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.party-panel__member-name {
    color: #ccc;
    font-size: 0.7rem;
    font-weight: bold;
}

.party-panel__member-level {
    color: #888;
    font-size: 0.65rem;
}

.party-panel__hp-bar {
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
}

.party-panel__hp-fill {
    height: 100%;
    background: #2a2;
    transition: width 0.3s;
}

.party-panel__hp-text {
    font-size: 0.6rem;
    color: #888;
    text-align: right;
    margin-top: 1px;
}

.party-panel__actions {
    padding: 0.3rem;
    border-top: 1px solid #333;
}

.party-panel__btn {
    display: block;
    width: 100%;
    padding: 0.25rem;
    background: #333;
    border: 1px solid #444;
    border-radius: 3px;
    color: #ccc;
    font-size: 0.7rem;
    cursor: pointer;
    text-align: center;
}

.party-panel__btn:hover {
    background: #444;
}

.party-panel__btn--leave {
    background: #3a1a1a;
    border-color: #633;
    color: #f88;
}

.party-panel__btn--leave:hover {
    background: #4a2020;
}

/* Party invite popup */
.party-invite {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.party-invite__box {
    background: #1a1a1a;
    border: 2px solid #555;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    min-width: 260px;
}

.party-invite__text {
    color: #eee;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.party-invite__actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.party-invite__accept {
    padding: 0.4rem 1rem;
    background: #2a5a2a;
    border: 1px solid #3a7a3a;
    border-radius: 4px;
    color: #eee;
    cursor: pointer;
}

.party-invite__accept:hover {
    background: #3a7a3a;
}

.party-invite__decline {
    padding: 0.4rem 1rem;
    background: #3a1a1a;
    border: 1px solid #633;
    border-radius: 4px;
    color: #f88;
    cursor: pointer;
}

.party-invite__decline:hover {
    background: #4a2020;
}

/* ---------- Map Name Banner ---------- */

.map-name-banner {
    position: fixed;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 16px;
    border-radius: 4px;
    font-size: calc(0.85rem * var(--game-ui-scale, 1));
    color: #ffd700;
    font-weight: bold;
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.map-name-banner--visible {
    opacity: 1;
}

/* ── Tab-target HUD ─────────────────────────────────────── */

.target-hud {
    position: fixed;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid rgba(255, 34, 34, 0.8);
    border-radius: 6px;
    padding: 8px 16px;
    color: #fff;
    font-size: 13px;
    z-index: 20;
    min-width: 180px;
    text-align: center;
    pointer-events: none;
    box-shadow: 0 0 8px rgba(255, 34, 34, 0.3);
}

.target-hud__name {
    font-weight: bold;
    color: #ffdddd;
    margin-bottom: 5px;
    font-size: calc(14px * var(--game-ui-scale, 1));
}

.target-hud__hp-bar {
    width: 100%;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

.target-hud__hp-fill {
    height: 100%;
    background: #44ff44;
    border-radius: 4px;
    transition: width 0.2s ease;
}

.target-hud__hp-text {
    font-size: calc(11px * var(--game-ui-scale, 1));
    color: #ddd;
    margin-top: 3px;
}

/* ---------- Entity Label Overlay ---------- */

.entity-label-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 5;
}

.entity-label {
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
    will-change: transform;
    font-family: Arial, Helvetica, sans-serif;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        0 -1px 0 #000,
        0 1px 0 #000,
        -1px 0 0 #000,
        1px 0 0 #000;
}

.entity-label--npc {
    font-size: 12px;
    color: #ffcccc;
}

.entity-label--player {
    font-size: 13px;
    color: #fff;
}

/* ---------- DOM HUD Overlay ---------- */

.hud-dom {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    pointer-events: none;
}

.hud-dom__text {
    display: inline-block;
    margin: 8px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.75);
    color: #ffd700;
    font-size: 14px;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.4;
    white-space: pre;
    border-radius: 4px;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
}
