﻿:root {
    --bg: #111a29;
    --panel: rgba(14, 23, 38, 0.88);
    --panel-strong: rgba(10, 18, 32, 0.94);
    --line: #4f6f9f;
    --line-soft: #34507a;
    --text: #eaf2ff;
    --text-dim: #a7bddf;
    --accent: #f0c15f;
    --danger: #ff9090;
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top, #1f3556, #111a29 60%);
    color: var(--text);
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

.auth-body {
    min-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.auth-wrap {
    width: min(460px, 100%);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

input, select, button {
    border-radius: 10px;
    border: 1px solid #5f7caf;
    padding: 9px 11px;
    font-size: 13px;
    color: #fff;
}
input, select {
    background: #1a2842;
}
button {
    cursor: pointer;
    background: linear-gradient(180deg, #3e5f95 0%, #2a4369 100%);
    transition: transform 0.12s ease, filter 0.12s ease;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#gameRoot {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #101622;
    touch-action: none;
}

.hud-top, .hud-bottom {
    position: absolute;
    left: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    padding: 7px 9px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    z-index: 8;
    backdrop-filter: blur(2px);
}
.hud-top { top: 8px; }
.hud-bottom {
    bottom: 8px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.hud-help {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 56px;
    z-index: 8;
    font-size: 11px;
    color: var(--text-dim);
    pointer-events: none;
}

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

.quest-tracker {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 76px;
    z-index: 8;
    font-size: 12px;
    line-height: 1.35;
    padding: 6px 9px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: rgba(15, 25, 40, 0.78);
    color: #dceaff;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.35s ease;
}
.quest-tracker.idle { opacity: 0.35; }

.pickup-feed {
    position: absolute;
    right: 12px;
    top: 108px;
    z-index: 9;
    width: min(280px, 62vw);
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}
.pickup-msg {
    border: 1px solid #5d7aac;
    border-radius: 8px;
    background: rgba(12, 20, 34, 0.92);
    color: #dff0ff;
    font-size: 12px;
    padding: 6px 8px;
    animation: pickup-fade 2.2s ease forwards;
}
@keyframes pickup-fade {
    0% {opacity: 0; transform: translateY(4px);}
    15% {opacity: 1; transform: translateY(0);}
    80% {opacity: 1;}
    100% {opacity: 0; transform: translateY(-6px);}
}

.message-box {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 74px;
    z-index: 8;
    min-width: 220px;
    text-align: center;
    padding: 8px 14px;
    border-radius: 12px;
    border: 1px solid #526e9d;
    background: rgba(8, 16, 30, 0.82);
}

.map-transition {
    position: absolute;
    inset: 0;
    background: #000;
    opacity: 0;
    z-index: 11;
    pointer-events: none;
    transition: opacity 0.22s ease;
}
.map-transition.active { opacity: 0.52; }

.modal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}
.modal.hidden { display: none; }

.modal-panel {
    width: min(440px, 100%);
    background: linear-gradient(180deg, var(--panel) 0%, var(--panel-strong) 100%);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4);
}
.modal-panel h2 {
    margin: 0 0 12px;
    font-size: 20px;
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(116, 182, 255, 0.2);
}
.modal-wide { width: min(640px, 100%); }

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.field-label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: var(--text-dim);
}

.quest-text {
    margin: 0 0 12px;
    line-height: 1.55;
    color: #dce8fb;
}

#inventoryList {
    max-height: 300px;
    overflow: auto;
    margin-bottom: 12px;
    padding-right: 4px;
}
.panel-empty {
    margin: 10px 0;
    color: var(--text-dim);
}
.inventory-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(21, 34, 56, 0.6);
    margin-bottom: 7px;
}
.item-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.item-icon {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: rgba(102, 145, 207, 0.24);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.pixel-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    position: relative;
    border: 1px solid #6f8fc0;
    background: #1b2b44;
    image-rendering: pixelated;
    box-shadow: inset 0 0 0 1px rgba(8, 16, 31, 0.9);
    flex-shrink: 0;
}
.pixel-icon::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 2px;
    pointer-events: none;
    box-shadow: 0 0 0 0 transparent;
}
.icon-equip {
    background-color: #1b2b44;
    background:
        linear-gradient(#dce8ff, #dce8ff) 9px 2px/2px 11px no-repeat,
        linear-gradient(#dce8ff, #dce8ff) 6px 4px/8px 2px no-repeat,
        linear-gradient(#dce8ff, #dce8ff) 6px 12px/8px 2px no-repeat,
        linear-gradient(#8ea5cd, #8ea5cd) 8px 15px/4px 2px no-repeat;
}
.icon-card {
    background-color: #1b2b44;
    background:
        linear-gradient(#8c6bcb, #8c6bcb) 3px 3px/13px 13px no-repeat,
        linear-gradient(#e8ddff, #e8ddff) 6px 6px/7px 7px no-repeat,
        linear-gradient(#ffffff, #ffffff) 7px 7px/1px 5px no-repeat,
        linear-gradient(#ffffff, #ffffff) 8px 9px/3px 1px no-repeat;
}
.icon-consumable {
    background-color: #1b2b44;
    background:
        linear-gradient(#6fd4b0, #6fd4b0) 6px 2px/6px 3px no-repeat,
        linear-gradient(#6fd4b0, #6fd4b0) 5px 5px/8px 8px no-repeat,
        linear-gradient(#d9fff2, #d9fff2) 7px 8px/4px 3px no-repeat,
        linear-gradient(#7fbfef, #7fbfef) 6px 13px/6px 1px no-repeat;
}

/* Specific item icons (override type base) */
.icon-code-iron_sword {
    background:
        linear-gradient(#dfe9ff, #dfe9ff) 9px 2px/2px 12px no-repeat,
        linear-gradient(#dfe9ff, #dfe9ff) 6px 4px/8px 2px no-repeat,
        linear-gradient(#9db2d4, #9db2d4) 7px 13px/6px 2px no-repeat,
        linear-gradient(#6f86ab, #6f86ab) 8px 15px/4px 2px no-repeat,
        linear-gradient(#1b2b44, #1b2b44) 0 0/100% 100% no-repeat;
}

.icon-code-star_blade {
    background:
        linear-gradient(#ffe29f, #ffe29f) 9px 2px/2px 12px no-repeat,
        linear-gradient(#ffe29f, #ffe29f) 6px 4px/8px 2px no-repeat,
        linear-gradient(#ffcf6b, #ffcf6b) 7px 13px/6px 2px no-repeat,
        radial-gradient(circle at 15px 4px, #fff7c8 0 2px, transparent 3px),
        linear-gradient(#1b2b44, #1b2b44) 0 0/100% 100% no-repeat;
}

.icon-code-leather_armor {
    background:
        linear-gradient(#a27b52, #a27b52) 5px 4px/10px 10px no-repeat,
        linear-gradient(#805f40, #805f40) 7px 6px/2px 8px no-repeat,
        linear-gradient(#805f40, #805f40) 11px 6px/2px 8px no-repeat,
        linear-gradient(#1b2b44, #1b2b44) 0 0/100% 100% no-repeat;
}

.icon-code-shadow_manteau {
    background:
        linear-gradient(#6c5a8c, #6c5a8c) 4px 3px/12px 11px no-repeat,
        linear-gradient(#a895d1, #a895d1) 6px 5px/8px 2px no-repeat,
        linear-gradient(#1b2b44, #1b2b44) 0 0/100% 100% no-repeat;
}

.icon-code-potion_small {
    background:
        linear-gradient(#de6f7b, #de6f7b) 6px 3px/8px 10px no-repeat,
        linear-gradient(#ffe2e7, #ffe2e7) 8px 2px/4px 2px no-repeat,
        linear-gradient(#a8d7ff, #a8d7ff) 7px 9px/6px 3px no-repeat,
        linear-gradient(#1b2b44, #1b2b44) 0 0/100% 100% no-repeat;
}

.icon-code-town_scroll {
    background:
        linear-gradient(#ead9a8, #ead9a8) 5px 4px/10px 10px no-repeat,
        linear-gradient(#b39555, #b39555) 5px 4px/2px 10px no-repeat,
        linear-gradient(#b39555, #b39555) 13px 4px/2px 10px no-repeat,
        linear-gradient(#6aa2d7, #6aa2d7) 8px 7px/4px 4px no-repeat,
        linear-gradient(#1b2b44, #1b2b44) 0 0/100% 100% no-repeat;
}

.icon-code-card_poring,
.icon-code-card_lunatic,
.icon-code-card_fabre,
.icon-code-card_harpy,
.icon-code-card_baphomet {
    background:
        linear-gradient(#7e67bf, #7e67bf) 3px 3px/13px 13px no-repeat,
        linear-gradient(#efe8ff, #efe8ff) 6px 6px/7px 7px no-repeat,
        linear-gradient(#ffffff, #ffffff) 8px 8px/3px 3px no-repeat,
        linear-gradient(#1b2b44, #1b2b44) 0 0/100% 100% no-repeat;
}

.icon-code-card_baphomet {
    background:
        linear-gradient(#9f4fe0, #9f4fe0) 3px 3px/13px 13px no-repeat,
        linear-gradient(#f3dcff, #f3dcff) 6px 6px/7px 7px no-repeat,
        linear-gradient(#ffffff, #ffffff) 8px 8px/3px 3px no-repeat,
        linear-gradient(#1b2b44, #1b2b44) 0 0/100% 100% no-repeat;
}
.item-meta {
    display: inline-flex;
    flex-direction: column;
    min-width: 0;
}
.item-meta strong {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.item-side {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.item-count {
    color: #ffd57a;
    font-weight: 600;
}
.card-actions-inline {
    display: inline-flex;
    gap: 4px;
}

.quality-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 11px;
    line-height: 1.1;
}

.equip-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.equip-slot {
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    padding: 10px;
    font-size: 13px;
    background: rgba(22, 36, 58, 0.62);
}
.slot-title {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.slot-main { line-height: 1.45; }
.equip-actions {
    margin-top: 7px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.socket-hint {
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.6;
}
.socket-pair {
    display: inline-flex;
    gap: 4px;
    margin-right: 6px;
    margin-bottom: 4px;
}

.stat-block {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 12px;
    font-size: 13px;
}
.stat-head {
    padding: 8px 10px;
    border: 1px solid var(--line-soft);
    border-radius: 9px;
    background: rgba(20, 34, 55, 0.62);
}
.stat-sub { margin-top: -2px; }
.stat-line {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line-soft);
    border-radius: 9px;
    padding: 7px 9px;
    background: rgba(17, 30, 49, 0.55);
}
.stat-name { color: var(--text-dim); }
.stat-value { font-weight: 700; color: #f3fbff; }

.shop-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    max-height: 320px;
    overflow: auto;
    padding-right: 4px;
}
.shop-block-title {
    margin-top: 8px;
    padding-left: 2px;
    font-size: 12px;
    color: #bcd0ef;
    letter-spacing: 0.3px;
}
.shop-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(21, 34, 56, 0.6);
}
.shop-item-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.shop-item-main > span:last-child {
    display: inline-flex;
    flex-direction: column;
}
.sell-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}
.shop-item-muted {
    opacity: 0.58;
    border-style: dashed;
}
.shop-session-stat {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    font-size: 12px;
    color: #d7e7ff;
    background: rgba(12, 20, 35, 0.7);
}

.npc-dialog-head {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 10px;
}
.npc-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid #7ca2d9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    background: radial-gradient(circle at 30% 28%, #5f88ca, #2f476f);
    color: #f2f7ff;
    flex-shrink: 0;
}
#npcDialogOptions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}
#npcDialogOptions .npc-opt {
    width: 100%;
}

.skill-bar {
    position: absolute;
    right: 12px;
    bottom: 24px;
    z-index: 95;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.skill-btn {
    min-width: 96px;
    padding: 10px 12px;
    font-size: 13px;
    border-radius: 11px;
    border: 1px solid #7a9fd4;
    background: linear-gradient(180deg, rgba(66, 102, 158, 0.94), rgba(38, 61, 95, 0.94));
    color: #fff;
    touch-action: manipulation;
}

.mini {
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 12px;
}

.quality-common {
    border-color: #476089;
    box-shadow: inset 0 0 0 1px rgba(96, 126, 170, 0.18);
}
.quality-common .pixel-icon::after {
    box-shadow: 0 0 3px rgba(120, 150, 192, 0.28);
}
.quality-common .quality-badge {
    color: #d5e1f6;
    border-color: #5e7aa8;
    background: rgba(80, 110, 152, 0.24);
}

.quality-excellent {
    border-color: #3a8f78;
    box-shadow: 0 0 0 1px rgba(92, 192, 165, 0.2) inset, 0 0 10px rgba(62, 170, 139, 0.15);
}
.quality-excellent .pixel-icon::after {
    box-shadow: 0 0 5px rgba(80, 205, 165, 0.35);
}
.quality-excellent .quality-badge {
    color: #cbffef;
    border-color: #57be9e;
    background: rgba(52, 139, 113, 0.28);
}

.quality-rare {
    border-color: #4b67be;
    box-shadow: 0 0 0 1px rgba(108, 140, 255, 0.24) inset, 0 0 11px rgba(86, 118, 232, 0.18);
}
.quality-rare .pixel-icon::after {
    box-shadow: 0 0 7px rgba(108, 140, 255, 0.42);
}
.quality-rare .quality-badge {
    color: #d6e2ff;
    border-color: #6b8cff;
    background: rgba(69, 91, 168, 0.36);
}

.quality-legendary {
    border-color: #b17a29;
    box-shadow: 0 0 0 1px rgba(255, 194, 86, 0.26) inset, 0 0 14px rgba(255, 188, 68, 0.22);
}
.quality-legendary .pixel-icon::after {
    box-shadow: 0 0 10px rgba(255, 196, 88, 0.6);
}
.quality-legendary .quality-badge {
    color: #fff2cf;
    border-color: #f2bd5d;
    background: rgba(164, 110, 30, 0.38);
}

@media (max-width: 768px) {
    .hud-top {
        flex-direction: column;
        align-items: flex-start;
    }
    .hud-actions {
        width: 100%;
        justify-content: space-between;
    }
    .quest-tracker { top: 98px; }
    .pickup-feed {
        top: 136px;
        width: min(250px, 74vw);
    }
    .equip-row {
        grid-template-columns: 1fr;
    }
    .stat-line {
        grid-template-columns: 52px 1fr auto;
    }
    #npcDialogOptions {
        grid-template-columns: 1fr;
    }
}

.muted { opacity: 0.7; }
.muted-small { font-size: 12px; color: var(--text-dim); }
.msg { min-height: 18px; }
