/* === Global Styles === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    font-family: 'GameFont';
    src: local('Hiragino Sans'), local('Microsoft YaHei'), local('Arial');
}

body {
    background: #0c0a14;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    font-family: 'GameFont', 'Hiragino Sans', 'Microsoft YaHei', sans-serif;
}

#game-root {
    width: 960px;
    height: 540px;
    position: relative;
    overflow: hidden;
    background: #0c0a14;
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    transition: border-radius 0.3s ease, box-shadow 0.3s ease;
}

/* Responsive scaling */
@media (max-width: 980px), (max-height: 560px) {
    #game-root {
        border-radius: 0;
    }
}

/* Fullscreen toggle button */
.fullscreen-btn {
    position: fixed;
    top: 8px;
    right: 8px;
    z-index: 100000;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
}

.fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Fullscreen state */
body:fullscreen {
    background: #000;
}

body:-webkit-full-screen {
    background: #000;
}

/* Scene container */
.scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 1;
}

.scene.active {
    opacity: 1;
    pointer-events: all;
}

/* Scene transition classes */
.scene.fade-in {
    animation: sceneFadeIn 0.2s ease forwards;
}

.scene.fade-out {
    animation: sceneFadeOut 0.2s ease forwards;
}

@keyframes sceneFadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes sceneFadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(1.02); }
}

/* Canvas overlays (for pet rendering, minigames) */
.game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.game-canvas.interactive {
    pointer-events: all;
}

/* Utility */
.hidden { display: none !important; }
.no-select { user-select: none; }

/* Touch support */
@media (hover: none) {
    .action-btn, .game-btn, .pet-action-btn, .card, .shop-item, .costume-card {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .action-btn:active, .game-btn:active {
        transform: scale(0.95);
    }
}

/* Prevent text selection during gameplay */
#game-root {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

/* Allow text selection in inputs */
input, textarea {
    -webkit-user-select: text;
    user-select: text;
}

/* === Title Scene — Game Dashboard === */
:root {
    --td-accent:  #6ee7b7;
    --td-accent2: #38bdf8;
    --td-accent3: #a78bfa;
    --td-bg:      #0c0a14;
    --td-border:  rgba(255,255,255,0.09);
    --td-card:    rgba(255,255,255,0.05);
    --td-radius:  20px;
    --td-gap:     10px;
}

/* ── Base layer: shows through gaps between panels ── */
.title-scene {
    background:
        radial-gradient(ellipse 70% 60% at 35% 55%, rgba(90,40,180,0.10) 0%, transparent 65%),
        radial-gradient(ellipse 50% 70% at 80% 20%, rgba(30,100,200,0.06) 0%, transparent 60%),
        #0c0a14;
    display: flex;
    flex-direction: row;
    padding: var(--td-gap);
    gap: var(--td-gap);
    overflow: hidden;
}

/* ── Sidebar panel — full height card ── */
.td-sidebar {
    flex: 0 0 66px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(12,10,20,0.85);
    border-radius: var(--td-radius);
    border: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
    z-index: 10;
    position: relative;
}
.td-sb-logo {
    height: 46px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 900; color: var(--td-accent); letter-spacing: 2px;
    border-bottom: 1px solid var(--td-border);
    width: 100%; flex-shrink: 0;
    background: linear-gradient(180deg, rgba(110,231,183,0.05) 0%, transparent 100%);
}
/* Currency display */
.td-currency {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 6px;
    border-bottom: 1px solid var(--td-border);
    width: 100%;
    flex-shrink: 0;
}
.td-currency-item {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: default;
    width: 100%;
    justify-content: center;
}
.td-currency-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex-shrink: 0;
}
.td-currency-icon[alt="Gold"] {
    filter: brightness(0) saturate(100%) invert(83%) sepia(40%) saturate(600%) hue-rotate(5deg) brightness(105%);
}
.td-currency-icon[alt="Gems"] {
    filter: brightness(0) saturate(100%) invert(50%) sepia(80%) saturate(500%) hue-rotate(230deg) brightness(120%);
}
.td-currency-val {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.6);
    min-width: 16px;
    text-align: left;
}

.td-sb-nav {
    flex: 1;
    display: flex; flex-direction: column; align-items: center;
    padding: 6px 0; gap: 0; overflow: hidden;
}
.td-sb-item {
    width: 58px;
    display: flex; flex-direction: column; align-items: center;
    gap: 3px; padding: 8px 4px;
    border-radius: 10px; border: none; background: transparent;
    cursor: pointer; transition: all 0.2s;
    color: rgba(255,255,255,0.32); position: relative; flex-shrink: 0;
}
.td-sb-item:hover { background: rgba(110,231,183,0.07); color: var(--td-accent); }
.td-sb-item.active { background: rgba(110,231,183,0.1); color: var(--td-accent); }
.td-sb-item.active::before {
    content: ''; position: absolute; left: 0; top: 25%; bottom: 25%;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--td-accent);
}
.td-sb-icon { width: 19px; height: 19px; object-fit: contain; opacity: 0.5; transition: opacity 0.2s; }
.td-sb-item:hover .td-sb-icon, .td-sb-item.active .td-sb-icon { opacity: 1; }
.td-sb-label { font-size: 9px; font-weight: 600; color: rgba(255,255,255,0.38); }

/* sidebar footer — pushed to bottom */
.td-sb-footer {
    margin-top: auto;
    display: flex; flex-direction: column; align-items: center;
    padding: 10px 0 12px; gap: 8px;
    border-top: 1px solid var(--td-border);
    width: 100%; flex-shrink: 0;
}
.td-sb-avatar { width: 100%; display: flex; justify-content: center; }
.td-sb-lang-row { display: flex; gap: 4px; }
.td-sb-mini-btn {
    width: 26px; height: 20px; font-size: 10px; font-weight: 700;
    border-radius: 5px; border: 1px solid var(--td-border);
    background: transparent; color: rgba(255,255,255,0.32);
    cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; padding: 0;
}
.td-sb-mini-btn:hover { color: var(--td-accent); border-color: rgba(110,231,183,0.3); }

/* ── Content column (main row + bottom bar) ── */
.td-content {
    flex: 1;
    display: flex; flex-direction: column;
    gap: var(--td-gap);
    min-width: 0;
}
.td-main-row {
    flex: 1;
    display: flex; flex-direction: row;
    gap: var(--td-gap);
    overflow: visible; min-height: 0;
}

/* ── Center hero panel ── */
.td-center {
    flex: 1; position: relative; overflow: visible;
    z-index: 1;
}
.td-hero-img {
    position: absolute;
    inset: -18px;
    width: calc(100% + 36px); height: calc(100% + 36px);
    object-fit: cover; object-position: center center; display: block;
    mask-image:
        linear-gradient(to right, transparent 0%, black 5%, black 92%, transparent 100%),
        linear-gradient(to bottom, transparent 0%, black 4%, black 88%, transparent 100%);
    mask-composite: intersect;
    -webkit-mask-image:
        linear-gradient(to right, transparent 0%, black 5%, black 92%, transparent 100%),
        linear-gradient(to bottom, transparent 0%, black 4%, black 88%, transparent 100%);
    -webkit-mask-composite: source-in;
}
.td-left-overlay {
    position: absolute; inset: -18px;
    background:
        linear-gradient(95deg, rgba(10,12,18,0.72) 0%, transparent 50%),
        linear-gradient(to bottom, transparent 30%, rgba(10,12,18,0.6) 65%, rgba(10,12,18,0.96) 100%);
    mask-image:
        linear-gradient(to right, transparent 0%, black 5%, black 92%, transparent 100%),
        linear-gradient(to bottom, transparent 0%, black 4%, black 88%, transparent 100%);
    mask-composite: intersect;
    -webkit-mask-image:
        linear-gradient(to right, transparent 0%, black 5%, black 92%, transparent 100%),
        linear-gradient(to bottom, transparent 0%, black 4%, black 88%, transparent 100%);
    -webkit-mask-composite: source-in;
}
.td-hero-badge-corner {
    position: absolute; top: 14px; left: 18px; z-index: 2;
    font-size: 9px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
    color: rgba(196,181,253,0.8);
    background: rgba(124,58,237,0.15);
    border: 1px solid rgba(167,139,250,0.25);
    padding: 3px 10px; border-radius: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.td-hero-text {
    position: absolute; bottom: 72px; left: 22px; right: 20px;
}
.td-hero-title {
    font-size: 26px; font-weight: 900; line-height: 1.2; margin-bottom: 5px;
    background: linear-gradient(135deg, #fff 40%, #c4b5fd 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.td-hero-desc {
    font-size: 11px; color: rgba(255,255,255,0.4); line-height: 1.55; max-width: 280px;
}

/* Action buttons — vertical stack, right-aligned */
.td-left-actions {
    position: absolute; bottom: 18px; left: 22px; right: 20px;
    display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
.td-btn-continue {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 18px; border-radius: 18px;
    background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 50%, #c4b5fd 100%);
    border: none; color: #fff; font-size: 11px; font-weight: 700;
    cursor: pointer; transition: all 0.25s; letter-spacing: 0.3px;
    box-shadow: 0 0 18px rgba(167,139,250,0.55), 0 4px 20px rgba(124,58,237,0.4);
}
.td-btn-continue:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 0 28px rgba(167,139,250,0.75), 0 6px 28px rgba(124,58,237,0.55);
    background: linear-gradient(135deg, #6d28d9 0%, #a78bfa 50%, #ddd6fe 100%);
}
.td-btn-continue.td-btn-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
}
.td-btn-row { display: flex; gap: 14px; align-items: center; }
.td-btn-secondary {
    background: transparent; border: none; padding: 2px 0;
    color: rgba(255,255,255,0.48); font-size: 12px; font-weight: 600;
    cursor: pointer; transition: all 0.18s;
    border-bottom: 1px solid rgba(255,255,255,0.16);
}
.td-btn-secondary:hover { color: rgba(255,255,255,0.85); border-bottom-color: rgba(255,255,255,0.48); }

/* ── Right panel — vertical game list ── */
.td-right {
    flex: 0 0 155px;
    display: flex; flex-direction: column;
    padding: 14px 8px 10px;
    background: rgba(12,10,20,0.85);
    border-radius: var(--td-radius);
    border: 1px solid rgba(255,255,255,0.06);
    z-index: 2;
    overflow: hidden;
}
.td-section-label {
    font-size: 9px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase;
    color: rgba(255,255,255,0.25); margin-bottom: 6px; flex-shrink: 0;
}
.td-game-list {
    flex: 1; display: flex; flex-direction: column; gap: 8px;
    justify-content: flex-start;
    overflow-y: auto; overflow-x: hidden;
    scrollbar-width: none;
}
.td-game-list::-webkit-scrollbar { display: none; }
.td-game-row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 6px 5px 5px; border-radius: 14px;
    cursor: pointer; transition: all 0.2s; flex-shrink: 0;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
}
.td-game-row:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.12);
    transform: translateX(3px);
}
/* cover thumbnail — portrait crop */
.td-game-thumb {
    width: 46px; height: 60px;
    border-radius: 10px; flex-shrink: 0;
    background-size: cover; background-position: center top;
    border: 1px solid rgba(255,255,255,0.08);
}
.td-game-row-info { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.td-game-row-name { font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.88); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-game-row-sub  { font-size: 8px; color: rgba(255,255,255,0.3); letter-spacing: 0.2px; }
.td-game-row-arrow { font-size: 12px; color: rgba(255,255,255,0.18); flex-shrink: 0; }

/* ── Bottom bar — fixed height so hero image isn't squished ── */
.td-bottom-bar {
    flex-shrink: 0;
    height: 165px;
    z-index: 2;
    display: flex; flex-direction: column;
    padding: 10px 16px 10px;
    gap: 8px;
    background: rgba(12,10,20,0.85);
    border-radius: var(--td-radius);
    border: 1px solid rgba(255,255,255,0.06);
}
.td-bottom-label {
    font-size: 9px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase;
    color: rgba(255,255,255,0.22); flex-shrink: 0;
}
.td-hub-row {
    flex: 1;
    display: flex; flex-direction: row;
    gap: 12px; align-items: stretch;
    min-height: 0;
    overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.td-hub-row::-webkit-scrollbar { display: none; }
/* portrait 3:4 image cards */
.td-hub-tile {
    flex: 0 0 calc((100% - 36px) / 4);  /* 4 visible, scroll for more */
    min-width: 140px;
    height: 100%;
    border-radius: 16px; overflow: hidden; position: relative;
    cursor: pointer; transition: all 0.25s;
    border: 1px solid rgba(255,255,255,0.08);
    background-size: cover; background-position: center top;
    scroll-snap-align: start;
}
.td-hub-tile:not(.locked):hover {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 12px 32px rgba(0,0,0,0.55);
}
.td-hub-tile.locked { opacity: 0.32; cursor: default; }
.td-hub-tile-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.18) 45%, transparent 70%);
}
.td-hub-tile-name {
    position: absolute; bottom: 10px; left: 0; right: 0;
    text-align: center; font-size: 11px; font-weight: 700;
    color: rgba(255,255,255,0.92); padding: 0 6px;
    letter-spacing: 0.3px; z-index: 1;
}
.td-hub-badge {
    position: absolute; top: 7px; right: 7px; font-size: 8px; font-weight: 700;
    color: rgba(255,255,255,0.55); background: rgba(0,0,0,0.45);
    padding: 2px 6px; border-radius: 4px; z-index: 1;
    border: 1px solid rgba(255,255,255,0.12);
}

/* Toast */
.title-toast {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99;
    background: rgba(6,8,15,0.92);
    color: #fff;
    padding: 8px 22px;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid var(--td-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: notifSlide 0.3s ease;
    white-space: nowrap;
}

/* === Title Music Menu === */
.title-music-menu {
    position: absolute;
    top: 44px;
    right: 12px;
    width: 200px;
    background: rgba(6,8,15,0.96);
    border: 1px solid var(--td-border);
    border-radius: 10px;
    z-index: 60;
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    animation: notifSlide 0.15s ease;
}
.title-music-header {
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    color: var(--td-accent);
    border-bottom: 1px solid var(--td-border);
    letter-spacing: 1px;
    text-transform: uppercase;
}
.title-music-list { max-height: 220px; overflow-y: auto; }
.title-music-item {
    padding: 8px 14px;
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: background 0.15s;
    text-transform: capitalize;
}
.title-music-item:hover { background: rgba(110,231,183,0.07); color: #fff; }
.title-music-stop {
    border-top: 1px solid var(--td-border);
    color: rgba(255,150,150,0.8);
}

/* === World Map Scene === */
.world-scene {
    position: relative;
    overflow: hidden;
}

/* ===== Image Map Mode ===== */
.wm-img-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}

.wm-img-bg {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    user-select: none;
    pointer-events: none;
}

.wm-hotspot-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}

/* Hotspot — aesthetic glass-morphism style */
.wm-hotspot {
    position: absolute;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.wm-hotspot:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
    box-shadow: 0 4px 24px rgba(100,180,255,0.2), inset 0 1px 0 rgba(255,255,255,0.15);
    transform: scale(1.04);
}

.wm-hs-icon {
    font-size: 22px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    opacity: 0.85;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Kenney PNG icon inside hotspot */
.wm-hs-icon-img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)) brightness(1.15);
}

.wm-hs-label {
    font-size: 11px;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 1px 6px rgba(0,0,0,0.8);
    white-space: nowrap;
    font-weight: 600;
    letter-spacing: 0.3px;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.wm-hotspot:hover .wm-hs-icon {
    opacity: 1;
    transform: scale(1.1);
}
.wm-hotspot:hover .wm-hs-label {
    opacity: 1;
}

/* Ghost mode — subtle presence, full reveal on hover */
.wm-hotspot.hm-ghost {
    background: transparent;
    border-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}
.wm-hotspot.hm-ghost .wm-hs-icon {
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.wm-hotspot.hm-ghost .wm-hs-label {
    opacity: 0;
    transition: opacity 0.3s ease;
}
.wm-hotspot.hm-ghost:hover {
    border-color: transparent;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}
.wm-hotspot.hm-ghost:hover .wm-hs-icon {
    opacity: 1;
    transform: scale(1.1);
}
.wm-hotspot.hm-ghost:hover .wm-hs-label {
    opacity: 1;
}

/* Resize handle (hidden in play mode) */
.wm-hs-resize {
    display: none;
    position: absolute;
    right: -4px; bottom: -4px;
    width: 12px; height: 12px;
    background: #FFD700;
    border-radius: 2px;
    cursor: nwse-resize;
}

.wm-hs-delete {
    display: none;
    position: absolute;
    top: -8px; right: -8px;
    width: 20px; height: 20px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    z-index: 10;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    transition: background 0.2s, transform 0.2s;
}
.wm-hs-delete:hover {
    background: #c0392b;
    transform: scale(1.2);
}

/* Edit mode */
.wm-editing .wm-hotspot {
    border-color: rgba(100, 200, 255, 0.6);
    background: rgba(100, 200, 255, 0.12);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: move;
    animation: none;
}
.wm-editing .wm-hotspot .wm-hs-icon,
.wm-editing .wm-hotspot .wm-hs-label {
    opacity: 1;
}

.hm-container {
    overflow: hidden;
}
.wm-editing .hm-container {
    overflow: visible;
}
.wm-editing .wm-hs-resize {
    display: block;
}
.wm-editing .wm-hs-delete {
    display: block;
}
.wm-hs-rename {
    display: none;
    position: absolute;
    top: -8px; right: 16px;
    width: 20px; height: 20px;
    background: #3a8fc4;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 10px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    z-index: 10;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    transition: background 0.2s, transform 0.2s;
}
.wm-hs-rename:hover {
    background: #2176ae;
    transform: scale(1.2);
}
.wm-editing .wm-hs-rename {
    display: block;
}

/* Story trigger badge — pulsing '!' on hotspots with pending story */
.wm-hs-story-badge {
    position: absolute;
    top: -6px; left: -6px;
    width: 20px; height: 20px;
    background: #e74c3c;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    z-index: 12;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(231,76,60,0.7);
    animation: storyBadgePulse 1.5s ease-in-out infinite;
}
@keyframes storyBadgePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 6px rgba(231,76,60,0.7); }
    50%      { transform: scale(1.2); box-shadow: 0 0 12px rgba(231,76,60,0.9); }
}
/* Always show icon+label on hotspots with story badge (override ghost) */
.wm-hotspot:has(.wm-hs-story-badge) .wm-hs-icon { opacity: 1; }
.wm-hotspot:has(.wm-hs-story-badge) .wm-hs-label { opacity: 1; }

/* Delete confirmation popup */
.wm-hs-del-popup {
    position: absolute;
    top: 100%; left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    background: rgba(30, 24, 50, 0.95);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 120px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    animation: cedPickerFadeIn 0.1s ease;
}
.wm-del-opt {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
}
.wm-del-opt:hover { background: rgba(255,255,255,0.1); }
.wm-del-destroy { color: #e74c3c; }
.wm-del-destroy:hover { background: rgba(231,76,60,0.15); }

.wm-editing .wm-hotspot.wm-hs-dragging {
    border-color: #FFD700;
    background: rgba(255, 215, 0, 0.25);
    z-index: 20;
}

/* Disabled minigame hotspot (placeholder / unplayable) */
.wm-hotspot.wm-hotspot-disabled {
    opacity: 0.4;
    border-style: dashed;
    filter: grayscale(0.5);
}
.wm-hotspot.wm-hotspot-disabled:hover {
    opacity: 0.6;
    filter: grayscale(0.3);
}

/* Play button (visible only in edit mode) */
.wm-hs-play {
    display: none;
    position: absolute;
    bottom: -8px; left: 50%;
    transform: translateX(-50%);
    width: 22px; height: 22px;
    background: #2ecc71;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 11px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    z-index: 10;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    transition: background 0.2s, transform 0.2s;
}
.wm-hs-play:hover {
    background: #27ae60;
    transform: translateX(-50%) scale(1.2);
}
.wm-editing .wm-hs-play {
    display: block;
}

.wm-edit-hint {
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #8cf;
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 12px;
    z-index: 50;
    white-space: nowrap;
}

.wm-save-btn {
    position: absolute;
    bottom: 52px; right: 12px;
    z-index: 50;
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: #4CAF50;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.wm-save-btn:hover {
    background: #45a049;
}

/* Toolbar */
/* (wm-img-toolbar / wm-tb-btn / wm-tb-toggle removed — replaced by system-menu) */

/* ============ OCEAN ============ */
.wm-ocean {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        linear-gradient(180deg,
            #1A3858 0%,
            #1A4A6A 20%,
            #1A5A7A 40%,
            #1565A0 55%,
            #1976B8 70%,
            #2196D0 85%,
            #40B0E0 100%);
    z-index: 0;
}
.wm-ocean-deep {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(circle 80px at 15% 90%, rgba(0,40,80,0.4), transparent),
        radial-gradient(circle 60px at 75% 85%, rgba(0,40,80,0.3), transparent),
        radial-gradient(circle 100px at 50% 95%, rgba(0,30,60,0.5), transparent);
}
.wm-wave {
    position: absolute;
    width: 130%; left: -15%;
    height: 6px;
    background: linear-gradient(90deg,
        transparent 0%, rgba(255,255,255,0.08) 20%,
        rgba(255,255,255,0.15) 50%,
        rgba(255,255,255,0.08) 80%, transparent 100%);
    border-radius: 50%;
}
.wv1 { bottom: 3%; animation: wmWave 5s ease-in-out infinite; }
.wv2 { bottom: 8%; animation: wmWave 6s ease-in-out infinite 1s; }
.wv3 { bottom: 14%; animation: wmWave 4.5s ease-in-out infinite 2s; }
.wv4 { bottom: 19%; animation: wmWave 7s ease-in-out infinite 0.5s; }
.wv5 { bottom: 25%; animation: wmWave 5.5s ease-in-out infinite 3s; }
.wv6 { bottom: 30%; animation: wmWave 6.5s ease-in-out infinite 1.5s; }
@keyframes wmWave {
    0%, 100% { transform: translateX(-3%); opacity: 0.3; }
    50% { transform: translateX(3%); opacity: 1; }
}

/* Sea label */
.wm-sea-label {
    position: absolute;
    bottom: 8%; left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    z-index: 15;
    transition: all 0.25s;
}
.wm-sea-label:hover { transform: translateX(-50%) scale(1.08); }
.wm-sea-label:hover .wm-sea-text { color: #B0E0FF; }
.wm-sea-icon { font-size: 24px; }
.wm-sea-text {
    font-size: 18px;
    font-weight: bold;
    color: rgba(180, 220, 255, 0.6);
    letter-spacing: 12px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    transition: color 0.25s;
}

/* ============ CONTINENT ============ */
.wm-continent {
    position: absolute;
    top: 0; left: 3%;
    width: 94%; height: 68%;
    background:
        linear-gradient(180deg,
            #6A7A4A 0%,
            #7A8A5A 15%,
            #7A8A55 40%,
            #8A9A60 60%,
            #7A8A50 80%,
            #6A7A45 100%);
    border-radius: 8px 8px 40% 30%;
    z-index: 1;
    box-shadow:
        0 4px 0 #5A6A3A,
        0 8px 0 #4A5A2A,
        0 12px 20px rgba(0,0,0,0.4);
}
/* Coastline sandy edge */
.wm-coast {
    position: absolute;
    bottom: -4px; left: 2%;
    width: 96%; height: 12px;
    background: linear-gradient(180deg, #C8B888, #D8C898);
    border-radius: 0 0 40% 30%;
    z-index: -1;
}

/* ============ TERRAIN ZONES ============ */
.wm-zone {
    position: absolute;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 3;
}
.wm-zone:hover {
    filter: brightness(1.15);
    z-index: 4;
}
.wm-zone:active {
    filter: brightness(0.95);
}

/* --- 落日山谷 (top, full width) --- */
.wm-valley {
    top: 0; left: 0;
    width: 70%; height: 32%;
    background:
        linear-gradient(180deg,
            #5A4A38 0%, #6A5A42 20%, #7A6A4C 45%,
            #6A7A4A 70%, #7A8A5A 100%);
    border-radius: 8px 0 0 0;
    clip-path: polygon(0 0, 100% 0, 95% 100%, 0 100%);
}
/* Mountains */
.wm-mt {
    position: absolute;
    width: 0; height: 0;
    border-left: solid transparent;
    border-right: solid transparent;
    border-bottom-style: solid;
    z-index: 2;
}
.wm-mt1 { top: -20px; left: 8%;  border-left-width: 22px; border-right-width: 22px; border-bottom-width: 40px; border-bottom-color: #5A4A38; }
.wm-mt2 { top: -30px; left: 22%; border-left-width: 30px; border-right-width: 30px; border-bottom-width: 55px; border-bottom-color: #4A3A28; }
.wm-mt3 { top: -15px; left: 40%; border-left-width: 18px; border-right-width: 18px; border-bottom-width: 32px; border-bottom-color: #5A4A38; }
.wm-mt4 { top: -25px; left: 55%; border-left-width: 26px; border-right-width: 26px; border-bottom-width: 46px; border-bottom-color: #4A3A28; }
.wm-mt5 { top: -12px; left: 75%; border-left-width: 16px; border-right-width: 16px; border-bottom-width: 28px; border-bottom-color: #5A4A38; }
/* Snow caps */
.wm-snow {
    position: absolute;
    width: 0; height: 0;
    border-left: solid transparent;
    border-right: solid transparent;
    border-bottom-style: solid;
    z-index: 3;
}
.ws1 { top: -8px;  left: calc(8% + 10px);  border-left-width: 10px; border-right-width: 10px; border-bottom-width: 15px; border-bottom-color: rgba(255,255,255,0.5); }
.ws2 { top: -14px; left: calc(22% + 14px); border-left-width: 14px; border-right-width: 14px; border-bottom-width: 22px; border-bottom-color: rgba(255,255,255,0.45); }
.ws3 { top: -10px; left: calc(55% + 12px); border-left-width: 12px; border-right-width: 12px; border-bottom-width: 18px; border-bottom-color: rgba(255,255,255,0.4); }
/* River */
.wm-river {
    position: absolute;
    bottom: 10%; left: 20%;
    width: 55%; height: 3px;
    background: linear-gradient(90deg, transparent, rgba(80,160,220,0.6) 15%, rgba(80,160,220,0.8) 50%, rgba(80,160,220,0.6) 85%, transparent);
    border-radius: 2px;
}

/* --- 迷雾森林 (top-right, connects to valley) --- */
.wm-forest {
    top: 0; right: 0;
    width: 32%; height: 38%;
    background:
        linear-gradient(135deg,
            #1A3A1A 0%, #2A4A25 20%, #1E3E1E 40%,
            #254A28 60%, #2A4A2A 80%, #1A3A1A 100%);
    border-radius: 0 8px 0 30%;
}
.wm-fog {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(ellipse 60% 40% at 30% 30%, rgba(200,210,220,0.12), transparent),
        radial-gradient(ellipse 50% 35% at 70% 60%, rgba(200,210,220,0.08), transparent);
    border-radius: inherit;
    animation: wmFog 10s ease-in-out infinite;
    pointer-events: none;
}
@keyframes wmFog {
    0%, 100% { opacity: 0.4; transform: translate(0,0); }
    33% { opacity: 0.9; transform: translate(4px, 2px); }
    66% { opacity: 0.6; transform: translate(-3px, -1px); }
}
.wm-tree {
    position: absolute;
    z-index: 2;
}
.wm-tree::before {
    content: '';
    display: block;
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 12px solid #1A3A1A;
}
.wm-tree::after {
    content: '';
    display: block;
    width: 2px; height: 4px;
    background: #3A2A1A;
    margin: 0 auto;
}
.wt1  { top: 12%; left: 12%; }  .wt2  { top: 8%;  left: 30%; }
.wt3  { top: 18%; left: 48%; }  .wt4  { top: 10%; left: 65%; }
.wt5  { top: 28%; left: 20%; }  .wt6  { top: 35%; left: 40%; }
.wt7  { top: 25%; left: 75%; }  .wt8  { top: 42%; left: 55%; }
.wt9  { top: 50%; left: 25%; }  .wt10 { top: 55%; left: 70%; }
.wt11 { top: 65%; left: 35%; }  .wt12 { top: 60%; left: 58%; }

/* --- 风暴草原 (left, mid) --- */
.wm-prairie {
    top: 28%; left: 0;
    width: 30%; height: 42%;
    background:
        linear-gradient(135deg,
            #5A9A3A 0%, #6AAA4A 20%, #7ABA55 40%,
            #6AAA4A 60%, #5A9A3A 80%, #4A8A30 100%);
    border-radius: 0 20% 25% 0;
    clip-path: polygon(0 0, 85% 5%, 100% 50%, 90% 100%, 0 100%);
}
.wm-grass {
    position: absolute;
    width: 4px; height: 8px;
    border-radius: 50% 50% 0 0;
    background: #4A8A28;
    z-index: 2;
}
.wg1 { top: 10%; left: 15%; transform: rotate(-12deg); }
.wg2 { top: 25%; left: 40%; transform: rotate(8deg); }
.wg3 { top: 18%; left: 65%; transform: rotate(-5deg); }
.wg4 { top: 40%; left: 20%; transform: rotate(10deg); }
.wg5 { top: 55%; left: 50%; transform: rotate(-8deg); }
.wg6 { top: 65%; left: 30%; transform: rotate(6deg); }
.wg7 { top: 45%; left: 70%; transform: rotate(-15deg); }
.wg8 { top: 75%; left: 55%; transform: rotate(12deg); }
.wm-wind {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    border-radius: 1px;
    z-index: 2;
}
.wd1 { top: 30%; left: 5%; width: 55%; animation: wmWind 3s ease-in-out infinite; }
.wd2 { top: 50%; left: 15%; width: 45%; animation: wmWind 4s ease-in-out infinite 1.2s; }
.wd3 { top: 70%; left: 8%; width: 50%; animation: wmWind 3.5s ease-in-out infinite 2.5s; }
@keyframes wmWind {
    0%   { opacity: 0; transform: translateX(-15px); }
    50%  { opacity: 1; }
    100% { opacity: 0; transform: translateX(40px); }
}

/* --- 国王大道 (right, mid, connecting forest to highland) --- */
.wm-road {
    top: 34%; right: 0;
    width: 20%; height: 36%;
    background: linear-gradient(90deg, #7A8A55, #8A7A5A 30%, #9A8A6A 50%, #8A7A5A 70%, #7A8A55);
    border-radius: 0;
    clip-path: polygon(20% 0, 100% 0, 100% 100%, 10% 100%, 0% 50%);
}
.wm-road-surface {
    position: absolute;
    top: 5%; left: 35%;
    width: 30%; height: 90%;
    background: linear-gradient(90deg, #7A6A4A, #8A7A5A, #7A6A4A);
    border-radius: 4px;
}
.wm-road-dash {
    position: absolute;
    left: 47%; width: 6%;
    height: 8px;
    background: rgba(255,255,200,0.35);
    border-radius: 2px;
}
.rd1 { top: 10%; } .rd2 { top: 28%; } .rd3 { top: 46%; }
.rd4 { top: 64%; } .rd5 { top: 82%; }
.wm-road-post {
    position: absolute;
    left: 30%;
    width: 4px; height: 10px;
    background: #5A4A3A;
    border-radius: 1px;
}
.wm-road-post::after {
    content: '';
    position: absolute;
    top: -3px; left: -2px;
    width: 8px; height: 4px;
    background: #8A7A5A;
    border-radius: 2px;
}
.rp1 { top: 25%; } .rp2 { top: 65%; }

/* --- 屠龙高地 (bottom-right, coastal) --- */
.wm-highland {
    bottom: 0; right: 0;
    width: 35%; height: 30%;
    background:
        linear-gradient(135deg,
            #5A4A3A 0%, #6A5A48 25%, #7A6A55 50%,
            #6A5A45 75%, #5A4A38 100%);
    border-radius: 30% 0 8px 0;
    clip-path: polygon(15% 0, 100% 0, 100% 100%, 0 100%, 0% 40%);
}
.wm-rock {
    position: absolute;
    background: #4A3A2A;
    border-radius: 40% 50% 45% 55%;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.4);
    z-index: 2;
}
.wr1 { top: 18%; left: 20%; width: 20px; height: 14px; }
.wr2 { top: 35%; left: 55%; width: 16px; height: 11px; transform: rotate(20deg); }
.wr3 { top: 55%; left: 30%; width: 24px; height: 16px; transform: rotate(-10deg); }
.wr4 { top: 70%; left: 65%; width: 14px; height: 10px; }
.wm-lava {
    position: absolute;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255,100,30,0.4), rgba(255,60,20,0.6), rgba(255,100,30,0.4), transparent);
    border-radius: 2px;
    z-index: 2;
    animation: wmLava 3s ease-in-out infinite;
}
.wl1 { top: 45%; left: 15%; width: 35%; }
.wl2 { top: 65%; left: 40%; width: 30%; animation-delay: 1.5s; }
@keyframes wmLava {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ============ ZONE LABELS ============ */
.wm-label {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    z-index: 8;
    pointer-events: none;
}
.wm-lbl-icon {
    font-size: 22px;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}
.wm-lbl-text {
    font-size: 11px;
    font-weight: bold;
    color: #F0E8D8;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8), 0 0 6px rgba(0,0,0,0.5);
    letter-spacing: 2px;
    white-space: nowrap;
}
/* Label positions within each zone */
.wm-valley .wm-label  { bottom: 20%; left: 35%; }
.wm-forest .wm-label  { top: 40%; left: 30%; }
.wm-prairie .wm-label  { top: 35%; left: 20%; }
.wm-road .wm-label     { top: 38%; left: 20%; }
.wm-highland .wm-label { top: 30%; left: 35%; }

/* ============ CITY (CENTER, WITH WALLS) ============ */
.wm-city-area {
    position: absolute;
    top: 32%; left: 30%;
    width: 140px; height: 120px;
    z-index: 6;
}

/* Walls */
.wm-city-walls {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 5px solid #8A7A5A;
    border-radius: 6px;
    background: rgba(90,80,60,0.3);
    box-shadow:
        0 0 0 2px #6A5A3A,
        0 0 0 5px rgba(80,70,50,0.3),
        inset 0 0 15px rgba(0,0,0,0.2),
        0 4px 12px rgba(0,0,0,0.4);
}
/* Battlements */
.wm-battlement {
    position: absolute;
    z-index: 2;
}
.wm-bt-top {
    top: -8px; left: 6px;
    width: calc(100% - 12px); height: 6px;
    background: repeating-linear-gradient(90deg,
        #8A7A5A 0px, #8A7A5A 10px,
        transparent 10px, transparent 16px);
}
.wm-bt-bottom {
    bottom: -8px; left: 6px;
    width: calc(100% - 12px); height: 6px;
    background: repeating-linear-gradient(90deg,
        #8A7A5A 0px, #8A7A5A 10px,
        transparent 10px, transparent 16px);
}
.wm-bt-left {
    top: 6px; left: -8px;
    width: 6px; height: calc(100% - 12px);
    background: repeating-linear-gradient(180deg,
        #8A7A5A 0px, #8A7A5A 10px,
        transparent 10px, transparent 16px);
}
.wm-bt-right {
    top: 6px; right: -8px;
    width: 6px; height: calc(100% - 12px);
    background: repeating-linear-gradient(180deg,
        #8A7A5A 0px, #8A7A5A 10px,
        transparent 10px, transparent 16px);
}
/* Gates */
.wm-gate {
    position: absolute;
    background: #5A4A30;
    z-index: 3;
}
.wm-gate-s {
    bottom: -5px; left: 50%;
    transform: translateX(-50%);
    width: 20px; height: 10px;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.wm-gate-e {
    right: -5px; top: 50%;
    transform: translateY(-50%);
    width: 10px; height: 20px;
    border-radius: 0 4px 4px 0;
    box-shadow: 2px 0 4px rgba(0,0,0,0.3);
}

/* City inner (clickable) */
.wm-city-inner {
    position: absolute;
    top: 8px; left: 8px;
    width: calc(100% - 16px); height: calc(100% - 16px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    border-radius: 3px;
    background: linear-gradient(135deg, rgba(160,140,100,0.2), rgba(140,120,80,0.1));
    transition: all 0.25s;
    z-index: 5;
}
.wm-city-inner:hover {
    background: linear-gradient(135deg, rgba(255,220,120,0.25), rgba(200,180,100,0.15));
    box-shadow: 0 0 20px rgba(255,215,0,0.2);
}
.wm-city-icon {
    font-size: 32px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.wm-city-name {
    font-size: 14px;
    font-weight: bold;
    color: #FFE8A0;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7), 0 0 8px rgba(255,215,0,0.3);
    letter-spacing: 4px;
}
.wm-city-glow {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 80px; height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,215,0,0.15), transparent 70%);
    animation: wmCityGlow 2.5s ease-in-out infinite;
    pointer-events: none;
}
@keyframes wmCityGlow {
    0%, 100% { opacity: 0.3; transform: translate(-50%,-50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%,-50%) scale(1.4); }
}

/* ============ STRATEGY ZONE ============ */
.wm-strategy-zone {
    top: 30%; left: 5%;
    width: 80px; height: 60px;
    background: radial-gradient(ellipse, rgba(180,40,40,0.15), transparent 70%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wm-strategy-zone:hover {
    background: radial-gradient(ellipse, rgba(220,60,60,0.25), transparent 70%);
}
.wm-label-strategy {
    position: relative;
    pointer-events: none;
}
.wm-label-strategy .wm-lbl-text {
    color: #FFB0A0;
    font-size: 10px;
}
.wm-badge {
    position: absolute;
    top: -8px; right: -20px;
    background: linear-gradient(135deg, #FF5252, #D32F2F);
    color: #fff;
    font-size: 7px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 4px;
    letter-spacing: 1px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
    animation: wmBadge 2s ease-in-out infinite;
}
@keyframes wmBadge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ============ EXPANSION ZONES ============ */
.wm-expand {
    position: absolute;
    width: 30px; height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: rgba(255,255,255,0.12);
    border: 1px dashed rgba(255,255,255,0.08);
    border-radius: 6px;
    z-index: 5;
}
.wm-exp1 { top: 8%; left: 2%; }
.wm-exp2 { top: 48%; left: 2%; }
.wm-exp3 { bottom: 10%; left: 10%; }

/* ============ STORY MARKER (quest exclamation) ============ */
.wm-story-marker {
    position: absolute;
    top: -8px; right: -8px;
    width: 22px; height: 22px;
    background: #f5c542;
    color: #333;
    font-weight: 900;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(245, 197, 66, 0.8), 0 0 16px rgba(245, 197, 66, 0.4);
    z-index: 20;
    animation: wm-marker-bounce 1.2s ease-in-out infinite;
    pointer-events: none;
}
@keyframes wm-marker-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* ============ CARTOUCHE (title) ============ */
.wm-cartouche {
    position: absolute;
    top: 6px; left: 50%;
    transform: translateX(-50%);
    z-index: 20;
}
.wm-cartouche-inner {
    font-size: 18px;
    font-weight: bold;
    color: rgba(240, 230, 200, 0.85);
    text-shadow: 0 0 8px rgba(200, 180, 140, 0.3), 0 2px 4px rgba(0,0,0,0.6);
    letter-spacing: 6px;
    padding: 4px 20px;
    border: 1px solid rgba(200,180,140,0.2);
    border-radius: 4px;
    background: rgba(30,25,20,0.5);
}

/* ============ COMPASS ============ */
.wm-compass {
    position: absolute;
    bottom: 65px; right: 16px;
    width: 44px; height: 44px;
    z-index: 20;
}
.wm-comp-ring {
    position: absolute;
    top: 2px; left: 2px;
    width: 40px; height: 40px;
    border: 1px solid rgba(200,180,140,0.3);
    border-radius: 50%;
}
.wm-comp-n, .wm-comp-s, .wm-comp-w, .wm-comp-e {
    position: absolute;
    font-size: 9px;
    font-weight: bold;
    color: rgba(220,200,170,0.6);
}
.wm-comp-n { top: -2px; left: 50%; transform: translateX(-50%); color: rgba(220,180,140,0.9); }
.wm-comp-s { bottom: -2px; left: 50%; transform: translateX(-50%); }
.wm-comp-w { top: 50%; left: -1px; transform: translateY(-50%); }
.wm-comp-e { top: 50%; right: -1px; transform: translateY(-50%); }
.wm-comp-needle {
    position: absolute;
    top: 50%; left: 50%;
    width: 2px; height: 18px;
    background: linear-gradient(180deg, #C44 50%, #CCC 50%);
    transform: translate(-50%, -50%);
    border-radius: 1px;
}
.wm-comp-needle::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 5px; height: 5px;
    background: #AA9;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 3px rgba(0,0,0,0.3);
}

/* === Strategy Game Scene === */
.strategy-scene {
    width: 100%; height: 100%;
    position: relative;
    overflow: hidden;
}

.strategy-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #1A1E28 0%, #0a1020 40%, #1a2040 100%);
}

.strategy-stars {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(circle 1px at 10% 15%, rgba(255,255,255,0.4), transparent),
        radial-gradient(circle 1px at 30% 8%, rgba(255,255,255,0.3), transparent),
        radial-gradient(circle 1px at 55% 20%, rgba(255,255,255,0.5), transparent),
        radial-gradient(circle 1px at 70% 12%, rgba(255,255,255,0.3), transparent),
        radial-gradient(circle 1px at 85% 25%, rgba(255,255,255,0.4), transparent),
        radial-gradient(circle 1px at 20% 30%, rgba(255,255,255,0.2), transparent),
        radial-gradient(circle 1px at 45% 5%, rgba(255,255,255,0.3), transparent);
}

.strategy-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100% - 56px);
    gap: 24px;
    z-index: 5;
}

.strategy-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.strategy-icon {
    font-size: 56px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

.strategy-game-title {
    font-size: 36px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255,215,0,0.4), 0 3px 6px rgba(0,0,0,0.5);
    letter-spacing: 6px;
}

.strategy-subtitle {
    font-size: 16px;
    color: rgba(220, 200, 170, 0.7);
    letter-spacing: 4px;
}

.strategy-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 500px;
}

.strategy-desc {
    font-size: 14px;
    color: rgba(200, 200, 220, 0.8);
    text-align: center;
    line-height: 1.6;
}

.strategy-countries {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.country-tag {
    font-size: 12px;
    color: #C8C8D8;
    background: rgba(60, 60, 100, 0.5);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(100, 100, 160, 0.3);
}

.strategy-launch-btn {
    font-size: 18px !important;
    padding: 14px 36px !important;
    letter-spacing: 2px;
}

.strategy-hint {
    font-size: 12px;
    color: rgba(180, 180, 200, 0.5);
    text-align: center;
}

/* === City Scene (安帕城) === */
.city-scene {
    position: relative;
    overflow: hidden;
}

/* Environment layers */
.city-env {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
}

/* Mountains — top */
.city-env-mountain {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 28%;
    background:
        linear-gradient(180deg, #5A7A5A 0%, #6B8B6B 40%, #7A9A7A 70%, #8AAA7A 100%);
}
.city-env-mountain::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(ellipse 180px 90px at 15% 100%, #4A6A4A, transparent),
        radial-gradient(ellipse 220px 120px at 35% 100%, #3A5A3A, transparent),
        radial-gradient(ellipse 160px 80px at 55% 100%, #4A6A4A, transparent),
        radial-gradient(ellipse 250px 130px at 75% 100%, #3A5A3A, transparent),
        radial-gradient(ellipse 140px 70px at 90% 100%, #4A6A4A, transparent);
}
.city-env-mountain::after {
    content: '';
    position: absolute;
    top: 5%; left: 10%;
    width: 80%; height: 40%;
    background:
        radial-gradient(ellipse 60px 30px at 20% 50%, rgba(255,255,255,0.6), transparent),
        radial-gradient(ellipse 50px 25px at 50% 30%, rgba(255,255,255,0.5), transparent),
        radial-gradient(ellipse 70px 35px at 80% 60%, rgba(255,255,255,0.4), transparent);
}

/* Grassland — left */
.city-env-grass {
    position: absolute;
    top: 28%; left: 0;
    width: 15%; height: 44%;
    background: linear-gradient(90deg, #6AAF4A 0%, #7ABF5A 50%, #8ACF6A 100%);
}
.city-env-grass::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(circle 3px at 20% 20%, #5A9F3A, transparent),
        radial-gradient(circle 2px at 50% 40%, #5A9F3A, transparent),
        radial-gradient(circle 3px at 30% 65%, #5A9F3A, transparent),
        radial-gradient(circle 2px at 70% 80%, #5A9F3A, transparent),
        radial-gradient(circle 3px at 40% 15%, #5A9F3A, transparent);
}

/* Road — right */
.city-env-road {
    position: absolute;
    top: 28%; right: 0;
    width: 12%; height: 44%;
    background: linear-gradient(90deg, #9A8A7A, #8A7A6A 40%, #7A6A5A 100%);
}
.city-env-road::before {
    content: '';
    position: absolute;
    top: 0; left: 45%;
    width: 10%; height: 100%;
    background: repeating-linear-gradient(180deg,
        #DDD 0px, #DDD 20px,
        transparent 20px, transparent 40px);
    opacity: 0.6;
}

/* Sea — bottom */
.city-env-sea {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 28%;
    background: linear-gradient(180deg, #4A9ACA 0%, #3A8ABA 30%, #2A7AAA 60%, #1A6A9A 100%);
    overflow: hidden;
}
.sea-wave {
    position: absolute;
    left: -10%;
    width: 120%;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}
.wave-1 { top: 15%; animation: waveMove 4s ease-in-out infinite; }
.wave-2 { top: 45%; animation: waveMove 5s ease-in-out infinite 1s; }
.wave-3 { top: 75%; animation: waveMove 3.5s ease-in-out infinite 0.5s; }

@keyframes waveMove {
    0%, 100% { transform: translateX(-3%); }
    50% { transform: translateX(3%); }
}

/* City title */
.city-title {
    position: absolute;
    top: 6%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 32px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 16px rgba(255, 220, 150, 0.6), 0 3px 6px rgba(0, 0, 0, 0.5);
    letter-spacing: 8px;
    z-index: 20;
}

/* City walls */
.city-walls {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 540px;
    height: 360px;
    border: 8px solid #8A7A5A;
    border-radius: 12px;
    background: rgba(60, 50, 40, 0.5);
    box-shadow:
        0 0 0 4px #6A5A3A,
        0 0 0 8px rgba(100, 90, 70, 0.4),
        inset 0 0 30px rgba(0, 0, 0, 0.3),
        0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

/* Wall texture (battlements) */
.city-walls::before {
    content: '';
    position: absolute;
    top: -16px; left: 4px;
    width: calc(100% - 8px);
    height: 12px;
    background: repeating-linear-gradient(90deg,
        #8A7A5A 0px, #8A7A5A 20px,
        transparent 20px, transparent 30px);
    border-radius: 2px;
}
.city-walls::after {
    content: '';
    position: absolute;
    bottom: -16px; left: 4px;
    width: calc(100% - 8px);
    height: 12px;
    background: repeating-linear-gradient(90deg,
        #8A7A5A 0px, #8A7A5A 20px,
        transparent 20px, transparent 30px);
    border-radius: 2px;
}

/* City interior */
.city-interior {
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 8px;
}

.city-row {
    display: flex;
    gap: 8px;
    flex: 1;
}

.city-loc {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(180, 160, 130, 0.2), rgba(160, 140, 110, 0.1));
    border: 2px solid rgba(180, 160, 130, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.city-loc:hover {
    background: linear-gradient(135deg, rgba(255, 220, 150, 0.3), rgba(220, 190, 130, 0.2));
    border-color: rgba(255, 220, 150, 0.7);
    box-shadow: 0 0 16px rgba(255, 220, 150, 0.25);
    transform: scale(1.03);
}

.city-loc:active {
    transform: scale(0.97);
}

.city-loc-home {
    border-color: rgba(255, 200, 100, 0.5);
    background: linear-gradient(135deg, rgba(255, 220, 150, 0.15), rgba(220, 190, 130, 0.08));
}

.city-loc-girl-home {
    border-color: rgba(255, 150, 200, 0.5);
    background: linear-gradient(135deg, rgba(255, 180, 220, 0.15), rgba(240, 160, 200, 0.08));
}
.city-loc-girl-home:hover {
    background: linear-gradient(135deg, rgba(255, 180, 220, 0.3), rgba(240, 160, 200, 0.2));
    border-color: rgba(255, 150, 200, 0.7);
    box-shadow: 0 0 16px rgba(255, 150, 200, 0.25);
}

.city-loc-casino {
    border-color: rgba(255, 215, 0, 0.5);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(200, 160, 0, 0.08));
}
.city-loc-casino:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(200, 160, 0, 0.2));
    border-color: rgba(255, 215, 0, 0.7);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.25);
}

.loc-emoji {
    font-size: 36px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.loc-label {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 3px;
}

/* === Home Map Scene === */
.home-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1A1E28 0%, #1e2a3a 40%, #2a3a4e 100%);
}

.home-title {
    font-size: 36px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 16px rgba(100, 180, 255, 0.5), 0 3px 6px rgba(0, 0, 0, 0.4);
    margin-bottom: 32px;
    letter-spacing: 6px;
}

.home-floorplan {
    width: 520px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(80, 70, 60, 0.6);
    padding: 6px;
    border-radius: 10px;
    border: 2px solid rgba(160, 140, 110, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.home-row {
    display: flex;
    gap: 4px;
}

.home-row-top .home-room {
    flex: 1;
    height: 180px;
}

.home-row-bottom .home-room {
    height: 180px;
}

.home-room-wide {
    flex: 1;
}

.home-room {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(200, 185, 160, 0.25), rgba(180, 165, 140, 0.15));
    border: 2px solid rgba(180, 160, 130, 0.4);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.home-room:hover {
    background: linear-gradient(135deg, rgba(200, 185, 160, 0.45), rgba(180, 165, 140, 0.3));
    border-color: rgba(255, 220, 150, 0.7);
    box-shadow: 0 0 20px rgba(255, 220, 150, 0.2);
    transform: scale(1.02);
}

.home-room:active {
    transform: scale(0.98);
}

.room-emoji {
    font-size: 48px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.room-label {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 4px;
}

/* === Casino Scene === */
.casino-scene {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.casino-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(160deg, #1a0a2e 0%, #0d1b2a 40%, #1a0a2e 100%);
    z-index: 0;
}

.casino-lights {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(255, 215, 0, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 30%, rgba(255, 50, 50, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(100, 50, 255, 0.06) 0%, transparent 50%);
}

.casino-coin-display {
    right: auto;
    left: 16px;
}

/* Casino / Arena fallback card grid */
.casino-fallback,
.arena-fallback {
    width: 100%; height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.casino-fallback-title,
.arena-fallback-title {
    text-align: center;
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 6px;
    padding: 14px 0 8px;
    position: relative;
    z-index: 1;
}
.casino-fallback-title { color: #E8D0A0; text-shadow: 0 2px 8px rgba(255, 215, 0, 0.3); }
.arena-fallback-title  { color: #E0C0A0; text-shadow: 0 2px 8px rgba(255, 120, 50, 0.3); }

.casino-fallback-grid,
.arena-fallback-grid {
    flex: 1;
    display: flex;
    gap: 16px;
    padding: 12px 24px 20px;
    min-height: 0;
    position: relative;
    z-index: 1;
}

.casino-fallback-card,
.arena-fallback-card {
    flex: 1;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s;
    gap: 10px;
}
.casino-fallback-card:hover,
.arena-fallback-card:hover {
    transform: scale(1.03);
    filter: brightness(1.2);
}
.casino-fallback-card:active,
.arena-fallback-card:active {
    transform: scale(0.98);
}

.casino-fallback-card {
    background: linear-gradient(180deg, #2A1A40, #1A1030);
    border: 2px solid #4A3060;
    box-shadow: inset 0 0 30px rgba(130, 50, 200, 0.12), 0 4px 16px rgba(0, 0, 0, 0.4);
}
.arena-fallback-card {
    background: linear-gradient(180deg, #3A2A1A, #2A1A0A);
    border: 2px solid #5A4030;
    box-shadow: inset 0 0 30px rgba(200, 100, 30, 0.12), 0 4px 16px rgba(0, 0, 0, 0.4);
}

.casino-fallback-card-icon,
.arena-fallback-card-icon {
    font-size: 42px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.casino-fallback-card-label,
.arena-fallback-card-label {
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 3px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.casino-fallback-card-label { color: #D0C0E0; }
.arena-fallback-card-label  { color: #D8C8B0; }

.casino-fallback-card-desc,
.arena-fallback-card-desc {
    font-size: 11px;
    color: #888;
    letter-spacing: 1px;
}

/* Floating game-selector bar (always visible in arena) */
.arena-game-bar {
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 30;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 10px;
    padding: 5px 10px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.arena-game-bar-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border: 1px solid rgba(255, 180, 80, 0.35);
    border-radius: 8px;
    background: rgba(60, 40, 20, 0.6);
    color: #D8C8B0;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.arena-game-bar-btn:hover {
    background: rgba(100, 70, 30, 0.8);
    border-color: rgba(255, 200, 100, 0.6);
    transform: scale(1.05);
}
.arena-game-bar-btn:active {
    transform: scale(0.97);
}

/* === Arena Scene === */
.arena-scene {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.arena-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(160deg, #1a0a0a 0%, #2a1a0a 40%, #1a0a0a 100%);
    z-index: 0;
}

.arena-lights {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(ellipse at 30% 25%, rgba(255, 100, 50, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 35%, rgba(255, 180, 0, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 75%, rgba(200, 50, 50, 0.06) 0%, transparent 50%);
}

.arena-coin-display {
    right: auto;
    left: 16px;
}

/* ═══════ Dynamic Media Manager ═══════ */
.dyn-media-manager {
    position: relative;
    width: 100%; height: 100%;
    background: linear-gradient(180deg, #1A1E28, #16213e);
    display: flex; flex-direction: column;
    color: #eee;
    font-size: 13px;
}
.dmm-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.dmm-title {
    font-size: 16px; font-weight: bold;
}
.dmm-back-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px; padding: 5px 14px;
    color: #ccc; font-size: 13px; cursor: pointer;
    transition: background 0.2s;
}
.dmm-back-btn:hover { background: rgba(255,255,255,0.15); }

.dmm-tabs {
    display: flex; gap: 2px;
    padding: 8px 16px 0;
    background: rgba(0,0,0,0.15);
}
.dmm-tab {
    flex: 1; padding: 8px 4px;
    background: rgba(255,255,255,0.04);
    border: none; border-radius: 8px 8px 0 0;
    color: #999; font-size: 13px; cursor: pointer;
    transition: all 0.2s; text-align: center;
}
.dmm-tab:hover { color: #ddd; background: rgba(255,255,255,0.08); }
.dmm-tab.active {
    color: #fff; background: rgba(100,160,255,0.15);
    border-bottom: 2px solid #5588cc;
}

.dmm-content {
    flex: 1; overflow-y: auto;
    padding: 12px 16px;
}
.dmm-loading, .dmm-empty {
    text-align: center; color: #888;
    padding: 40px 0; font-size: 14px;
}

.dmm-grid {
    display: grid; gap: 10px;
}
.dmm-image-grid { grid-template-columns: repeat(4, 1fr); }
.dmm-video-grid { grid-template-columns: repeat(3, 1fr); }

.dmm-item {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; overflow: hidden;
    cursor: pointer; transition: all 0.2s;
    position: relative;
}
.dmm-item:hover {
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.dmm-image-item img {
    width: 100%; height: 80px;
    object-fit: cover; display: block;
}
.dmm-item-name {
    padding: 4px 6px; font-size: 11px;
    color: #aaa; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.dmm-video-icon {
    font-size: 32px; text-align: center;
    padding: 16px 0 4px;
}
.dmm-badge {
    position: absolute; top: 4px; right: 4px;
    font-size: 10px; padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255,165,0,0.3); color: #ffa500;
}
.dmm-badge--perm {
    background: rgba(100,200,100,0.3); color: #6c6;
}
.dmm-item-actions {
    display: flex; gap: 4px;
    padding: 4px 6px; justify-content: center;
}
.dmm-item-actions button {
    background: rgba(255,255,255,0.08);
    border: none; border-radius: 4px;
    padding: 3px 8px; cursor: pointer;
    font-size: 12px; transition: background 0.15s;
}
.dmm-item-actions button:hover { background: rgba(255,255,255,0.18); }

.dmm-audio-list {
    display: flex; flex-direction: column; gap: 8px;
}
.dmm-audio-row {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px; padding: 8px 12px;
}
.dmm-audio-name {
    flex: 0 0 auto; font-size: 13px; color: #ccc;
    min-width: 100px;
}
.dmm-audio-row audio {
    flex: 1; height: 32px;
}
.dmm-audio-del {
    background: none; border: none;
    font-size: 14px; cursor: pointer;
    opacity: 0.6; transition: opacity 0.15s;
}
.dmm-audio-del:hover { opacity: 1; }

.dmm-actions {
    display: flex; gap: 8px;
    padding: 10px 16px;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid rgba(255,255,255,0.06);
    justify-content: center;
}
.dmm-action-btn {
    padding: 8px 20px; border: none;
    border-radius: 8px; font-size: 13px;
    cursor: pointer; transition: all 0.2s;
    background: rgba(100,160,255,0.15);
    color: #aaccff;
}
.dmm-action-btn:hover {
    background: rgba(100,160,255,0.25);
}

/* Lightbox */
.dmm-lightbox {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; cursor: pointer;
}
.dmm-lightbox-content {
    max-width: 90%; max-height: 90%;
    text-align: center;
}
.dmm-lightbox-content img {
    max-width: 100%; max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
}
.dmm-lightbox-name {
    color: #aaa; font-size: 13px;
    margin-top: 8px;
}

/* ═══════ Dynamic Interaction Scene ═══════ */
.dyn-interaction-scene {
    position: relative;
    width: 100%; height: 100%;
}

/* ═══════ Town Social UI ═══════ */

/* Dialogue log panel */
#town-log-panel {
    position: absolute;
    top: 50px; right: 8px;
    width: 220px;
    max-height: 320px;
    background: rgba(12,10,25,0.88);
    border: 1px solid rgba(100,160,255,0.15);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: #c8d0ff;
    z-index: 50;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.tlp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(100,160,255,0.12);
    font-size: 12px;
    color: rgba(200,208,255,0.7);
    flex-shrink: 0;
}
.tlp-toggle {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 11px;
    padding: 0 2px;
}
.tlp-body {
    overflow-y: auto;
    flex: 1;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.tlp-body::-webkit-scrollbar { width: 4px; }
.tlp-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
.tlp-entry {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tlp-who {
    color: rgba(160,180,255,0.6);
    font-size: 10px;
    font-weight: 500;
}
.tlp-msg {
    color: #e0e8ff;
    line-height: 1.4;
}
.tlp-entry + .tlp-entry {
    border-top: 1px solid rgba(100,160,255,0.06);
    padding-top: 4px;
}
.tlp-from-player .tlp-who { color: #80c8ff; }
.tlp-from-player .tlp-msg { color: #c8e8ff; }
.tlp-from-npc_3 .tlp-who  { color: #c8a060; }

/* Consensus bar */
#town-consensus-bar {
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(10,8,25,0.75);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 4px 14px;
    z-index: 50;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.tcb-label {
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
}
.tcb-stances {
    display: flex;
    gap: 8px;
}
.tcb-npc {
    font-size: 10px;
    color: #ccc;
    border: 1px solid #888;
    border-radius: 8px;
    padding: 2px 7px;
    text-align: center;
    line-height: 1.3;
    white-space: nowrap;
}
#town-consensus-bar.consensus-reached {
    border-color: #60d060;
    background: rgba(20,50,20,0.85);
}
#town-consensus-bar.consensus-reached .tcb-label {
    color: #90e890;
    font-weight: bold;
}

/* Player input modal */
#town-input-modal {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.45);
    z-index: 100;
}
.tim-inner {
    background: rgba(12,10,25,0.95);
    border: 1px solid rgba(100,160,255,0.2);
    border-radius: 14px;
    padding: 20px 24px;
    width: 340px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.tim-title {
    font-size: 14px;
    color: #c8d0ff;
    margin-bottom: 12px;
}
.tim-text {
    width: 100%;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(100,160,255,0.15);
    border-radius: 8px;
    color: #e0e8ff;
    font-size: 14px;
    padding: 10px 12px;
    resize: none;
    outline: none;
    font-family: inherit;
}
.tim-text:focus { border-color: rgba(100,160,255,0.4); }
.tim-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}
.tim-cancel, .tim-send {
    padding: 7px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 13px;
}
.tim-cancel {
    background: rgba(255,255,255,0.08);
    color: #aaa;
}
.tim-send {
    background: rgba(60,120,220,0.8);
    color: #fff;
}
.tim-send:hover { background: rgba(80,140,240,0.9); }

/* Town Log & Chronicle Panel (inline→CSS consolidation) */
.town-log-panel {
    position: absolute; bottom: 60px; right: 8px; width: 220px; max-height: 45%;
    background: rgba(12,10,25,0.88); border: 1px solid rgba(100,160,255,0.18);
    border-radius: 10px; display: flex; flex-direction: column; z-index: 15;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    overflow: hidden; font-size: 12px;
}
.town-log-tabs {
    display: flex; border-bottom: 1px solid rgba(100,160,255,0.1); flex-shrink: 0;
}
.town-log-tab {
    flex: 1; background: none; border: none; padding: 7px 0; font-size: 11px;
    cursor: pointer; border-bottom: 2px solid transparent;
    color: rgba(180,180,180,0.5); transition: color .15s, border-color .15s;
}
.town-log-tab.active { color: #c0b8e8; border-bottom-color: rgba(120,140,255,0.6); }
.town-log-scroll {
    flex: 1; overflow-y: auto; padding: 6px 8px; min-height: 80px; max-height: 260px;
}
.town-log-scroll::-webkit-scrollbar { width: 4px; }
.town-log-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
.town-log-entry {
    padding: 3px 0; border-bottom: 1px solid rgba(100,160,255,0.05);
}
.town-log-entry .speaker { color: rgba(160,180,255,0.6); font-size: 10px; font-weight: 500; }
.town-log-entry .message { color: #e0e8ff; line-height: 1.4; }
.town-chronicle-entry {
    padding: 4px 0; border-bottom: 1px solid rgba(100,160,255,0.05);
    font-size: 11px; color: rgba(200,210,240,0.7);
}
.town-chronicle-entry .chr-time { color: rgba(160,180,255,0.4); font-size: 9px; }
.town-log-empty {
    color: rgba(150,150,150,0.4); text-align: center; padding: 20px 0; font-size: 11px;
}

/* Town Dashboard (unified with editor deep purple-blue theme) */
.town-dashboard {
    position: absolute; top: 50px; left: 12px; width: 260px; max-height: 60%;
    overflow-y: auto; background: rgba(12,10,25,0.92);
    border: 1px solid rgba(100,160,255,0.2); border-radius: 12px;
    padding: 12px; font-size: 12px; color: rgba(200,210,240,0.9); z-index: 40;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.town-dashboard::-webkit-scrollbar { width: 4px; }
.town-dashboard::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
.town-dashboard-title {
    font-size: 14px; font-weight: 600; margin-bottom: 8px; color: #a0b0ff;
}
.town-dashboard-close {
    position: absolute; top: 8px; right: 8px; background: none; border: none;
    color: rgba(255,255,255,0.5); font-size: 14px; cursor: pointer;
}

/* Town Period Transition Announcement */
.town-period-announce {
    position: absolute; top: 40%; left: 50%; transform: translate(-50%,-50%);
    font-size: 28px; font-weight: 700; color: rgba(200,210,255,0.9);
    text-shadow: 0 2px 12px rgba(0,0,0,0.6); letter-spacing: 4px;
    pointer-events: none; z-index: 50; opacity: 0;
    transition: opacity 1s ease;
}

/* Town Event Toast */
.town-event-toast {
    position: absolute; top: 30%; left: 50%;
    transform: translate(-50%,-50%) scale(0.9);
    background: rgba(12,10,25,0.92);
    border: 1px solid rgba(255,200,80,0.3);
    border-radius: 12px;
    padding: 10px 24px;
    font-size: 14px; font-weight: 600;
    color: rgba(255,220,140,0.95);
    text-shadow: 0 1px 8px rgba(0,0,0,0.5);
    pointer-events: none; z-index: 55;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
    box-shadow: 0 0 20px rgba(255,180,60,0.15);
}

/* Town Reputation Badge */
.town-reputation-badge {
    position: absolute; top: 82px; right: 12px;
    font-size: 10px; color: rgba(200,210,255,0.6);
    background: rgba(12,10,25,0.6);
    padding: 2px 8px; border-radius: 8px;
    pointer-events: none; z-index: 8;
    border: 1px solid rgba(100,160,255,0.08);
}

/* Town Interaction Menu */
.town-interact-menu {
    position: absolute; left: 50%; top: 55%;
    transform: translate(-50%,-50%);
    z-index: 60;
    background: rgba(12,10,25,0.92);
    border: 1px solid rgba(100,160,255,0.2);
    border-radius: 12px;
    padding: 12px 16px;
    min-width: 180px;
    backdrop-filter: blur(8px);
}
.town-interact-menu .menu-title {
    color: #d0c8ff; font-size: 13px; font-weight: 600;
    margin-bottom: 8px; text-align: center;
}
.town-interact-menu .menu-subtitle {
    font-size: 10px; color: rgba(180,190,220,0.5);
    font-weight: 400; margin-top: 2px;
}
.town-interact-btn {
    display: block; width: 100%;
    padding: 7px 12px; margin: 3px 0;
    background: rgba(80,60,140,0.2);
    border: 1px solid rgba(120,100,200,0.15);
    border-radius: 8px;
    color: #c8d0ff; font-size: 12px;
    cursor: pointer; text-align: left;
    transition: background .15s;
}
.town-interact-btn:hover { background: rgba(100,80,180,0.35); }
.town-interact-close {
    text-align: center; margin-top: 6px;
    font-size: 10px; color: rgba(160,160,200,0.4);
    cursor: pointer;
}

/* Town Modal Panel (shared by gift/info panels) */
.town-modal-panel {
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%,-50%);
    z-index: 60;
    background: rgba(12,10,25,0.92);
    border: 1px solid rgba(100,160,255,0.2);
    border-radius: 12px;
    padding: 14px 18px;
    min-width: 200px; max-width: 280px;
}

/* ═══════════════ Pixel Loading Overlay ═══════════════ */
.pixel-loading-overlay {
    position: absolute; inset: 0; z-index: 99;
    background: rgba(5, 3, 15, 0.95);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 14px;
    font-family: system-ui, sans-serif;
    transition: opacity .4s;
}
.pixel-loading-overlay .pixel-loader {
    display: flex; gap: 6px; align-items: flex-end;
}
.pixel-loading-overlay .pixel-block {
    width: 8px; height: 8px;
    background: rgba(160, 120, 255, 0.8);
    image-rendering: pixelated;
    animation: pixelBounce 1s ease-in-out infinite;
}
.pixel-loading-overlay .pixel-block:nth-child(2) { animation-delay: 0.15s; background: rgba(130, 180, 255, 0.8); }
.pixel-loading-overlay .pixel-block:nth-child(3) { animation-delay: 0.3s;  background: rgba(100, 220, 200, 0.8); }
.pixel-loading-overlay .pixel-block:nth-child(4) { animation-delay: 0.45s; background: rgba(255, 200, 100, 0.8); }
.pixel-loading-overlay .pixel-block:nth-child(5) { animation-delay: 0.6s;  background: rgba(255, 130, 160, 0.8); }
.pixel-loading-overlay .pixel-label {
    font-size: 11px; color: rgba(255, 255, 255, 0.3);
    letter-spacing: 2px; text-transform: uppercase;
}
@keyframes pixelBounce {
    0%, 100% { height: 8px;  opacity: 0.4; }
    50%      { height: 24px; opacity: 1; }
}

/* ═══════════════════════════════════════════
   Player Avatar Widget — 玩家分身悬浮组件
   ═══════════════════════════════════════════ */

.paw-container {
    position: absolute;
    z-index: 200;
    width: 180px;
    cursor: grab;
    user-select: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    filter: drop-shadow(0 4px 16px rgba(0,0,0,0.5));
}
.paw-container.paw-visible {
    opacity: 1;
    pointer-events: auto;
}
.paw-container:active { cursor: grabbing; }

.paw-portrait-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.paw-portrait {
    width: 160px;
    height: 235px;
    object-fit: contain;
    object-position: bottom center;
    border-radius: 12px;
    border: none;
    background: transparent;
    transition: transform 0.3s ease;
}
.paw-container:hover .paw-portrait {
    transform: scale(1.05) translateY(-2px);
}
.paw-name {
    margin-top: 4px;
    font-size: 11px;
    color: rgba(255,255,255,0.85);
    text-align: center;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.paw-glow {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 8px;
    background: radial-gradient(ellipse, rgba(110,231,183,0.3), transparent 70%);
    border-radius: 50%;
    animation: pawGlow 2s ease-in-out infinite;
}
@keyframes pawGlow {
    0%, 100% { opacity: 0.4; transform: translateX(-50%) scaleX(1); }
    50%      { opacity: 0.8; transform: translateX(-50%) scaleX(1.3); }
}

/* 呼吸光晕 */
.paw-portrait-wrap::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 120%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(110,231,183,0.15) 0%, rgba(110,231,183,0.05) 40%, transparent 70%);
    animation: pawAura 3s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}
@keyframes pawAura {
    0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }
    50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.1); }
}

/* 漂浮粒子 */
.paw-portrait-wrap::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(1.5px 1.5px at 20% 30%, rgba(110,231,183,0.8), transparent),
        radial-gradient(1px 1px at 70% 15%, rgba(180,200,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 85% 65%, rgba(110,231,183,0.6), transparent),
        radial-gradient(1px 1px at 35% 80%, rgba(180,200,255,0.5), transparent),
        radial-gradient(1px 1px at 55% 50%, rgba(255,255,255,0.4), transparent);
    animation: pawParticles 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}
@keyframes pawParticles {
    0%   { opacity: 0.3; transform: translateY(0); }
    50%  { opacity: 0.8; transform: translateY(-6px); }
    100% { opacity: 0.3; transform: translateY(0); }
}

/* ── Notification badge ── */
.paw-notif-badge {
    position: absolute; top: -4px; right: 10px;
    min-width: 18px; height: 18px; line-height: 18px;
    border-radius: 9px; padding: 0 5px;
    background: #ef4444; color: #fff;
    font-size: 10px; font-weight: 700; text-align: center;
    z-index: 5; pointer-events: none;
}

/* ── Dialog (replaces bubble) ── */
.paw-dialog {
    position: absolute; z-index: 210;
    width: 320px; max-height: 480px;
    background: rgba(15,18,28,0.95);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    backdrop-filter: blur(16px);
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: pawDialogIn 0.25s ease-out;
}
@keyframes pawDialogIn {
    from { opacity: 0; transform: scale(0.9) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.paw-dialog-left::after {
    content: ''; position: absolute;
    right: -6px; top: 50px;
    border: 6px solid transparent;
    border-left-color: rgba(255,255,255,0.12);
}
.paw-dialog-right::after {
    content: ''; position: absolute;
    left: -6px; top: 50px;
    border: 6px solid transparent;
    border-right-color: rgba(255,255,255,0.12);
}

.paw-dialog-header {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.paw-dialog-name {
    font-size: 13px; font-weight: 600;
    color: rgba(110,231,183,0.9);
}
.paw-dialog-close {
    width: 22px; height: 22px;
    border: none; background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.5);
    border-radius: 50%; cursor: pointer;
    font-size: 14px; line-height: 22px; text-align: center;
}
.paw-dialog-close:hover { background: rgba(255,80,80,0.3); color: #fff; }

/* Tabs */
.paw-dialog-tabs {
    display: flex; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.paw-tab {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; gap: 2px;
    padding: 8px 4px; font-family: inherit;
    background: transparent; border: none;
    color: rgba(255,255,255,0.35); cursor: pointer;
    font-size: 10px; transition: all 0.2s;
    border-bottom: 2px solid transparent;
}
.paw-tab:hover { color: rgba(255,255,255,0.6); }
.paw-tab.active {
    color: rgba(110,231,183,0.9);
    border-bottom-color: rgba(110,231,183,0.6);
}
.paw-tab-icon { font-size: 16px; line-height: 1; }
.paw-tab-label { font-weight: 600; letter-spacing: 0.3px; }

/* Body */
.paw-dialog-body {
    flex: 1; overflow-y: auto; min-height: 200px; max-height: 340px;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
}

/* Chat tab */
.paw-chat { display: flex; flex-direction: column; height: 100%; }
.paw-chat-messages {
    flex: 1; overflow-y: auto;
    padding: 10px 14px; min-height: 120px;
}
.paw-msg {
    font-size: 12px; line-height: 1.5;
    padding: 6px 10px; border-radius: 10px;
    margin-bottom: 6px; max-width: 85%;
    word-break: break-word;
}
.paw-msg-sys {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.75);
}
.paw-msg-user {
    background: rgba(110,231,183,0.15);
    color: rgba(255,255,255,0.9);
    margin-left: auto; text-align: right;
}
.paw-msg-loading { opacity: 0.5; animation: pawPulse 1s ease-in-out infinite; }
@keyframes pawPulse { 50% { opacity: 0.2; } }

.paw-chat-input-row {
    display: flex; gap: 6px;
    padding: 8px 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.paw-chat-input {
    flex: 1; padding: 7px 10px; font-size: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; background: rgba(255,255,255,0.04);
    color: #fff; outline: none; font-family: inherit;
}
.paw-chat-input:focus { border-color: rgba(110,231,183,0.4); }
.paw-chat-send {
    width: 32px; height: 32px; border: none;
    background: rgba(110,231,183,0.2); color: #6ee7b7;
    border-radius: 8px; cursor: pointer;
    font-size: 14px; font-weight: 700;
}
.paw-chat-send:hover { background: rgba(110,231,183,0.35); }

/* Config tab */
.paw-config { padding: 16px; }
.paw-config-preview {
    display: flex; justify-content: center; margin-bottom: 14px;
}
.paw-config-avatar {
    width: 80px; height: 120px;
    object-fit: contain; object-position: bottom;
    border-radius: 8px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}
.paw-config-info {
    display: flex; flex-direction: column; gap: 8px;
    margin-bottom: 14px;
}
.paw-config-row {
    display: flex; justify-content: space-between;
    font-size: 12px;
}
.paw-config-label { color: rgba(255,255,255,0.4); }
.paw-config-value { color: rgba(255,255,255,0.8); font-weight: 600; }
.paw-config-edit {
    width: 100%; padding: 9px;
    border: 1px solid rgba(110,231,183,0.3);
    border-radius: 8px; background: rgba(110,231,183,0.08);
    color: rgba(110,231,183,0.9); font-size: 13px;
    font-weight: 600; cursor: pointer; font-family: inherit;
    transition: all 0.2s;
}
.paw-config-edit:hover {
    background: rgba(110,231,183,0.15);
    border-color: rgba(110,231,183,0.5);
}

/* Search tab */
.paw-search { display: flex; flex-direction: column; height: 100%; }
.paw-search-input {
    margin: 10px 12px 0; padding: 8px 12px;
    font-size: 13px; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; background: rgba(255,255,255,0.04);
    color: #fff; outline: none; font-family: inherit;
}
.paw-search-input:focus { border-color: rgba(110,231,183,0.4); }
.paw-search-input::placeholder { color: rgba(255,255,255,0.25); }
.paw-search-results {
    flex: 1; overflow-y: auto; padding: 10px 12px;
}
.paw-search-hint {
    text-align: center; color: rgba(255,255,255,0.25);
    font-size: 12px; padding: 30px 0;
}
.paw-search-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border-radius: 8px;
    cursor: pointer; font-size: 12px;
    color: rgba(255,255,255,0.75);
    transition: all 0.15s;
}
.paw-search-item:hover {
    background: rgba(255,255,255,0.06);
}
.paw-search-icon { font-size: 14px; flex-shrink: 0; }
.paw-search-type {
    margin-left: auto; font-size: 10px;
    color: rgba(255,255,255,0.25); flex-shrink: 0;
}

/* Notifications tab */
.paw-notif-empty {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 8px; padding: 40px 20px;
    color: rgba(255,255,255,0.25); font-size: 13px;
}
.paw-notif-empty-icon { font-size: 28px; opacity: 0.3; }
.paw-notif-list { padding: 8px 12px; }
.paw-notif-item {
    padding: 10px 12px; border-radius: 8px;
    margin-bottom: 4px;
    background: rgba(255,255,255,0.03);
    transition: background 0.15s;
}
.paw-notif-item:hover { background: rgba(255,255,255,0.06); }
.paw-notif-text {
    font-size: 12px; line-height: 1.5;
    color: rgba(255,255,255,0.75);
}
.paw-notif-time {
    font-size: 10px; color: rgba(255,255,255,0.25);
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   Game Feed Scene (.gf-*) — TikTok-style
   ═══════════════════════════════════════════════ */
.gf-scene { position: absolute; inset: 0; overflow: hidden; background: #000; display: flex; align-items: center; justify-content: center; }
.gf-container {
    position: relative; overflow: hidden;
    /* 竖屏约束：PC 上居中 9:16 容器，移动端全屏 */
    width: 100%; height: 100%;
    max-width: calc(100vh * 9 / 16);
    border-radius: 0;
}
@media (min-width: 768px) {
    .gf-container {
        border-radius: 16px;
        box-shadow: 0 0 40px rgba(0,0,0,0.5);
    }
}

/* Viewport — holds the current card */
.gf-viewport { position: absolute; inset: 0; }
.gf-card {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.gf-card-bg-canvas {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}
.gf-card-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.65) 0%, transparent 35%, transparent 65%, rgba(0,0,0,0.3) 100%);
    pointer-events: none; z-index: 2;
}
.gf-engine-container {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    overflow: hidden;
}

/* Slide transitions */
.gf-card-enter-up   { transform: translateY(100%); opacity: 0; }
.gf-card-enter-down { transform: translateY(-100%); opacity: 0; }
.gf-card-exit-up    { transform: translateY(-100%); opacity: 0; }
.gf-card-exit-down  { transform: translateY(100%); opacity: 0; }

/* Play button */
.gf-play-btn {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: 10px;
    padding: 14px 36px;
    border: 2px solid rgba(255,255,255,0.8);
    border-radius: 40px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    color: #fff; font-size: 16px; font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.gf-play-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
    border-color: #fff;
}
.gf-play-icon { font-size: 22px; }


/* Right action bar — TikTok style */
.gf-action-bar {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%); z-index: 10;
    display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.gf-ab-btn {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: none; color: #fff; cursor: pointer;
    transition: transform 0.2s ease;
}
.gf-ab-btn:hover { transform: scale(1.1); }
.gf-ab-btn:active { transform: scale(1.25); }
.gf-ab-icon {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.12);
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}
.gf-ab-icon svg { width: 22px; height: 22px; fill: #fff; }
.gf-ab-btn:hover .gf-ab-icon { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.25); }
.gf-ab-count { font-size: 11px; color: rgba(255,255,255,0.55); font-weight: 500; }
.gf-ab-liked .gf-ab-icon { background: rgba(255,60,80,0.2); border-color: rgba(255,60,80,0.4); }
.gf-ab-liked .gf-ab-icon svg { fill: #ff3c50; }
.gf-ab-liked .gf-ab-count { color: rgba(255,60,80,0.8); }

/* Bottom nav arrows — appended below action bar */
.gf-nav-bar {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    margin-top: 14px;
}
.gf-nav-btn {
    width: 44px; height: 44px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(8px);
    color: #fff; font-size: 15px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, transform 0.15s;
}
.gf-nav-btn:hover { background: rgba(255,255,255,0.15); }
.gf-nav-btn:active { transform: scale(0.9); }

/* Bottom info overlay */
.gf-info {
    position: absolute; left: 16px; bottom: 24px; right: 80px; z-index: 10;
}
.gf-info-name {
    font-size: 20px; font-weight: 700; color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    margin-bottom: 6px;
}
.gf-info-tags {
    display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap;
}
.gf-tag {
    padding: 2px 10px; border-radius: 12px;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.7);
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
}
.gf-info-desc {
    font-size: 13px; color: rgba(255,255,255,0.8);
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Back button */
.gf-back-btn {
    position: absolute; top: 12px; left: 12px; z-index: 100;
    width: 36px; height: 36px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff; font-size: 18px; cursor: pointer;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.gf-back-btn:hover { background: rgba(255,255,255,0.15); }

/* Counter */
.gf-counter {
    position: absolute; top: 14px; right: 14px; z-index: 10;
    font-size: 12px; color: rgba(255,255,255,0.5);
}

/* Game loading overlay */
.gf-loading {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
}
.gf-loading-inner { text-align: center; }
.gf-loading-inner .pz-spinner,
.gf-loading-inner::before {
    content: ''; display: block;
    width: 32px; height: 32px; margin: 0 auto 10px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: gf-spin 0.7s linear infinite;
}
@keyframes gf-spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════
   Character Feed — portrait & chat overlay (.cf-*)
   ═══════════════════════════════════════════════ */
.cf-portrait {
    position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    height: 85%; width: auto; max-width: none;
    object-fit: contain; object-position: bottom center;
    z-index: 1; pointer-events: none;
    filter: drop-shadow(0 4px 30px rgba(0,0,0,0.6));
}


/* ═══════════════════════════════════════════════
   Friends Scene (.fr-*)
   ═══════════════════════════════════════════════ */
.fr-scene {
    position: absolute; inset: 0; overflow: hidden;
    background: radial-gradient(ellipse at 30% 20%, #16122a, #0c0a14 65%);
}

/* ── Body: two columns ── */
.fr-body {
    display: flex; height: 100%; overflow: hidden;
}

/* ── Left: contacts ── */
.fr-left {
    width: 240px; flex-shrink: 0; overflow-y: auto;
    padding-top: 52px; /* space for overlay back btn */
    background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.1) 100%);
    border-right: 1px solid rgba(255,255,255,0.06);
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.06) transparent;
}
.fr-left::-webkit-scrollbar { width: 3px; }
.fr-left::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

/* Tabs: Agent / Real */
.fr-tabs {
    display: flex; gap: 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.15);
}
.fr-tab {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
    padding: 10px 0; background: none; border: none; border-bottom: 2px solid transparent;
    color: rgba(255,255,255,0.35); font-size: 12px; font-weight: 500; cursor: pointer;
    transition: all 0.15s;
}
.fr-tab:hover { color: rgba(255,255,255,0.55); background: rgba(255,255,255,0.02); }
.fr-tab-active {
    color: rgba(255,255,255,0.9); border-bottom-color: #7755dd;
}
.fr-tab-count {
    font-size: 9px; padding: 1px 6px; border-radius: 8px;
    background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.3);
    font-weight: 600;
}
.fr-tab-active .fr-tab-count {
    background: rgba(119,85,221,0.2); color: rgba(170,140,255,0.8);
}

/* Search */
.fr-search {
    position: sticky; top: 0; z-index: 2;
    padding: 8px 10px; display: flex; align-items: center; gap: 6px;
    background: rgba(12,10,20,0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.fr-search-icon { flex-shrink: 0; }
.fr-search-input {
    flex: 1; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; padding: 5px 10px; color: #ccc; font-size: 11px;
    outline: none; transition: all 0.15s;
}
.fr-search-input::placeholder { color: rgba(255,255,255,0.2); }
.fr-search-input:focus { border-color: rgba(119,85,221,0.4); background: rgba(255,255,255,0.08); box-shadow: 0 0 0 2px rgba(119,85,221,0.1); }

.fr-no-result {
    padding: 24px 14px; text-align: center;
    color: rgba(255,255,255,0.25); font-size: 12px;
}
.fr-empty-tab {
    padding: 30px 14px; text-align: center;
    color: rgba(255,255,255,0.25); font-size: 11px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.fr-empty-tab-icon { font-size: 28px; opacity: 0.4; }
.fr-list-area { }

/* Group */
.fr-group { padding-bottom: 4px; }
.fr-group-header {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 14px 4px; font-size: 10px; color: rgba(255,255,255,0.35);
    letter-spacing: 0.5px; text-transform: uppercase;
}
.fr-group-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 6px currentColor; }
.fr-group-label { font-weight: 600; }
.fr-group-count { margin-left: auto; color: rgba(255,255,255,0.2); font-size: 9px; }

/* Items */
.fr-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px; cursor: pointer; transition: all 0.12s;
    border-left: 3px solid transparent;
}
.fr-item:hover { background: rgba(255,255,255,0.03); }
.fr-item-active { background: rgba(119,85,221,0.08); border-left-color: var(--tier-color, #888); }

.fr-item-avatar {
    width: 38px; height: 38px; border-radius: 10px; object-fit: cover; object-position: top center;
    border: 1.5px solid rgba(255,255,255,0.08); flex-shrink: 0;
    background: rgba(255,255,255,0.03);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.fr-item-info { flex: 1; min-width: 0; }
.fr-item-name {
    font-size: 13px; color: #ddd; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fr-item-loc { font-size: 10px; color: rgba(255,255,255,0.25); margin-top: 2px; }

/* ═══ Right: profile + feed ═══ */
.fr-right {
    flex: 1; overflow-y: auto; padding: 20px 24px;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.06) transparent;
}

.fr-profile {
    max-width: 560px; margin: 0 auto;
}

.fr-profile-content {
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 14px;
    padding: 20px;
    display: flex; flex-direction: column; gap: 16px;
    backdrop-filter: blur(4px);
}

/* Top row: portrait + info */
.fr-profile-top { display: flex; gap: 20px; }

.fr-profile-portrait {
    width: 170px; flex-shrink: 0;
    display: flex; align-items: flex-end; justify-content: center;
    background: radial-gradient(ellipse at 50% 80%, rgba(119,85,221,0.08), transparent 70%);
    border-radius: 12px;
    padding: 8px;
}
.fr-profile-portrait img {
    max-width: 100%; max-height: 280px; object-fit: contain;
    filter: drop-shadow(0 6px 20px rgba(0,0,0,0.7));
}

.fr-profile-header {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 6px;
    padding-top: 8px;
}
.fr-profile-name { font-size: 22px; color: #fff; font-weight: 700; line-height: 1.2; }
.fr-profile-tier {
    display: inline-block; width: fit-content;
    font-size: 11px; padding: 2px 10px; border-radius: 10px;
    background: color-mix(in srgb, var(--tier-color) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--tier-color) 25%, transparent);
    color: var(--tier-color); font-weight: 500;
}
.fr-profile-loc { font-size: 11px; color: rgba(255,255,255,0.4); }
.fr-profile-bio {
    font-size: 12px; color: rgba(255,255,255,0.4); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.fr-profile-traits { display: flex; flex-wrap: wrap; gap: 4px; }
.fr-trait {
    font-size: 10px; padding: 2px 8px; border-radius: 8px;
    background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.45);
    border: 1px solid rgba(255,255,255,0.06);
}

/* Affection */
.fr-profile-aff {}
.fr-profile-aff-header {
    display: flex; justify-content: space-between;
    font-size: 11px; color: rgba(255,255,255,0.5); margin-bottom: 5px;
}
.fr-profile-aff-next { color: rgba(255,255,255,0.25); font-size: 10px; }
.fr-profile-aff-bar { height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.fr-profile-aff-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, color-mix(in srgb, var(--tier-color) 70%, #333), var(--tier-color)); transition: width 0.4s; }

/* Actions */
.fr-profile-actions { display: flex; gap: 8px; }
.fr-act-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
    padding: 9px 0; border-radius: 10px; border: none; cursor: pointer;
    font-size: 12px; font-weight: 500; color: #fff; transition: all 0.12s;
}
.fr-act-btn:active { transform: scale(0.97); }
.fr-act-chat {
    background: linear-gradient(135deg, #6633cc, #4455dd);
    box-shadow: 0 3px 12px rgba(102,51,204,0.3);
}
.fr-act-chat:hover { box-shadow: 0 4px 18px rgba(102,51,204,0.45); transform: translateY(-1px); }
.fr-act-secondary {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
}
.fr-act-secondary:hover { background: rgba(255,255,255,0.1); }

/* ── Social feed ── */
.fr-feed {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 12px;
}
.fr-feed-title {
    font-size: 13px; color: rgba(255,255,255,0.55); font-weight: 600;
    margin-bottom: 10px;
}
.fr-feed-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 8px 0; font-size: 12px; color: rgba(255,255,255,0.5);
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.fr-feed-item:last-child { border-bottom: none; }
.fr-feed-icon { flex-shrink: 0; font-size: 14px; line-height: 1.3; }
.fr-feed-text { flex: 1; line-height: 1.4; }
.fr-feed-time { flex-shrink: 0; font-size: 10px; color: rgba(255,255,255,0.2); }
.fr-feed-muted { opacity: 0.35; }

/* ── Empty ── */
.fr-empty {
    padding: 30px 14px; text-align: center;
    color: rgba(255,255,255,0.25); font-size: 12px;
}
.fr-empty-detail {
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    color: rgba(255,255,255,0.35); font-size: 13px; padding: 50px 20px;
}
.fr-empty-icon { font-size: 44px; opacity: 0.5; }
.fr-empty-text { max-width: 200px; line-height: 1.6; }
.fr-empty-btn {
    padding: 9px 24px; border-radius: 10px; border: none; cursor: pointer;
    background: linear-gradient(135deg, #6633cc, #4455dd); color: #fff;
    font-size: 12px; font-weight: 500; box-shadow: 0 3px 12px rgba(102,51,204,0.3);
    transition: all 0.15s;
}
.fr-empty-btn:hover { box-shadow: 0 4px 18px rgba(102,51,204,0.45); transform: translateY(-1px); }


/* ═══════════════════════════════════════════════
   Achieve Scene (.ach-*) — Kenney UI Adventure Pack
   ═══════════════════════════════════════════════ */
.ach-scene {
    position: absolute; inset: 0; overflow: hidden;
    background: radial-gradient(ellipse at 35% 15%, #1e1635 0%, #110e1e 50%, #0a0812 100%);
}

.ach-body { display: flex; height: 100%; overflow: hidden; }

/* ══ Left: player card ══ */
.ach-left {
    width: 260px; flex-shrink: 0; overflow-y: auto;
    padding: 56px 14px 16px; /* top space for overlay back btn */
    background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.12) 100%);
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.06) transparent;
}

/* Player card */
.ach-player-card {
    width: 100%; padding: 16px 12px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(204,170,68,0.06) 0%, rgba(204,170,68,0.02) 100%);
    border: 1px solid rgba(204,170,68,0.12);
}

.ach-player-portrait {
    width: 140px; display: flex; align-items: flex-end; justify-content: center;
    background: radial-gradient(ellipse at 50% 80%, rgba(204,170,68,0.08), transparent 70%);
    border-radius: 10px; padding: 4px;
}
.ach-player-portrait img {
    max-width: 100%; max-height: 190px; object-fit: contain;
    filter: drop-shadow(0 6px 20px rgba(0,0,0,0.7));
}

.ach-player-name { font-size: 18px; color: #fff; font-weight: 700; text-align: center; }

.ach-player-title-badge {
    display: flex; align-items: center; gap: 5px;
    font-size: 12px; color: #ddbb55; font-weight: 600;
    background: rgba(204,170,68,0.08); padding: 2px 10px; border-radius: 10px;
}
.ach-title-star { width: 14px; height: 14px; }

/* Overall progress */
.ach-overall-section { width: 100%; padding: 0 4px; }
.ach-overall-label { font-size: 10px; color: rgba(255,255,255,0.4); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.ach-overall-wrap { display: flex; align-items: center; gap: 8px; }
.ach-overall-bar {
    flex: 1; height: 10px; border-radius: 5px; overflow: hidden;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
}
.ach-overall-fill {
    height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, #886622, #ddbb55);
    box-shadow: 0 0 8px rgba(204,170,68,0.3);
    transition: width 0.5s ease-out;
}
.ach-overall-pct { font-size: 14px; color: #ddbb55; font-weight: 700; min-width: 36px; }

/* Stats with Kenney hexagon backgrounds */
.ach-player-stats { display: flex; gap: 8px; width: 100%; justify-content: center; }
.ach-stat {
    position: relative; width: 64px; height: 64px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ach-stat-bg {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: contain; opacity: 0.75;
}
.ach-stat-val { position: relative; font-size: 15px; color: #fff; font-weight: 700; z-index: 1; text-shadow: 0 1px 4px rgba(0,0,0,0.5); }
.ach-stat-label { position: relative; font-size: 9px; color: rgba(255,255,255,0.55); z-index: 1; }

/* Category nav */
.ach-cat-nav { width: 100%; display: flex; flex-direction: column; gap: 2px; }
.ach-cat-nav-title {
    font-size: 11px; color: rgba(255,255,255,0.35); font-weight: 600;
    padding: 4px 10px 6px; text-transform: uppercase; letter-spacing: 0.5px;
    display: flex; align-items: center; gap: 6px;
}
.ach-cat-nav-total { color: #ddbb55; font-weight: 700; }
.ach-cat-row {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 12px; border-radius: 8px; cursor: pointer;
    transition: all 0.12s;
    border-left: 3px solid transparent;
}
.ach-cat-row:hover { background: rgba(255,255,255,0.04); }
.ach-cat-active { background: rgba(255,255,255,0.06); border-left-color: var(--cat-color); box-shadow: inset 0 0 12px rgba(255,255,255,0.02); }
.ach-cat-icon { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.ach-cat-icon svg { width: 16px; height: 16px; fill: var(--cat-color, rgba(255,255,255,0.5)); }
.ach-cat-name { flex: 1; font-size: 13px; color: rgba(255,255,255,0.6); font-weight: 500; }
.ach-cat-active .ach-cat-name { color: rgba(255,255,255,0.95); }
.ach-cat-pct { font-size: 11px; color: rgba(255,255,255,0.25); font-weight: 600; }
.ach-cat-active .ach-cat-pct { color: var(--cat-color); }

/* ══ Right: achievement list ══ */
.ach-right {
    flex: 1; overflow-y: auto; padding: 20px 24px;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.06) transparent;
}

.ach-cat-header {
    display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
    padding-bottom: 12px; border-bottom: 2px solid color-mix(in srgb, var(--cat-color) 35%, transparent);
}
.ach-cat-header-icon { width: 28px; height: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.ach-cat-header-icon svg { width: 24px; height: 24px; fill: var(--cat-color, #fff); }
.ach-cat-header-name { font-size: 18px; color: #fff; font-weight: 700; flex: 1; }
.ach-cat-header-progress { font-size: 13px; color: var(--cat-color); font-weight: 600; }

.ach-list { display: flex; flex-direction: column; gap: 8px; }

/* Achievement item */
.ach-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px; border-radius: 10px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    transition: all 0.15s;
}
.ach-item:hover { background: rgba(255,255,255,0.04); transform: translateX(2px); }
.ach-done {
    background: linear-gradient(135deg, rgba(102,170,68,0.06) 0%, rgba(102,170,68,0.02) 100%);
    border-color: rgba(102,170,68,0.15);
}

/* Badge with Kenney hexagon */
.ach-item-badge {
    position: relative; width: 48px; height: 48px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.ach-badge-bg {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
}
.ach-badge-icon { position: relative; z-index: 1; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.ach-badge-icon svg { width: 20px; height: 20px; fill: #fff; }
.ach-locked .ach-badge-icon { opacity: 0.3; }
.ach-locked .ach-badge-icon svg { fill: rgba(255,255,255,0.4); }
.ach-done .ach-badge-icon svg { fill: #fff; filter: drop-shadow(0 0 4px rgba(102,170,68,0.5)); }

/* Item body */
.ach-item-body { flex: 1; min-width: 0; }
.ach-item-top { display: flex; align-items: center; gap: 8px; }
.ach-item-name { font-size: 14px; color: #ddd; font-weight: 600; }
.ach-locked .ach-item-name { color: rgba(255,255,255,0.3); }
.ach-item-check { width: 18px; height: 18px; }
.ach-item-desc { font-size: 11px; color: rgba(255,255,255,0.3); margin: 3px 0 6px; }

/* Progress bar */
.ach-item-progress { display: flex; align-items: center; gap: 8px; }
.ach-item-bar {
    flex: 1; height: 6px; border-radius: 3px; overflow: hidden;
    background: rgba(255,255,255,0.06);
}
.ach-item-fill {
    height: 100%; border-radius: 3px;
    background: var(--cat-color, #5533bb);
    transition: width 0.4s ease-out;
}
.ach-done .ach-item-fill { box-shadow: 0 0 6px color-mix(in srgb, var(--cat-color) 50%, transparent); }
.ach-locked .ach-item-fill { background: rgba(255,255,255,0.08); }
.ach-item-count {
    font-size: 11px; color: rgba(255,255,255,0.3); font-weight: 600;
    min-width: 38px; text-align: right;
}
.ach-done .ach-item-count { color: #88cc66; }


/* ═══════════════════════════════════════════════
   Onboarding Scene (.onb-*)
   ═══════════════════════════════════════════════ */
.onb-scene {
    position: absolute; inset: 0;
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 80%, #1e1250 0%, #0e0820 60%, #080412 100%);
}
.onb-bg {
    position: absolute; inset: 0;
    background: radial-gradient(circle at 30% 60%, rgba(90,50,180,0.2) 0%, transparent 55%),
                radial-gradient(circle at 70% 40%, rgba(40,60,200,0.12) 0%, transparent 50%),
                radial-gradient(circle at 50% 90%, rgba(80,40,160,0.15) 0%, transparent 40%);
    pointer-events: none;
}
.onb-content {
    position: relative; z-index: 1;
    display: flex; align-items: flex-end;
    width: 100%; height: 100%;
    max-width: 1100px; margin: 0 auto;
    padding: 0 24px;
}
.onb-elser {
    flex: 0 0 38%; max-width: 400px;
    display: flex; align-items: flex-end; justify-content: center;
    height: 100%;
    padding-top: 60px;
    animation: onb-fadeInUp 0.8s ease both;
}
.onb-elser-img {
    width: 100%; max-height: 82vh;
    object-fit: contain; object-position: bottom;
    filter: drop-shadow(0 0 30px rgba(140,100,255,0.2));
    margin-bottom: -10px;
}
.onb-panel {
    flex: 1; min-width: 0;
    display: flex; align-items: center; justify-content: center;
    height: 100%;
    padding: 40px 0 60px;
    animation: onb-fadeIn 0.6s ease 0.3s both;
}
.onb-panel-inner {
    width: 100%; max-width: 460px;
}

/* Dialogue */
.onb-dialogue { margin-bottom: 24px; }
.onb-dialogue-text {
    color: rgba(255,255,255,0.88);
    font-size: 17px; line-height: 1.7;
    min-height: 48px;
}

/* Chat UI */
.onb-chat {
    display: flex; flex-direction: column;
    height: 100%; max-height: 420px;
    animation: onb-fadeIn 0.4s ease both;
}
.onb-chat-messages {
    flex: 1; overflow-y: auto;
    display: flex; flex-direction: column; gap: 10px;
    padding: 8px 0 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.onb-bubble {
    max-width: 85%; padding: 10px 14px;
    border-radius: 14px; font-size: 14px; line-height: 1.6;
    animation: onb-fadeIn 0.3s ease both;
    word-break: break-word;
}
.onb-bubble-elser {
    align-self: flex-start;
    background: rgba(140,100,255,0.15);
    color: rgba(255,255,255,0.88);
    border-bottom-left-radius: 4px;
}
.onb-bubble-user {
    align-self: flex-end;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.9);
    border-bottom-right-radius: 4px;
}
.onb-typing {
    display: flex; gap: 4px; padding: 12px 16px;
}
.onb-typing span {
    width: 6px; height: 6px; border-radius: 50%;
    background: rgba(255,255,255,0.3);
    animation: onb-typingDot 1.2s ease-in-out infinite;
}
.onb-typing span:nth-child(2) { animation-delay: 0.2s; }
.onb-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes onb-typingDot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-4px); opacity: 0.8; }
}
.onb-chat-input-row {
    display: flex; gap: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.onb-chat-input {
    flex: 1; padding: 10px 14px; font-size: 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: #fff; outline: none; font-family: inherit;
    transition: border-color 0.2s;
}
.onb-chat-input:focus { border-color: rgba(140,100,255,0.5); }
.onb-chat-send { padding: 10px 20px; flex-shrink: 0; }
.onb-create-ready {
    margin-top: 10px; width: 100%;
    animation: onb-fadeIn 0.4s ease both;
}

/* Buttons */
.onb-btn {
    display: inline-block; padding: 11px 28px; font-size: 14px; font-weight: 700;
    border-radius: 10px; border: none; cursor: pointer;
    transition: all 0.2s; font-family: inherit;
}
.onb-btn-primary {
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    color: #fff;
}
.onb-btn-primary:hover { filter: brightness(1.15); transform: translateY(-1px); }
.onb-btn-secondary {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.12);
}
.onb-btn-secondary:hover { background: rgba(255,255,255,0.14); }
.onb-btn-muted {
    background: transparent; color: rgba(255,255,255,0.4);
    font-size: 13px; font-weight: 400; padding: 8px 16px;
}
.onb-btn-muted:hover { color: rgba(255,255,255,0.7); }
.onb-btn-small { padding: 6px 16px; font-size: 12px; }
.onb-btn-enter { font-size: 16px; padding: 14px 48px; margin-top: 32px; }

/* Generating spinner */
.onb-generating {
    display: flex; align-items: center; gap: 10px;
    color: rgba(255,255,255,0.5); font-size: 13px;
    margin-bottom: 16px;
}
.onb-spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.15);
    border-top-color: rgba(140,100,255,0.7);
    border-radius: 50%;
    animation: onb-spin 0.8s linear infinite;
}
.onb-spinner-small {
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.15);
    border-top-color: rgba(140,100,255,0.7);
    border-radius: 50%;
    animation: onb-spin 0.8s linear infinite;
}
.onb-wait-actions { animation: onb-fadeIn 0.4s ease both; }

/* Result display */
.onb-result { animation: onb-fadeIn 0.5s ease both; text-align: center; }
.onb-result-portrait {
    width: 200px; height: 340px; margin: 0 auto 16px;
    border-radius: 12px; overflow: hidden;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
}
.onb-result-img {
    width: 100%; height: 100%;
    object-fit: contain; object-position: bottom;
    animation: onb-breathe 3s ease-in-out infinite;
}
.onb-result-error, .onb-result-loading {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    width: 100%; height: 100%;
    color: rgba(255,255,255,0.4); font-size: 13px; padding: 20px;
}
.onb-upload-label { cursor: pointer; }
.onb-result-name {
    font-size: 20px; font-weight: 700;
    color: rgba(255,255,255,0.9); margin-bottom: 4px;
}
.onb-result-style {
    font-size: 12px; color: rgba(140,100,255,0.7); margin-bottom: 16px;
}
.onb-result-actions { display: flex; gap: 12px; justify-content: center; align-items: center; }
.onb-regen-exhausted { font-size: 12px; color: rgba(255,255,255,0.3); }

/* Welcome */
.onb-welcome {
    text-align: center;
    animation: onb-fadeIn 0.6s ease both;
}
.onb-welcome-mode .onb-elser-img {
    filter: drop-shadow(0 0 50px rgba(140,100,255,0.35));
}
.onb-welcome-text {
    font-size: 32px; font-weight: 800;
    background: linear-gradient(135deg, #c4b5fd, #93c5fd, #c4b5fd);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}
.onb-welcome-sub {
    font-size: 15px; color: rgba(255,255,255,0.55);
    margin-bottom: 8px;
}
.onb-welcome-particles {
    position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.onb-particle {
    position: absolute; bottom: -10px;
    width: 4px; height: 4px; border-radius: 50%;
    background: rgba(140,100,255,0.5);
    animation: onb-rise linear infinite;
}
.onb-particle:nth-child(even) { background: rgba(100,180,255,0.4); width: 3px; height: 3px; }
.onb-particle:nth-child(3n)   { background: rgba(200,140,255,0.3); width: 5px; height: 5px; }

/* Game overlay */
.onb-game-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: #000;
    display: flex; align-items: center; justify-content: center;
}
.onb-game-close {
    position: absolute; top: 12px; left: 12px;
    padding: 6px 14px; font-size: 13px;
    background: rgba(20,15,40,0.65); color: rgba(255,255,255,0.75);
    border: 1px solid rgba(255,255,255,0.2); border-radius: 8px;
    cursor: pointer; z-index: 1;
    backdrop-filter: blur(6px);
}
.onb-game-indicator {
    position: absolute; top: 12px; right: 12px;
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; font-size: 12px;
    background: rgba(20,15,40,0.65); color: rgba(255,255,255,0.5);
    border-radius: 8px; backdrop-filter: blur(6px);
}
.onb-game-banner {
    position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px; border-radius: 12px;
    background: rgba(20,15,40,0.85); color: rgba(255,255,255,0.9);
    border: 1px solid rgba(140,100,255,0.3);
    backdrop-filter: blur(8px);
    animation: onb-fadeIn 0.4s ease both;
    font-size: 14px;
}

/* Animations */
@keyframes onb-fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes onb-fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes onb-spin {
    to { transform: rotate(360deg); }
}
@keyframes onb-breathe {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.015); }
}
@keyframes onb-rise {
    0%   { transform: translateY(0) scale(1);   opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 0.5; }
    100% { transform: translateY(-100vh) scale(0.3); opacity: 0; }
}

/* Quiz */
.onb-quiz { animation: onb-fadeIn 0.4s ease both; }
.onb-quiz-progress {
    width: 100%; height: 4px; border-radius: 2px;
    background: rgba(255,255,255,0.08); margin-bottom: 8px; overflow: hidden;
}
.onb-quiz-bar {
    height: 100%; border-radius: 2px;
    background: linear-gradient(90deg, #7c3aed, #3b82f6);
    transition: width 0.4s ease;
}
.onb-quiz-step {
    font-size: 11px; color: rgba(255,255,255,0.3);
    text-align: right; margin-bottom: 16px;
}
.onb-quiz-opts {
    display: flex; flex-direction: column; gap: 10px;
}
.onb-quiz-opt {
    padding: 14px 18px; font-size: 14px; line-height: 1.5;
    border-radius: 12px; border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.85);
    cursor: pointer; text-align: left; font-family: inherit;
    transition: all 0.2s;
}
.onb-quiz-opt:hover {
    background: rgba(140,100,255,0.12); border-color: rgba(140,100,255,0.3);
    transform: translateX(4px);
}
.onb-quiz-opt-selected {
    background: rgba(140,100,255,0.2); border-color: rgba(140,100,255,0.5);
    color: #fff;
}

/* Profile Setup */
.onb-profile { animation: onb-fadeIn 0.4s ease both; }
.onb-profile-form { margin-top: 20px; }
.onb-field { margin-bottom: 16px; }
.onb-label {
    display: block; font-size: 12px; font-weight: 600;
    color: rgba(255,255,255,0.5); margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: 1px;
}
.onb-input {
    width: 100%; padding: 10px 14px; font-size: 15px;
    border-radius: 10px; border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06); color: #fff;
    outline: none; font-family: inherit;
    transition: border-color 0.2s;
}
.onb-input:focus { border-color: rgba(140,100,255,0.5); }
.onb-input::placeholder { color: rgba(255,255,255,0.25); }

.onb-gender-row { display: flex; gap: 10px; }
.onb-gender-btn {
    flex: 1; padding: 10px; font-size: 14px; font-weight: 600;
    border-radius: 10px; border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.6);
    cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.onb-gender-btn:hover { background: rgba(255,255,255,0.08); }
.onb-gender-btn.active {
    background: rgba(140,100,255,0.15); border-color: rgba(140,100,255,0.4);
    color: #fff;
}

/* Style tabs */
.onb-style-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.onb-style-tab {
    padding: 6px 14px; font-size: 12px; font-weight: 600;
    border-radius: 8px; border: 1px solid rgba(255,255,255,0.08);
    background: transparent; color: rgba(255,255,255,0.4);
    cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.onb-style-tab:hover { color: rgba(255,255,255,0.7); }
.onb-style-tab.active {
    background: rgba(140,100,255,0.12); border-color: rgba(140,100,255,0.3);
    color: #fff;
}

/* Portrait grid */
.onb-portrait-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 10px; max-height: 320px; overflow-y: auto;
    padding: 4px; margin-bottom: 12px;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.onb-portrait-cell {
    position: relative; border-radius: 10px; overflow: hidden;
    background: rgba(255,255,255,0.03); border: 2px solid transparent;
    cursor: pointer; transition: all 0.2s;
    aspect-ratio: 9 / 16;
}
.onb-portrait-cell:hover {
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.onb-portrait-cell.selected {
    border-color: rgba(140,100,255,0.7);
    box-shadow: 0 0 16px rgba(140,100,255,0.3);
}
.onb-portrait-cell img {
    width: 100%; height: 100%;
    object-fit: cover; object-position: top;
}
.onb-portrait-name {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 16px 4px 4px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    font-size: 9px; color: rgba(255,255,255,0.7);
    text-align: center; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.onb-upload-btn {
    width: 100%; text-align: center; cursor: pointer;
    margin-top: 4px;
}
.onb-confirm-btn {
    width: 100%; margin-top: 8px;
}
.onb-confirm-btn:disabled {
    opacity: 0.4; cursor: not-allowed;
    filter: none; transform: none;
}

/* Responsive */
@media (max-width: 700px) {
    .onb-content { flex-direction: column; align-items: center; padding: 0 16px; }
    .onb-elser { flex: 0 0 auto; max-width: 200px; height: auto; margin-top: 20px; }
    .onb-elser-img { max-height: 30vh; }
    .onb-panel { padding: 16px 0 40px; align-items: flex-start; }
    .onb-panel-inner { max-width: 100%; }
    .onb-welcome-text { font-size: 24px; }
    .onb-portrait-grid { grid-template-columns: repeat(3, 1fr); max-height: 240px; }
}
