@font-face {
    font-family: 'IBM Plex Sans';
    src: url('./Graphics/Fonts/IBMPlexSans-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBM Plex Sans';
    src: url('./Graphics/Fonts/IBMPlexSans-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBM Plex Sans';
    src: url('./Graphics/Fonts/IBMPlexSans-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBM Plex Sans';
    src: url('./Graphics/Fonts/IBMPlexSans-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --font-ui-info: 'IBM Plex Sans', 'Segoe UI', Tahoma, Arial, sans-serif;
    --font-ui-display: 'IBM Plex Sans', 'Segoe UI', Tahoma, Arial, sans-serif;
}

/* Basic styles for the Idle Gatherer popout menus and layout */
.body, body { font-family: var(--font-ui-info); margin: 0; font-weight: 600; }
.layout { display: flex; min-height: 100vh; flex-direction: column; }
.content { flex: 1; padding: 20px; box-sizing: border-box; }
.game-container { max-width: 900px; margin: 0 auto; position: relative; }
.actions { display: flex; flex-direction: column; gap: 12px; }
.action-card { border: 1px solid #ddd; padding: 12px; border-radius: 6px; background:#fff; }
.action-card button { margin-top:8px; }
.progress-bar-container { background: #eee; width: 100%; height: 16px; border-radius: 8px; overflow: hidden; }
#progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg,#6b8cff,#4aa3ff); }

/* Overlay for popouts */
.menu-overlay { display: none; }
.menu-overlay:not(.hidden) {
    position: fixed;
    inset: 0;
    display: block;
    background: transparent;
    z-index: 120;
}

/* Convert menu popouts into centered modal panels */
.menu-popout {
    left: 50%;
    transform: translateX(-50%);
    width: min(1100px, 96%);
    max-height: calc(100vh - 150px);
    overflow: auto;
    border-radius: 8px;
    box-shadow: none;
    display: block;
    margin: 0;
    z-index: 130;
}

/* Make woodcutting/mining/foraging menus match app background */
#menu-woodcutting, #menu-mining, #menu-foraging { background: #fafafa; }

/* Ensure menu internals don't show white boxes */
.menu-popout header,
.menu-popout footer { background: transparent; box-shadow: none; border: none; }
.menu-popout .menu-body { padding: 8px 12px; }

.menu-popout header { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; border-bottom:none; }
.menu-body { padding: 12px 16px; max-height: 240px; overflow:auto; }
.menu-popout footer { padding: 12px 16px; border-top: none; display:flex; justify-content:flex-end; }
.close-btn { background:none; border:0; font-size:16px; cursor:pointer; }

/* Header buttons container for skill menus */
.header-buttons { display: flex; gap: 8px; align-items: center; }

/* Menu tabs styling */
.menu-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 16px 0;
    background: transparent;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: relative;
    z-index: 5;
    pointer-events: auto;
}

.menu-tab {
    background: rgba(255,255,255,0.05);
    border: none;
    border-bottom: 2px solid transparent;
    color: #aaa;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.2s;
    border-radius: 4px 4px 0 0;
    position: relative;
    z-index: 6;
    pointer-events: auto;
}

.menu-tab:hover {
    background: rgba(255,255,255,0.08);
    color: #ddd;
}

.menu-tab.active {
    background: rgba(47,143,74,0.2);
    color: #2f8f4a;
    border-bottom-color: #2f8f4a;
}

input,
textarea,
select,
.inventory-item-popup,
.item-name-tooltip,
.popup-item-name,
.popup-item-value,
.popup-item-stats,
.skill-card,
.skill-card .card-meta,
.skill-card .card-gathered,
.skill-xp-text,
.status-area,
.loot-text {
    font-family: var(--font-ui-info);
}

button,
h1,
h2,
h3,
.menu-tab,
.skills-button,
.skill-item .skill-name,
.skill-item .skill-count,
.status-area p,
.inventory-level-label,
#inventory-hp-text,
#inventory-level-badge-value,
.exploration-cooldown-title,
.exploration-cooldown-list,
.exploration-cooldown-row,
.exploration-cooldown-zone,
.exploration-cooldown-time {
    font-family: var(--font-ui-display);
}

.hidden { display:none !important; }

@media (max-width:720px){
    .content{ padding:12px; }
}

/* Skills dropdown button and menu */
.skills-dropdown-container {
    position: fixed;
    top: 14px;
    left: 8px;
    bottom: 8px;
    width: 210px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 8px;
    background: rgba(18, 23, 30, 0.82);
    border-right: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    z-index: 125;
}

.skills-dropdown-container.condensed {
    width: 210px;
}

.skills-button {
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    border: none;
    color: #eaf6ff;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0,0,0,0.42);
    transition: filter 0.2s;
}

.skills-button:hover {
    filter: brightness(1.08);
}

#amount-bonus-debug-button.active {
    background: linear-gradient(180deg, rgba(255,200,100,0.15), rgba(255,150,50,0.1));
    box-shadow: 0 0 12px rgba(255,150,50,0.5), 0 4px 10px rgba(0,0,0,0.42);
    color: #ffcc99;
}

.inventory-rail-button {
    width: 100%;
}

.talent-tree-sidebar-button {
    width: 100%;
}

.skills-dropdown {
    position: relative;
    flex: 1;
    overflow-y: auto;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    min-width: 0;
    z-index: 126;
}

.skills-dropdown.condensed {
    min-width: 0;
}

.skills-dropdown .skill-list {
    list-style: none;
    padding: 4px;
    margin: 0;
}

.skills-dropdown .skill-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
    color: #e0e0e0;
    gap: 12px;
}

.skills-dropdown.condensed .skill-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    padding: 4px;
}

.skills-dropdown.condensed .skill-item {
    justify-content: center;
    padding: 5px 3px;
    gap: 0;
}

.skills-dropdown .skill-item:hover {
    background: rgba(255,255,255,0.08);
}

.skills-dropdown .skill-item.active {
    background: rgba(47,143,74,0.3);
    border-left: 3px solid #2f8f4a;
}

.skills-dropdown.condensed .skill-item.active {
    border-left: none;
    box-shadow: inset 0 0 0 2px rgba(47,143,74,0.45);
}

.skills-dropdown .skill-icon {
    width: 72px;
    height: 72px;
    display: block;
    object-fit: contain;
}

.skills-dropdown.condensed .skill-icon {
    width: 34px;
    height: 34px;
}

.skills-dropdown .skill-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
}

.skills-dropdown.condensed .skill-name,
.skills-dropdown.condensed .skill-count {
    display: none;
}

.skills-dropdown .skill-count {
    font-size: 12px;
    color: #aaa;
}

body .layout {
    padding-left: 228px;
}

body.skills-menu-condensed .layout {
    padding-left: 228px;
}

@media (max-width: 900px) {
    .skills-dropdown-container,
    .skills-dropdown-container.condensed {
        width: 126px;
    }

    body .layout,
    body.skills-menu-condensed .layout {
        padding-left: 140px;
    }

    .skills-dropdown .skill-icon {
        width: 54px;
        height: 54px;
    }

    .skills-dropdown.condensed .skill-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* Wood list inside menu */
.wood-list { list-style:none; padding:0; margin:0; }
.wood-list li { display:flex; justify-content:space-between; align-items:center; padding:8px 0; border-bottom:1px dashed #eee; }
.wood-list button { padding:6px 10px; }

.card-meta .cost-material-link {
    display: inline;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.card-meta .cost-material-link:hover,
.card-meta .cost-material-link:focus-visible {
    color: #f3d57a;
}

@media (max-width:420px){ .menu-popout{ width:90%; } }

/* Talent tree styles */
.talent-tree-menu .talent-tree-body {
    display: flex !important;
    flex-direction: column;
    gap: 18px;
}

.talent-tree-subtitle {
    font-size: 12px;
    color: var(--muted);
}

.talent-tree-category {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 12px;
    background: rgba(14, 20, 28, 0.36);
}

.talent-tree-category h3 {
    margin: 0 0 10px 0;
    color: #d8ecff;
}

.talent-tree-skill-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

@media (max-width: 1280px) {
    .talent-tree-skill-grid {
        grid-template-columns: 1fr;
    }
}

.talent-skill-card {
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 12px;
    background: rgba(8, 14, 20, 0.55);
}

.talent-skill-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.talent-skill-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.talent-skill-title img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.talent-skill-points {
    font-size: 12px;
    color: #b7d7f3;
}

.talent-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.talent-node {
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.talent-node.locked {
    opacity: 0.55;
}

.talent-node-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    font-size: 12px;
}

.talent-node-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.talent-node-rank-top {
    color: #9fc2df;
    font-size: 11px;
    line-height: 1;
}

.talent-node-icon-btn {
    border: 1px solid rgba(118, 215, 134, 0.45);
    background: rgba(118, 215, 134, 0.08);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.talent-node-icon-btn:hover:not(.disabled):not(:disabled),
.talent-node-icon-btn:focus-visible:not(.disabled):not(:disabled) {
    border-color: rgba(175, 236, 187, 0.8);
    background: rgba(118, 215, 134, 0.18);
    outline: none;
}

.talent-node-icon-btn.disabled,
.talent-node-icon-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.talent-node-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex: 0 0 24px;
    filter: drop-shadow(0 0 4px rgba(255,255,255,0.2));
}

.talent-node-name {
    color: #d8ecff;
    font-weight: 700;
    flex: 1;
}

.talent-node .node-meta {
    font-size: 11px;
    color: var(--muted);
    min-height: 30px;
}

.talent-node-locked-text {
    font-size: 11px;
    color: #d9a9a9;
}

.talent-tree-empty {
    color: var(--muted);
    font-size: 12px;
}

/* Force full transparency and remove separators for popout menus */
.menu-popout,
.menu-popout header,
.menu-popout .menu-body,
.menu-popout footer,
.menu-popout .talent-node,
.menu-popout .wood-list li {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    color: inherit !important;
}

/* Bolder typography for headings and buttons */
h1, h2, h3 { font-weight: 700; }
button { font-weight: 700; }

body {
    background-color: #1a1a1a;
    color: #e0e0e0;
    font-family: var(--font-ui-info);
    display: flex;
    justify-content: center;
    padding-top: 50px;
    overflow: hidden;
}

.game-container {
    background-color: #2d2d2d;
    padding: 2rem;
    padding-top: 132px; /* space for fixed logo */

/* Eldervale logo styling */
.logo{ position:fixed; left:50%; transform:translateX(-50%) scale(0.75); transform-origin: top center; top:2px; height:96px; display:flex; align-items:flex-start; justify-content:center; margin:0; z-index:95; width: min(620px, 86%); overflow:visible; pointer-events:none; }
.logo-svg{ width:100%; height:96px; overflow:visible; pointer-events:none; }
.logo-image{ width:100%; height:100%; object-fit:contain; object-position:center top; transform: translateY(-4px); pointer-events:none; }
.logo-text{ font-family: var(--font-ui-display); font-weight:900; font-size:64px; fill:#2f8f4a; stroke: rgba(235,255,240,0.95); stroke-width:1.6; paint-order:stroke; letter-spacing:4px; }
.logo-sub{ font-family: var(--font-ui-display); font-weight:600; font-size:14px; fill:rgba(220,255,230,0.95); letter-spacing:2px; opacity:0.95; }
.logo-sway{ transform-origin: 50% 50%; transform-box: fill-box; animation: sway 3s ease-in-out infinite; }

@keyframes sway{
    0%{ transform: translateX(0) rotate(0deg); }
 25%{ transform: translateX(-4px) rotate(-0.6deg); }
 50%{ transform: translateX(0) rotate(0deg); }
 75%{ transform: translateX(4px) rotate(0.6deg); }
 100%{ transform: translateX(0) rotate(0deg); }
}

/* moving glow behind logo */
.logo-glow{ transform-origin: 50% 50%; opacity: 0.45; filter: blur(10px); animation: glowX 3s ease-in-out infinite; }
@keyframes glowX{
    0%{ transform: translateX(-60px) scaleX(1); opacity:0.35; }
    50%{ transform: translateX(60px) scaleX(1.02); opacity:0.55; }
    100%{ transform: translateX(-60px) scaleX(1); opacity:0.35; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
    .logo-sway, .logo-glow{ animation: none !important; transform: none !important; }
}
.visually-hidden{ position:absolute; left:-9999px; }

@media (max-width:600px){
    .logo{ top:0; height:76px; width:min(520px, 92%); }
    .logo-image{ height:100%; transform: translateY(-3px); }
    .logo-text{ font-size:40px; }
}
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    width: 400px;
    text-align: center;
}

.actions {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
}

button {
    padding: 10px 15px;
    cursor: pointer;
    background-color: #4CAF50;
    border: none;
    color: white;
    border-radius: 4px;
    transition: background 0.2s;
}

button:hover {
    background-color: #45a049;
}

.progress-bar-container {
    width: 100%;
    background-color: #444;
    height: 20px;
    border-radius: 10px;
    margin-top: 10px;
    overflow: hidden;
}

#progress-bar {
    width: 0%;
    height: 100%;
    background-color: #3498db;
    transition: width 0.1s linear;
}

/* --- Visual overhaul to approximate reference UI (dark, sidebar, card grid) --- */
:root{
    --bg:#0f1720;
    --surface:#11161b;
    --surface-2:#1b2226;
    --muted: #9aa6b2;
    --accent: #21c7ff;
    --card: #14181b;
}

body{ background: var(--bg); color: #dfe8ee; }
.layout{ max-width:1200px; margin: 0 auto; align-items:flex-start; }

/* Sidebar as compact skill list */
.sidebar{ background: transparent; border-right: 1px solid rgba(255,255,255,0.03); padding: 20px 12px; }
.sidebar h2{ color: #cfe9ff; font-size:14px; margin-bottom:12px; }
.skill-list{ list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:6px; }
.skill-item{ display:flex; align-items:center; gap:10px; padding:8px 10px; color:var(--muted); border-radius:8px; cursor:pointer; }
.skill-item:hover{ background: rgba(255,255,255,0.02); color:#fff; }
.skill-item .skill-icon{ width:22px; height:22px; display:flex; align-items:center; justify-content:center; opacity:0.95; }
.kill-fallback{ font-size:0; }
.skill-item .skill-icon svg{ width:18px; height:18px; fill: currentColor; display:block; }
.skill-item .skill-name{ flex:1; font-size:13px; font-family: var(--font-ui-display); font-weight:700; }
.skill-item .skill-count{ color:var(--muted); font-weight:800; min-width:36px; text-align:right; font-family: var(--font-ui-display); }
.skill-item.active{ background: rgba(33,199,255,0.06); color:#eaf6ff; border-left:4px solid rgba(33,199,255,0.24); padding-left:8px; }
.action-card.active{ background: rgba(33,199,255,0.08); color:#eaf6ff; border-left:4px solid rgba(33,199,255,0.24); }

/* Main content header */
.game-container{ background: transparent; box-shadow:none; padding: 8px 0 24px 0; max-width: 100%; }
.game-container h1{ font-size:36px; margin:8px 0 6px 0; color:#eaf6ff; }
.inventory p{ color: var(--muted); margin:4px 0; }

/* Popout menus become large centered panels with card grid */
.menu-popout{ opacity: 0; transform: translateY(8px) translateX(-50%); transition: opacity 220ms ease, transform 220ms ease; }
.menu-popout.open{ opacity: 1; transform: translateY(0) translateX(-50%); }
.menu-popout .menu-body{ display:grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap:18px; padding:20px; align-content:start; align-items:start; position: relative; z-index: 1; }
.menu-popout .menu-body.hidden{ display:none !important; pointer-events:none !important; visibility: hidden !important; position: absolute !important; top: -9999px !important; }

/* Skill cards shown inside popout menus (e.g. woodcutting choices) */
.skill-card{
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
    border-radius:8px;
    border: none;
    padding:12px 16px;
    display:flex;
    flex-direction:column;
    align-items:center;
    text-align:center;
    color:#e0e0e0;
    position:relative;
    transition: filter 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
}
.skill-card h3{ margin:0 0 6px 0; font-size:16px; }
.skill-card .card-meta{ font-size:12px; color:var(--muted); margin:2px 0; }
.skill-card .card-meta.insufficient-cost{ color:#8f96a3; opacity:0.6; }
.skill-card .card-img{ font-size:40px; margin:8px 0; }
.skill-card .card-img img{ width:40px; height:40px; object-fit:contain; display:block; margin:0 auto; }
.skill-card .card-img img.mirrored{ transform: scaleX(-1); }
.skill-card[data-ore] .card-img img{ width:44px; height:44px; }
.skill-card .skill-icon{ width:40px; height:40px; fill:currentColor; }
.skill-card .card-gathered{ font-size:13px; color:#fff; margin-top:auto; }


/* small bar for showing selected-task progress */
.skill-card .task-bar{ width:100%; height:4px; background:rgba(255,255,255,0.1); border-radius:2px; overflow:hidden; margin-top:6px; }
.skill-card .task-fill{ height:100%; background:var(--accent); width:0%; transition:width 0.1s linear; }
.skill-card .task-fill[data-render-mode="transform"]{ width:100%; transform:scaleX(0); transform-origin:left center; transition:none; will-change:transform; }

/* selection/lock states */
.skill-card.selected{ box-shadow: 0 0 0 1px rgba(124, 217, 149, 0.65), 0 6px 18px rgba(0,0,0,0.6); }
.skill-card.locked{ opacity:0.65; cursor:not-allowed; }
.skill-card.locked .card-meta{ color:var(--muted); }

.skill-card.availability-ready{
    filter: brightness(1.04);
    box-shadow: 0 0 0 1px rgba(88, 165, 122, 0.28), 0 6px 18px rgba(0,0,0,0.6);
}

.skill-card.availability-missing{
    filter: saturate(0.78) brightness(0.9);
    opacity: 0.84;
    box-shadow: 0 0 0 1px rgba(208, 150, 79, 0.28), 0 6px 18px rgba(0,0,0,0.6);
}

.skill-card.availability-locked{
    filter: grayscale(0.5) saturate(0.72) brightness(0.78);
    opacity: 0.62;
    box-shadow: 0 0 0 1px rgba(155, 163, 176, 0.22), 0 6px 18px rgba(0,0,0,0.6);
}

/* override grid for three per row on wider screens */
@media(min-width:800px){
    .menu-popout .menu-body{ grid-template-columns: repeat(3,1fr); }
}

/* Cards inside menus */
.menu-popout .wood-list{ display:block; padding:0; margin:0; }
.menu-popout .wood-list li{ display:block; background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); padding:14px; border-radius:10px; margin-bottom:0; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
.menu-popout .wood-list li strong{ display:block; color:#eaf6ff; margin-bottom:8px; }
.menu-popout .wood-list li button{ float:right; background: linear-gradient(90deg,#2fa4ff,#1fb0ff); border:none; color:white; padding:8px 12px; border-radius:8px; }

/* Player level + logout in top-right corner */
.player-header { position: fixed; top: 18px; right: 20px; display: flex; gap: 12px; align-items: center; z-index: 60; }
.player-level,
.logout-btn {
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
    color: #eaf6ff;
    border: none;
    font-weight: 700;
}
.player-level span{ font-weight:800; margin-left:6px; }
.logout-btn { cursor: pointer; }
.logout-btn:hover { filter: brightness(1.08); }

.trophy-popout {
    position: fixed;
    top: 62px;
    right: 20px;
    width: min(320px, calc(100vw - 28px));
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(118,215,134,0.42);
    background: linear-gradient(180deg, rgba(18,30,25,0.96), rgba(12,24,20,0.96));
    box-shadow: 0 12px 24px rgba(0,0,0,0.55);
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.28s ease, opacity 0.2s ease;
    z-index: 260;
    pointer-events: none;
}

.trophy-popout.hidden { display: none; }

.trophy-popout.is-visible {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
}

.trophy-popout.is-visible:hover {
    filter: brightness(1.06);
}

.trophy-popout-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
}

.trophy-popout-text {
    min-width: 0;
}

.trophy-popout-title {
    color: #9de1ad;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.trophy-popout-detail {
    color: #e6f6ec;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Stats Modal ──────────────────────────────────────────────────────── */
.stats-modal {
    position: fixed; inset: 0; z-index: 500;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(3px);
}
.stats-modal.hidden { display: none; }

.stats-modal-inner {
    display: flex; flex-direction: column;
    width: min(600px, 94vw); max-height: 82vh;
    background: linear-gradient(160deg, #141c22 0%, #0f1519 100%);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.8);
    overflow: hidden;
}

.stats-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.stats-modal-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats-modal-title {
    font-size: 18px; font-weight: 800;
    color: #eaf6ff; letter-spacing: 0.04em;
}

.stats-tab-row {
    display: flex;
    gap: 8px;
}

.stats-tab-btn {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.12);
    color: #c8dde8;
    padding: 5px 10px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.stats-tab-btn:hover { filter: brightness(1.12); }

.stats-tab-btn.is-active {
    border-color: rgba(118,215,134,0.65);
    color: #76d786;
    background: rgba(118,215,134,0.08);
}

.stats-close-btn {
    background: transparent; border: 1px solid rgba(255,255,255,0.08);
    color: #aac8d8; font-size: 16px; font-weight: 700;
    padding: 4px 9px; border-radius: 6px; cursor: pointer;
    line-height: 1;
}
.stats-close-btn:hover { color: #fff; border-color: rgba(255,255,255,0.25); }

.stats-modal-scroll-area {
    flex: 1 1 auto; overflow-y: auto;
    padding: 18px 22px;
    scrollbar-width: none; /* Firefox */
}
.stats-modal-scroll-area::-webkit-scrollbar { display: none; }

.stats-scroll-controls {
    display: flex; align-items: center; justify-content: center; gap: 18px;
    padding: 10px 22px 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.stats-scroll-btn {
    height: 20px; width: auto;
    cursor: pointer; opacity: 0.75;
    transition: opacity 0.15s, filter 0.15s;
    user-select: none;
}
.stats-scroll-btn:hover { opacity: 1; filter: brightness(1.2); }

.stats-section {
    margin-bottom: 22px;
}

.stats-section-title {
    font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
    color: #76d786; margin-bottom: 8px;
    border-bottom: 1px solid rgba(118,215,134,0.2); padding-bottom: 4px;
}

.stats-row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 3px 0; font-size: 13px; color: #c8dde8;
}

.stats-label { flex: 1; padding-right: 12px; }
.stats-value { font-weight: 700; color: #eaf6ff; white-space: nowrap; }

.stats-empty {
    color: #6a8fa0; font-size: 13px; text-align: center; padding: 32px 0;
}

.trophy-category {
    margin-bottom: 24px;
}

.trophy-skill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.trophy-skill-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 10px;
}

.trophy-skill-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    gap: 8px;
}

.trophy-skill-name {
    color: #eaf6ff;
    font-size: 13px;
    font-weight: 700;
}

.trophy-skill-progress {
    color: #8fb7c7;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.trophy-slot-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.trophy-slot {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: help;
}

.trophy-slot img {
    width: 72%;
    height: auto;
    pointer-events: none;
}

.trophy-slot.is-locked {
    filter: grayscale(1);
    opacity: 0.45;
}

.trophy-slot.is-unlocked {
    border-color: rgba(118,215,134,0.55);
    box-shadow: 0 0 0 1px rgba(118,215,134,0.2), inset 0 0 14px rgba(118,215,134,0.12);
    opacity: 1;
}

.talent-tree-menu .trophy-slot.talent-slot {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    color: inherit;
    padding: 0;
    outline: none;
    cursor: pointer;
}

.talent-tree-menu .trophy-slot.talent-slot img {
    position: relative;
    z-index: 1;
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.talent-tree-menu .trophy-slot.talent-slot .talent-slot-fill {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.62);
    pointer-events: none;
    z-index: 2;
    transition: height 0.16s ease;
}

.talent-tree-menu .trophy-slot.talent-slot .trophy-slot-tier {
    z-index: 3;
}

.talent-tree-menu .trophy-slot.talent-slot.is-unlocked:hover,
.talent-tree-menu .trophy-slot.talent-slot.is-unlocked:focus-visible {
    border-color: rgba(162, 237, 176, 0.75);
    box-shadow: 0 0 0 1px rgba(118,215,134,0.3), inset 0 0 16px rgba(118,215,134,0.2), 0 0 14px rgba(118,215,134,0.25);
}

.talent-tree-menu .trophy-slot.talent-slot.is-locked {
    cursor: help;
}

.talent-tree-menu .trophy-skill-head {
    align-items: flex-start;
    flex-wrap: wrap;
    row-gap: 4px;
    margin-bottom: 12px;
}

.talent-tree-menu .trophy-skill-progress {
    margin-left: auto;
    flex: 0 0 auto;
}

.talent-tree-menu,
.talent-tree-menu.open {
    transition: none !important;
}

.talent-tree-menu {
    width: 1100px;
    max-width: 1100px;
    overflow: hidden;
}

.talent-tree-menu .talent-tree-body {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.talent-tree-menu .talent-tree-body::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.talent-tree-menu .trophy-skill-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.talent-tree-menu .trophy-skill-card {
    padding: 12px;
}

.talent-tree-menu .trophy-slot-grid {
    gap: 10px;
}

.talent-tree-menu .trophy-slot.talent-slot {
    min-height: 82px;
}

.talent-tree-scroll-controls {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 5;
    pointer-events: none;
}

.talent-tree-scroll-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0.8;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.55));
    transition: opacity 0.15s ease, transform 0.15s ease, filter 0.15s ease;
}

.talent-tree-scroll-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.talent-tree-scroll-btn:hover {
    opacity: 1;
    transform: scale(1.04);
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.65));
}

.talent-tree-scroll-btn.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.trophy-slot-tier {
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 3px;
    text-align: center;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #d8e8ef;
    text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}

.trophy-summary {
    margin-top: 8px;
    color: #87a8b6;
    font-size: 11px;
}

.trophy-next-target {
    margin-top: 4px;
    color: #76d786;
    font-size: 11px;
    font-weight: 700;
}

/* Bottom centered status area (current task + progress) */
.status-area{ position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 110; width: min(820px, 94%); display:flex; flex-direction:column; align-items:center; gap:2px; pointer-events:auto; transition: opacity 0.18s ease; }
.status-area p{ margin:0; color: #dcefe0; font-weight:700; font-size:14px; display:flex; align-items:center; gap:8px; }
.progress-bar-container{ width: 100%; max-width:760px; height:14px; border-radius:10px; background: rgba(255,255,255,0.03); box-shadow: inset 0 1px 0 rgba(255,255,255,0.02); overflow:hidden; position:relative; border:1px solid rgba(255,255,255,0.06); }
.progress-bar{ position:relative; width:100%; height:100%; }
.progress-fill{ position:absolute; left:0; top:0; bottom:0; width:100%; background: linear-gradient(90deg,#76d786,#2fa86a); transform: translateX(-100%); transition: transform 0.08s linear; will-change: transform; box-shadow: inset 0 0 0 0.5px rgba(255,255,255,0.08), 0 1px 6px rgba(47,143,74,0.06); }

.cancel-btn{ background:transparent; border:1px solid rgba(255,255,255,0.06); color:#fff; padding:6px 8px; border-radius:6px; cursor:pointer; font-weight:800; }
.cancel-btn:hover{ background: rgba(255,255,255,0.02); }

body.skill-popout-open .status-area{ opacity: 0; pointer-events: none; }

@media (max-width:420px){
    .status-area{ width: calc(100% - 36px); bottom: 14px; }
    .progress-bar-container{ height:12px; }
}

/* Responsive tweaks */
@media (max-width:900px){ .menu-popout{ top:70px; } .menu-popout .menu-body{ grid-template-columns: repeat(auto-fill,minmax(160px,1fr)); } }

/* Inventory button and panel */
.inventory-button{ position: fixed; right: 0; bottom: 0; width: auto; height: auto; border: none; background: transparent; color: #fff; box-shadow: none; font-size: 22px; z-index: 100; cursor: pointer; padding: 0; filter: drop-shadow(0 0 8px rgba(0, 255, 0, 0.6)); }
.inventory-button:hover{ background: transparent; filter: drop-shadow(0 0 16px rgba(0, 255, 0, 0.9)); }

.queued-loot-button{
    position: fixed;
    right: 8px;
    bottom: 76px;
    width: auto;
    height: auto;
    border: none;
    background: transparent;
    box-shadow: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    z-index: 101;
    cursor: pointer;
    padding: 0;
    filter: drop-shadow(0 0 8px rgba(0, 255, 0, 0.6));
}

.queued-loot-button:hover{
    background: transparent;
    border: none;
    box-shadow: none;
    outline: none;
    filter: drop-shadow(0 0 16px rgba(0, 255, 0, 0.9));
}

.queued-loot-button.has-loot{ animation: queuedLootPulse 1.6s ease-in-out infinite; }

@keyframes queuedLootPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

.queued-loot-count{
    position: absolute;
    top: 0;
    right: 0;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #d43b2e;
    color: #fff4e6;
    border: 1px solid rgba(255,255,255,0.65);
    font-size: 11px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    padding: 0 4px;
}

.queued-loot-panel{
    position: fixed;
    right: 96px;
    bottom: 14px;
    width: min(360px, calc(100vw - 24px));
    border-radius: 12px;
    border: 1px solid rgba(255, 220, 140, 0.35);
    background: linear-gradient(180deg, rgba(20, 26, 34, 0.95), rgba(14, 18, 26, 0.96));
    box-shadow: 0 14px 38px rgba(0,0,0,0.6);
    z-index: 135;
    padding: 10px;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.queued-loot-panel.open{
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.queued-loot-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.queued-loot-header h3{
    margin: 0;
    color: #ffe0a5;
    font-size: 16px;
}

.queued-loot-status{
    margin: 0 0 8px;
    color: #d8deeb;
    font-size: 12px;
    line-height: 1.3;
}

.queued-loot-slots{
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
}

.queued-loot-slot{
    position: relative;
    min-height: 62px;
    border-radius: 8px;
    border: 1px solid rgba(255, 220, 140, 0.28);
    background: rgba(33, 41, 54, 0.85);
    color: #f2f5ff;
    padding: 4px;
    cursor: pointer;
}

.queued-loot-slot.empty{
    border-color: rgba(180, 190, 210, 0.24);
    background: rgba(20, 24, 32, 0.7);
    color: #9aa6bf;
}

.queued-loot-empty{ font-size: 11px; }

.queued-loot-slot-inner{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.queued-loot-item-icon{
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.queued-loot-fallback{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    font-size: 12px;
    font-weight: 700;
}

.queued-loot-item-count{
    font-size: 11px;
    color: #ffffff;
    font-weight: 700;
}

.queued-loot-item-timer{
    font-size: 10px;
    color: #ffcb84;
    font-weight: 700;
}

.queued-loot-actions{
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.queued-loot-claim-all{
    border: 1px solid rgba(110, 216, 154, 0.45);
    border-radius: 8px;
    background: rgba(76, 194, 132, 0.2);
    color: #d8ffe7;
    font-weight: 700;
    padding: 6px 10px;
    cursor: pointer;
}

.queued-loot-claim-all:hover{ background: rgba(76, 194, 132, 0.3); }

@media (max-width: 700px){
    .queued-loot-panel{
        right: 8px;
        bottom: 148px;
        width: min(340px, calc(100vw - 16px));
    }

    .queued-loot-button{ bottom: 74px; }
}

.testing-button{ position: fixed; right: 20px; top: 50%; transform: translateY(-50%); width: auto; height: auto; border: none; background: transparent; color: #fff; box-shadow: none; font-size: 32px; z-index: 99; cursor: pointer; padding: 8px; filter: drop-shadow(0 0 8px rgba(47, 123, 153, 0.6)); transition: filter 0.2s; }
.testing-button:hover{ filter: drop-shadow(0 0 16px rgba(47, 123, 153, 0.9)); }

.inventory-panel{
    width: min(99vw, 1660px);
    max-width: 1660px;
    max-height: calc(100vh - 48px);
    right: auto;
    bottom: auto;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.inventory-panel .menu-body{
    max-height: calc(100vh - 190px);
    overflow-x: hidden;
    overflow-y: auto;
}

#inventory-panel [data-inventory-layout-key]{
    position: relative;
}

body.boundary-edit-enabled #inventory-panel [data-inventory-layout-key]{
    outline: 1px dashed rgba(124, 217, 149, 0.42);
    outline-offset: 2px;
    cursor: move;
}

body.boundary-edit-enabled #inventory-panel [data-inventory-layout-key="inventory-avatar-frame"]{
    outline: none;
}

body.boundary-edit-enabled #inventory-panel [data-inventory-layout-key="inventory-avatar-frame"].boundary-dragging{
    outline: none;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.28);
}

body.boundary-edit-enabled #inventory-panel [data-inventory-layout-key].boundary-dragging{
    outline-color: rgba(164, 235, 183, 0.88);
    box-shadow: 0 0 0 2px rgba(164, 235, 183, 0.18);
    will-change: transform;
    z-index: 2;
}

.inventory-panel header{ display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.1); }

.inventory-panel footer{ padding: 10px 14px; }

.inventory-header-right{ display: flex; gap: 16px; align-items: center; }

.inventory-combat-ui{
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.inventory-hp-stack{
    display: flex;
    flex-direction: row;
    gap: 8px;
    min-width: auto;
    align-items: center;
    width: 100%;
    justify-content: center;
}

.inventory-player-name{
    color: #d9ecf4;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    line-height: 1.2;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    flex: 0 0 auto;
    max-width: 100px;
}

.inventory-avatar-display{
    width: 72px;
    height: 72px;
    border-radius: 12px;
    border: none;
    background: transparent;
    display: grid;
    place-items: center;
    overflow: visible;
    box-shadow: none;
    flex-shrink: 0;
}

.inventory-avatar-display img{
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 0;
    border: none;
    background: transparent;
}

#inventory-avatar-label{
    display: none;
    font-size: 10px;
    color: #b4c6d1;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.inventory-avatar-display.is-empty img{
    opacity: 0;
}

.inventory-avatar-display.is-empty{
    border-color: rgba(130, 150, 165, 0.3);
    background: transparent;
}

.inventory-hp-bar{
    position: relative;
    width: 270px;
    height: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    border: 1px solid rgba(87, 187, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    display: none;
}

.inventory-hp-fill{
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, #57bb00, #45a200);
    width: 0%;
    transition: width 0.2s ease;
}

.inventory-hp-fill[data-render-mode="transform"]{
    width: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.2s ease;
    will-change: transform;
}

#inventory-hp-text{
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f7f2e7;
    font-family: var(--font-ui-display);
    font-style: italic;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1;
    letter-spacing: 0.4px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.65);
    pointer-events: none;
    z-index: 3;
    white-space: nowrap;
}

.inventory-level-badge{
    width: 88px;
    height: 84px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: relative;
    flex-shrink: 0;
    background: none;
    border: none;
    border-radius: 0;
    clip-path: none;
    box-shadow: none;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.35));
    color: #eaf6ff;
    transition: filter 0.2s;
}

.inventory-level-badge:hover{
    filter: brightness(1.08) drop-shadow(0 4px 6px rgba(0,0,0,0.35));
}

.inventory-level-label{
    color: #eaf6ff;
    font-size: 10px;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    line-height: 1;
    font-weight: 700;
    text-align: center;
}

.inventory-level-label-image{
    display: block;
    width: 76px;
    height: auto;
    object-fit: contain;
    pointer-events: none;
}

#inventory-level-badge-value{
    position: static;
    width: auto;
    text-align: center;
    pointer-events: none;
    color: #f7f2e7;
    font-family: var(--font-ui-display);
    font-style: italic;
    font-weight: 700;
    font-size: 1.3rem;
    line-height: 1;
    -webkit-text-stroke: 1px rgba(0,0,0,0.85);
    paint-order: stroke fill;
    text-shadow: 0 1px 2px rgba(0,0,0,0.65);
}

@media (max-width:520px){
    .inventory-combat-ui{ gap: 8px; }
    .inventory-hp-stack{ min-width: 180px; }
    .inventory-player-name{ font-size: 10px; width: 180px; }
    .inventory-hp-bar{ width: 180px; height: 25px; }
    #inventory-hp-text{ font-size: 0.86rem; }
    .inventory-avatar-display{ width: 72px; height: 72px; border-radius: 14px; }
    .inventory-avatar-display img{ width: 58px; height: 58px; }
    .inventory-level-badge{ width: 72px; }
    .inventory-level-badge{ height: 68px; border-radius: 14px; }
    #inventory-level-badge-value{ font-size: 1rem; }
}

/* Inventory Layout: Left (Storage) + Right (Equipment) */
.inventory-layout{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 14px;
    min-width: 0;
    align-items: stretch;
}

/* Left Side: Storage Inventory */
.inventory-storage{
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    padding: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
    overflow: hidden;
    max-height: 650px;
}

.inventory-storage::before {
    content: none;
    position: absolute;
    top: -12px;
    left: 10px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(150, 180, 200, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
    z-index: 2;
}

.inventory-inline-title{ display: inline-flex; align-items: center; gap: 8px; width: fit-content; }
.inventory-inline-title img{ width: 22px; height: 22px; object-fit: contain; }
.inventory-inline-title span{ color: rgba(150, 180, 200, 0.9); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }

.inventory-storage::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(100, 150, 180, 0.02) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(100, 180, 220, 0.01) 0%, transparent 40%);
    pointer-events: none;
    border-radius: 10px;
}

.gold-coins-slot{ display: inline-flex; align-items: center; gap: 8px; width: fit-content; padding: 6px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.24); background: rgba(255,255,255,0.08); }
.gold-coins-slot img{ width: 18px; height: 18px; object-fit: contain; }
.gold-coins-slot span{ color: #fff6cf; font-size: 13px; font-weight: 700; line-height: 1; min-width: 14px; text-align: right; }

.inventory-search-bar{
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
    margin-left: 3px;
    width: min(402px, 100%);
    max-width: 402px;
    align-items: center;
}
.inventory-search-bar input{ flex: 1 1 auto; width: auto; min-width: 170px; height: 32px; padding: 0 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.02); color: #eaf6ff; font-size: 12px; line-height: 32px; box-sizing: border-box; }
.inventory-search-bar input::placeholder{ color: var(--muted); }
.inventory-search-bar button{ height: 32px; min-width: 64px; padding: 0 12px; border-radius: 6px; border: none; background: rgba(255,255,255,0.08); color: #eaf6ff; cursor: pointer; font-weight: 600; font-size: 11px; line-height: 32px; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; }
.inventory-search-bar button:hover{ background: rgba(255,255,255,0.12); }
.close-search-btn{ background: rgba(255,100,100,0.2) !important; }
.close-search-btn:hover{ background: rgba(255,100,100,0.3) !important; }
.inventory-search-bar .gold-coins-slot{ height: 32px; padding: 0 10px; border-radius: 6px; box-sizing: border-box; margin-left: auto; }
.inventory-search-bar .gold-coins-slot img{ width: 16px; height: 16px; }
.inventory-search-bar .gold-coins-slot span{ line-height: 1; }

.inventory-grid{
    display: grid !important;
    grid-template-columns: repeat(6, 62px);
    grid-auto-rows: 62px;
    grid-auto-flow: row;
    gap: 6px;
    margin-left: 0;
    margin-top: 0;
    width: max-content;
    max-width: 100%;
    flex: 1;
    min-height: 0;
    max-height: clamp(280px, 65vh, 614px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 3px 2px 0 3px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    align-content: start;
    justify-content: start;
}

.inventory-grid::-webkit-scrollbar{
    width: 0;
    height: 0;
}

.inventory-grid-scroll-controls{
    position: absolute;
    right: 13px;
    bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 3;
    pointer-events: none;
}

.inventory-scroll-btn{
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    pointer-events: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.inventory-scroll-btn img{
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.inventory-scroll-btn:hover{
    transform: scale(1.04);
}

.inventory-scroll-btn.is-hidden{
    opacity: 0;
    pointer-events: none;
}


.inv-slot{
    position: relative;
    aspect-ratio: 1;
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.05), 0 2px 4px rgba(0,0,0,0.3);
}

.inv-slot:hover{
    background: rgba(255,255,255,0.12);
    border-color: rgba(100, 200, 255, 0.6);
    transform: scale(1.02);
    box-shadow: inset 0 1px 4px rgba(100,200,255,0.15), 0 4px 8px rgba(100,200,255,0.2);
}


.inv-slot.empty{ opacity: 1; }


body.inventory-drag-active .inv-slot.drag-over{ background: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.08); }

.inv-slot img{ max-width: 70%; max-height: 70%; object-fit: contain; pointer-events: none; }

.inv-slot .item-count{
    position: absolute;
    bottom: 6px;
    right: 6px;
    color: #ffd700;
    font-size: 11px;
    font-weight: 900;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}



.inv-slot .item-icon{ max-width: 70%; max-height: 70%; object-fit: contain; pointer-events: none; }



.inv-slot .item-stats-bonus{
    position: absolute;
    bottom: 6px;
    left: 6px;
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
    pointer-events: none;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.inv-slot.rarity-rare,
.equipment-slot.rarity-rare{
    border-color: rgba(78,163,255,0.95);
    box-shadow: inset 0 0 14px rgba(78,163,255,0.25), 0 0 10px rgba(78,163,255,0.28);
}

.inv-slot.rarity-epic,
.equipment-slot.rarity-epic{
    border-color: rgba(160,97,255,0.95);
    box-shadow: inset 0 0 14px rgba(160,97,255,0.26), 0 0 10px rgba(160,97,255,0.32);
}

.inv-slot.rarity-legendary,
.equipment-slot.rarity-legendary{
    border-color: rgba(255,158,44,0.95);
    box-shadow: inset 0 0 14px rgba(255,158,44,0.28), 0 0 12px rgba(255,158,44,0.36);
}

.inventory-item-popup{ position: fixed; z-index: 220; min-width: 150px; max-width: 210px; padding: 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.22); background: rgba(18,22,28,0.92); box-shadow: 0 8px 18px rgba(0,0,0,0.45); display: flex; flex-direction: column; gap: 6px; }
.inventory-item-popup.hidden{ display: none; }
.item-name-tooltip{ position: fixed; z-index: 230; padding: 4px 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.18); background: rgba(18,22,28,0.88); color: #eaf6ff; font-size: 11px; font-weight: 600; white-space: nowrap; pointer-events: none; box-shadow: 0 4px 10px rgba(0,0,0,0.4); }
.item-name-tooltip.hidden{ display: none; }
.popup-item-name{ color: #eaf6ff; font-size: 12px; font-weight: 700; line-height: 1.2; }
.popup-item-name.rarity-rare{ color: #8ec4ff; }
.popup-item-name.rarity-epic{ color: #c8a9ff; }
.popup-item-name.rarity-legendary{ color: #ffd39a; }
.popup-item-value{ color: #f4df9d; font-size: 11px; line-height: 1.2; }
.popup-item-stats{ color: #c6f0d3; font-size: 11px; line-height: 1.2; }
.popup-stat-line + .popup-stat-line{ margin-top: 2px; }
.popup-set-title{ color: rgba(214, 224, 236, 0.92); }
.popup-set-bonus-active{ color: #f4df9d; }
.popup-set-bonus-inactive{ color: rgba(178, 188, 204, 0.45); }
.popup-socket-line{ display: flex; align-items: center; gap: 6px; }
.popup-socket-dots{ display: inline-flex; align-items: center; gap: 4px; }
.popup-socket-dot{ width: 8px; height: 8px; border-radius: 999px; border: 1px solid rgba(214, 221, 229, 0.95); background: rgba(150, 158, 170, 0.28); box-shadow: inset 0 1px 1px rgba(255,255,255,0.2); }
.popup-socket-dot.is-filled{ background: rgba(224, 229, 236, 0.92); }
.popup-socket-dot.is-blue{ background: #4fa6ff; border-color: #9acfff; box-shadow: 0 0 8px rgba(79, 166, 255, 0.35); }
.popup-socket-dot.is-green{ background: #63cf74; border-color: #b7efbf; box-shadow: 0 0 8px rgba(99, 207, 116, 0.35); }
.popup-socket-dot.is-red{ background: #df5f5f; border-color: #f0b0b0; box-shadow: 0 0 8px rgba(223, 95, 95, 0.35); }
.popup-socket-dot.is-yellow{ background: #d6b347; border-color: #f0dda0; box-shadow: 0 0 8px rgba(214, 179, 71, 0.35); }
.inventory-item-popup.rarity-rare{ border-color: rgba(78,163,255,0.75); box-shadow: 0 8px 20px rgba(78,163,255,0.26); }
.inventory-item-popup.rarity-epic{ border-color: rgba(160,97,255,0.75); box-shadow: 0 8px 20px rgba(160,97,255,0.28); }
.inventory-item-popup.rarity-legendary{ border-color: rgba(255,158,44,0.8); box-shadow: 0 8px 22px rgba(255,158,44,0.32); }
.popup-actions{ display: flex; gap: 6px; }
.popup-sell-btn{ align-self: flex-start; padding: 4px 9px; border: 1px solid rgba(255,220,120,0.35); border-radius: 6px; background: rgba(255, 212, 120, 0.12); color: #ffe8af; font-size: 11px; font-weight: 700; cursor: pointer; }
.popup-sell-btn:hover{ background: rgba(255, 212, 120, 0.2); }
.popup-equip-btn{ border-color: rgba(95,230,160,0.45); background: rgba(70, 210, 140, 0.16); color: #d7ffe8; }
.popup-equip-btn:hover{ background: rgba(80, 230, 150, 0.25); }
.popup-socket-panel{ display: flex; flex-direction: column; gap: 6px; margin-top: 2px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.12); }
.popup-socket-panel.hidden{ display: none; }
.popup-socket-panel-title{ font-size: 11px; font-weight: 700; color: rgba(226,239,255,0.92); }
.popup-socket-group{ display: flex; flex-direction: column; gap: 4px; }
.popup-socket-group-title{ font-size: 10px; color: rgba(212,222,232,0.82); text-transform: uppercase; letter-spacing: 0.5px; }
.popup-socket-row{ display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.popup-socket-row-label{ font-size: 10px; color: rgba(224,232,242,0.9); line-height: 1.2; flex: 1 1 auto; }
.popup-socket-action-btn{ border: 1px solid rgba(255,255,255,0.24); background: rgba(255,255,255,0.08); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 5px; cursor: pointer; flex: 0 0 auto; }
.popup-socket-action-btn:hover{ background: rgba(255,255,255,0.14); }
.popup-socket-empty{ font-size: 10px; color: rgba(210,217,227,0.78); }

/* Right Side: Equipment Slots */
.inventory-equipment{
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
    box-shadow: inset 0 0 20px rgba(100,150,180,0.01);
    position: relative;
    overflow: hidden;
    min-height: 650px;
}

.inventory-equipment::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(100, 150, 180, 0.01) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(100, 180, 220, 0.01) 0%, transparent 50%);
    pointer-events: none;
    border-radius: 10px;
}

.loadout-header{ display: flex; gap: 6px; align-items: center; position: relative; z-index: 1; }
.loadout-selector{ flex: 1; padding: 7px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.02); color: #eaf6ff; font-size: 12px; cursor: pointer; }
.loadouts-btn{ padding: 7px 11px; border-radius: 6px; border: none; background: rgba(255,255,255,0.08); color: #eaf6ff; cursor: pointer; font-weight: 600; font-size: 11px; }
.loadouts-btn:hover{ background: rgba(255,255,255,0.12); }

.player-stats-panel{
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    box-sizing: border-box;
    gap: 8px;
    padding: 0;
    border-radius: 0;
    border: none;
    background: transparent;
    position: relative;
    overflow: hidden;
}

.player-stats-panel::before {
    content: none;
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(100, 150, 180, 0.2), transparent);
    pointer-events: none;
}

.player-stat-group{
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 7px;
    border-radius: 7px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.025);
    position: relative;
    z-index: 1;
}

.player-stat-group-title{
    color: rgba(180, 210, 230, 0.9);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.35px;
    margin-bottom: 4px;
    padding-bottom: 3px;
    border-bottom: 1px solid rgba(180, 210, 230, 0.25);
}

.player-stat-row{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    padding: 0;
    position: relative;
    z-index: 1;
}

.player-stat-label{
    color: rgba(180, 200, 220, 0.75);
    font-weight: 600;
    flex: 1;
    font-size: 10px;
    letter-spacing: 0.2px;
}

.player-stat-value{
    color: #e8f6ff;
    font-weight: 700;
    text-align: right;
    min-width: 28px;
    padding-left: 6px;
    font-size: 11px;
}

.equipment-grid{
    display: grid;
    grid-template-columns: repeat(5, 65px);
    grid-template-areas:
        ". shoulder-left head shoulder-right ."
        ". gloves-left body gloves-right ."
        ". weapon belt offhand ."
        ". . legs . ."
        ". boots-left . boots-right .";
    gap: 6px;
    width: max-content;
    margin: 0 auto;
    justify-content: center;
    align-items: center;
    padding: 8px 0 0 0;
    position: relative;
}

.equipment-grid::before {
    content: 'Equipment';
    position: absolute;
    top: -28px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: rgba(150, 180, 200, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
}

.equipment-slot{
    position: relative;
    aspect-ratio: 1;
    background-color: rgba(255,255,255,0.08);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 84% 84%;
    border: 1.5px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    min-height: 44px;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.06), 0 2px 4px rgba(0,0,0,0.3);
}

.equipment-slot:hover{
    background-color: rgba(255,255,255,0.14);
    border-color: rgba(100,200,255,0.7);
    transform: scale(1.02);
    box-shadow: inset 0 1px 4px rgba(100,200,255,0.12), 0 4px 8px rgba(100,200,255,0.15);
}

.equipment-slot.selected {
    border-color: rgba(100, 200, 255, 0.9);
    border-width: 2px;
    background-color: rgba(100, 200, 255, 0.15);
    box-shadow: inset 0 1px 4px rgba(100,200,255,0.2), 0 0 12px rgba(100,200,255,0.25);
}

.equipment-slot.drag-over{ background-color: rgba(100,200,255,0.15); border-color: rgba(100,200,255,0.6); }

.equipment-slot.invalid-drop{
    animation: equip-invalid-drop 0.24s ease;
    border-color: rgba(255, 90, 90, 0.95);
    background-color: rgba(255, 90, 90, 0.18);
}

.equipment-slot.valid-drop{
    animation: equip-valid-drop 0.24s ease;
    border-color: rgba(96, 255, 165, 0.95);
    background-color: rgba(96, 255, 165, 0.16);
}

.equipment-slot.has-item{
    background-image: none !important;
}

.equipment-slot img{ max-width: 80%; max-height: 80%; object-fit: contain; pointer-events: none; }
.equipment-slot img.mirrored{ transform: scaleX(-1); }

.equipment-slot .item-count{
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.85);
    color: #ffd700;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 800;
    pointer-events: none;
    border: 1px solid rgba(255,215,0,0.3);
    box-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

.equipment-slot-head{ grid-area: head; background-image: url('Graphics/UI/HeadSlot.png'); }
.equipment-slot-body{ grid-area: body; background-image: url('Graphics/UI/ChestSlot.png'); }
.equipment-slot-legs{ grid-area: legs; background-image: url('Graphics/UI/PantsSlot.png'); }
.equipment-slot-belt{ grid-area: belt; background-image: url('Graphics/UI/BeltSlot.png'); }

.equipment-slot-shoulder-left{ grid-area: shoulder-left; background-image: url('Graphics/UI/ShoulderLeftSlot.png'); }
.equipment-slot-shoulder-right{ grid-area: shoulder-right; background-image: url('Graphics/UI/ShoulderRightSlot.png'); }
.equipment-slot-gloves-left{ grid-area: gloves-left; background-image: url('Graphics/UI/GlovesLeftSlot.png'); }
.equipment-slot-gloves-right{ grid-area: gloves-right; background-image: url('Graphics/UI/GlovesRightSlot.png'); }
.equipment-slot-boots-left{ grid-area: boots-left; background-image: url('Graphics/UI/BootsLeftSlot.png'); }
.equipment-slot-boots-right{ grid-area: boots-right; background-image: url('Graphics/UI/BootsRightSlot.png'); }


.equipment-slot-weapon,
.equipment-slot-offhand{
    background-image: none;
    border-style: dashed;
    border-color: rgba(255,255,255,0.35);
}
.equipment-slot-weapon{ grid-area: weapon; }
.equipment-slot-offhand{ grid-area: offhand; }

@keyframes equip-invalid-drop {
    0% { transform: translateX(0); }
    30% { transform: translateX(-3px); }
    65% { transform: translateX(3px); }
    100% { transform: translateX(0); }
}

@keyframes equip-valid-drop {
    0% { transform: scale(1); }
    45% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

@media (max-width:900px){
    .inventory-layout{ grid-template-columns: 1fr; }
    .inventory-equipment{ width: 100%; }
    .inventory-grid{ grid-template-columns: repeat(4, 58px); grid-auto-rows: 58px; width: max-content; max-width: 100%; max-height: clamp(350px, 60vh, 600px); }
    .inventory-header-right{ gap: 10px; }
    .inventory-hp-bar{ width: 220px; }
    .player-stats-panel{ width: 100%; }
    .loadout-header{ flex-wrap: wrap; }
    .inventory-combat-ui{ margin-left: 0; width: 100%; justify-content: flex-end; }
}

@media (max-width:520px){
    .inventory-grid{ grid-template-columns: repeat(3, 52px); grid-auto-rows: 52px; width: max-content; max-width: 100%; max-height: clamp(300px, 55vh, 550px); }
    .player-stats-panel{ width: 180px; }
    .equipment-grid{
        grid-template-columns: repeat(4, 65px);
        width: max-content;
        grid-template-areas:
            "shoulder-left head head shoulder-right"
            "gloves-left body body gloves-right"
            "weapon belt offhand offhand"
            "legs legs . ."
            "boots-left . . boots-right";
    }
}

/* draggable cursor */
.inv-slot[draggable="true"]{ cursor: grab; }
.inv-slot:active{ cursor: grabbing; }
.equipment-slot[draggable="true"]{ cursor: grab; }
.equipment-slot:active{ cursor: grabbing; }

/* inventory sort button */
.inventory-sort-button{ background:#2f7b99; color:#fff; border:none; padding:8px 10px; border-radius:8px; margin-right:8px; cursor:pointer; }
.inventory-sort-button:hover{ filter:brightness(1.05); }

.inventory-search-bar .inventory-sort-button{
    margin-right: 0;
}

/* Testing panel styles */
.testing-grid{ padding: 16px; }
.testing-section{
    border: 1px solid rgba(112, 196, 255, 0.18);
    background: linear-gradient(180deg, rgba(9, 18, 31, 0.86), rgba(6, 14, 24, 0.9));
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.testing-boundary-tools{ border-style: dashed; border-color: rgba(86, 194, 255, 0.36); }
.testing-save-tools{ border-color: rgba(106, 204, 160, 0.34); }
.testing-skill-section{ border-color: rgba(124, 169, 255, 0.28); }
.testing-item-browser{ border-color: rgba(86, 194, 255, 0.3); }
.testing-craft-debug-section{ border-color: rgba(255, 180, 60, 0.35); }
.testing-section-header{ display: flex; flex-direction: column; gap: 4px; }
.testing-section-subtitle{ font-size: 12px; line-height: 1.45; color: #98a9b6; }
.testing-boundary-title{ color: #b8e7ff; font-size: 13px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; }
.testing-boundary-actions{ display: flex; flex-wrap: wrap; gap: 8px; }
.testing-boundary-actions-inline{ align-items: center; }
.testing-boundary-nudge .testing-boost-btn{ min-width: 64px; padding: 7px 10px; }
.testing-boundary-status{ font-size: 12px; color: #c7d4de; line-height: 1.45; }
.testing-button-cluster{ display: flex; flex-wrap: wrap; gap: 8px; }
.testing-button-cluster-inline{ margin-top: 2px; }
.testing-skill-grid{ display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.testing-skill-row{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
}
.testing-skill-label{ font-weight: 600; color: #eaf6ff; min-width: 0; }
.testing-section-footer{ display: flex; justify-content: flex-end; }
.testing-boost-btn,
.danger-btn{
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    padding: 9px 14px;
    transition: transform 0.14s ease, filter 0.14s ease, box-shadow 0.14s ease;
}
.testing-boost-btn{
    background: linear-gradient(180deg, #3a8fb1, #246680);
    color: #fff;
    box-shadow: 0 8px 18px rgba(13, 47, 62, 0.28);
}
.testing-boost-btn:hover,
.danger-btn:hover{
    filter: brightness(1.08);
    transform: translateY(-1px);
}
.danger-btn{
    background: linear-gradient(180deg, #a34b40, #7f3027);
    color: #fff;
    box-shadow: 0 8px 18px rgba(62, 19, 13, 0.25);
}
.testing-item-browser-controls{ display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.testing-item-input,
.testing-item-select,
.testing-item-list{
    background: rgba(0,0,0,0.35);
    color: #eaf6ff;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
}
.testing-item-input{ flex: 1; min-width: 160px; }
.testing-item-select{ min-width: 120px; }
.testing-item-list{ width: 100%; min-height: 220px; }
.testing-hidden-input{ display: none; }
.testing-craft-debug-controls{ display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.testing-craft-debug-filter-label{ color: #eaf6ff; font-size: 13px; display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.craft-debug-log{ background: rgba(0,0,0,0.5); color: #b8e4ff; font-family: 'Courier New', monospace; font-size: 12px; border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; padding: 10px; min-height: 140px; max-height: 280px; overflow-y: auto; white-space: pre; word-break: break-all; }
.testing-panel-footer{ display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 760px){
    .testing-grid{ padding: 12px; }
    .testing-skill-row{ flex-wrap: wrap; }
    .testing-button-cluster,
    .testing-item-browser-controls,
    .testing-craft-debug-controls,
    .testing-boundary-actions{ flex-direction: column; align-items: stretch; }
    .testing-section-footer,
    .testing-panel-footer{ justify-content: stretch; }
}

.menu-boundary-nudge{
    position: absolute;
    top: 10px;
    right: 58px;
    z-index: 6;
    display: none;
    grid-template-columns: repeat(3, 24px);
    grid-template-areas:
        '. up .'
        'left down right';
    gap: 3px;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid rgba(86, 194, 255, 0.45);
    background: rgba(7, 19, 30, 0.9);
}

.menu-boundary-nudge-btn{
    width: 24px;
    height: 22px;
    border: 1px solid rgba(150, 223, 255, 0.35);
    border-radius: 4px;
    background: rgba(30, 74, 96, 0.95);
    color: #e5f6ff;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

.menu-boundary-nudge-btn:hover{
    filter: brightness(1.12);
}

.menu-boundary-nudge-btn.nudge-up{ grid-area: up; }
.menu-boundary-nudge-btn.nudge-left{ grid-area: left; }
.menu-boundary-nudge-btn.nudge-down{ grid-area: down; }
.menu-boundary-nudge-btn.nudge-right{ grid-area: right; }

body.boundary-edit-enabled .menu-popout.open .menu-boundary-nudge{
    display: grid;
}

/* Chest Confirmation Modal */
.chest-confirm-modal{ position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 160; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.chest-confirm-modal.open{ opacity: 1; }
.chest-confirm-modal:not(.hidden){ pointer-events: auto; }

.chest-confirm-container{ background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 24px 32px; box-shadow: 0 6px 20px rgba(0,0,0,0.6); text-align: center; min-width: 280px; }

.chest-confirm-container h3{ color: #eaf6ff; font-size: 20px; margin: 0 0 20px 0; font-weight: 700; }

.chest-confirm-buttons{ display: flex; gap: 12px; justify-content: center; }

.chest-open-btn{ background: linear-gradient(90deg, #2fa4ff, #1fb0ff); color: #fff; border: none; padding: 10px 24px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 15px; transition: transform 0.1s, filter 0.2s; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.chest-open-btn:hover{ filter: brightness(1.15); transform: scale(1.05); }
.chest-open-all-btn{ background: linear-gradient(90deg, #31c66a, #229a52); }

.chest-open-all-btn:hover{ filter: brightness(1.12); }

.chest-cancel-btn{ background: rgba(255,255,255,0.08); color: #dff6ff; border: 1px solid rgba(255,255,255,0.15); padding: 10px 24px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 15px; transition: transform 0.1s, filter 0.2s; }
.chest-cancel-btn:hover{ background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.3); transform: scale(1.05); }

/* Chest Animation Modal */
.chest-modal{ position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); display: flex; justify-content: center; align-items: center; z-index: 150; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.chest-modal.open{ opacity: 1; }
.chest-modal:not(.hidden){ pointer-events: auto; }

.chest-container{ position: relative; width: 100%; max-width: 1200px; height: 500px; display: flex; justify-content: center; align-items: center; margin-left: -58px; }

.chest-image{ max-width: 250px; max-height: 250px; object-fit: contain; transition: transform 0.3s ease-out; z-index: 2; position: relative; }
.chest-image.opening{ transform: scale(1.1); animation: chestBounce 0.4s ease-out; }

@keyframes chestBounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.15); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1.1); }
}

.chest-flare{ position: absolute; top: 50%; left: 50%; width: 400px; height: 400px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(255,215,0,0.8) 0%, rgba(255,165,0,0.6) 20%, rgba(255,215,0,0.3) 40%, transparent 70%); opacity: 0; transition: opacity 0.5s; pointer-events: none; z-index: 1; }
.chest-flare.active{ animation: flareExpand 1.5s ease-out forwards; }

@keyframes flareExpand {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.3); opacity: 0; }
}

/* Chest Loot Popups */
.chest-loot-container{ position: absolute; top: 50%; left: 50%; width: 100%; height: 100%; pointer-events: none; z-index: 3; }

.chest-stop-btn{
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    background: rgba(27, 38, 48, 0.92);
    color: #f0f6ff;
    border: 1px solid rgba(185, 205, 230, 0.45);
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.chest-stop-btn:hover{
    background: rgba(40, 56, 71, 0.95);
}

.chest-loot-popup{ position: fixed; background: linear-gradient(180deg, rgba(0,0,0,0.7), rgba(0,0,0,0.6)); border: 2px solid rgba(255,215,0,0.4); border-radius: 10px; padding: 10px 12px; width: 120px; max-width: 120px; text-align: center; opacity: 0; animation: lootPopOut 4s ease-out forwards; box-shadow: 0 6px 20px rgba(0,0,0,0.8), 0 0 15px rgba(255,215,0,0.3); overflow: hidden; }

@keyframes lootPopOut {
  0% { 
    transform: translate(-50%, -200%) scale(0.3);
    opacity: 0;
  }
  20% { 
    transform: translate(-50%, -50%) scale(1.15) rotate(5deg);
    opacity: 1;
  }
  30% { 
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    opacity: 1;
  }
  85% { 
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% { 
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
  }
}

.loot-flare{ position: absolute; top: 50%; left: 50%; width: 100px; height: 100px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(255,215,0,0.4) 0%, rgba(255,165,0,0.3) 20%, transparent 60%); animation: lootFlareGlow 1s ease-out; pointer-events: none; z-index: -1; }

@keyframes lootFlareGlow {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

.loot-icon{ width: 36px; height: 36px; object-fit: contain; margin: 4px auto; display: block; }

.loot-text{ color: #eaf6ff; font-size: 12px; font-weight: 600; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Exploration Modal */
.exploration-modal{ position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); display: flex; justify-content: center; align-items: center; z-index: 150; opacity: 0; transition: opacity 0.3s; pointer-events: none; overflow: hidden; }
.exploration-modal.open{ opacity: 1; }
.exploration-modal.is-interactive{ pointer-events: auto; }

.exploration-debug-controls{ position: fixed; top: 14px; left: 14px; background: rgba(0,0,0,0.9); color: #fff; padding: 12px; border-radius: 10px; font-size: 12px; z-index: 149; border: 2px solid rgba(255,255,255,0.3); width: min(430px, 44vw); max-height: calc(100vh - 28px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.exploration-debug-controls button{ margin: 0; padding: 6px 8px; font-size: 11px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.3); color: #fff; cursor: pointer; border-radius: 6px; }
.exploration-debug-controls button:hover{ background: rgba(255,255,255,0.2); }
.exploration-debug-controls > div{ display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 !important; padding: 10px; border-radius: 8px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); }
.exploration-debug-controls > div > strong{ grid-column: 1; align-self: center; }
.exploration-debug-controls > div > span[id^="debug-"]{ grid-column: 2 / -1; align-self: center; color: #c6ebff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exploration-debug-controls > div > br{ display: none; }
.exploration-debug-controls > div > select{ grid-column: span 2; background: rgba(255,255,255,0.08); color: #fff; border: 1px solid rgba(255,255,255,0.3); border-radius: 6px; padding: 6px 8px; }

.exploration-debug-controls > div:first-child{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
.exploration-debug-controls > div:first-child button{ min-height: 34px; }

.exploration-debug-toggle-btn{ position: fixed; top: 20px; right: 82px; background: rgba(0,0,0,0.65); color: #fff; border: 2px solid rgba(255,255,255,0.35); border-radius: 999px; padding: 8px 14px; font-size: 12px; font-weight: 700; cursor: pointer; z-index: 149; transition: all 0.2s ease; }
.exploration-debug-toggle-btn:hover{ background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.55); }

.exploration-close-btn{ position: fixed; top: 20px; right: 20px; background: rgba(0,0,0,0.6); color: #fff; border: 2px solid rgba(255,255,255,0.3); width: 48px; height: 48px; border-radius: 50%; font-size: 24px; cursor: pointer; z-index: 149; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.exploration-close-btn:hover{ background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.5); transform: scale(1.1); }

.exploration-cooldown-board{
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 149;
    min-width: 320px;
    max-width: 44vw;
    padding: 10px 14px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.35);
    background: linear-gradient(180deg, rgba(14, 23, 29, 0.9), rgba(9, 16, 20, 0.9));
    box-shadow: 0 12px 28px rgba(0,0,0,0.45);
}

.exploration-cooldown-title,
.exploration-cooldown-list,
.exploration-cooldown-row,
.exploration-cooldown-zone,
.exploration-cooldown-time{
    font-family: var(--font-ui-display);
    font-style: italic;
    font-weight: 900;
    -webkit-text-stroke: 3px #000;
    paint-order: stroke fill;
}

.exploration-cooldown-title{
    margin: 0 0 8px;
    color: #fff3d3;
    letter-spacing: 0.02em;
    font-size: 22px;
    line-height: 1;
}

.exploration-cooldown-list{ display: flex; flex-direction: column; gap: 4px; }

.exploration-cooldown-row{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    font-size: 17px;
    line-height: 1.05;
}

.exploration-cooldown-zone{ color: #fff; }
.exploration-cooldown-time{ color: #ffe38f; white-space: nowrap; }

@media (max-width: 900px){
    .exploration-cooldown-board{
        top: 72px;
        max-width: calc(100vw - 24px);
        left: 12px;
        padding: 8px 10px;
        min-width: 0;
    }
    .exploration-cooldown-title{ font-size: 18px; }
    .exploration-cooldown-row{ font-size: 14px; }
}

.exploration-map-layout{
    --exploration-map-drop: 52px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: min(96vw, 1420px);
    min-height: min(90vh, 820px);
    margin: var(--exploration-map-drop) auto 0;
    transition: transform 0.2s ease;
}
.exploration-map-container{
    position: relative;
    flex: 0 0 auto;
    width: fit-content;
    height: fit-content;
    max-width: min(90vw, 1200px);
    max-height: calc(90vh - var(--exploration-map-drop));
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    margin: 0 auto;
    transition: opacity 0.2s ease;
}
.exploration-modal.debug-visible .exploration-map-layout{ transform: translateX(190px); }

.exploration-map-tabs{
    position: absolute;
    top: 0;
    left: 0;
    transform: none;
    display: flex;
    flex-direction: row;
    gap: 4px;
    align-items: center;
    padding: 0;
    border: none;
    background: transparent;
    backdrop-filter: none;
    z-index: 41;
}

.exploration-map-tab{
    background: rgba(255,255,255,0.05);
    border: none;
    border-bottom: 2px solid transparent;
    color: #aaa;
    padding: 10px 20px;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    box-shadow: none;
    transition: filter 0.2s, box-shadow 0.2s, background 0.2s;
    white-space: nowrap;
}

.exploration-map-tab:hover{
    background: rgba(255,255,255,0.08);
    color: #ddd;
    filter: none;
}

.exploration-map-tab.is-active{
    background: rgba(47,143,74,0.2);
    color: #2f8f4a;
    border-bottom-color: #2f8f4a;
    box-shadow: none;
}

.exploration-progress-panel{
    display: none;
    position: absolute;
    left: 50%;
    top: 18px;
    transform: translateX(-50%);
    width: min(90vw, 1200px);
    height: calc(90vh - var(--exploration-map-drop) - 18px);
    min-height: 0;
    max-height: calc(90vh - var(--exploration-map-drop) - 18px);
    padding: 14px 14px 16px;
    border-radius: 16px;
    border: 2px solid rgba(255,255,255,0.18);
    background: linear-gradient(180deg, rgba(11, 20, 26, 0.94), rgba(7, 13, 18, 0.96));
    box-shadow: 0 18px 44px rgba(0,0,0,0.56);
    z-index: 42;
    overflow: hidden;
}

.exploration-progress-panel-inner{
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.exploration-progress-cards{
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: min-content;
    align-items: start;
    gap: 10px;
    min-height: 0;
    flex: 1 1 auto;
    overflow: auto;
    padding-right: 4px;
}

.exploration-progress-kicker,
.exploration-progress-heading,
.exploration-progress-copy,
.exploration-progress-card-title,
.exploration-progress-percent,
.exploration-progress-card-meta,
.exploration-progress-note{
    font-family: var(--font-ui-display);
    font-style: italic;
    font-weight: 900;
    -webkit-text-stroke: 2px #000;
    paint-order: stroke fill;
}

.exploration-progress-kicker{
    margin: 0;
    font-size: 14px;
    color: #f4c86e;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.exploration-progress-heading{
    margin: 0;
    font-size: 26px;
    line-height: 0.95;
    color: #f8fbff;
}

.exploration-progress-copy{
    margin: 0;
    font-size: 13px;
    line-height: 1.15;
    color: #d5e7f7;
    max-width: 92ch;
}

.exploration-progress-xp{
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid rgba(137, 184, 215, 0.28);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(10, 24, 34, 0.94), rgba(8, 18, 26, 0.96));
}

.exploration-progress-xp-head{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.exploration-progress-level,
.exploration-progress-xp-text{
    font-family: var(--font-ui-display);
    font-style: italic;
    font-weight: 900;
    -webkit-text-stroke: 2px #000;
    paint-order: stroke fill;
}

.exploration-progress-level{
    font-size: 15px;
    color: #f3f8ff;
}

.exploration-progress-xp-text{
    font-size: 12px;
    color: #d1e6f8;
}

.exploration-progress-xp-shell{
    position: relative;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(5, 11, 17, 0.95);
    border: 1px solid rgba(255,255,255,0.14);
}

.exploration-progress-xp-fill{
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #4f9fd3, #9fe2ff);
    box-shadow: 0 0 14px rgba(117, 201, 243, 0.5);
    transition: width 0.24s ease;
}

.exploration-progress-xp-fill[data-render-mode="transform"]{
    width: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.24s ease;
    will-change: transform;
}

.exploration-progress-card{
    width: 100%;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 11px;
    min-height: 0;
    border-radius: 14px;
    border: 2px solid rgba(242, 202, 128, 0.18);
    background: linear-gradient(180deg, rgba(38, 27, 17, 0.92), rgba(21, 16, 12, 0.96));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
    color: #fff;
    text-align: left;
    cursor: default;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, filter 0.18s ease;
}

.exploration-progress-card:disabled{
    opacity: 1;
}

.exploration-progress-card.is-tracked-only{
    border-color: rgba(121, 161, 190, 0.28);
    background: linear-gradient(180deg, rgba(17, 32, 45, 0.94), rgba(12, 23, 33, 0.98));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.exploration-progress-card.is-level-locked{
    border-color: rgba(180, 188, 195, 0.36);
    background: linear-gradient(180deg, rgba(43, 45, 48, 0.92), rgba(29, 31, 35, 0.96));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
    filter: grayscale(0.7);
}

.exploration-progress-card.is-unlocked{
    cursor: pointer;
    border-color: rgba(255, 213, 96, 0.86);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}

.exploration-progress-card.is-unlocked:hover{
    transform: none;
    filter: brightness(1.04);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.26), inset 0 0 18px rgba(255,255,255,0.34);
}

.exploration-progress-card-header,
.exploration-progress-card-meta{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.exploration-progress-card-title{
    margin: 0;
    font-size: 18px;
    line-height: 0.92;
    color: #fff6df;
}

.exploration-progress-percent{
    font-size: 21px;
    line-height: 1;
    color: #fff4cf;
    white-space: nowrap;
}

.exploration-progress-bar-shell{
    position: relative;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(6, 11, 15, 0.9);
    border: 1px solid rgba(255,255,255,0.12);
}

.exploration-progress-bar-fill{
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #c97335, #f4cf72);
    box-shadow: 0 0 18px rgba(255, 204, 102, 0.35);
    transition: width 0.24s ease;
}

.exploration-progress-bar-fill[data-render-mode="transform"]{
    width: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.24s ease;
    will-change: transform;
}

.exploration-progress-card-meta{
    font-size: 11px;
    line-height: 1.05;
    color: #f8edd2;
}

.exploration-progress-note{
    margin: 0;
    font-size: 10px;
    line-height: 1.05;
    color: #d6e6f3;
}

.exploration-modal.show-progress .exploration-map-container{
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.exploration-modal.show-progress .exploration-progress-panel{
    display: flex;
}

.exploration-base-map{ max-width: min(90vw, 1200px); max-height: calc(90vh - var(--exploration-map-drop)); object-fit: contain; display: block; }
.sailing-base-map{ max-width: min(90vw, 1200px); max-height: calc(90vh - var(--exploration-map-drop)); object-fit: contain; display: none; }

.exploration-region-overlay{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 0.3s ease; pointer-events: none; }
.exploration-region-overlay.is-level-locked{ filter: grayscale(1) brightness(0.55); }
.exploration-region-overlay.is-hover-locked{ filter: grayscale(1) brightness(0.65); }

.sailing-overlays-layer,
.sailing-boundaries-layer{
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.sailing-overlays-layer{ z-index: 18; }
.sailing-boundaries-layer{ z-index: 24; }

.sailing-region-overlay{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.22s ease;
    pointer-events: none;
}

.sailing-svg-boundary{ position: absolute; pointer-events: none; z-index: 25; overflow: visible; }
.sailing-boundary-path{ cursor: pointer; pointer-events: none; transition: fill-opacity 0.2s ease, stroke-width 0.2s ease; opacity: 0; }
.sailing-svg-boundary.sailing-boundary-hidden,
.sailing-boundary-label.sailing-boundary-hidden{ display: none !important; }
.exploration-modal.is-interactive.show-sailing .sailing-boundary-path{ pointer-events: all; }
.exploration-modal.debug-visible.show-sailing .sailing-boundary-path{ opacity: 1; }
.sailing-boundary-path:hover{ fill-opacity: 0.52; stroke-width: 2.6; }

.sailing-boundary-label{
    position: absolute;
    top: 2px;
    left: 2px;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    background: rgba(8, 13, 18, 0.78);
    border: 1px solid rgba(255,255,255,0.38);
    color: #f6fbff;
    font-size: 10px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.exploration-modal.debug-visible.show-sailing .sailing-boundary-label{ display: flex; }

.exploration-modal.show-sailing .exploration-base-map,
.exploration-modal.show-sailing .exploration-region-overlay,
.exploration-modal.show-sailing .exploration-svg-boundary{ display: none; }

.exploration-modal.show-sailing .sailing-base-map,
.exploration-modal.show-sailing .sailing-overlays-layer,
.exploration-modal.show-sailing .sailing-boundaries-layer{ display: block; }

.sailing-debug-controls{ top: 14px; left: 14px; width: min(430px, 44vw); max-width: none; }

@media (max-width: 1200px){
    .exploration-modal.debug-visible .exploration-map-layout{ transform: translateX(120px); }
}

@media (max-width: 900px){
    .exploration-debug-controls,
    .sailing-debug-controls{
        width: min(340px, 92vw);
    }
    .exploration-map-layout{
        flex-direction: column;
        align-items: center;
        gap: 10px;
        min-height: auto;
        --exploration-map-drop: 0px;
        margin-top: 0;
    }
    .exploration-map-tabs{
        position: static;
        transform: none;
        align-self: center;
        padding: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .exploration-map-tab{
        font-size: 13px;
        padding: 8px 14px;
    }
    .exploration-progress-panel{
        position: static;
        transform: none;
        width: min(92vw, 540px);
        height: auto;
        max-height: none;
        padding: 14px;
    }
    .exploration-progress-panel-inner{
        height: auto;
        overflow: visible;
    }
    .exploration-progress-cards{
        grid-template-columns: 1fr;
        overflow: visible;
    }
    .exploration-progress-heading{
        font-size: 28px;
    }
    .exploration-progress-card-title,
    .exploration-progress-percent{
        font-size: 24px;
    }
    .exploration-progress-card-header,
    .exploration-progress-card-meta{
        flex-direction: column;
        align-items: flex-start;
    }
    .exploration-modal.debug-visible .exploration-map-layout{ transform: none; }
}

/* Exploration SVG boundaries */
.exploration-svg-boundary{ position: absolute; pointer-events: none; z-index: 20; }

.exploration-boundary-path{ cursor: pointer; pointer-events: none; transition: all 0.3s ease; opacity: 0; }
.exploration-modal.is-interactive .exploration-boundary-path{ pointer-events: all; }

.exploration-boundary-path.is-level-locked{
    cursor: not-allowed;
    fill: rgba(120, 128, 136, 0.35) !important;
    stroke: rgba(180, 188, 196, 0.86) !important;
}

.exploration-boundary-path.is-hover-locked{
    fill-opacity: 0.62;
}

.exploration-modal.debug-visible .exploration-boundary-path{ opacity: 1; }

.exploration-boundary-path:hover{ fill-opacity: 0.5; }

/* Region Quest Modals */
.region-quest-modal{ position: fixed; inset: 0; background: rgba(0, 0, 0, 0.95); z-index: 150; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.region-quest-modal:not(.hidden){ opacity: 1; pointer-events: all; }

.region-close-btn{ position: fixed; top: 20px; left: 20px; background: rgba(0,0,0,0.7); color: #fff; border: 2px solid rgba(255,255,255,0.4); padding: 12px 20px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; z-index: 151; transition: all 0.2s ease; }
.region-close-btn:hover{ background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.6); transform: translateX(-4px); }

.region-quest-container{ position: relative; max-width: 90vw; max-height: 90vh; display: flex; justify-content: center; align-items: center; }

.region-background{ max-width: 100%; max-height: 90vh; object-fit: contain; display: block; }

.region-quest-marker{ position: absolute; cursor: pointer; transition: all 0.3s ease; }
.region-quest-marker:hover .quest-marker-img{ filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.9)) drop-shadow(0 0 40px rgba(255, 215, 0, 0.6)); transform: scale(1.1); }

.quest-marker-img{ width: 120px; height: 120px; object-fit: contain; transition: all 0.3s ease; filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.3)); }

.quest-info-panel{ position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0, 0, 0, 0.85); border: 2px solid rgba(255, 215, 0, 0.6); border-radius: 12px; padding: 30px; min-width: 400px; max-width: 600px; backdrop-filter: blur(10px); z-index: 152; opacity: 0; pointer-events: none; transition: all 0.3s ease; }
.quest-info-panel:not(.hidden){ opacity: 1; pointer-events: all; }

.quest-info-content h3{ color: #ffd700; font-size: 24px; margin: 0 0 16px 0; text-align: center; }
.quest-info-content p{ color: #fff; font-size: 16px; line-height: 1.6; margin: 0 0 24px 0; }

.quest-info-buttons{ display: flex; gap: 12px; justify-content: center; }
.quest-start-btn, .quest-back-btn{ padding: 12px 24px; font-size: 14px; font-weight: 600; border-radius: 6px; cursor: pointer; transition: all 0.2s ease; border: 2px solid; }
.quest-start-btn{ background: rgba(76, 175, 80, 0.3); color: #fff; border-color: rgba(76, 175, 80, 0.8); }
.quest-start-btn:hover{ background: rgba(76, 175, 80, 0.5); border-color: rgba(76, 175, 80, 1); transform: translateY(-2px); }
.quest-back-btn{ background: rgba(255, 255, 255, 0.1); color: #fff; border-color: rgba(255, 255, 255, 0.3); }
.quest-back-btn:hover{ background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.5); }

.sailing-trip-modal{
    z-index: 151;
}

.sailing-trip-container{
    width: min(700px, 94vw);
    max-height: 88vh;
    overflow: auto;
    background: linear-gradient(180deg, rgba(6, 17, 24, 0.96), rgba(10, 24, 33, 0.96));
    border: 2px solid rgba(108, 198, 255, 0.45);
    border-radius: 14px;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5);
    padding: 18px;
}

.sailing-trip-container h2{
    margin: 0;
    color: #d9efff;
}

.sailing-trip-base-time{
    margin: 8px 0 14px;
    color: #b2cbde;
    font-size: 13px;
}

.sailing-setup-section{
    margin-bottom: 14px;
    border: 1px solid rgba(152, 203, 238, 0.24);
    border-radius: 10px;
    padding: 10px;
    background: rgba(8, 26, 36, 0.55);
}

.sailing-setup-section h3{
    margin: 0 0 8px;
    color: #d3ebff;
    font-size: 16px;
}

.sailing-boat-options{
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.sailing-boat-btn{
    text-align: left;
    font-size: 12px;
    padding: 10px;
    border: 1px solid rgba(162, 205, 234, 0.4);
    border-radius: 8px;
    background: rgba(11, 36, 48, 0.8);
    color: #e5f6ff;
}

.sailing-boat-btn.is-selected{
    border-color: rgba(112, 223, 173, 0.9);
    box-shadow: 0 0 0 1px rgba(112, 223, 173, 0.45) inset;
}

.sailing-boat-btn:disabled{
    opacity: 0.45;
    cursor: not-allowed;
}

.sailing-food-slots{
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.sailing-food-slot-label{
    font-size: 12px;
    color: #cae1f0;
}

.sailing-food-slot{
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(168, 210, 236, 0.4);
    background: rgba(10, 30, 42, 0.85);
    color: #e7f7ff;
    font-weight: 600;
}

.sailing-summary-block p{
    margin: 4px 0;
    color: #cde3f2;
    font-size: 13px;
}

.sailing-trip-status{
    min-height: 20px;
    margin: 0 0 12px;
    color: #bde1ce;
    font-size: 13px;
}

#sailing-set-sail-btn:disabled{
    opacity: 0.45;
    cursor: not-allowed;
}

.sailing-voyage-board{
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 160;
    min-width: 280px;
    max-width: 44vw;
    padding: 10px 14px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.35);
    background: linear-gradient(180deg, rgba(14, 23, 29, 0.9), rgba(9, 16, 20, 0.9));
    box-shadow: 0 12px 28px rgba(0,0,0,0.45);
}

@media (max-width: 900px){
    .sailing-voyage-board{
        bottom: 12px;
        right: 12px;
        max-width: calc(100vw - 24px);
        min-width: 0;
        padding: 8px 10px;
    }
}

.sunreach-task-order{
    position: absolute;
    right: 2%;
    top: 6%;
    width: min(460px, 45vw);
    background: linear-gradient(180deg, rgba(5, 15, 18, 0.92), rgba(11, 25, 30, 0.92));
    border: 2px solid rgba(140, 199, 166, 0.55);
    border-radius: 14px;
    padding: 14px;
    z-index: 152;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(4px);
}

.sunreach-task-order-title{ margin: 0 0 6px; color: #ddf2e4; font-size: 24px; letter-spacing: 0.02em; }
.sunreach-task-order-status{ margin: 0 0 8px; color: #c2d7cf; font-size: 13px; }
.sunreach-task-order-cooldown{ margin: 0 0 10px; color: #ffd28f; font-size: 13px; font-weight: 700; }

.sunreach-task-order-slots{ display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 10px; }
.sunreach-task-slot{
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 8px;
    align-items: center;
    border: 1px dashed rgba(220, 238, 228, 0.35);
    border-radius: 10px;
    background: rgba(7, 22, 29, 0.58);
    padding: 8px;
}
.sunreach-task-slot.drag-over{ border-color: #9fe2bb; background: rgba(38, 76, 59, 0.35); }
.sunreach-task-slot.filled{ border-style: solid; border-color: rgba(147, 214, 176, 0.5); }
.sunreach-task-slot.active{ border-color: #70d3a2; box-shadow: 0 0 0 1px rgba(112, 211, 162, 0.4) inset; }
.sunreach-task-slot.paused{ border-color: #ffcb7f; box-shadow: 0 0 0 1px rgba(255, 203, 127, 0.4) inset; }

.slot-number{
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(209, 235, 223, 0.15);
    color: #e4f5ec;
    font-size: 12px;
}

.slot-content{ display: flex; align-items: center; gap: 8px; color: #b9cbc4; font-size: 12px; min-height: 32px; }
.slot-content img{ width: 38px; height: 38px; object-fit: contain; flex: 0 0 auto; }
.slot-text{ display: flex; flex-direction: column; min-width: 0; }
.slot-text strong{ color: #e8f4ef; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-text span{ color: #bfd1c9; font-size: 11px; }

.slot-progress{ grid-column: 2 / span 1; width: 100%; height: 5px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.slot-progress-fill{ width: 0%; height: 100%; background: linear-gradient(90deg, #6dc6a2, #3dd594); transition: width 0.12s linear; }
.slot-progress-fill[data-render-mode="transform"]{ width: 100%; transform: scaleX(0); transform-origin: left center; transition: none; will-change: transform; }

.sunreach-task-controls{ display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.sunreach-task-controls button{ flex: 1 1 calc(50% - 4px); min-width: 0; }
.sunreach-task-controls button:disabled{ opacity: 0.45; cursor: not-allowed; transform: none; }

.sunreach-task-pool-title{ margin: 0 0 6px; color: #d8eadf; font-size: 14px; }
.sunreach-task-pool{ display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sunreach-task-card{
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(9, 27, 35, 0.7);
    border: 1px solid rgba(173, 220, 194, 0.45);
    border-radius: 10px;
    padding: 6px;
    min-height: 56px;
}
.sunreach-task-card[draggable="true"]{ cursor: grab; }
.sunreach-task-card[draggable="false"]{ opacity: 0.5; }
.sunreach-task-card img{ width: 44px; height: 44px; object-fit: contain; flex: 0 0 auto; }
.sunreach-task-card-info{ display: flex; flex-direction: column; min-width: 0; }
.sunreach-task-card-info strong{ color: #f0fff6; font-size: 12px; line-height: 1.2; }
.sunreach-task-card-info span{ color: #c1d8cc; font-size: 11px; line-height: 1.2; }

.sunreach-task-run-summary{ margin-top: 10px; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 8px; }
.sunreach-task-run-summary p{ margin: 0; font-size: 12px; color: #c8f2d7; }

@media (max-width: 980px){
    .sunreach-task-order{
        position: static;
        width: min(96vw, 560px);
        margin-top: 12px;
    }
    .region-quest-container{
        flex-direction: column;
        gap: 10px;
    }
    .sunreach-task-pool{ grid-template-columns: 1fr; }
}

/* Override: pin sidebar left-center and provide spacing for content */
.sidebar{ position: fixed; left: 12px; top: 50%; transform: translateY(-50%); width: 220px; z-index:70; }
.content{ margin-left: 260px; }

/* Modal overlay and centered popout (authoritative rules) */
.menu-overlay { display: none; }
.menu-overlay:not(.hidden) { position: fixed; inset: 0; display: block; background: transparent; z-index: 120; }

/* Precision alignment grid overlay (toggle via Testing panel) */
body.grid-overlay-enabled::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 125;
    background-image:
        repeating-linear-gradient(to right, rgba(120, 195, 255, 0.16) 0, rgba(120, 195, 255, 0.16) 1px, transparent 1px, transparent var(--grid-minor-step, 24px)),
        repeating-linear-gradient(to bottom, rgba(120, 195, 255, 0.16) 0, rgba(120, 195, 255, 0.16) 1px, transparent 1px, transparent var(--grid-minor-step, 24px)),
        repeating-linear-gradient(to right, rgba(120, 195, 255, 0.28) 0, rgba(120, 195, 255, 0.28) 1px, transparent 1px, transparent var(--grid-major-step, 120px)),
        repeating-linear-gradient(to bottom, rgba(120, 195, 255, 0.28) 0, rgba(120, 195, 255, 0.28) 1px, transparent 1px, transparent var(--grid-major-step, 120px));
}

.menu-popout { position: fixed; z-index: 130; left: 50%; top: 50%; transform: translate(calc(-50% + var(--menu-offset-x, 0px)), calc(-50% + var(--menu-offset-y, 0px))) scale(var(--menu-scale, 1)); width: min(1100px, 96%); max-height: calc(100vh - 140px); background: var(--surface-2); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); overflow: hidden; opacity: 0; pointer-events: none; transition: none; }
.menu-popout.open{ opacity: 1; transform: translate(calc(-50% + var(--menu-offset-x, 0px)), calc(-50% + var(--menu-offset-y, 0px))) scale(var(--menu-scale, 1)); pointer-events: auto; }
.menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) {
    top: calc(clamp(24px, 6vh, 56px) + var(--menu-offset-y, 0px));
    transform: translateX(calc(-50% + var(--menu-offset-x, 0px))) scale(var(--menu-scale, 1));
    height: min(780px, calc(100vh - 80px));
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}
.menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel).open {
    transform: translateX(calc(-50% + var(--menu-offset-x, 0px))) scale(var(--menu-scale, 1));
}

/*
   Layout mode switch:
   - body.layout-v2 (default): fixed-height, top-anchored skill panels.
   - body.layout-legacy: restores the older centered, height-reactive modal behavior.
*/
body.layout-legacy .menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) {
    top: 50%;
    height: auto;
    max-height: calc(100vh - 140px);
    display: block;
    transform: translate(calc(-50% + var(--menu-offset-x, 0px)), calc(-50% + var(--menu-offset-y, 0px))) scale(var(--menu-scale, 1));
}

body.layout-legacy .menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel).open {
    transform: translate(calc(-50% + var(--menu-offset-x, 0px)), calc(-50% + var(--menu-offset-y, 0px))) scale(var(--menu-scale, 1));
}
.menu-popout.inventory-panel{
    width: min(calc(100vw - 120px), 1500px);
    max-width: 1500px;
    left: calc(50% + 100px);
    max-height: calc(100vh - 48px);
}
.menu-popout header { display:flex; justify-content:space-between; align-items:center; padding:16px 56px 16px 20px; border-bottom:1px solid rgba(255,255,255,0.03); position: relative; }
.skill-header-content { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.skill-title-row { display: flex; align-items: center; gap: 12px; }
.skill-header-content h2 { margin: 0; display: inline-flex; align-items: center; gap: 8px; }
.menu-title-icon { width: 32px; height: 32px; display: inline-block; object-fit: contain; flex: 0 0 auto; }
.skill-xp-bar-container { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; }
.skill-xp-bar { flex: 1; min-width: 0; height: 8px; background: rgba(255,255,255,0.05); border-radius: 4px; overflow: hidden; border: 1px solid rgba(255,255,255,0.08); }
.skill-xp-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #76d786, #2fa86a); transition: width 0.3s ease; box-shadow: inset 0 0 0 0.5px rgba(255,255,255,0.1); }
.skill-xp-fill[data-render-mode="transform"] { width: 100%; transform: scaleX(0); transform-origin: left center; transition: transform 0.3s ease; will-change: transform; }
.skill-xp-text {
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
    flex: 0 0 15ch;
    width: 15ch;
    font-variant-numeric: tabular-nums;
}
.skill-header-content + .close-btn {
    position: absolute;
    top: 14px;
    right: 8px;
    line-height: 1;
    padding: 4px 6px;
    z-index: 2;
}
.menu-body { padding: 18px 20px; max-height: 70vh; min-height: 400px; overflow:auto; scrollbar-gutter: stable; }
.menu-body.hidden { min-height: 0 !important; height: 0 !important; padding: 0 !important; overflow: hidden !important; }
.menu-popout footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.03); display:flex; justify-content:flex-end; }

.menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) header,
.menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) .menu-tabs,
.menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) footer {
    flex: 0 0 auto;
}

.menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) .menu-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
}

/* V2 docked layout: tighten vertical density so panes fit without tiny extra scroll. */
body.layout-v2 .menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) .menu-body {
    row-gap: 10px;
    column-gap: 16px;
    padding: 14px 18px;
}

body.layout-v2 .menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) .skill-card {
    padding: 10px 14px;
}

body.layout-v2 .menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) .skill-card h3 {
    margin-bottom: 4px;
}

body.layout-v2 .menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) .skill-card .card-meta {
    margin: 1px 0;
    line-height: 1.25;
}

body.layout-v2 .menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) .skill-card .card-img {
    margin: 6px 0;
}

body.layout-v2 .menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) .skill-card .task-bar {
    margin-top: 4px;
}

body.layout-legacy .menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) header,
body.layout-legacy .menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) .menu-tabs,
body.layout-legacy .menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) footer {
    flex: initial;
}

body.layout-legacy .menu-popout[id^="menu-"]:not(.talent-tree-menu):not(.inventory-panel) .menu-body {
    flex: initial;
    min-height: 400px;
    max-height: 70vh;
}

.menu-popout.tab-scroll-constrained .menu-body:not(.hidden) {
    overflow-y: auto;
    overflow-x: hidden;
    align-content: start;
}

.menu-popout .menu-body::-webkit-scrollbar {
    width: 10px;
}

.menu-popout .menu-body::-webkit-scrollbar-thumb {
    background: rgba(118, 215, 134, 0.45);
    border-radius: 999px;
}

/* Debug boundary boxes for skill popouts (exploration uses a separate modal) */
body.boundary-edit-enabled .menu-popout[id^="menu-"]:not([id^="menu-talent-"]) {
    outline: 2px dashed rgba(86, 194, 255, 0.75);
    outline-offset: -2px;
    box-shadow: 0 0 0 1px rgba(86, 194, 255, 0.28), 0 20px 60px rgba(0,0,0,0.6);
}

body.boundary-edit-enabled .menu-popout[id^="menu-"]:not([id^="menu-talent-"])::after {
    content: attr(id);
    position: absolute;
    top: 8px;
    right: 54px;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: rgba(175, 230, 255, 0.92);
    background: rgba(9, 22, 35, 0.88);
    border: 1px solid rgba(86, 194, 255, 0.45);
    border-radius: 6px;
    padding: 3px 7px;
    pointer-events: none;
    z-index: 2;
}

body.boundary-edit-enabled .menu-popout[id^="menu-"]:not([id^="menu-talent-"]) header {
    cursor: move;
}

body.boundary-edit-enabled .menu-popout.boundary-dragging {
    user-select: none;
}

body.boundary-edit-enabled .menu-popout[id^="menu-"].snap-corner-active:not([id^="menu-talent-"])::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 12px;
    height: 12px;
    transform: translate(-2px, -2px);
    border-radius: 999px;
    background: rgba(118, 215, 134, 0.95);
    box-shadow: 0 0 0 2px rgba(8, 22, 33, 0.95), 0 0 14px rgba(118, 215, 134, 0.65);
    pointer-events: none;
    z-index: 3;
}

.boundary-snap-anchor {
    position: fixed;
    left: 50%;
    top: 50%;
    width: 34px;
    height: 34px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(125, 209, 255, 0.45);
    background: rgba(8, 22, 33, 0.42);
    box-shadow: 0 0 0 1px rgba(125, 209, 255, 0.2) inset;
    pointer-events: none;
    z-index: 160;
    display: grid;
    place-items: center;
    opacity: 0;
    transition: opacity 120ms ease, transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.boundary-snap-anchor.hidden {
    display: none;
}

.boundary-snap-anchor span {
    font-family: var(--font-ui-display);
    font-size: 24px;
    line-height: 1;
    font-weight: 700;
    color: rgba(181, 230, 255, 0.85);
}

body.boundary-edit-enabled .boundary-snap-anchor {
    opacity: 1;
    pointer-events: auto;
    cursor: grab;
}

.boundary-snap-anchor.boundary-dragging {
    cursor: grabbing;
}

.boundary-snap-anchor.snap-active {
    border-color: rgba(118, 215, 134, 0.9);
    box-shadow: 0 0 0 1px rgba(118, 215, 134, 0.35) inset, 0 0 18px rgba(118, 215, 134, 0.4);
    transform: translate(-50%, -50%) scale(1.06);
}

.boundary-snap-anchor.snap-active span {
    color: rgba(199, 255, 209, 0.95);
}

/* Match Smithing modal geometry and keep both Leatherworking tabs aligned (legacy mode only) */
body.layout-legacy #menu-leatherworking {
    top: 50% !important;
    transform: translate(calc(-50% + var(--menu-offset-x, 0px)), calc(-50% + var(--menu-offset-y, 0px))) scale(var(--menu-scale, 1)) !important;
}

body.layout-legacy #menu-leatherworking.open {
    transform: translate(calc(-50% + var(--menu-offset-x, 0px)), calc(-50% + var(--menu-offset-y, 0px))) scale(var(--menu-scale, 1)) !important;
}

body.layout-legacy #menu-leatherworking .tab-content-leatherworking,
body.layout-legacy #menu-leatherworking .tab-content-mistralhide,
body.layout-legacy #menu-leatherworking .tab-content-tannery,
body.layout-legacy #menu-leatherworking .tab-content-skinning {
    min-height: 400px;
    max-height: 70vh;
    align-content: start;
}

/* Login Modal */
.login-modal {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-modal.hidden {
    display: none !important;
}

.login-container {
    text-align: center;
    max-width: 500px;
    padding: 60px 40px;
}

.login-logo {
    display: block;
    width: min(420px, 88vw);
    max-width: 100%;
    height: auto;
    margin: 0 auto 28px;
}

.login-title {
    font-family: var(--font-ui-display);
    font-size: 48px;
    font-weight: 900;
    color: #4cbf6a;
    margin: 0 0 8px 0;
    text-shadow: 0 0 20px rgba(76, 191, 106, 0.32);
}

.login-subtitle {
    font-size: 16px;
    color: #9aa6b2;
    margin: 0 0 40px 0;
    font-weight: 600;
}

.login-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

#login-buttons-section .login-btn {
    width: auto;
    padding-top: 13px;
    padding-bottom: 13px;
}

.login-btn {
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-btn {
    background: linear-gradient(135deg, #4cbf6a, #2f8f4a);
    color: #f4fff6;
    box-shadow: 0 4px 20px rgba(76, 191, 106, 0.28);
    font-weight: 700;
}

.primary-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #63ce7f, #3ea85a);
    box-shadow: 0 8px 30px rgba(76, 191, 106, 0.42);
    transform: translateY(-2px);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn {
    background: rgba(76, 191, 106, 0.1);
    color: #7cd995;
    border: 1px solid rgba(76, 191, 106, 0.34);
}

.secondary-btn:hover {
    background: rgba(76, 191, 106, 0.18);
    border-color: rgba(76, 191, 106, 0.56);
    color: #a1e4b3;
}

/* Character Creator Modal */
.character-creator-modal {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
}

.character-creator-modal.hidden {
    display: none !important;
}

.creator-container {
    max-width: 900px;
    width: 100%;
    padding: 40px;
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
    border-radius: 16px;
    border: 1px solid rgba(47, 143, 74, 0.3);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.9), 0 0 40px rgba(76, 191, 106, 0.16);
}

.creator-title {
    font-family: var(--font-ui-display);
    font-size: 32px;
    font-weight: 700;
    color: #4cbf6a;
    margin: 0 0 30px 0;
    text-align: center;
    text-shadow: 0 0 20px rgba(76, 191, 106, 0.22);
}

.creator-section {
    margin-bottom: 30px;
}

.creator-label {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #dfe8ee;
    margin-bottom: 12px;
}

.character-name-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(76, 191, 106, 0.32);
    border-radius: 8px;
    color: #dfe8ee;
    transition: all 0.2s;
}

.character-name-input:focus {
    outline: none;
    border-color: #4cbf6a;
    background: rgba(76, 191, 106, 0.1);
    box-shadow: 0 0 0 3px rgba(76, 191, 106, 0.18);
}

.avatar-gender-toggle {
    display: inline-flex;
    gap: 10px;
    margin-bottom: 12px;
}

.avatar-gender-btn {
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid rgba(124, 217, 149, 0.32);
    background: rgba(16, 34, 29, 0.8);
    color: #cce8d5;
    font-weight: 700;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.avatar-gender-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(124, 217, 149, 0.62);
}

.avatar-gender-btn.selected {
    background: linear-gradient(135deg, rgba(76, 191, 106, 0.28), rgba(36, 128, 74, 0.45));
    color: #f3fff7;
    border-color: rgba(164, 235, 183, 0.9);
    box-shadow: 0 0 0 1px rgba(164, 235, 183, 0.22), 0 0 20px rgba(76, 191, 106, 0.4);
}

.creator-avatar-hint,
.creator-avatar-note {
    margin: 0 0 12px 0;
    font-size: 12px;
    color: #9eb0bc;
}

.creator-avatar-note {
    margin-top: 12px;
    margin-bottom: 0;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
    align-content: start;
    gap: 10px;
    height: min(52vh, 440px);
    min-height: min(52vh, 440px);
    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(124, 217, 149, 0.16);
    background: linear-gradient(145deg, rgba(8, 16, 20, 0.92), rgba(14, 26, 24, 0.86));
}

.avatar-choice-card {
    position: relative;
    border: 1px solid rgba(124, 217, 149, 0.2);
    background: linear-gradient(145deg, rgba(25, 42, 39, 0.85), rgba(16, 28, 31, 0.92));
    border-radius: 10px;
    cursor: pointer;
    padding: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transform-origin: center;
    animation: avatar-card-rise 0.45s ease both;
    animation-delay: calc(var(--stagger-index, 0) * 12ms);
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.avatar-choice-card img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(124, 217, 149, 0.3);
    background: rgba(255, 255, 255, 0.04);
}

.avatar-choice-card:hover {
    transform: translateY(-4px) scale(1.04) rotate(-1deg);
    border-color: rgba(169, 241, 188, 0.72);
    box-shadow: 0 10px 26px rgba(20, 88, 54, 0.45);
}

.avatar-choice-card.selected {
    border-color: #9de7b2;
    box-shadow: 0 0 0 1px rgba(157, 231, 178, 0.35), 0 0 18px rgba(87, 194, 120, 0.5);
    animation: avatar-selected-pulse 1.6s ease-in-out infinite;
}

.avatar-choice-index {
    font-size: 11px;
    font-weight: 700;
    color: #cae7d5;
    line-height: 1;
}

@keyframes avatar-card-rise {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes avatar-selected-pulse {
    0% { box-shadow: 0 0 0 1px rgba(157, 231, 178, 0.35), 0 0 8px rgba(87, 194, 120, 0.36); }
    50% { box-shadow: 0 0 0 1px rgba(157, 231, 178, 0.5), 0 0 18px rgba(87, 194, 120, 0.68); }
    100% { box-shadow: 0 0 0 1px rgba(157, 231, 178, 0.35), 0 0 8px rgba(87, 194, 120, 0.36); }
}

@media (prefers-reduced-motion: reduce) {
    .avatar-choice-card,
    .avatar-choice-card.selected,
    .avatar-gender-btn {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}

.creator-actions {
    margin-top: 30px;
    text-align: center;
}

.avatar-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

/* Character List Section */
.character-list-section {
    width: 100%;
}

.character-list-section h2 {
    font-size: 24px;
    font-weight: 700;
    color: #4cbf6a;
    margin: 0 0 24px 0;
    text-align: center;
}

.character-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.character-card {
    padding: 20px;
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 2px solid rgba(76, 191, 106, 0.22);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.character-card:hover {
    background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface) 100%);
    border-color: rgba(124, 217, 149, 0.52);
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(76, 191, 106, 0.22), 0 8px 16px rgba(0, 0, 0, 0.4);
}

.character-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.character-avatar-image {
    width: 56px;
    height: 56px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid rgba(76, 191, 106, 0.3);
    background: rgba(255, 255, 255, 0.02);
    padding: 2px;
}

.character-card-info {
    flex: 1;
}

.character-name {
    font-size: 18px;
    font-weight: 700;
    color: #7cd995;
    margin: 0;
}

.character-details {
    font-size: 13px;
    color: #9aa6b2;
    margin: 4px 0 0 0;
    display: flex;
    gap: 12px;
}

@media (max-width: 720px) {
    .creator-container {
        padding: 24px;
    }

    .avatar-grid {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        height: min(48vh, 340px);
        min-height: min(48vh, 340px);
    }

    .avatar-choice-card img {
        width: 52px;
        height: 52px;
    }
}

.character-list-section.hidden,
.login-buttons.hidden {
    display: none !important;
}

.login-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ------------------------------------------------------------------
   Boss Fight Modal
------------------------------------------------------------------ */

.boss-fight-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}
.boss-fight-modal.hidden { display: none; }

.boss-fight-inner {
    position: relative;
    display: flex;
    gap: 16px;
    background: #141820;
    border: 1px solid #2e3340;
    border-radius: 14px;
    padding: 20px;
    max-width: 1260px;
    width: 100%;
    max-height: 92vh;
    overflow: hidden;
    box-shadow: 0 8px 48px rgba(0,0,0,0.7);
}

/* -- Boss portrait column -- */
.boss-fight-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 200px;
    width: 220px;
    flex-shrink: 0;
}

.boss-portrait-frame {
    border-radius: 10px;
    border: 3px solid #555;
    overflow: hidden;
    background: #0e1116;
    padding: 3px;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.boss-portrait-frame.rarity-rare {
    border-color: #4ea3ff;
    box-shadow: 0 0 14px rgba(78,163,255,0.5);
}
.boss-portrait-frame.rarity-epic {
    border-color: #a855f7;
    box-shadow: 0 0 14px rgba(168,85,247,0.5);
}
.boss-portrait-frame.rarity-legendary {
    border-color: #f59e0b;
    box-shadow: 0 0 18px rgba(245,158,11,0.55);
}

.boss-portrait-area {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    overflow: hidden;
    border-radius: 6px;
}
.boss-portrait-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* HP bar under portrait */
.boss-hp-bar-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.boss-hp-bar {
    height: 14px;
    border-radius: 7px;
    background: #1e2330;
    overflow: hidden;
}
.boss-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 7px;
    width: 0%;
    transition: width 0.3s;
}

.boss-hp-fill[data-render-mode="transform"] {
    width: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.3s;
    will-change: transform;
}
.player-hp-bar .player-hp-fill {
    background: linear-gradient(90deg, #4ade80, #16a34a);
}
.boss-hp-text {
    font-size: 0.75rem;
    color: #d4e7c5;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.04em;
}

/* Swing timer bar */
.boss-swing-bar {
    height: 5px;
    background: #1e2330;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 3px;
}
.boss-swing-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    border-radius: 3px;
    width: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    transition: none;
    will-change: transform;
}

.player-swing-bar {
    height: 4px;
    margin-top: 2px;
}

.player-swing-fill {
    background: linear-gradient(90deg, #34d399, #16a34a);
}

/* Rarity badge + name */
.boss-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.boss-rarity-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 7px;
    border-radius: 4px;
    background: #22c55e22;
    color: #22c55e;
    border: 1px solid #22c55e55;
    white-space: nowrap;
}
.boss-rarity-badge.rarity-rare {
    background: rgba(78,163,255,0.14);
    color: #8ec4ff;
    border-color: rgba(78,163,255,0.55);
}
.boss-rarity-badge.rarity-epic {
    background: #a855f722;
    color: #c084fc;
    border-color: #a855f755;
}
.boss-rarity-badge.rarity-legendary {
    background: #f59e0b22;
    color: #fbbf24;
    border-color: #f59e0b55;
}
.boss-name-text {
    font-size: 0.9rem;
    font-weight: 700;
    color: #e8eaf0;
    line-height: 1.25;
    text-align: center;
    width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Stats row (boss + player) */
.boss-stats-row {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}
.boss-stat-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
}
.boss-stat-cell img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}
.boss-stat-cell span {
    font-size: 0.8rem;
    font-weight: 700;
    color: #c0cae0;
}

/* Ability card */
.boss-ability-card {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #1b2030;
    border: 1px solid #2e3a50;
    border-radius: 8px;
    padding: 8px 10px;
    transition: border-color 0.25s, box-shadow 0.25s;
}
.boss-ability-card.ability-active {
    border-color: #f59e0b;
    box-shadow: 0 0 10px rgba(245,158,11,0.4);
}
.ability-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 5px;
    flex-shrink: 0;
}
.ability-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #f0e09a;
}
.ability-desc {
    font-size: 0.7rem;
    color: #8899aa;
    line-height: 1.4;
    margin-top: 2px;
}

/* -- Center combat log -- */
.boss-fight-center {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}
.combat-log-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #5a6a80;
    margin-bottom: 6px;
}
.boss-combat-log {
    flex: 1;
    overflow-y: auto;
    background: #0d1018;
    border: 1px solid #1e2535;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 420px;
    min-height: 200px;
}
.log-entry {
    font-size: 0.78rem;
    line-height: 1.4;
    padding: 1px 0;
}
.type-player-hit { color: #4ade80; }
.type-boss-hit   { color: #f87171; font-weight: 600; }
.type-miss       { color: #4b5563; font-style: italic; }
.type-ability    { color: #fbbf24; font-weight: 600; }
.type-status     { color: #94a3b8; font-style: italic; }

/* -- Player column -- */
.boss-fight-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 185px;
    width: 200px;
    flex-shrink: 0;
}

.boss-fight-debug {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 230px;
    width: 250px;
    flex-shrink: 0;
    background: #101621;
    border: 1px solid #243146;
    border-radius: 10px;
    padding: 10px;
}

.boss-debug-title {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #c0ddff;
    font-weight: 700;
}

.boss-debug-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    color: #e2e8f0;
}

.boss-debug-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.boss-debug-group label {
    font-size: 0.68rem;
    color: #9fb3cc;
}

.boss-debug-group select {
    width: 100%;
    box-sizing: border-box;
    padding: 5px 6px;
    border-radius: 6px;
    border: 1px solid #2c3d56;
    background: #0c1220;
    color: #d5e5fb;
    font-size: 0.72rem;
}

.boss-debug-group select:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.boss-debug-subtitle {
    font-size: 0.68rem;
    color: #9fb3cc;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.boss-debug-range-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
}

.boss-debug-range-row input[type="range"] {
    width: 100%;
    accent-color: #38bdf8;
}

.boss-debug-range-row span {
    min-width: 34px;
    text-align: right;
    color: #bbf7d0;
    font-size: 0.72rem;
    font-weight: 700;
}

.boss-debug-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.boss-debug-grid label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.66rem;
    color: #a7bad2;
}

.boss-debug-grid input[type="number"] {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid #2c3d56;
    background: #0c1220;
    color: #d5e5fb;
    font-size: 0.72rem;
}

.boss-debug-grid input[type="number"]:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.boss-debug-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.boss-debug-btn {
    background: #17263a;
    border: 1px solid #2c4767;
    color: #c6dcf5;
    padding: 6px 8px;
    border-radius: 7px;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
}

.boss-debug-btn:hover {
    background: #1d334d;
    border-color: #3b82f6;
    color: #eff6ff;
}

.boss-debug-summary {
    min-height: 32px;
    padding: 7px 8px;
    border-radius: 7px;
    border: 1px solid #223044;
    background: #0d141f;
    color: #9fb3cc;
    font-size: 0.68rem;
    line-height: 1.35;
}
.bfp-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #e0e8f8;
    text-align: center;
}

.boss-debuff-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.boss-debuff-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.boss-debuff-slot {
    background: #1b2030;
    border: 1px solid #2e3a50;
    border-radius: 7px;
    padding: 5px 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-height: 62px;
    justify-content: center;
}

.boss-debuff-name {
    font-size: 0.58rem;
    color: #cbd5e1;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    max-width: 100%;
}

.boss-debuff-bar.boss-debuff-align-two-lines .boss-debuff-name {
    min-height: calc(1.1em * 2);
}

.boss-debuff-slot img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.boss-debuff-turns {
    font-size: 0.68rem;
    color: #fca5a5;
    font-weight: 700;
}

.boss-debuff-empty {
    grid-column: 1 / -1;
    font-size: 0.7rem;
    color: #64748b;
    text-align: center;
    border: 1px dashed #273246;
    border-radius: 7px;
    padding: 8px;
}

/* Consumable section */
.consumable-section { display: flex; flex-direction: column; gap: 6px; }
.consumable-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #5a6a80;
}
.boss-consumable-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.boss-consumable-slot {
    background: #1b2030;
    border: 1px solid #2e3a50;
    border-radius: 7px;
    padding: 5px 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    min-height: 62px;
    justify-content: center;
}
.boss-consumable-slot:hover { border-color: #3b82f6; background: #1f2d45; }
.boss-consumable-slot.empty { cursor: default; border-color: #1a2030; }
.boss-consumable-slot img { width: 28px; height: 28px; object-fit: contain; }
.consumable-count {
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 700;
}
.consumable-hp {
    font-size: 0.62rem;
    color: #4ade80;
    font-weight: 600;
}
.slot-empty { color: #2e3a50; font-size: 1rem; }
.boss-consumable-cooldown {
    font-size: 0.72rem;
    color: #f59e0b;
    min-height: 16px;
    text-align: center;
}

.boss-auto-heal-control {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.boss-auto-heal-control label {
    font-size: 0.68rem;
    color: #94a3b8;
    white-space: nowrap;
}

.boss-auto-heal-control input[type="range"] {
    width: 100%;
    accent-color: #22c55e;
}

.boss-auto-heal-control span {
    font-size: 0.72rem;
    color: #bbf7d0;
    font-weight: 700;
    min-width: 34px;
    text-align: right;
}

.boss-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

/* Flee button */
.boss-flee-btn {
    background: #2c1a1a;
    border: 1px solid #7f1d1d;
    color: #fca5a5;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.boss-flee-btn:hover { background: #3f1f1f; border-color: #ef4444; color: #fff; }

.boss-start-btn {
    background: #1f3a26;
    border: 1px solid #22c55e;
    color: #bbf7d0;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.boss-start-btn:hover {
    background: #245530;
    border-color: #4ade80;
    color: #ffffff;
}

/* -- End screen overlay -- */
.boss-end-screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 12, 18, 0.92);
    border-radius: 14px;
    z-index: 10;
    flex-direction: column;
}
.boss-end-screen.hidden { display: none; }
.boss-end-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    padding: 30px;
}
.boss-end-title {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 0.06em;
}
.result-victory .boss-end-title { color: #fbbf24; text-shadow: 0 0 20px rgba(251,191,36,0.5); }
.result-defeat  .boss-end-title { color: #f87171; text-shadow: 0 0 20px rgba(248,113,113,0.5); }
.result-flee    .boss-end-title { color: #94a3b8; }
.boss-end-sub {
    font-size: 1rem;
    color: #94a3b8;
}
.boss-end-continue {
    background: #1e3a5f;
    border: 1px solid #3b82f6;
    color: #93c5fd;
    padding: 10px 28px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}
.boss-end-continue:hover { background: #1e4a7f; color: #fff; }

/* -- Floating damage numbers -- */
.boss-dmg-float {
    position: absolute;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url("Graphics/Exploration/Boss UI/Icons/Damage Taken.png");
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    font-size: 1rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
    pointer-events: none;
    animation: bossFloatUp 1.35s ease-out forwards;
    z-index: 5;
    white-space: nowrap;
    transform: translate(-50%, -50%);
}
@keyframes bossFloatUp {
    0%   { opacity: 1; transform: translate(-50%, -50%) translateY(0); }
    70%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) translateY(-45px); }
}

/* -- Mobile layout -- */
@media (max-width: 680px) {
    .boss-fight-inner {
        flex-direction: column;
        max-height: 96vh;
        overflow-y: auto;
        gap: 12px;
    }
    .boss-fight-left,
    .boss-fight-right,
    .boss-fight-debug { width: 100%; min-width: unset; }
    .boss-portrait-area { aspect-ratio: 2/1; }
    .boss-combat-log { max-height: 180px; }
    .boss-debug-actions { grid-template-columns: 1fr; }
}

/* =====================================================
   Boss Drops Panel (under combat log)
   ===================================================== */
.boss-drops-panel {
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid #1f2940;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(16, 23, 36, 0.95), rgba(12, 17, 27, 0.95));
}

.boss-drops-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #d5b574;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.boss-drops-chance {
    font-size: 0.66rem;
    font-weight: 500;
    color: #9f8962;
}

.boss-drops-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.boss-drop-slot {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 7px;
    border: 1px solid #2e3a50;
    background: #182236;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(95, 124, 176, 0.18);
}

.boss-drop-slot.set-oakheart {
    border-color: rgba(34, 197, 94, 0.55);
    background: linear-gradient(180deg, rgba(18, 43, 27, 0.95), rgba(14, 29, 20, 0.95));
    box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.18), 0 0 10px rgba(34, 197, 94, 0.12);
}

.boss-drop-slot.set-stonewarden {
    border-color: rgba(59, 130, 246, 0.55);
    background: linear-gradient(180deg, rgba(19, 31, 55, 0.96), rgba(13, 21, 37, 0.96));
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.18), 0 0 10px rgba(59, 130, 246, 0.12);
}

.boss-drop-slot img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.boss-drop-tooltip {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    min-width: 190px;
    max-width: 240px;
    padding: 7px 8px;
    border: 1px solid #3a4f74;
    border-radius: 7px;
    background: rgba(15, 22, 35, 0.98);
    color: #c6d5ef;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.55);
    z-index: 8;
    pointer-events: none;
    text-align: left;
}

.boss-drop-tooltip.set-oakheart {
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(12, 25, 17, 0.98);
}

.boss-drop-tooltip.set-stonewarden {
    border-color: rgba(59, 130, 246, 0.55);
    background: rgba(12, 20, 35, 0.98);
}

.boss-drop-slot:hover .boss-drop-tooltip {
    display: block;
}

.boss-drop-tooltip-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: #e6eefc;
}

.boss-drop-tooltip-set {
    margin-top: 2px;
    font-size: 0.64rem;
    color: #9eb3d6;
    white-space: nowrap;
}

.boss-drop-tooltip-note {
    margin-top: 2px;
    font-size: 0.64rem;
    color: #91a8cc;
}

.boss-drop-tooltip-indent {
    display: inline-block;
    padding-left: 22px;
}

.boss-drop-tooltip-note.is-active {
    color: #78d7a4;
}

.boss-drops-empty {
    font-size: 0.72rem;
    color: #7d8ba3;
}

