/* 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;
}

:root {
    --ui-shadow-quiet: 0 1px 4px rgba(0, 0, 0, 0.24);
    --ui-shadow-float: 0 4px 12px rgba(0, 0, 0, 0.26);
    --ui-shadow-panel: 0 8px 22px rgba(0, 0, 0, 0.34);
    --ui-shadow-modal: 0 16px 42px rgba(0, 0, 0, 0.42);
    --ui-shadow-control: 0 3px 8px rgba(0, 0, 0, 0.24);
    --ui-shadow-gold-hairline: 0 0 1px rgba(255, 215, 0, 0.14);
    --ui-shadow-inset-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    --ui-shadow-inset-soft: inset 0 0 10px rgba(0, 0, 0, 0.34);
    --ui-shadow-inset-gold: inset 0 1px 0 rgba(255, 215, 0, 0.08);
}

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

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    margin-top: 0;
}

/* 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;
    box-shadow: var(--ui-shadow-modal);
}

.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--profile {
    gap: 0.35rem;
}

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

.login-form__federated-user {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 0.2rem 0.55rem 0.22rem 0.42rem;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.12);
    color: #f2f7ff;
    font-size: 0.8rem;
    font-weight: 600;
    gap: 0.35rem;
    line-height: 1;
}

.login-form__federated-avatar {
    flex-shrink: 0;
    font-size: 0.95rem;
    line-height: 1;
}

.login-form__federated-name {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.login-form__federated-user--status {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #cde;
}

.login-form__federated-switch {
    margin-top: 0.4rem;
    text-align: center;
}

.login-form button.login-form__link-button {
    width: auto;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    color: #aaf;
    font-size: 0.78rem;
}

.login-form button.login-form__link-button:hover {
    background: transparent;
    color: #c7d2fe;
    text-decoration: underline;
}

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

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

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

.login-form 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:
        var(--ui-shadow-modal),
        var(--ui-shadow-gold-hairline),
        var(--ui-shadow-inset-highlight);
}

.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__admin {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #d0aa4a;
    font-size: 0.75rem;
    margin-left: 0.75rem;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}

.char-slot__admin input {
    width: auto;
    margin: 0;
    accent-color: #ffd700;
}

.char-slot__admin input:disabled {
    cursor: wait;
}

.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;
    transform: scale(0.667);
    transform-origin: bottom center;
    margin-top: -64px;
}

.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;
}

.char-create__field .admin-toggle {
    display: flex;
}

.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: fixed;
    bottom: calc(100vh - var(--canvas-bottom-px, 100vh) + 10px);
    left: calc(var(--canvas-left-px, 0px) + 10px);
    width: min(420px, calc(var(--canvas-width-px, 100vw) - 20px));
    z-index: 12;
    font-family: Arial, Helvetica, sans-serif;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.chat-box--focused {
    pointer-events: auto;
}

.chat-box--passive {
    opacity: 0.82;
}

.chat-box:not(.chat-box--focused):not(.chat-box--has-passive-messages) .chat-box__messages {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-color: transparent;
    opacity: 0;
}

.chat-box__messages {
    max-height: 92px;
    overflow-y: auto;
    background:
        linear-gradient(180deg, rgba(10, 9, 7, 0.52), rgba(0, 0, 0, 0.72));
    border: 1px solid rgba(255, 215, 0, 0.14);
    border-bottom: 0;
    border-radius: 4px 4px 0 0;
    padding: 6px 8px;
    font-size: calc(12px * var(--game-ui-scale, 1));
    line-height: 1.25;
    color: #ddd;
    opacity: 0.86;
    transition: max-height 0.18s ease, opacity 0.18s ease, padding 0.18s ease;
}

.chat-box:not(.chat-box--focused) .chat-box__messages:empty {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-color: transparent;
    opacity: 0;
}

.chat-box--focused .chat-box__messages {
    max-height: 150px;
    opacity: 1;
}

.chat-box__input {
    width: 100%;
    max-height: 0;
    padding: 0 8px;
    background: rgba(0, 0, 0, 0.86);
    border: 1px solid transparent;
    border-radius: 0 0 4px 4px;
    color: #eee;
    font-size: calc(14px * var(--game-ui-scale, 1));
    line-height: 20px;
    opacity: 0;
    pointer-events: none;
    transition:
        max-height 0.18s ease,
        padding 0.18s ease,
        opacity 0.18s ease,
        border-color 0.18s ease;
}

.chat-box--focused .chat-box__input {
    max-height: 34px;
    padding: 6px 8px;
    border-color: rgba(255, 215, 0, 0.45);
    opacity: 1;
    pointer-events: auto;
}

.chat-box__input:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.08);
}

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

.chat-box--passive .chat-box__line:not(.chat-box__line--passive-visible) {
    display: none;
}

.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;
    box-shadow:
        var(--ui-shadow-panel),
        var(--ui-shadow-inset-highlight);
}

.editor-toolbar__title {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #ffd700;
    padding-bottom: 0.4rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid #444;
    font-size: 0.9rem;
    position: relative;
}

.editor-toolbar__exit-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 1px solid transparent;
    border-radius: 3px;
    color: #888;
    font-size: 0.85rem;
    line-height: 1;
    padding: 2px 4px;
    cursor: pointer;
}

.editor-toolbar__exit-btn:hover {
    color: #ff6666;
    border-color: #ff6666;
    background: rgba(255, 50, 50, 0.15);
}

.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;
    box-shadow:
        var(--ui-shadow-panel),
        var(--ui-shadow-inset-highlight);
}

.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;
}

/* Stencil palette */
.stencil-palette {
    position: absolute;
    bottom: 8px;
    left: 8px;
    width: 220px;
    max-height: 400px;
    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;
    display: flex;
    flex-direction: column;
    box-shadow:
        var(--ui-shadow-panel),
        var(--ui-shadow-inset-highlight);
}

.stencil-palette__title {
    text-align: center;
    font-weight: bold;
    padding-bottom: 0.4rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid #444;
    cursor: move;
}

.stencil-palette__list {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.stencil-palette__list::-webkit-scrollbar {
    width: 4px;
}

.stencil-palette__list::-webkit-scrollbar-track {
    background: transparent;
}

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

.stencil-palette__category {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.3rem 0 0.15rem;
    border-bottom: 1px solid #333;
    margin-bottom: 0.2rem;
}

.stencil-palette__item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.3rem;
    border-radius: 3px;
    cursor: pointer;
}

.stencil-palette__item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.stencil-palette__item--selected {
    background: rgba(0, 255, 136, 0.15);
    outline: 1px solid #00ff88;
}

.stencil-palette__thumb {
    image-rendering: pixelated;
    border: 1px solid #444;
    border-radius: 2px;
    flex-shrink: 0;
}

.stencil-palette__item-info {
    flex: 1;
    min-width: 0;
}

.stencil-palette__item-name {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stencil-palette__item-dims {
    font-size: 0.65rem;
    color: #888;
}

.stencil-palette__info {
    font-size: 0.7rem;
    color: #666;
    text-align: center;
    padding-top: 0.3rem;
    border-top: 1px solid #333;
    margin-top: 0.3rem;
}

/* Stencil overlap confirmation dialog */
.stencil-confirm {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 260px;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid #ff4444;
    border-radius: 8px;
    padding: 1rem;
    color: #eee;
    font-size: 0.85rem;
    z-index: 30;
    box-shadow: var(--ui-shadow-modal);
}

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

.stencil-confirm__msg {
    font-size: 0.8rem;
    color: #ccc;
    margin-bottom: 0.75rem;
    text-align: center;
    line-height: 1.4;
}

.stencil-confirm__buttons {
    display: flex;
    gap: 4%;
}

.stencil-confirm__place,
.stencil-confirm__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;
}

.stencil-confirm__place:hover,
.stencil-confirm__cancel:hover {
    background: #444;
}

.stencil-confirm__place {
    background: #5a2a2a;
    border-color: #7a3a3a;
}

.stencil-confirm__place:hover {
    background: #6a3a3a;
}

/* Map properties panel */
.map-props {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 340px;
    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 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #444;
    cursor: move;
}

.map-props__id-badge {
    display: inline-block;
    background: #ffd700;
    color: #111;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* ── Sections ──────────────────────────────────────────── */

.map-props__section {
    margin-bottom: 0.6rem;
}

.map-props__section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid #333;
    padding-bottom: 0.2rem;
}

/* ── General field rows ────────────────────────────────── */

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

.map-props__label {
    width: 55px;
    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;
}

/* ── Compass layout ────────────────────────────────────── */

.map-props__compass {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
}

.map-props__compass-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.map-props__compass-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
    gap: 2px;
}

.map-props__compass-dir {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
}

.map-props__input--border {
    width: 64px;
    flex: none;
    text-align: center;
    font-size: 0.85rem;
    padding: 0.2rem 0.3rem;
}

.map-props__border-name {
    font-size: 0.65rem;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.map-props__border-name--none {
    color: #666;
    font-style: italic;
}

.map-props__border-name--linked {
    color: #7ec8e3;
}

.map-props__compass-center {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 48px;
    background: #1a1a1a;
    border: 2px solid #ffd700;
    border-radius: 6px;
}

.map-props__compass-current {
    font-weight: 700;
    font-size: 1rem;
    color: #ffd700;
}

/* ── Buttons ───────────────────────────────────────────── */

.map-props__buttons {
    display: flex;
    gap: 4%;
    margin-top: 0.5rem;
}

.map-props__apply,
.map-props__close {
    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;
}

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

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

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

/* ---------- Standalone Map Properties Panel (Admin Menu) ---------- */

.map-props-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 340px;
    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-panel__title-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #444;
    cursor: grab;
}

.map-props-panel__id-badge {
    display: inline-block;
    background: #ffd700;
    color: #111;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.map-props-panel__title {
    flex: 1;
}

.map-props-panel__close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0 0.2rem;
    margin-left: auto;
}

.map-props-panel__close:hover {
    color: #ff6666;
}

.map-props-panel__section {
    margin-bottom: 0.6rem;
}

.map-props-panel__section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid #333;
    padding-bottom: 0.2rem;
}

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

.map-props-panel__label {
    width: 55px;
    font-size: 0.75rem;
    color: #aaa;
    flex-shrink: 0;
}

.map-props-panel__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-panel__input:focus {
    outline: none;
    border-color: #ffd700;
}

.map-props-panel__compass {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
}

.map-props-panel__compass-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.map-props-panel__compass-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
    gap: 2px;
}

.map-props-panel__compass-dir {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
}

.map-props-panel__input--border {
    width: 64px;
    flex: none;
    text-align: center;
    font-size: 0.85rem;
    padding: 0.2rem 0.3rem;
}

.map-props-panel__border-name {
    font-size: 0.65rem;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.map-props-panel__border-name--none {
    color: #666;
    font-style: italic;
}

.map-props-panel__border-name--linked {
    color: #7ec8e3;
}

.map-props-panel__compass-center {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 48px;
    background: #1a1a1a;
    border: 2px solid #ffd700;
    border-radius: 6px;
}

.map-props-panel__compass-current {
    font-weight: 700;
    font-size: 1rem;
    color: #ffd700;
}

.map-props-panel__buttons {
    display: flex;
    gap: 4%;
    margin-top: 0.5rem;
}

.map-props-panel__save,
.map-props-panel__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;
}

.map-props-panel__save {
    background: #2a5a2a;
    border-color: #3a7a3a;
}

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

.map-props-panel__cancel:hover {
    background: #444;
}

.map-props-panel__status {
    font-size: 0.7rem;
    color: #aaa;
    text-align: center;
    margin-top: 0.4rem;
    min-height: 1em;
}

.map-props-panel__status--success { color: #44ff44; }
.map-props-panel__status--error { color: #ff4444; }
.map-props-panel__status--info { color: #88bbff; }

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

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

/* Dirty state indicator (dot in title bar) */
.map-props-panel__dirty {
    display: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffa500;
    flex-shrink: 0;
}

.map-props-panel__dirty--active {
    display: inline-block;
}

.map-props-panel__save--dirty {
    background: #3a7a3a;
    border-color: #4a9a4a;
    animation: dirty-pulse 1.5s ease-in-out infinite;
}

@keyframes dirty-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Border link indicator */
.map-props-panel__border-link {
    font-size: 0.75rem;
    min-height: 1em;
}

.map-props-panel__border-link--ok {
    color: #44ff44;
}

.map-props-panel__border-link--oneway {
    color: #ffaa33;
}

.map-props-panel__border-link--mismatch {
    color: #ff4444;
}

.map-props-panel__border-link--unknown {
    color: #888;
}

/* 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;
}

/* NPC picker list in attribute dialog */
.attr-dialog__npc-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #444;
    border-radius: 3px;
    margin-bottom: 0.5rem;
    background: #1a1a1a;
}

.attr-dialog__npc-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 3px 6px;
    cursor: pointer;
    border-bottom: 1px solid #2a2a2a;
    transition: background 0.12s;
}

.attr-dialog__npc-item:last-child {
    border-bottom: none;
}

.attr-dialog__npc-item:hover {
    background: #333;
}

.attr-dialog__npc-item--selected {
    background: #2a5a2a;
    outline: 1px solid #3a7a3a;
}

.attr-dialog__npc-sprite {
    width: 32px;
    height: 48px;
    background-size: 128px 192px;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.attr-dialog__npc-info {
    flex: 1;
    min-width: 0;
}

.attr-dialog__npc-name {
    font-size: 0.8rem;
    color: #fff;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attr-dialog__npc-meta {
    font-size: 0.65rem;
    color: #888;
}

.attr-dialog__npc-loading {
    padding: 0.4rem;
    color: #aaa;
    font-size: 0.75rem;
}

.attr-dialog__npc-actions {
    display: flex;
    gap: 6px;
    margin-top: 0.4rem;
}

.attr-dialog__move {
    flex: 1;
    padding: 0.3rem;
    background: #2a3a5a;
    border: 1px solid #3a5a7a;
    color: #88bbff;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.75rem;
    text-align: center;
}

.attr-dialog__move:hover {
    background: #3a5a7a;
    color: #aaddff;
}

.attr-dialog__delete {
    flex: 1;
    padding: 0.3rem;
    background: #5a2a2a;
    border: 1px solid #7a3a3a;
    color: #ff8888;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.75rem;
    text-align: center;
}

.attr-dialog__delete:hover {
    background: #7a3a3a;
    color: #ffaaaa;
}

/* 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;
    box-shadow:
        var(--ui-shadow-panel),
        var(--ui-shadow-inset-highlight);
}

.inventory-panel__title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0.5rem;
    margin-bottom: 0.3rem;
    border-bottom: 1px solid #555;
    cursor: grab;
}

.inventory-panel__title {
    font-weight: bold;
    color: #ffd700;
    font-size: 0.85rem;
}

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

.inventory-panel__close:hover {
    background: #4a2020;
    border-color: #f44;
}

.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: repeat(3, minmax(48px, 58px));
    grid-template-areas:
        ". head ."
        "cape neck ammo"
        "weapon body shield"
        ". legs ."
        "hands feet ring";
    justify-content: center;
    gap: 6px;
    margin: 0 auto 0.5rem;
    padding: 8px 6px;
    border: 1px solid #3d3524;
    background:
        radial-gradient(circle at 50% 43%, rgba(255, 216, 74, 0.1), transparent 34%),
        linear-gradient(180deg, rgba(61, 53, 36, 0.34), rgba(10, 9, 6, 0.52));
}

.inventory-panel__eq-slot[data-slot="head"] { grid-area: head; }
.inventory-panel__eq-slot[data-slot="cape"] { grid-area: cape; }
.inventory-panel__eq-slot[data-slot="neck"] { grid-area: neck; }
.inventory-panel__eq-slot[data-slot="ammo"] { grid-area: ammo; }
.inventory-panel__eq-slot[data-slot="weapon"] { grid-area: weapon; }
.inventory-panel__eq-slot[data-slot="body"] { grid-area: body; }
.inventory-panel__eq-slot[data-slot="shield"] { grid-area: shield; }
.inventory-panel__eq-slot[data-slot="legs"] { grid-area: legs; }
.inventory-panel__eq-slot[data-slot="hands"] { grid-area: hands; }
.inventory-panel__eq-slot[data-slot="feet"] { grid-area: feet; }
.inventory-panel__eq-slot[data-slot="ring"] { grid-area: ring; }

.inventory-panel__eq-slot[data-slot="head"],
.inventory-panel__eq-slot[data-slot="body"],
.inventory-panel__eq-slot[data-slot="legs"],
.inventory-panel__eq-slot[data-slot="feet"] {
    box-shadow: inset 0 0 0 1px rgba(255, 216, 74, 0.08);
}

.inventory-panel__eq-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.3rem;
    background: #17140d;
    border: 1px solid #5a4d30;
    border-radius: 3px;
    cursor: pointer;
    min-height: 52px;
}

.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: #a69a77;
    text-transform: uppercase;
}

.inventory-panel__eq-icon {
    font-size: 0.62rem;
    color: #ccc;
    margin-top: 2px;
    line-height: 1.05;
    max-width: 100%;
    overflow-wrap: anywhere;
    text-align: center;
}

.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::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    border: 1px solid transparent;
    border-radius: inherit;
    pointer-events: none;
}

.inventory-panel__slot:hover,
.inventory-panel__slot:focus-visible {
    border-color: #888;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
    outline: none;
}

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

.inventory-panel__slot:focus-visible {
    border-color: #ffd700;
    box-shadow: inset 0 0 0 1px rgba(255, 216, 74, 0.4);
}

.inventory-panel__slot:focus-visible::after {
    border-color: #ffd700;
}

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

.inventory-panel__slot--selected {
    border-color: #ffd700;
    background: #2a2a1a;
    box-shadow: inset 0 0 0 1px rgba(255, 216, 74, 0.42);
}

.inventory-panel__slot--selected::after {
    border-color: #ffd700;
}

.inventory-panel__item-qty {
    position: absolute;
    right: 2px;
    bottom: 2px;
    min-width: 13px;
    padding: 0 2px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.76);
    font-size: 0.6rem;
    color: #ffd700;
    font-weight: bold;
    line-height: 1.15;
    text-align: center;
    text-shadow: 0 1px 0 #000;
}

.inventory-panel__item-icon {
    display: block;
    width: 24px;
    height: 24px;
    margin: 0 auto;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    image-rendering: pixelated;
}

.inventory-panel__coin-icon {
    display: block;
    width: 18px;
    height: 14px;
    margin: 0 auto 1px;
    position: relative;
    /* Top coin */
    background: radial-gradient(ellipse at 40% 35%, #ffec80, #ffd700 50%, #b8860b);
    width: 9px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid #996515;
    top: 0;
}

.inventory-panel__coin-icon::before,
.inventory-panel__coin-icon::after {
    content: '';
    position: absolute;
    width: 9px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(ellipse at 40% 35%, #ffec80, #ffd700 50%, #b8860b);
    border: 1px solid #996515;
    z-index: -1;
}

/* Bottom-left coin */
.inventory-panel__coin-icon::before {
    left: -5px;
    top: 4px;
}

/* Bottom-right coin */
.inventory-panel__coin-icon::after {
    left: 5px;
    top: 4px;
}

.inventory-panel__tooltip {
    position: fixed;
    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: 1001;
    box-sizing: border-box;
    width: max-content;
    min-width: min(150px, calc(100vw - 16px));
    max-width: min(220px, calc(100vw - 16px));
    box-shadow: var(--ui-shadow-float);
    line-height: 1.25;
    transform: translate(-50%, -100%);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}

.inventory-panel__tooltip--below {
    transform: translate(-50%, 0);
}

.inventory-panel__tooltip-name {
    color: #ffd700;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.inventory-panel__tooltip-desc {
    margin-top: 3px;
    color: #ddd;
    overflow-wrap: anywhere;
}

.inventory-panel__tooltip-meta {
    margin-top: 4px;
    color: #aaa;
    font-size: 0.68rem;
    overflow-wrap: anywhere;
}

/* 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--deployment {
    padding: 22px;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(2px);
}

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

.disconnect-overlay__box--deployment {
    width: min(560px, 92vw);
    min-width: 0;
    padding: 30px 34px 32px;
    border: 1px solid rgba(255, 216, 74, 0.45);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(255, 216, 74, 0.07), rgba(0, 0, 0, 0)),
        #15140f;
    box-shadow:
        var(--ui-shadow-modal),
        var(--ui-shadow-inset-highlight);
}

.disconnect-overlay__status-mark {
    position: relative;
    width: 44px;
    height: 44px;
    margin: 0 auto 16px;
    border: 3px solid rgba(255, 216, 74, 0.18);
    border-top-color: #ffd84a;
    border-right-color: #79e06f;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 18px rgba(255, 216, 74, 0.12);
    animation: deploy-spinner-spin 0.95s linear infinite;
}

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

.disconnect-overlay--deployment .disconnect-overlay__title {
    color: #ffd84a;
    font-size: 1.45rem;
    letter-spacing: 0;
    text-shadow: 2px 2px 0 #000;
}

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

.disconnect-overlay--deployment .disconnect-overlay__msg {
    max-width: 430px;
    margin: 0 auto 18px;
    color: #d8d1ba;
    font-size: 1rem;
    line-height: 1.45;
}

.disconnect-overlay__status-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    margin-bottom: 12px;
    padding: 5px 12px;
    border: 1px solid rgba(255, 216, 74, 0.2);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.26);
    color: #f3e6b4;
    font-size: 0.86rem;
    font-weight: 800;
}

.disconnect-overlay__pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #79e06f;
    box-shadow: 0 0 0 0 rgba(121, 224, 111, 0.42);
    animation: deploy-dot-pulse 1.1s ease-in-out infinite;
}

.disconnect-overlay__rail {
    width: min(290px, 74vw);
    height: 5px;
    margin: 0 auto 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 216, 74, 0.18);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.4);
}

.disconnect-overlay__rail-fill {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #79e06f, #ffd84a);
    transform-origin: left center;
    transition: transform 0.95s linear;
}

.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--deployment .disconnect-overlay__btn {
    min-width: 190px;
    border-color: #4d9a50;
    background: #276031;
    color: #fff6d6;
    font-weight: 850;
    box-shadow:
        var(--ui-shadow-control),
        var(--ui-shadow-inset-highlight);
}

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

.disconnect-overlay--deployment .disconnect-overlay__btn:hover {
    background: #32733b;
}

@keyframes deploy-spinner-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 520px) {
    .disconnect-overlay__box--deployment {
        padding: 26px 22px 28px;
    }
}

/* 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: 72px;
    height: 56px;
    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.7rem * var(--game-ui-scale, 1));
    color: #888;
    font-weight: bold;
}

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

.spell-bar__mp {
    font-size: calc(0.65rem * 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: 62px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid #4488ff;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 0.85rem;
    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;
}

.auto-battle-toggle {
    position: fixed;
    top: calc(var(--canvas-top-px, 64px) + 34px);
    right: calc(100vw - var(--canvas-right-px, 100vw) + 8px);
    min-width: 106px;
    height: 28px;
    padding: 0 10px;
    background: linear-gradient(180deg, rgba(42, 35, 20, 0.94), rgba(16, 14, 10, 0.96));
    border: 1px solid rgba(255, 215, 0, 0.62);
    border-radius: 4px;
    color: #ffd700;
    cursor: pointer;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: 800;
    line-height: 26px;
    text-shadow: 0 1px 0 #000;
    text-transform: uppercase;
    box-shadow:
        var(--ui-shadow-inset-highlight),
        var(--ui-shadow-control);
    z-index: 39;
}

.auto-battle-toggle:hover {
    border-color: #fff0a0;
    color: #fff6c5;
}

.auto-battle-toggle:focus-visible {
    outline: 2px solid #88bbff;
    outline-offset: 2px;
}

.auto-battle-toggle--active {
    background: linear-gradient(180deg, rgba(105, 25, 25, 0.96), rgba(42, 10, 10, 0.98));
    border-color: #ff6666;
    color: #ffffff;
    box-shadow:
        var(--ui-shadow-inset-highlight),
        0 0 10px rgba(255, 68, 68, 0.38),
        var(--ui-shadow-control);
}

/* ---------- 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;
}

.escape-menu__btn--small {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    margin-top: 0.4rem;
}

.escape-menu__audio {
    margin-top: 0.8rem;
    padding-top: 0.6rem;
    border-top: 1px solid #333;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.escape-menu__audio-label {
    font-weight: bold;
    color: #ffd700;
    font-size: 0.85rem;
}

.escape-menu__audio-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: #ddd;
}

.escape-menu__audio-row input[type="range"] {
    flex: 1;
}

/* ---------- 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;
}

/* ---------- Shared Interaction Chrome ---------- */

.interaction-frame {
    background: rgba(7, 8, 7, 0.94);
    border: 1px solid rgba(255, 216, 74, 0.38);
    border-radius: 6px;
    color: #eee4c3;
    font-family: Arial, Helvetica, sans-serif;
    box-shadow:
        var(--ui-shadow-panel),
        var(--ui-shadow-inset-highlight);
}

.interaction-frame__body {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
}

.interaction-frame__main {
    min-width: 0;
}

.interaction-frame__context {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
    align-items: stretch;
}

.interaction-frame__context-name {
    color: #ffd84a;
    font-size: 0.78rem;
    font-weight: 900;
    line-height: 1.15;
    text-align: center;
}

.interaction-frame__context-meta {
    color: #b9ad8e;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
}

.interaction-frame__symbol {
    display: grid;
    place-items: center;
    min-height: 82px;
    border: 1px solid rgba(255, 216, 74, 0.22);
    background:
        linear-gradient(180deg, rgba(255, 216, 74, 0.08), rgba(0, 0, 0, 0)),
        #17140d;
    color: #ffd84a;
    font-size: 2rem;
    font-weight: 900;
}

.interaction-frame__request-box {
    min-width: min(280px, 88vw);
    padding: 16px;
    text-align: center;
}

.interaction-portrait,
.dialogue-panel__portrait {
    position: relative;
    min-height: 96px;
    border: 1px solid rgba(255, 216, 74, 0.22);
    background:
        linear-gradient(180deg, rgba(255, 216, 74, 0.08), rgba(0, 0, 0, 0)),
        #17140d;
    overflow: hidden;
}

.interaction-portrait--sprite {
    display: grid;
    place-items: end center;
}

.interaction-portrait__sprite {
    width: 32px;
    height: 48px;
    margin-bottom: 8px;
    background-repeat: no-repeat;
    background-size: 128px 192px;
    image-rendering: pixelated;
    transform: scale(1.72);
    transform-origin: center bottom;
}

.interaction-button {
    min-height: 32px;
    border-radius: 3px;
    border: 1px solid #d6b63a;
    background: #28220f;
    color: #ffd84a;
    padding: 0.36rem 0.78rem;
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 900;
}

.interaction-button:hover {
    background: #3b3216;
}

.interaction-button--primary,
.interaction-button--choice,
.interaction-button--complete {
    background: #2c341c;
}

.interaction-button--secondary {
    border-color: #574d2a;
    background: #17150f;
    color: #cfc3a2;
}

@media (max-width: 620px) {
    .interaction-frame__body {
        grid-template-columns: 1fr;
    }

    .interaction-frame__context {
        display: none;
    }
}

/* ---------- Admin Menu ---------- */

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

.game-shell__map-modal-body .admin-menu,
.admin-menu--modal {
    position: static;
    transform: none;
    width: min(420px, 100%);
    z-index: auto;
    box-shadow: var(--ui-shadow-modal);
}

.admin-menu--modal .admin-menu__title-bar {
    cursor: default;
}

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

.admin-menu__title {
    font-weight: bold;
    color: #ffd700;
}

.admin-menu__close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0 0.2rem;
}

.admin-menu__close:hover {
    color: #ff6666;
}

.admin-menu__buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0.5rem;
}

.admin-menu__btn {
    padding: 0.5rem;
    background: #1a3a5a;
    border: 1px solid #2a5a8a;
    border-radius: 4px;
    color: #eee;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: center;
}

.admin-menu__btn:hover {
    background: #2a4a6a;
}

.admin-menu__separator {
    height: 1px;
    background: #444;
    margin: 2px 0;
}

.admin-menu__section {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0.45rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

.admin-menu__section-title {
    font-size: 0.74rem;
    font-weight: 700;
    color: #ffd700;
    text-transform: uppercase;
}

.admin-menu__note {
    color: #b8c2cc;
    font-size: 0.72rem;
    line-height: 1.25;
}

.admin-menu__mini-label {
    margin-top: 2px;
    color: #d6c684;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.admin-menu__button-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
}

.admin-menu__control-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.admin-menu__select {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.42rem 0.45rem;
    background: #111c27;
    border: 1px solid #2a5a8a;
    border-radius: 4px;
    color: #eee;
    font-size: 0.82rem;
}

.admin-menu__btn--inline {
    flex: 0 0 auto;
    padding: 0.42rem 0.55rem;
    white-space: nowrap;
}

.admin-menu__btn--mini {
    min-height: 30px;
    padding: 0.34rem 0.45rem;
    font-size: 0.72rem;
    line-height: 1.15;
}

.admin-menu__btn--toggle {
    position: relative;
    padding-left: 1.8rem;
}

.admin-menu__btn--toggle::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    border: 1px solid #888;
}

.admin-menu__btn--active {
    background: #1a4a2a;
    border-color: #2a8a4a;
}

.admin-menu__btn--active::before {
    background: #4ade80;
    border-color: #4ade80;
}

.admin-menu__btn--active:hover {
    background: #2a5a3a;
}

.admin-menu__btn--close-all {
    background: #5a1a1a;
    border-color: #8a2a2a;
}

.admin-menu__btn--close-all:hover {
    background: #6a2a2a;
}

.admin-menu__btn--danger {
    background: #4a2618;
    border-color: #8a4a2a;
}

.admin-menu__btn--danger:hover {
    background: #5a3020;
}

.admin-menu__btn--inline-danger {
    background: #3e2d1a;
    border-color: #7a5b24;
}

.admin-menu__btn--inline-danger:hover {
    background: #4c371f;
}

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

.shop-window,
.crafting-window {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(440px, 94vw);
    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;
}

/* Interactive NPC dialogue panel. */
.dialogue-panel {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: min(760px, 94vw);
    background: rgba(7, 7, 5, 0.95);
    border: 2px solid rgba(255, 216, 74, 0.66);
    border-radius: 6px;
    color: #eee;
    font-size: 0.9rem;
    z-index: 25;
    user-select: none;
    box-shadow:
        var(--ui-shadow-panel),
        var(--ui-shadow-inset-highlight);
}

.dialogue-panel__title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid rgba(255, 216, 74, 0.28);
}

.dialogue-panel__speaker {
    display: flex;
    align-items: baseline;
    min-width: 0;
    gap: 0.5rem;
}

.dialogue-panel__name {
    font-weight: 900;
    color: #ffd700;
    font-size: 1.05rem;
    line-height: 1;
    text-shadow: 2px 2px 0 #000;
}

.dialogue-panel__meta {
    color: #a99d78;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.dialogue-panel__close {
    width: 28px;
    height: 26px;
    background: #2b2620;
    border: 1px solid #655a32;
    border-radius: 3px;
    color: #f88;
    font-size: 0.78rem;
    font-weight: 900;
    cursor: pointer;
}

.dialogue-panel__close:hover {
    background: #433b2c;
}

.dialogue-panel__content {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.7rem;
}

.dialogue-panel__portrait-head,
.dialogue-panel__portrait-body {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.dialogue-panel__portrait-head {
    top: 17px;
    width: 28px;
    height: 28px;
    border: 2px solid #21140a;
    border-radius: 50%;
    background: #c8ad80;
    box-shadow:
        -7px 7px 0 #6b5834,
        7px 7px 0 #6b5834;
}

.dialogue-panel__portrait-body {
    bottom: 14px;
    width: 36px;
    height: 42px;
    border: 2px solid #20160e;
    background:
        linear-gradient(90deg, #2b6ea8 0 38%, #f5d37b 38% 52%, #2b6ea8 52% 100%);
}

.dialogue-panel__copy {
    display: grid;
    grid-template-rows: minmax(52px, 1fr) auto;
    min-width: 0;
}

.dialogue-panel__text {
    padding: 0.2rem 0.2rem 0.65rem;
    line-height: 1.4;
    min-height: 3.2em;
    color: #f4ecd2;
    font-size: 1rem;
}

.dialogue-panel__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-start;
    padding: 0.65rem 0 0;
    border-top: 1px solid rgba(255, 216, 74, 0.18);
}

.dialogue-panel__ok,
.dialogue-panel__choice,
.dialogue-panel__cancel {
    min-height: 34px;
    background: #28220f;
    border: 1px solid #d6b63a;
    border-radius: 3px;
    color: #ffd84a;
    padding: 0.42rem 0.85rem;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 900;
}

.dialogue-panel__choice {
    background: #2c341c;
    border-color: #d6b63a;
}

.dialogue-panel__cancel {
    background: #17150f;
    border-color: #574d2a;
    color: #cfc3a2;
}

.dialogue-panel__ok:hover,
.dialogue-panel__choice:hover,
.dialogue-panel__cancel:hover {
    background: #3b3216;
}

.dialogue-panel__choice:hover {
    background: #3f4b28;
}

.dialogue-panel__cancel:hover {
    background: #252117;
}

@media (max-width: 620px) {
    .dialogue-panel__content {
        grid-template-columns: 1fr;
    }

    .dialogue-panel__portrait {
        display: none;
    }

    .dialogue-panel__buttons {
        display: grid;
        grid-template-columns: 1fr;
    }
}

.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: 1px solid rgba(255, 216, 74, 0.18);
    border-bottom: 0;
}

.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__stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0.6rem;
    background: rgba(0, 0, 0, 0.34);
    border: 1px solid rgba(255, 216, 74, 0.18);
    border-top: 0;
    font-size: 0.75rem;
}

.shop-window__gold {
    color: #ffd700;
    font-weight: bold;
}

.shop-window__level {
    color: #8cf;
}

.shop-window__item-level {
    color: #8cf;
    font-size: 0.65rem;
    white-space: nowrap;
}

.shop-window__item-level--locked {
    color: #f66;
}

.shop-window__item-price--cant-afford {
    color: #f66;
}

.shop-window__grid {
    padding: 0.4rem;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid rgba(255, 216, 74, 0.14);
    border-top: 0;
    background: rgba(0, 0, 0, 0.18);
}

.shop-window__item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.4rem;
    margin-bottom: 3px;
    background: rgba(26, 26, 34, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}

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

.shop-window__item--exchange {
    align-items: stretch;
}

.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__exchange-main {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
}

.shop-window__exchange-main .shop-window__item-name {
    flex: 0;
}

.shop-window__exchange-rate {
    color: #ffd700;
    font-size: 0.72rem;
    font-weight: bold;
    white-space: nowrap;
}

.shop-window__exchange-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0.15rem;
    white-space: nowrap;
}

.shop-window__exchange-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
}

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

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

.shop-window__buy-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    background: #333;
    border-color: #444;
}

.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: min(440px, 94vw);
    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: 6px;
    padding: 8px;
    background: transparent;
}

.trade-window__panel {
    flex: 1;
    background: rgba(0, 0, 0, 0.32);
    border: 1px solid rgba(255, 216, 74, 0.16);
    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: rgba(26, 26, 34, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.12);
    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 8px 8px;
    border-top: 0;
}

.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: rgba(7, 8, 7, 0.94);
    border: 1px solid rgba(255, 216, 74, 0.38);
    border-radius: 6px;
}

.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: min(390px, 94vw);
    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: left;
    font-weight: bold;
    color: #aaa;
    font-size: 0.8rem;
    padding: 0 0 0.35rem;
}

.bank-window__grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
    padding: 0.4rem;
    border: 1px solid rgba(255, 216, 74, 0.14);
    background: rgba(0, 0, 0, 0.18);
}

.bank-window__slot {
    aspect-ratio: 1;
    background: rgba(26, 26, 26, 0.84);
    border: 1px solid rgba(255, 255, 255, 0.12);
    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.45rem 0 0;
    border-top: 0;
}

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

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

/* ---------- 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;
    box-shadow:
        var(--ui-shadow-panel),
        var(--ui-shadow-inset-highlight);
}

.party-panel__title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #333;
}

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

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

.party-panel__close:hover {
    background: #4a2020;
    border-color: #f44;
}

.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: rgba(7, 8, 7, 0.94);
    border: 1px solid rgba(255, 216, 74, 0.38);
    border-radius: 6px;
}

.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: 5px 18px;
    border-radius: 4px;
    font-size: calc(1rem * var(--game-ui-scale, 1));
    color: #ffd700;
    font-weight: bold;
    letter-spacing: 0.5px;
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.4s ease;
}

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

/* Narrow viewports (non-panel mode): anchor map name to top-right
   so it doesn't overlap the player stats HUD in the top-left. */
@media (max-width: 600px) {
    body:not(.game--panel-mode) .map-name-banner {
        left: auto;
        right: 8px;
        transform: none;
    }
}

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

.target-hud {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -100%);
    display: none;
    flex-direction: column;
    align-items: stretch;
    background:
        linear-gradient(180deg, rgba(26, 12, 10, 0.92) 0%, rgba(8, 4, 4, 0.96) 100%);
    border: 1px solid rgba(255, 72, 72, 0.48);
    border-top: 2px solid rgba(255, 86, 72, 0.7);
    border-radius: 6px;
    padding: 5px 8px 6px;
    color: #fff;
    font-size: 12px;
    z-index: 22;
    min-width: 138px;
    max-width: min(190px, calc(100vw - 24px));
    text-align: center;
    pointer-events: none;
    box-shadow:
        0 0 12px rgba(255, 34, 34, 0.14),
        var(--ui-shadow-float),
        var(--ui-shadow-inset-highlight);
}

.target-hud__header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-bottom: 2px;
}

.target-hud__level {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 4px;
    background: linear-gradient(135deg, rgba(255, 60, 60, 0.6) 0%, rgba(180, 20, 20, 0.8) 100%);
    border: 1px solid rgba(255, 100, 100, 0.5);
    border-radius: 4px;
    font-size: calc(10px * var(--game-ui-scale, 1));
    font-weight: bold;
    color: #fff;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
}

.target-hud__name {
    font-weight: bold;
    color: #ffd4d4;
    font-size: calc(12px * var(--game-ui-scale, 1));
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.target-hud__status {
    align-self: center;
    min-width: 62px;
    margin-bottom: 4px;
    padding: 1px 6px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #d8d2c2;
    font-size: calc(9px * var(--game-ui-scale, 1));
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
    text-shadow: 0 1px 2px #000;
}

.target-hud--pursuing .target-hud__status {
    border-color: rgba(255, 215, 0, 0.42);
    background: rgba(255, 215, 0, 0.14);
    color: #ffe07a;
}

.target-hud--attacking .target-hud__status {
    border-color: rgba(255, 84, 84, 0.48);
    background: rgba(255, 62, 62, 0.18);
    color: #ffb1a7;
}

.target-hud--warning .target-hud__status {
    border-color: rgba(255, 92, 92, 0.58);
    background: rgba(255, 44, 44, 0.22);
    color: #ff8a8a;
}

.target-hud__hp-bar {
    position: relative;
    width: 100%;
    height: 7px;
    background: rgba(30, 30, 30, 0.9);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(80, 80, 80, 0.4);
}

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

.target-hud__hp-shine {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, transparent 100%);
    border-radius: 5px 5px 0 0;
    pointer-events: none;
}

.target-hud__hp-text {
    font-size: calc(9px * var(--game-ui-scale, 1));
    color: #aaa;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.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;
    letter-spacing: 0;
    font-weight: 800;
    line-height: 1.05;
    padding: 0;
    border: 0;
    background: transparent;
    transform-origin: center top;
    transition: opacity 0.12s ease;
    --entity-label-outline:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
    text-shadow: var(--entity-label-outline);
}

.entity-label--occluded {
    opacity: 0;
}

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

.entity-label--npc-friendly {
    color: #9af29a;
}

.entity-label--npc-passive {
    color: #ffff88;
}

.entity-label--npc-aggressive {
    color: #ffcccc;
}

.entity-label--npc-guard {
    color: #ffaa44;
}

.entity-label--selected {
    color: #f8ff8c;
    text-shadow: var(--entity-label-outline);
}

.entity-label--selected-hostile {
    color: #ffd76a;
}

.entity-label--hovered {
    text-shadow: var(--entity-label-outline);
}

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

.entity-label--local-player {
    color: #fff;
}

.npc-quest-marker {
    position: absolute;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 2px solid #0b0905;
    border-radius: 50%;
    background: #ffd84a;
    color: #191309;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    text-shadow: none;
    will-change: transform;
    z-index: 8;
}

.npc-quest-marker[hidden] {
    display: none;
}

.npc-quest-marker--available {
    background: #3b82f6;
    color: #f7fbff;
    border-color: rgba(5, 14, 31, 0.92);
}

.npc-quest-marker--complete {
    background: #8dff70;
    color: #0f230c;
}

.npc-quest-marker--active {
    background: #ffd84a;
    color: #191309;
    border-color: #0b0905;
    opacity: 1;
}

/* ---------- NPC Dialogue Bubble ---------- */

.npc-dialogue-bubble {
    position: absolute;
    top: 0;
    left: 0;
    will-change: transform;
    background: rgba(255, 255, 255, 0.94);
    color: #24211f;
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
    line-height: 1.16;
    padding: 4px 9px;
    border: 1px solid rgba(35, 31, 25, 0.8);
    border-radius: 6px;
    pointer-events: none;
    z-index: 6;
    transition: opacity 0.3s ease;
    max-width: min(164px, 34vw);
    text-align: center;
    word-wrap: break-word;
    box-shadow: var(--ui-shadow-float);
}

.npc-dialogue-bubble::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 7px solid #333;
}

.npc-dialogue-bubble::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #fff;
    z-index: 1;
}

/* ---------- Loading Overlay ---------- */

.game-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffd700;
    font-size: 20px;
    font-family: Arial, Helvetica, sans-serif;
    pointer-events: none;
    z-index: 10;
}

/* ---------- Death Overlay ---------- */

.game-death-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    pointer-events: none;
    z-index: 10;
    gap: 8px;
}

.game-death-overlay__title {
    font-size: 28px;
    font-weight: bold;
    font-family: Arial, Helvetica, sans-serif;
    color: #ff4444;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000,
                 -2px 0 0 #000, 2px 0 0 #000, 0 -2px 0 #000, 0 2px 0 #000;
}

.game-death-overlay__countdown {
    font-size: 14px;
    font-family: Arial, Helvetica, sans-serif;
    color: #ccc;
}

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

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

.hud-panel {
    position: relative;
    margin: 8px;
    padding: 8px 10px 10px;
    width: min(330px, calc(100vw - 20px));
    min-width: 0;
    background:
        linear-gradient(135deg, rgba(20, 14, 8, 0.92) 0%, rgba(35, 25, 15, 0.92) 100%);
    border: 2px solid #6b5430;
    border-radius: 6px;
    box-shadow:
        var(--ui-shadow-inset-soft),
        var(--ui-shadow-float),
        var(--ui-shadow-inset-gold);
    font-family: Arial, Helvetica, sans-serif;
}

/* Corner accents */
.hud-panel::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border: 1px solid rgba(107, 84, 48, 0.25);
    border-radius: 3px;
    pointer-events: none;
}

/* --- Header: name + level --- */
.hud-panel__header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(107, 84, 48, 0.45);
}

.hud-panel__name {
    color: #ffd700;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow:
        0 0 6px rgba(255, 215, 0, 0.3),
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
}

.hud-panel__level {
    color: #c4a86a;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
}

.hud-panel__class {
    margin-left: auto;
    color: #a8c4a0;
    font-size: 11px;
    font-style: italic;
    letter-spacing: 0.3px;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
}

.hud-panel__admin-button {
    flex: 0 0 auto;
    height: 22px;
    padding: 0 8px;
    background: linear-gradient(180deg, #263f68, #142843);
    border: 1px solid rgba(136, 187, 255, 0.65);
    border-radius: 4px;
    color: #e8f1ff;
    font-size: 10px;
    font-weight: 800;
    line-height: 20px;
    cursor: pointer;
    pointer-events: auto;
    text-transform: uppercase;
    text-shadow: 0 1px 0 #000;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        var(--ui-shadow-control);
}

.hud-panel__admin-button:hover {
    background: linear-gradient(180deg, #33527f, #193354);
    border-color: #ffd700;
    color: #fff6c5;
}

.hud-panel__admin-button:focus-visible {
    outline: 2px solid #ffd700;
    outline-offset: 2px;
}

.hud-panel__admin-button--active {
    background: linear-gradient(180deg, #45621f, #243a13);
    border-color: #8fd75b;
    color: #eeffd9;
}

/* --- Meter bars --- */
.hud-panel__meters {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hud-meter {
    position: relative;
    height: 16px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.hud-meter__fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Glossy highlight on meter fill */
.hud-meter__fill::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 2px;
    right: 2px;
    height: 40%;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.28) 0%,
        rgba(255, 255, 255, 0) 100%
    );
    border-radius: 2px 2px 0 0;
}

/* HP — red */
.hud-meter--hp .hud-meter__fill {
    background: linear-gradient(to bottom, #e03030 0%, #a01818 100%);
    box-shadow: 0 0 6px rgba(224, 48, 48, 0.4);
}

/* MP — blue */
.hud-meter--mp .hud-meter__fill {
    background: linear-gradient(to bottom, #3a7bd5 0%, #1e4fa0 100%);
    box-shadow: 0 0 6px rgba(58, 123, 213, 0.4);
}

/* EXP — yellow gold */
.hud-meter--exp .hud-meter__fill {
    background: linear-gradient(to bottom, #e0b020 0%, #a08010 100%);
    box-shadow: 0 0 6px rgba(224, 176, 32, 0.4);
}

/* Meter text (label + value) */
.hud-meter__label,
.hud-meter__value {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.8),
        1px -1px 0 rgba(0, 0, 0, 0.8),
        -1px 1px 0 rgba(0, 0, 0, 0.8),
        1px 1px 0 rgba(0, 0, 0, 0.8);
}

.hud-meter__label {
    left: 5px;
}

.hud-meter__value {
    right: 5px;
}

/* --- Combat stat readout --- */
.hud-combat {
    position: relative;
    margin-top: 7px;
    padding-top: 6px;
    border-top: 1px solid rgba(107, 84, 48, 0.45);
}

.hud-combat__stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
}

.hud-combat__stat {
    min-width: 0;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    padding: 0 5px;
    border: 1px solid rgba(196, 168, 106, 0.24);
    border-radius: 3px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.62));
    box-shadow: inset 0 1px 0 rgba(255, 215, 0, 0.06);
}

.hud-combat__stat-label {
    min-width: 0;
    color: #c4a86a;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 1px 0 #000;
}

.hud-combat__stat-value {
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.8),
        1px -1px 0 rgba(0, 0, 0, 0.8),
        -1px 1px 0 rgba(0, 0, 0, 0.8),
        1px 1px 0 rgba(0, 0, 0, 0.8);
}

.hud-combat__weapon {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
}

.hud-combat__weapon-label {
    color: #7f7358;
    font-weight: 700;
    text-transform: uppercase;
    text-shadow: 0 1px 0 #000;
}

.hud-combat__weapon-name {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    color: #f1df9b;
    font-weight: 700;
    text-overflow: ellipsis;
    text-shadow: 0 1px 0 #000;
}

.hud-combat__weapon-meta {
    flex: 0 0 auto;
    color: #a8c4a0;
    font-weight: 700;
    text-shadow: 0 1px 0 #000;
}

/* Active status-effect icon row shown under the HP/MP/EXP meters. */
.hud-effects {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    min-height: 26px;
}

.hud-effects:empty {
    display: none;
}

.hud-effects__icon {
    position: relative;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    line-height: 1;
}

.hud-effects__icon--poison { background: rgba(40, 140, 40, 0.85); border-color: #5f5; }
.hud-effects__icon--slow   { background: rgba(30, 100, 170, 0.85); border-color: #6cf; }
.hud-effects__icon--stun   { background: rgba(200, 170, 30, 0.85); border-color: #ffd54a; color: #1a1200; }
.hud-effects__icon--shield { background: rgba(180, 180, 200, 0.85); border-color: #fff; color: #0a0a20; }

.hud-effects__timer {
    position: absolute;
    bottom: -6px;
    right: -4px;
    font-size: 10px;
    padding: 0 3px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    pointer-events: none;
}

/* In-game data editor panel */
.data-editor {
    position: absolute;
    top: 64px;
    left: 8px;
    width: 560px;
    max-height: calc(100vh - 80px);
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid #555;
    border-radius: 6px;
    color: #eee;
    font-size: 0.8rem;
    z-index: 25;
    user-select: none;
    display: flex;
    flex-direction: column;
    box-shadow:
        var(--ui-shadow-panel),
        var(--ui-shadow-inset-highlight);
}

.data-editor__title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    font-weight: bold;
    color: #ffd700;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #444;
    font-size: 0.9rem;
    cursor: move;
}

.data-editor__close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.data-editor__close:hover {
    color: #fff;
}

.data-editor__dirty {
    display: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffa500;
    flex-shrink: 0;
    margin-left: 6px;
}

.data-editor__dirty--active {
    display: inline-block;
}

.data-editor__tabs {
    display: flex;
    border-bottom: 1px solid #333;
}

.data-editor__tab {
    flex: 1;
    padding: 0.35rem 0.5rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #888;
    font-size: 0.75rem;
    cursor: pointer;
    text-align: center;
}

.data-editor__tab:hover {
    color: #ccc;
    background: rgba(255, 255, 255, 0.03);
}

.data-editor__tab--active {
    color: #ffd700;
    border-bottom-color: #ffd700;
}

.data-editor__tab--dirty::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffa500;
    margin-left: 4px;
    vertical-align: middle;
}

.data-editor__toolbar {
    display: flex;
    gap: 4px;
    padding: 0.4rem 0.5rem;
    align-items: center;
    border-bottom: 1px solid #333;
}

.data-editor__btn {
    padding: 0.2rem 0.6rem;
    background: #333;
    border: 1px solid #555;
    border-radius: 3px;
    color: #ccc;
    font-size: 0.7rem;
    cursor: pointer;
}

.data-editor__btn:hover {
    background: #444;
    color: #fff;
}

.data-editor__btn--primary {
    background: #2a5a2a;
    border-color: #3a7a3a;
    color: #fff;
}

.data-editor__btn--primary:hover {
    background: #3a7a3a;
}

.data-editor__btn--save {
    background: #2a4a6a;
    border-color: #3a6a9a;
    color: #cdf;
}

.data-editor__btn--save:hover {
    background: #3a6a9a;
}

.data-editor__btn--danger {
    color: #f88;
    border-color: #633;
}

.data-editor__btn--danger:hover {
    background: #4a2020;
}

.data-editor__btn--sm {
    padding: 0.1rem 0.3rem;
    font-size: 0.65rem;
    margin-right: 2px;
}

.data-editor__status {
    font-size: 0.7rem;
    margin-left: auto;
    padding: 0 0.3rem;
}

.data-editor__status--success { color: #44ff44; }
.data-editor__status--error { color: #ff4444; }
.data-editor__status--info { color: #88bbff; }

.data-editor__content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.data-editor__list {
    flex: 1;
    overflow: auto;
    max-height: 400px;
    padding: 0.25rem;
}

.data-editor__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
}

.data-editor__table th {
    background: #1a1a1a;
    color: #ffd700;
    padding: 0.25rem 0.4rem;
    text-align: left;
    border-bottom: 1px solid #444;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
}

.data-editor__table td {
    padding: 0.2rem 0.4rem;
    border-bottom: 1px solid #222;
}

.data-editor__table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.data-editor__row--selected {
    background: rgba(255, 215, 0, 0.08) !important;
}

.data-editor__form {
    width: 260px;
    border-left: 1px solid #333;
    padding: 0.4rem;
    overflow-y: auto;
    max-height: 400px;
}

.data-editor__form-title {
    color: #ffd700;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 0.4rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #333;
}

.data-editor__form-row {
    display: flex;
    align-items: center;
    margin-bottom: 3px;
}

.data-editor__form-label {
    width: 70px;
    font-size: 0.65rem;
    color: #aaa;
    flex-shrink: 0;
}

.data-editor__form-input {
    flex: 1;
    padding: 0.15rem 0.3rem;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 2px;
    color: #eee;
    font-size: 0.7rem;
    min-width: 0;
}

.data-editor__form-input:focus {
    outline: none;
    border-color: #ffd700;
}

select.data-editor__form-input {
    appearance: auto;
}

.data-editor__form-actions {
    display: flex;
    gap: 4px;
    margin-top: 0.5rem;
    padding-top: 0.3rem;
    border-top: 1px solid #333;
}

/* ---- Sprite previews ---- */

.data-editor__sprite {
    display: inline-block;
    image-rendering: pixelated;
    background-repeat: no-repeat;
    background-position: 0 0;
    vertical-align: middle;
}

.data-editor__sprite--npc,
.data-editor__sprite--player {
    width: 32px;
    height: 48px;
    background-size: 128px 192px;
}

.data-editor__sprite--item {
    width: 32px;
    height: 32px;
    background-size: 32px 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    line-height: 1;
}

.data-editor__sprite--preview {
    width: 48px;
    height: 72px;
    background-size: 192px 288px;
    flex-shrink: 0;
    border: 1px solid #444;
    border-radius: 2px;
    background-color: rgba(0, 0, 0, 0.3);
}

.data-editor__sprite--preview.data-editor__sprite--item {
    width: 48px;
    height: 48px;
    background-size: 48px 48px;
    font-size: 1.3rem;
}

.data-editor__sprite-id {
    display: inline-block;
    background: #2a2a3a;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 0 4px;
    font-size: 0.6rem;
    color: #aac;
    line-height: 1.6;
    vertical-align: middle;
}

.data-editor__weapon-name {
    margin-left: 4px;
    color: #ccd;
    font-size: 0.65rem;
    vertical-align: middle;
}

.data-editor__sprite-field {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.data-editor__sprite-field .data-editor__form-input {
    width: 50px;
    flex: 0 0 50px;
}

/* ---- Sub-tables (drops, shop items, chest items) ---- */

.data-editor__subtable-section {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #333;
}

.data-editor__subtable-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.7rem;
    color: #ffd700;
    font-weight: bold;
}

.data-editor__subtable {
    font-size: 0.65rem;
}

.data-editor__subtable th {
    padding: 0.15rem 0.25rem;
    font-size: 0.6rem;
}

.data-editor__subtable td {
    padding: 0.1rem 0.2rem;
}

.data-editor__subtable-input {
    width: 100%;
    padding: 0.1rem 0.2rem;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 2px;
    color: #eee;
    font-size: 0.65rem;
    box-sizing: border-box;
}

.data-editor__subtable-input:focus {
    outline: none;
    border-color: #ffd700;
}

.data-editor__subtable-itemname {
    color: #8cf;
    font-size: 0.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.data-editor__subtable-empty {
    text-align: center;
    color: #666;
    padding: 0.4rem !important;
    font-style: italic;
}

/* ==========================================================================
   Skills Panel and Gathering Progress
   ========================================================================== */

.skills-panel {
    position: fixed;
    top: calc(var(--canvas-top-px, 0px) + 76px);
    right: calc(100vw - var(--canvas-right-px, 100vw) + 14px);
    z-index: 36;
    width: 270px;
    max-width: calc(100vw - 28px);
    background: rgba(12, 15, 18, 0.94);
    border: 1px solid rgba(210, 188, 108, 0.55);
    border-radius: 6px;
    box-shadow: var(--ui-shadow-panel);
    color: #f2ead2;
    font-family: monospace;
}

.skills-panel__title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 30px;
    padding: 0 8px 0 10px;
    border-bottom: 1px solid rgba(210, 188, 108, 0.28);
    background: rgba(48, 42, 28, 0.72);
}

.skills-panel__title {
    font-size: 13px;
    font-weight: 700;
}

.skills-panel__close {
    width: 22px;
    height: 22px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: #f2ead2;
    cursor: pointer;
}

.skills-panel__close:hover {
    background: rgba(255, 255, 255, 0.16);
}

.skills-panel__list {
    padding: 8px;
}

.skills-panel__row {
    display: grid;
    grid-template-columns: minmax(92px, 1fr) 48px;
    gap: 4px 8px;
    align-items: center;
    padding: 7px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.skills-panel__row:last-child {
    border-bottom: 0;
}

.skills-panel__name {
    font-size: 12px;
    color: #f3f0e4;
}

.skills-panel__level {
    font-size: 12px;
    color: #d9c27a;
    text-align: right;
}

.skills-panel__bar {
    grid-column: 1 / -1;
    height: 7px;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
}

.skills-panel__bar-fill {
    width: 100%;
    height: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    background: linear-gradient(90deg, #2ea96b, #d9c27a);
}

.skills-panel__xp,
.skills-panel__empty {
    grid-column: 1 / -1;
    font-size: 10px;
    color: #9fb0bd;
}

.skill-action {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -100%);
    z-index: 21;
    width: 154px;
    max-width: min(260px, calc(100vw - 24px));
    padding: 5px 9px 6px;
    border: 1px solid rgba(86, 210, 132, 0.5);
    border-top: 2px solid rgba(148, 226, 113, 0.72);
    border-radius: 6px;
    background:
        linear-gradient(180deg, rgba(12, 31, 20, 0.92) 0%, rgba(5, 12, 8, 0.96) 100%);
    box-shadow:
        0 0 14px rgba(54, 208, 108, 0.16),
        var(--ui-shadow-float),
        var(--ui-shadow-inset-highlight);
    color: #f2ead2;
    font-family: monospace;
    text-align: center;
    pointer-events: none;
}

.skill-action__label {
    margin-bottom: 4px;
    color: #d7ffd6;
    font-size: 11px;
    font-weight: 800;
    text-shadow: 0 1px 2px #000;
    text-transform: capitalize;
}

.skill-action__track {
    height: 7px;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.14);
}

.skill-action__fill {
    width: 100%;
    height: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    background: linear-gradient(90deg, #2ea96b, #d9c27a);
}

.skill-action--mining {
    border-color: rgba(177, 186, 193, 0.5);
    border-top-color: rgba(223, 228, 232, 0.72);
    background:
        linear-gradient(180deg, rgba(31, 35, 37, 0.94) 0%, rgba(11, 13, 14, 0.97) 100%);
    box-shadow:
        0 0 14px rgba(196, 205, 211, 0.12),
        var(--ui-shadow-float),
        var(--ui-shadow-inset-highlight);
}

.skill-action--mining .skill-action__label {
    color: #edf1f3;
}

.skill-action--mining .skill-action__track {
    background: rgba(211, 216, 219, 0.18);
}

.skill-action--mining .skill-action__fill {
    background: linear-gradient(90deg, #8a949a, #e4e8ea);
}

/* ---------- World Map Overlay ---------- */

.world-map__close {
    position: fixed;
    top: 60px;
    right: 16px;
    z-index: 50;
    padding: 0.5rem 1.2rem;
    background: rgba(30, 30, 50, 0.95);
    border: 1px solid #555;
    border-radius: 4px;
    color: #eee;
    font-size: 0.85rem;
    font-family: monospace;
    cursor: pointer;
    box-shadow: var(--ui-shadow-control);
}

.world-map__close:hover {
    background: rgba(50, 50, 80, 0.95);
    border-color: #888;
}

.world-map__regions {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    gap: 4px;
    background: rgba(20, 20, 40, 0.95);
    border: 1px solid #444;
    border-radius: 6px;
    padding: 4px;
    box-shadow: var(--ui-shadow-panel);
}

.world-map__region-btn {
    padding: 0.35rem 0.8rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    color: #99aacc;
    font-size: 0.8rem;
    font-family: monospace;
    cursor: pointer;
}

.world-map__region-btn:hover {
    background: rgba(60, 60, 100, 0.5);
    color: #ccddeeff;
}

.world-map__region-btn--active {
    background: rgba(50, 80, 140, 0.6);
    border-color: #4488cc;
    color: #eef;
}

.world-map__loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    color: #8899bb;
    font-family: monospace;
    font-size: 1rem;
}

/* ==========================================================================
   Medium Desktop Game UI
   Tall desktop windows can have the same vertical letterboxing as phones.
   Keep the UI compact and anchored to the canvas instead of centering the
   mobile panel over the combat space.
   ========================================================================== */

.game--medium-game-ui .hud-dom {
    position: fixed !important;
    top: calc(var(--canvas-top-px) + 10px) !important;
    left: calc(var(--canvas-left-px) + 10px) !important;
    right: auto !important;
    width: min(340px, calc(var(--canvas-width-px) - 20px));
    transform: none !important;
    transform-origin: unset !important;
    display: block;
    padding: 0;
    z-index: 14;
    pointer-events: none;
}

.game--medium-game-ui .hud-panel {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 6px 8px 8px;
    border-width: 1px;
    border-radius: 5px;
    background:
        linear-gradient(135deg, rgba(20, 14, 8, 0.88) 0%, rgba(35, 25, 15, 0.9) 100%);
}

.game--medium-game-ui .hud-panel::before {
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
}

.game--medium-game-ui .hud-panel__header {
    margin-bottom: 5px;
    padding-bottom: 3px;
}

.game--medium-game-ui .hud-panel__name {
    font-size: 14px;
}

.game--medium-game-ui .hud-panel__level {
    font-size: 11px;
}

.game--medium-game-ui .hud-panel__class {
    font-size: 10px;
}

.game--medium-game-ui .hud-panel__admin-button {
    height: 20px;
    padding: 0 6px;
    font-size: 9px;
    line-height: 18px;
}

.game--medium-game-ui .hud-panel__meters {
    gap: 3px;
}

.game--medium-game-ui .hud-meter {
    height: 13px;
}

.game--medium-game-ui .hud-meter__label,
.game--medium-game-ui .hud-meter__value {
    font-size: 9px;
}

.game--medium-game-ui .hud-combat {
    margin-top: 5px;
    padding-top: 5px;
}

.game--medium-game-ui .hud-combat__stats {
    gap: 3px;
}

.game--medium-game-ui .hud-combat__stat {
    height: 18px;
    padding: 0 4px;
}

.game--medium-game-ui .hud-combat__stat-label {
    font-size: 8px;
}

.game--medium-game-ui .hud-combat__stat-value {
    font-size: 11px;
}

.game--medium-game-ui .hud-combat__weapon {
    margin-top: 4px;
    font-size: 9px;
}

.game--medium-game-ui .map-name-banner {
    top: calc(var(--canvas-top-px) + 8px);
    z-index: 15;
    padding: 4px 16px;
    background: rgba(0, 0, 0, 0.72);
}

.game--medium-game-ui .ping-overlay {
    top: calc(var(--canvas-top-px) + 8px);
    right: calc(100vw - var(--canvas-right-px) + 8px);
    z-index: 15;
    font-size: 0.68rem;
    background: rgba(0, 0, 0, 0.72);
}

.game--medium-game-ui .auto-battle-toggle {
    top: calc(var(--canvas-top-px) + 34px);
    right: calc(100vw - var(--canvas-right-px) + 8px);
    z-index: 16;
    min-width: 98px;
    height: 24px;
    padding: 0 8px;
    font-size: 10px;
    line-height: 22px;
}

.game--medium-game-ui .target-hud {
    z-index: 16;
}

.game--medium-game-ui .skill-action {
    z-index: 16;
}

.game--medium-game-ui .chat-box {
    position: fixed;
    left: calc(var(--canvas-left-px) + 8px);
    right: calc(100vw - var(--canvas-right-px) + 8px);
    bottom: calc(100vh - var(--canvas-bottom-px) + 8px);
    width: auto;
    z-index: 14;
}

.game--medium-game-ui .chat-box__messages {
    max-height: 86px;
    padding: 6px 8px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.46), rgba(0, 0, 0, 0.68));
    font-size: 12px;
}

.game--medium-game-ui .chat-box--focused .chat-box__messages {
    max-height: 140px;
}

.game--medium-game-ui .chat-box__input {
    font-size: 14px;
}

.game--medium-game-ui .chat-box--focused .chat-box__input {
    padding: 6px 8px;
}

/* ==========================================================================
   Panel Mode — Adaptive mobile layout
   When significant dead space exists above/below the canvas (portrait phone),
   UI elements reposition into the letterbox zones instead of overlaying the map.
   ========================================================================== */

.game--panel-mode {
    touch-action: manipulation;
}

/* --- Map name banner: top-left of zone --- */
.game--panel-mode .map-name-banner {
    top: calc(var(--canvas-top-px) - var(--top-zone-height) + 2px);
}

/* --- Ping overlay: top-right of zone --- */
.game--panel-mode .ping-overlay {
    top: calc(var(--canvas-top-px) - var(--top-zone-height) + 4px);
    right: 8px;
    font-size: 0.65rem;
}

.game--panel-mode .auto-battle-toggle {
    top: calc(var(--canvas-top-px) + 6px);
    right: 8px;
    min-width: 94px;
    height: 24px;
    padding: 0 8px;
    font-size: 9px;
    line-height: 22px;
}

/* --- HUD panel: below map name / ping row --- */
.game--panel-mode .hud-dom {
    position: fixed !important;
    top: calc(var(--canvas-top-px) - var(--top-zone-height) + 28px) !important;
    left: 0 !important;
    right: 0;
    width: 100%;
    transform: none !important;
    transform-origin: unset !important;
    display: flex;
    justify-content: center;
    padding: 0 8px;
    z-index: 10;
    pointer-events: none;
}

.game--panel-mode .hud-panel {
    width: 92%;
    max-width: 400px;
    margin: 0;
}

.game--panel-mode .hud-combat {
    margin-top: 5px;
    padding-top: 5px;
}

.game--panel-mode .hud-combat__stat {
    height: 18px;
}

.game--panel-mode .hud-combat__weapon {
    font-size: 9px;
}

.game--panel-mode .hud-panel__admin-button {
    height: 20px;
    padding: 0 6px;
    font-size: 9px;
    line-height: 18px;
}

.game--panel-mode .target-hud {
    z-index: 16;
}

.game--panel-mode .skill-action {
    z-index: 16;
}

/* --- Chat box: bottom zone, above phone home bar --- */
.game--panel-mode .chat-box {
    position: fixed;
    top: var(--canvas-bottom-px);
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    display: flex;
    flex-direction: column;
    padding: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 10;
}

.game--panel-mode .chat-box__messages {
    flex: 1;
    max-height: none;
    border-radius: 4px 4px 0 0;
}

.game--panel-mode .chat-box:not(.chat-box--focused) .chat-box__messages:empty {
    flex: 0 0 auto;
    max-height: 0;
}

.game--panel-mode .chat-box__input {
    border-radius: 0 0 4px 4px;
    font-size: 16px; /* prevents iOS zoom on focus */
}

.game--panel-mode .chat-box--focused .chat-box__input {
    padding: 6px 8px;
}

/* ==========================================================================
   Exterior Game Shell
   ========================================================================== */

.game-shell-active #game-container {
    position: relative;
    width: 100%;
    height: 100%;
    margin-top: 0;
    overflow: hidden;
}

.game-shell-active #game-container > canvas {
    margin: 0 !important;
}

.game-shell {
    --shell-gold: #ffd84a;
    --shell-border: #5e5134;
    --shell-bg: #15120b;
    --shell-panel: #070807;
    --shell-panel-2: #181611;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 312px;
    gap: 5px;
    width: 100vw;
    height: 100vh;
    margin-top: 0;
    padding: 5px;
    overflow: hidden;
    background:
        linear-gradient(180deg, #252318, #14140f 42%, #0b0c0a);
    color: #eee4c3;
    font-family: Arial, Helvetica, sans-serif;
}

.game-shell__left {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: 34px minmax(0, 1fr);
    gap: 6px;
}

.game-shell__map-header,
.game-shell__side {
    border: 1px solid var(--shell-border);
    background:
        linear-gradient(180deg, rgba(24, 22, 15, 0.96), rgba(6, 7, 5, 0.96));
    box-shadow:
        var(--ui-shadow-inset-highlight),
        var(--ui-shadow-quiet);
}

.game-shell__map-header {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.game-shell__map-title {
    max-width: 100%;
    padding: 0 16px;
    color: var(--shell-gold);
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    text-shadow: 0 2px 0 #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-shell__map-pane {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 2px solid #211c12;
    background: #1d2112 url("/assets/ui/map_gutter_forest.png") repeat;
    image-rendering: pixelated;
}

.interaction-panel {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 19;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-width: 178px;
    max-width: min(286px, calc(100% - 18px));
    min-height: 46px;
    padding: 6px 8px;
    border: 1px solid rgba(255, 216, 74, 0.48);
    border-radius: 5px;
    background: rgba(7, 8, 5, 0.88);
    color: #f7efd8;
    box-shadow:
        var(--ui-shadow-float),
        var(--ui-shadow-inset-highlight);
    pointer-events: auto;
    user-select: none;
    will-change: transform;
}

.interaction-panel[hidden] {
    display: none;
}

.interaction-panel--hostile {
    border-color: rgba(222, 74, 62, 0.58);
}

.interaction-panel--resource {
    border-color: rgba(123, 200, 108, 0.54);
}

.interaction-panel__avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 216, 74, 0.35);
    border-radius: 4px;
    background: rgba(20, 17, 10, 0.94);
    color: #ffd84a;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    overflow: hidden;
}

.interaction-panel__avatar--npc {
    place-items: end center;
}

.interaction-panel__avatar--hostile,
.interaction-panel__avatar--combat {
    border-color: rgba(222, 74, 62, 0.5);
    background: rgba(38, 12, 10, 0.92);
    color: #ffb1a7;
}

.interaction-panel__avatar--resource {
    border-color: rgba(123, 200, 108, 0.52);
    background: rgba(16, 35, 18, 0.9);
    color: #bff0a9;
}

.interaction-panel__portrait {
    min-height: 0;
    width: 32px;
    height: 48px;
    border: 0;
    background: transparent;
    overflow: visible;
    transform: scale(0.68);
    transform-origin: center bottom;
}

.interaction-panel__portrait .interaction-portrait__sprite {
    margin-bottom: 0;
    transform: none;
}

.interaction-panel__content {
    min-width: 0;
}

.interaction-panel__title {
    color: #ffd84a;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.interaction-panel__meta {
    margin-top: 2px;
    color: #d8d0b4;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.1;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.interaction-panel__status,
.interaction-panel__detail {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.interaction-panel__status {
    color: #d8d0b4;
}

.interaction-panel__status--pursuing,
.interaction-panel__status--repositioning {
    color: #ffe08a;
}

.interaction-panel__status--attacking {
    color: #ffb1a7;
}

.interaction-panel__status--blocked {
    color: #ff8888;
}

.interaction-panel__status--auto {
    flex: 0 0 auto;
    padding: 1px 4px;
    border: 1px solid rgba(255, 216, 74, 0.34);
    border-radius: 3px;
    color: #ffd84a;
    background: rgba(255, 216, 74, 0.08);
    font-size: 10px;
    line-height: 1.1;
}

.interaction-panel__detail {
    color: #b8ad91;
}

.interaction-panel--hostile .interaction-panel__title {
    color: #ffcabf;
}

.interaction-panel--resource .interaction-panel__title {
    color: #bff0a9;
}

.interaction-panel__hp {
    margin-top: 5px;
}

.interaction-panel__hp-track {
    height: 5px;
    border: 1px solid rgba(0, 0, 0, 0.82);
    background: rgba(45, 22, 20, 0.92);
    overflow: hidden;
}

.interaction-panel__hp-fill {
    width: 100%;
    height: 100%;
    background: #ff6b5d;
    transform: scaleX(1);
    transform-origin: left center;
    transition: transform 0.16s ease;
}

.interaction-panel__hp-text {
    margin-top: 2px;
    color: #c9b8a6;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

.interaction-panel__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.interaction-panel__action {
    min-width: 54px;
    height: 30px;
    padding: 0 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.interaction-panel__action:disabled {
    opacity: 0.52;
    cursor: default;
}

.tutorial-objective {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 20;
    width: min(286px, calc(100% - 20px));
    min-height: 0;
    padding: 7px 9px 8px;
    border: 1px solid rgba(255, 216, 74, 0.34);
    border-radius: 5px;
    background: rgba(5, 6, 4, 0.78);
    color: #f3ead0;
    text-shadow: 0 1px 2px #000;
    box-shadow: var(--ui-shadow-float);
    pointer-events: auto;
}

.tutorial-objective[hidden] {
    display: none;
}

.tutorial-objective__topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tutorial-objective__label {
    color: #c9a94d;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.tutorial-objective__toggle {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border: 1px solid rgba(255, 216, 74, 0.36);
    border-radius: 3px;
    background: rgba(18, 17, 12, 0.92);
    color: #ffd84a;
    font-size: 15px;
    font-weight: 900;
    line-height: 18px;
    cursor: pointer;
}

.tutorial-objective__toggle:hover {
    background: rgba(42, 35, 18, 0.96);
}

.tutorial-objective__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    margin-top: 2px;
}

.tutorial-objective__title {
    color: #ffd84a;
    font-size: 12px;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tutorial-objective__step {
    margin-top: 4px;
    color: #f2ead3;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
}

.tutorial-objective__details {
    display: none;
}

.tutorial-objective--expanded .tutorial-objective__details {
    display: block;
}

.tutorial-objective__hint {
    margin-top: 4px;
    color: #cbd9aa;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.tutorial-objective__progress {
    min-width: 42px;
    color: #b7e18d;
    font-size: 12px;
    font-weight: 900;
    text-align: right;
}

.tutorial-objective__track {
    height: 7px;
    margin-top: 8px;
    border: 1px solid rgba(0, 0, 0, 0.82);
    background: rgba(45, 39, 23, 0.9);
    overflow: hidden;
}

.tutorial-objective__fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #75d96a, #ffd84a);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.18s ease;
}

.quest-guidance-layer {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
}

.quest-guidance-marker {
    position: absolute;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    will-change: transform;
    filter: none;
    pointer-events: none;
}

.quest-guidance-marker__icon {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border: 2px solid #0c0a05;
    border-radius: 50%;
    background: #ffd84a;
    color: #191309;
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    text-shadow: none;
    animation: none;
}

.quest-guidance-marker--resource {
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.quest-guidance-marker--resource .quest-guidance-marker__icon {
    inset: 7px;
    border-color: rgba(12, 10, 5, 0.92);
    background: radial-gradient(circle at 50% 50%, #ffe887 0 35%, #7bc86c 42% 100%);
    box-shadow:
        0 0 0 2px rgba(12, 10, 5, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.game-shell__map-modal-layer {
    position: absolute;
    inset: 0;
    z-index: 34;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    pointer-events: auto;
}

.game-shell__map-modal-layer--active {
    display: flex;
}

.game-shell__map-modal-layer[hidden] {
    display: none;
}

.game-shell__map-modal-layer--world-click-through {
    pointer-events: none;
}

.game-shell__map-modal-layer--world-click-through .game-shell__map-modal-positioner {
    pointer-events: auto;
}

.game-shell__map-modal-backdrop {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.44));
}

.game-shell__map-modal-positioner {
    position: relative;
    z-index: 1;
    display: flex;
    max-width: min(760px, calc(100% - 24px));
    max-height: calc(100% - 24px);
    min-width: min(360px, calc(100% - 24px));
    outline: none;
}

.game-shell__map-modal-body {
    width: 100%;
    max-height: 100%;
    overflow: auto;
}

.game-shell__map-modal-layer--bottom {
    align-items: flex-end;
    padding-bottom: 24px;
}

.game-shell__map-modal-layer--bottom .game-shell__map-modal-positioner {
    width: min(760px, calc(100% - 24px));
    max-width: min(760px, calc(100% - 24px));
}

.game-shell__chat {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 24;
    width: min(440px, calc(100% - 24px));
    max-height: min(42%, 260px);
    min-width: 0;
    min-height: 0;
    overflow: visible;
    pointer-events: none;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.game-shell__chat-resize {
    display: none;
}

.game-shell__chat-toggle {
    display: none;
}

.game-shell__chat--collapsed .chat-box__messages {
    display: none;
}

.game-shell__chat--collapsed .game-shell__chat-resize {
    cursor: default;
}

.game-shell__dialogue-mount {
    min-width: 0;
}

.game-shell__chat-mount {
    min-width: 0;
    min-height: 0;
}

.game-shell__touch-controls {
    display: none;
}

.game-shell__dpad,
.game-shell__touch-action {
    pointer-events: auto;
    touch-action: none;
}

.game-shell__dpad-btn,
.game-shell__touch-action {
    border: 1px solid rgba(255, 216, 74, 0.42);
    border-radius: 5px;
    background: linear-gradient(180deg, rgba(44, 38, 24, 0.94), rgba(11, 11, 8, 0.94));
    color: #ffd84a;
    font-weight: 900;
    text-shadow: 0 1px 0 #000;
    box-shadow:
        var(--ui-shadow-control),
        var(--ui-shadow-inset-highlight);
}

.game-shell__side {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    overflow: hidden;
}

.game-shell__status {
    padding: 7px;
    border-bottom: 1px solid rgba(255, 216, 74, 0.18);
}

.game-shell__vitals {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.game-shell__vitals-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}

.game-shell__vitals-name {
    min-width: 0;
    color: var(--shell-gold);
    font-size: 15px;
    font-weight: 800;
    text-shadow: 0 1px 0 #000;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-shell__vitals-level {
    flex: 0 0 auto;
    color: #d0bc75;
    font-size: 12px;
    font-weight: 700;
}

.game-shell__vitals-class {
    margin-left: auto;
    color: #9fc08f;
    font-size: 11px;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-shell__admin-button {
    flex: 0 0 auto;
    height: 22px;
    padding: 0 8px;
    border: 1px solid rgba(255, 216, 74, 0.36);
    border-radius: 3px;
    background: linear-gradient(180deg, #26384f, #152232);
    color: #e5f0ff;
    font-size: 10px;
    font-weight: 800;
    line-height: 20px;
    cursor: pointer;
    text-shadow: 0 1px 0 #000;
}

.game-shell__admin-button:hover,
.game-shell__admin-button--active {
    border-color: #8bb8ff;
    background: linear-gradient(180deg, #36577d, #1e334e);
}

.game-shell__vitals-meter {
    position: relative;
    height: 15px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #050505;
}

.game-shell__vitals-meter > div {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    transition: width 0.18s ease;
}

.game-shell__vitals-meter--hp > div {
    background: linear-gradient(180deg, #f04444, #9d1717);
}

.game-shell__vitals-meter--mp > div {
    background: linear-gradient(180deg, #3f82df, #1b4f9c);
}

.game-shell__vitals-meter--exp > div {
    background: linear-gradient(180deg, #d6be5d, #8d7524);
}

.game-shell__vitals-meter > span,
.game-shell__vitals-meter > strong {
    position: absolute;
    top: 0;
    z-index: 1;
    color: #fff;
    font-size: 11px;
    line-height: 13px;
    text-shadow: 0 1px 1px #000;
}

.game-shell__vitals-meter > span {
    left: 5px;
    font-weight: 800;
}

.game-shell__vitals-meter > strong {
    right: 5px;
}

.game-shell__status-line {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 22px;
    margin-top: 6px;
}

.game-shell__controls {
    display: flex;
    gap: 5px;
    justify-content: flex-end;
    margin-top: 6px;
}

.game-shell__combat-mount {
    margin-top: 6px;
}

.game-shell__combat-mount:empty {
    display: none;
}

.game-shell__control-btn {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 216, 74, 0.34);
    border-radius: 3px;
    background: linear-gradient(180deg, #282317, #11100b);
    color: var(--shell-gold);
    font-size: 15px;
    font-weight: 800;
    line-height: 24px;
    cursor: pointer;
    text-shadow: 0 1px 0 #000;
}

.game-shell__control-btn:hover,
.game-shell__control-btn[aria-pressed="true"] {
    border-color: var(--shell-gold);
    background: linear-gradient(180deg, #3a321d, #181409);
}

.game-shell__control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.game-shell__utility {
    min-height: 0;
    max-height: 38vh;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 216, 74, 0.2);
    background: rgba(0, 0, 0, 0.32);
}

.game-shell__utility[hidden] {
    display: none;
}

.game-shell__utility-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 30px;
    padding: 0 8px;
    border-bottom: 1px solid rgba(255, 216, 74, 0.18);
}

.game-shell__utility-title {
    min-width: 0;
    color: var(--shell-gold);
    font-size: 13px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-shell__utility-close {
    width: 23px;
    height: 23px;
    border: 1px solid #705252;
    border-radius: 3px;
    background: #3b2b2b;
    color: #ffb2a8;
    cursor: pointer;
}

.game-shell__utility-mount {
    max-height: calc(38vh - 31px);
    overflow-y: auto;
    padding: 6px;
}

.game-shell__tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    padding: 2px;
    border-bottom: 1px solid rgba(255, 216, 74, 0.18);
    background: #060604;
}

.game-shell__tab {
    min-width: 0;
    min-height: 42px;
    padding: 3px 2px 4px;
    border: 1px solid #3d3524;
    background: linear-gradient(180deg, #282317, #11100b);
    color: #b9ad8e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-weight: 800;
    cursor: pointer;
    text-shadow: 0 1px 0 #000;
}

.game-shell__tab-icon {
    position: relative;
    display: block;
    width: 22px;
    height: 21px;
    flex: 0 0 21px;
    font-size: 16px;
    line-height: 1;
}

.game-shell__tab-icon--skills {
    width: auto;
    height: auto;
}

.game-shell__tab-icon--backpack {
    width: 21px;
    height: 22px;
    border: 0;
    background: none;
}

.game-shell__tab-icon--backpack::before {
    content: '';
    position: absolute;
    left: 6px;
    right: 6px;
    top: 1px;
    height: 7px;
    border: 2px solid currentColor;
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
}

.game-shell__tab-icon--backpack::after {
    content: '';
    position: absolute;
    left: 2px;
    right: 2px;
    bottom: 1px;
    height: 15px;
    border: 2px solid currentColor;
    border-radius: 3px 3px 5px 5px;
    background: linear-gradient(180deg, rgba(255, 216, 74, 0.28), rgba(128, 84, 32, 0.3));
    box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.16);
}

.game-shell__tab-icon--book {
    width: 23px;
    height: 22px;
}

.game-shell__tab-icon--book::before,
.game-shell__tab-icon--book::after {
    content: '';
    position: absolute;
    top: 3px;
    width: 10px;
    height: 15px;
    border: 2px solid currentColor;
    background: linear-gradient(180deg, rgba(255, 216, 74, 0.2), rgba(255, 255, 255, 0.04));
}

.game-shell__tab-icon--book::before {
    left: 1px;
    border-radius: 3px 1px 1px 3px;
    transform: skewY(-7deg);
}

.game-shell__tab-icon--book::after {
    right: 1px;
    border-radius: 1px 3px 3px 1px;
    transform: skewY(7deg);
}

.game-shell__tab-icon--person {
    width: 21px;
    height: 22px;
}

.game-shell__tab-icon--person::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 1px;
    width: 7px;
    height: 7px;
    border: 2px solid currentColor;
    border-radius: 50%;
    background: rgba(255, 216, 74, 0.22);
}

.game-shell__tab-icon--person::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 10px;
    width: 13px;
    height: 10px;
    border: 2px solid currentColor;
    border-top-width: 3px;
    border-radius: 5px 5px 2px 2px;
    box-shadow:
        -5px 4px 0 -3px currentColor,
        5px 4px 0 -3px currentColor;
    background: rgba(255, 216, 74, 0.18);
}

.game-shell__tab-text {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: inherit;
    font-size: 10px;
    line-height: 1.05;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-shell__tab:hover,
.game-shell__tab--active {
    border-color: var(--shell-gold);
    color: var(--shell-gold);
    background: linear-gradient(180deg, #3a321d, #181409);
}

.game-shell__tab--attention:not(.game-shell__tab--active) {
    border-color: #ffd84a;
    color: #ffd84a;
    animation: tabAttentionPulse 1.25s ease-in-out infinite;
}

@keyframes tabAttentionPulse {
    0%, 100% {
        box-shadow: inset 0 0 0 0 rgba(255, 216, 74, 0.18), 0 0 0 rgba(255, 216, 74, 0);
    }
    50% {
        box-shadow: inset 0 0 0 1px rgba(255, 216, 74, 0.52), 0 0 10px rgba(255, 216, 74, 0.28);
    }
}

.game-shell__tab-panels {
    min-height: 0;
    overflow: hidden;
}

.game-shell__tab-panel {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
}

.game-shell__tab-panel[hidden] {
    display: none;
}

.game-shell__empty {
    padding: 14px 10px;
    color: #9e967f;
    font-size: 13px;
    text-align: center;
}

.quest-log-entry {
    margin: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 216, 74, 0.24);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.34);
}

.quest-log-entry__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: start;
}

.quest-log-entry__title {
    color: var(--shell-gold);
    font-size: 13px;
    font-weight: 900;
    line-height: 1.25;
}

.quest-log-entry__state {
    min-height: 22px;
    padding: 2px 7px;
    border: 1px solid rgba(255, 216, 74, 0.38);
    border-radius: 3px;
    color: #efe1a4;
    background: rgba(255, 216, 74, 0.08);
    font-size: 11px;
    font-weight: 900;
    line-height: 16px;
}

.quest-log-entry__description {
    margin-top: 7px;
    color: #aaa28a;
    font-size: 12px;
    line-height: 1.32;
}

.quest-log-entry__current {
    display: grid;
    gap: 5px;
    margin-top: 9px;
    padding: 8px;
    border: 1px solid rgba(183, 225, 141, 0.22);
    border-radius: 5px;
    background: rgba(88, 120, 54, 0.13);
}

.quest-log-entry__current--active {
    border-color: rgba(183, 225, 141, 0.34);
    background: rgba(88, 120, 54, 0.2);
}

.quest-log-entry__current-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #a9c58b;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.quest-log-entry__count,
.quest-log-entry__progress {
    color: #b7e18d;
    font-size: 11px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.quest-log-entry__current-text {
    color: #f2ead3;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.28;
}

.quest-log-entry__hint {
    color: #aaa28a;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
}

.quest-log-entry__objectives {
    display: grid;
    gap: 5px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.quest-log-entry__objective {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: start;
    min-height: 24px;
    padding: 5px 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #cfc6aa;
    font-size: 12px;
    line-height: 1.25;
}

.quest-log-entry__objective--current {
    border-color: rgba(183, 225, 141, 0.28);
    background: rgba(88, 120, 54, 0.18);
    color: #f2ead3;
}

.quest-log-entry__objective--done {
    color: #8da77a;
}

.quest-log-entry__objective strong {
    color: #b7e18d;
    font-size: 11px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.quest-log-entry__rewards {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.quest-log-entry__reward {
    min-height: 24px;
    padding: 4px 7px;
    border: 1px solid rgba(255, 216, 74, 0.18);
    border-radius: 3px;
    color: #d8cda8;
    background: rgba(0, 0, 0, 0.24);
    font-size: 11px;
    font-weight: 800;
}

.game-shell__drawer-scrim {
    display: none;
}

.game-shell--play-hidden {
    grid-template-columns: 1fr;
}

.game-shell--play-hidden .game-shell__left {
    grid-template-rows: minmax(0, 1fr);
}

.game-shell--play-hidden .game-shell__map-header,
.game-shell--play-hidden .game-shell__side {
    display: none;
}

.game-shell:fullscreen {
    width: 100vw;
    height: 100vh;
    margin-top: 0;
}

.game-shell .ping-overlay {
    position: static;
    inset: auto;
    display: flex;
    width: 100%;
    justify-content: flex-end;
    gap: 8px;
    padding: 0;
    background: transparent;
    border-radius: 0;
    font-size: 11px;
    z-index: auto;
}

.game-shell .auto-battle-toggle {
    position: static;
    min-width: 128px;
    height: 28px;
    line-height: 26px;
    z-index: auto;
}

.game-shell .hud-dom {
    position: static;
    transform: none !important;
    pointer-events: auto;
}

.game-shell .hud-panel {
    width: auto;
    max-width: none;
    margin: 0;
    border-width: 1px;
    border-radius: 0;
}

.game-shell__combat-mount .hud-panel {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.game-shell__combat-mount .hud-panel::before,
.game-shell__combat-mount .hud-panel__header,
.game-shell__combat-mount .hud-panel__meters {
    display: none;
}

.game-shell__combat-mount .hud-combat {
    margin-top: 0;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 216, 74, 0.18);
}

.game-shell__combat-mount .hud-effects {
    margin-top: 6px;
}

.game-shell .chat-box {
    position: static;
    display: block;
    width: 100%;
    height: auto;
    z-index: auto;
    opacity: 1;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.game-shell .chat-box--focused {
    pointer-events: auto;
}

.game-shell .chat-box__filters {
    display: none;
    gap: 1px;
    border: 1px solid rgba(255, 216, 74, 0.22);
    border-bottom: 0;
    background: rgba(7, 7, 5, 0.84);
}

.game-shell .chat-box--focused .chat-box__filters {
    display: flex;
}

.game-shell .chat-box__filter {
    flex: 1;
    min-height: 24px;
    border: 0;
    border-right: 1px solid rgba(255, 216, 74, 0.14);
    background: #16140f;
    color: #aaa08a;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.game-shell .chat-box__filter:last-child {
    padding-right: 0;
}

.game-shell .chat-box__filter--active {
    color: var(--shell-gold);
    background: #252017;
}

.game-shell .chat-box__messages {
    min-height: 0;
    max-height: 128px;
    overflow-y: hidden;
    border: 1px solid rgba(255, 216, 74, 0.14);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.18);
    opacity: 0.92;
    padding: 6px 8px;
    font-size: 12px;
    pointer-events: none;
}

.game-shell .chat-box:not(.chat-box--focused):not(.chat-box--has-passive-messages) .chat-box__messages,
.game-shell .chat-box:not(.chat-box--focused) .chat-box__messages:empty {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-color: transparent;
    background: transparent;
    opacity: 0;
}

.game-shell .chat-box--focused .chat-box__messages {
    max-height: min(220px, 34vh);
    overflow-y: auto;
    border-radius: 0;
    border-color: rgba(255, 216, 74, 0.28);
    background: rgba(5, 6, 4, 0.86);
    opacity: 1;
    pointer-events: auto;
}

.game-shell .chat-box--focused .chat-box__input {
    width: 100%;
    max-height: 34px;
    min-height: 32px;
    padding: 6px 9px;
    border: 1px solid rgba(255, 216, 74, 0.36);
    border-top-width: 0;
    border-radius: 0 0 4px 4px;
    background: rgba(7, 7, 5, 0.92);
    opacity: 1;
    pointer-events: auto;
    font-size: 14px;
}

.game-shell .inventory-panel,
.game-shell .skills-panel,
.game-shell .party-panel,
.game-shell .admin-menu {
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: none;
    z-index: auto;
    border-radius: 0;
    box-shadow: none;
}

.game-shell .inventory-panel,
.game-shell .skills-panel {
    border: 0;
    background: transparent;
    padding: 8px;
}

.game-shell .inventory-panel {
    position: relative;
}

.game-shell .inventory-panel__title-bar,
.game-shell .skills-panel__title-bar {
    display: none;
}

.game-shell .inventory-panel__grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
}

.game-shell .inventory-panel__slot {
    min-height: 52px;
    padding: 3px 2px 2px;
    gap: 1px;
}

.game-shell .inventory-panel__item-icon,
.game-shell .inventory-panel__item-fallback {
    width: 30px;
    height: 30px;
}

.game-shell .inventory-panel__item-icon {
    margin: 0;
}

.inventory-panel__item-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(255, 216, 74, 0.38);
    border-radius: 3px;
    background: #2b2819;
    color: #f5df83;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1;
}

.game-shell .inventory-panel__eq-icon {
    position: relative;
    display: block;
    width: 30px;
    height: 30px;
    margin: 1px auto 0;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    image-rendering: pixelated;
    color: #f5df83;
    font-size: 11px;
    line-height: 30px;
    text-align: center;
}

.game-shell .inventory-panel__eq-icon[data-qty]:not([data-qty=""])::after {
    content: attr(data-qty);
    position: absolute;
    right: 4px;
    bottom: 2px;
    color: var(--shell-gold);
    font-size: 10px;
    font-weight: 800;
    text-shadow: 0 1px 0 #000;
}

.game-shell .inventory-panel__eq-slot {
    min-height: 48px;
}

.game-shell .inventory-panel__stats {
    flex-wrap: wrap;
    gap: 6px;
}

.game-shell .party-panel,
.game-shell .admin-menu {
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 216, 74, 0.22);
}

.game-shell .admin-menu--modal {
    width: min(420px, 100%);
    max-width: 420px;
    margin: 0 auto;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.92);
    box-shadow: var(--ui-shadow-modal);
}

.quest-offer-dialog {
    background: rgba(7, 8, 7, 0.95);
    border: 1px solid rgba(255, 216, 74, 0.38);
    border-radius: 6px;
    padding: 12px;
    color: #eee4c3;
    font-family: Arial, Helvetica, sans-serif;
    z-index: 10000;
    box-shadow:
        var(--ui-shadow-panel),
        var(--ui-shadow-inset-highlight);
}

.quest-offer-dialog__title {
    margin: 0;
    color: #ffd84a;
    text-align: center;
}

.quest-offer-dialog__subtitle {
    margin: 3px 0 12px;
    color: #9f967b;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.quest-offer-dialog__body {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
}

.quest-offer-dialog__portrait {
    min-height: 112px;
}

.quest-offer-dialog__quests {
    min-width: 0;
    display: grid;
    gap: 8px;
}

.quest-offer-dialog__card {
    border: 1px solid rgba(255, 216, 74, 0.22);
    border-radius: 4px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.22);
}

.quest-offer-dialog__quest-title {
    font-weight: bold;
    color: #ffcc44;
    margin-bottom: 4px;
}

.quest-offer-dialog__description {
    font-size: 12px;
    color: #c7bea0;
    margin-bottom: 6px;
    line-height: 1.35;
}

.quest-offer-dialog__objectives {
    font-size: 11px;
    margin-bottom: 4px;
}

.quest-offer-dialog__objective {
    line-height: 1.35;
}

.quest-offer-dialog__rewards {
    font-size: 11px;
    color: #88ff88;
    margin-bottom: 6px;
}

.quest-offer-dialog__action,
.quest-offer-dialog__close {
    cursor: pointer;
}

.quest-offer-dialog__action {
    margin-right: 4px;
}

.quest-offer-dialog__action--accept {
    background: #2c341c;
}

.quest-offer-dialog__action--complete {
    background: #2c341c;
}

.quest-offer-dialog__close {
    width: 100%;
    margin-top: 12px;
}

.quest-offer-dialog:not(.quest-offer-dialog--modal) {
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 320px;
    width: min(680px, 94vw);
    max-width: 680px;
    transform: translate(-50%, -50%);
}

@media (max-width: 620px) {
    .quest-offer-dialog__body {
        grid-template-columns: 1fr;
    }

    .quest-offer-dialog__portrait {
        display: none;
    }
}

.game-shell__map-modal-body .shop-window,
.game-shell__map-modal-body .crafting-window,
.game-shell__map-modal-body .bank-window,
.game-shell__map-modal-body .trade-window,
.game-shell__map-modal-body .dialogue-panel,
.game-shell__map-modal-body .trade-request,
.game-shell__map-modal-body .party-invite,
.game-shell__map-modal-body .quest-offer-dialog {
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: none;
    margin: 0;
    z-index: auto;
    box-shadow:
        var(--ui-shadow-modal),
        var(--ui-shadow-inset-highlight);
}

.game-shell__map-modal-body .shop-window,
.game-shell__map-modal-body .crafting-window,
.game-shell__map-modal-body .bank-window,
.game-shell__map-modal-body .trade-window {
    background: rgba(0, 0, 0, 0.93);
    border: 1px solid rgba(255, 216, 74, 0.38);
    border-radius: 6px;
}

.game-shell__map-modal-body .shop-window__title-bar,
.game-shell__map-modal-body .bank-window__title-bar,
.game-shell__map-modal-body .trade-window__title-bar,
.game-shell__map-modal-body .dialogue-panel__title-bar {
    cursor: default;
}

.game-shell__map-modal-body .shop-window__grid,
.game-shell__map-modal-body .bank-window__grid {
    max-height: min(360px, 48vh);
}

.game-shell__map-modal-body .shop-window__item {
    align-items: center;
}

.game-shell__map-modal-body .shop-window__exchange-actions {
    min-width: 78px;
}

.game-shell__map-modal-body .dialogue-panel {
    background: rgba(7, 8, 7, 0.94);
    border: 2px solid rgba(255, 216, 74, 0.72);
    border-radius: 6px;
}

.game-shell__map-modal-body .trade-request,
.game-shell__map-modal-body .party-invite {
    background: transparent;
    border: 0;
}

.game-shell .admin-menu__title-bar {
    cursor: default;
}

@media (max-width: 900px) {
    .game-shell {
        grid-template-columns: minmax(0, 1fr);
        padding-right: 52px;
    }

    .game-shell__side {
        position: fixed;
        top: 56px;
        right: 0;
        bottom: 0;
        z-index: 45;
        width: min(340px, 88vw);
        transform: translateX(calc(100% - 64px));
        transition: transform 0.18s ease;
    }

    .game-shell--drawer-open .game-shell__side {
        transform: translateX(0);
    }

    .game-shell__tabs {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 64px;
        display: flex;
        flex-direction: column;
        padding: 4px;
        border-right: 1px solid rgba(255, 216, 74, 0.18);
        border-bottom: 0;
    }

    .game-shell__tab {
        min-height: 52px;
        padding: 0 2px;
    }

    .game-shell__status,
    .game-shell__utility,
    .game-shell__tab-panels {
        margin-left: 64px;
    }

    .game-shell__drawer-scrim {
        position: fixed;
        inset: 56px 0 0 0;
        display: none;
        z-index: 44;
        border: 0;
        background: rgba(0, 0, 0, 0.35);
    }

    .game-shell--drawer-open .game-shell__drawer-scrim {
        display: block;
    }
}

@media (max-width: 680px) {
    .game-shell {
        gap: 4px;
        padding: 4px 4px 70px;
    }

    .game-shell__left {
        grid-template-rows: 30px minmax(0, 1fr);
        gap: 4px;
    }

    .game-shell__map-title {
        font-size: 15px;
    }

    .game-shell__side {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: min(62vh, 430px);
        transform: translateY(calc(100% - 62px));
        border-width: 1px 0 0;
        box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.38);
    }

    .game-shell--drawer-open .game-shell__side {
        transform: translateY(0);
    }

    .game-shell__tabs {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
        width: auto;
        height: 62px;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 1px;
        padding: 4px;
        border-top: 1px solid rgba(255, 216, 74, 0.2);
        border-right: 0;
        background: rgba(6, 6, 4, 0.96);
    }

    .game-shell__tab {
        min-height: 54px;
        padding: 4px 2px;
    }

    .game-shell__tab-text {
        font-size: 10px;
        text-overflow: clip;
    }

    .game-shell__status,
    .game-shell__utility {
        display: none;
    }

    .game-shell__tab-panels {
        position: absolute;
        top: 62px;
        left: 0;
        right: 0;
        bottom: 0;
        margin-left: 0;
        border-bottom: 1px solid rgba(255, 216, 74, 0.18);
        background: rgba(7, 8, 5, 0.98);
        opacity: 1;
        overflow: hidden;
    }

    .game-shell:not(.game-shell--drawer-open) .game-shell__tab-panels {
        opacity: 0;
        pointer-events: none;
    }

    .game-shell__tab-panel {
        padding-bottom: 10px;
    }

    .game-shell__drawer-scrim {
        inset: 0 0 62px;
    }

    .game-shell__chat {
        left: 8px;
        right: auto;
        bottom: 238px;
        width: min(320px, calc(100% - 16px));
        max-height: 128px;
    }

    .game-shell__chat-toggle {
        display: grid;
        place-items: center;
        width: 34px;
        height: 28px;
        margin-bottom: 3px;
        border: 1px solid rgba(255, 216, 74, 0.34);
        border-radius: 4px;
        background: rgba(8, 9, 6, 0.9);
        color: #ffd84a;
        font-size: 15px;
        font-weight: 900;
        pointer-events: auto;
    }

    .game-shell__chat--collapsed .chat-box__input,
    .game-shell__chat--collapsed .chat-box__filters {
        display: none;
    }

    .game-shell .chat-box__messages {
        max-height: 76px;
        font-size: 11px;
    }

    .game-shell .chat-box--focused .chat-box__input {
        min-height: 36px;
        font-size: 16px;
    }

    .game-shell__touch-controls {
        position: absolute;
        inset: auto 10px 82px 10px;
        z-index: 30;
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        gap: 12px;
        pointer-events: none;
    }

    .game-shell__dpad {
        display: grid;
        grid-template-columns: repeat(3, 48px);
        grid-template-rows: repeat(3, 48px);
        gap: 4px;
    }

    .game-shell__dpad-btn {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }

    .game-shell__dpad-btn--up {
        grid-column: 2;
        grid-row: 1;
    }

    .game-shell__dpad-btn--left {
        grid-column: 1;
        grid-row: 2;
    }

    .game-shell__dpad-btn--right {
        grid-column: 3;
        grid-row: 2;
    }

    .game-shell__dpad-btn--down {
        grid-column: 2;
        grid-row: 3;
    }

    .game-shell__touch-action {
        min-width: 96px;
        height: 52px;
        padding: 0 14px;
        font-size: 14px;
    }

    .game-shell__map-modal-layer {
        padding: 10px;
    }

    .game-shell__map-modal-positioner {
        min-width: 0;
        width: min(100%, 520px);
        max-width: 100%;
        max-height: min(78vh, calc(100% - 20px));
    }
}
