/* ═══════════════════════════════════════════════════════════════
   Design tokens — single source of truth for the GridForge HUD.
   Sweep literals onto these so theming + UI scaling are free.
   --gf-ui-scale drives global HUD sizing (set from prefs at runtime).
   ═══════════════════════════════════════════════════════════════ */
:root {
    /* Accent / brand */
    --gf-accent:        #f0c060;
    --gf-accent-hot:    #ffd884;
    --gf-accent-deep:   #b8862f;
    --gf-accent-glow:   rgba(240,192,96,0.45);

    /* Semantic */
    --gf-danger:        #e0524a;
    --gf-danger-deep:   #8a2a25;
    --gf-success:       #6fc874;
    --gf-info:          #5aa6e0;
    --gf-mana:          #4f86d8;
    --gf-stamina:       #d9b13e;

    /* Text */
    --gf-text-1: #f4ecd8;   /* primary */
    --gf-text-2: #c9c2b4;   /* secondary */
    --gf-text-3: #948d80;   /* muted */
    --gf-text-4: #5e584d;   /* faint */

    /* Panels / surfaces (glass) */
    --gf-panel-bg:        rgba(18,18,26,0.82);
    --gf-panel-bg-strong: rgba(14,14,20,0.94);
    --gf-panel-bg-soft:   rgba(28,28,40,0.55);
    --gf-slot-bg:         rgba(255,255,255,0.045);
    --gf-slot-bg-hover:   rgba(255,255,255,0.10);

    /* Borders */
    --gf-border:        rgba(255,255,255,0.12);
    --gf-border-soft:   rgba(255,255,255,0.07);
    --gf-border-accent: rgba(240,192,96,0.40);

    /* Geometry / depth */
    --gf-radius:    7px;
    --gf-radius-sm: 4px;
    --gf-radius-lg: 12px;
    --gf-shadow:        0 6px 22px rgba(0,0,0,0.55);
    --gf-shadow-strong: 0 10px 38px rgba(0,0,0,0.7);
    --gf-inset:         inset 0 1px 0 rgba(255,255,255,0.08);
    --gf-blur:          7px;

    /* Slot sizing — scales with --gf-ui-scale */
    --gf-ui-scale: 1;
    --gf-slot:   calc(46px * var(--gf-ui-scale));
    --gf-slot-gap: calc(5px * var(--gf-ui-scale));

    --gf-mono: 'Consolas', 'SF Mono', monospace;
}

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

/* ── Fantasy icons (game-icons.net, CC BY 3.0) ──
   Masked SVG tinted to currentColor (gold by default). In-game reuse of the
   marketing-site pipeline. Usage:
     <span class="gf-ic" style="--ic:url('/assets/icons/sword.svg')"></span>
   or via client/js/ui/game_icons.js. Attribution: client/assets/CREDITS.md. */
.gf-ic {
    display: inline-block;
    vertical-align: middle;
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    color: var(--gf-accent);
    background-color: currentColor;
    -webkit-mask: var(--ic, none) center / contain no-repeat;
    mask: var(--ic, none) center / contain no-repeat;
    /* The SVGs are opaque single-path shapes (fill=currentColor → black when
       used as an external mask image). Force ALPHA masking so the shape shows;
       the default `match-source` uses luminance and would hide black shapes. */
    -webkit-mask-mode: alpha;
    mask-mode: alpha;
}

/* ── HUD icon placements (size/tint per surface) ── */
.cs-cat-ic   { color: var(--gf-accent);      vertical-align: -2px; margin: 0 4px 0 1px; opacity: .95; }
.cs-skill-ic { color: var(--gf-accent-deep); width: 12px; height: 12px; vertical-align: -2px; margin-right: 6px; opacity: .8; }
.sb-tab-ic   { vertical-align: -2px; }
.craft-station-ic { color: var(--gf-accent);      vertical-align: -2px; margin-right: 5px; }
.craft-row-ic     { color: var(--gf-accent-deep); width: 14px; height: 14px; margin-right: 7px; vertical-align: -2px; opacity: .85; }
.pt-name-ic       { color: var(--gf-accent);      width: 15px; height: 15px; vertical-align: -2px; margin-right: 5px; }
.pt-row-ic        { color: var(--gf-accent-deep); width: 12px; height: 12px; vertical-align: -2px; margin-right: 6px; opacity: .8; }
/* Hotbar/action-slot icon: cream on the colored backing plate for legibility. */
.gf-slot-icon .gf-slot-svg {
    width: 74%; height: 74%;
    color: var(--gf-text-1);
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.65));
}
/* Inventory slots: faint equip-slot placeholder + filled-item category icon. */
.inv-slot { position: relative; }
.inv-slot-ph {
    position: absolute; inset: 22%; width: auto; height: auto;
    color: var(--gf-accent); opacity: 0.22; pointer-events: none;
}
.inv-item-ic {
    position: absolute; inset: 20%; width: auto; height: auto;
    color: var(--gf-text-1); filter: drop-shadow(0 1px 1px rgba(0,0,0,0.6)); pointer-events: none;
}
/* Third-party attribution footer in the Quick Help panel (CC BY 3.0). */
.qh-credit {
    margin-top: 10px; padding-top: 8px;
    border-top: 1px solid var(--gf-border-soft);
    font-size: 10px; color: var(--gf-text-3);
    text-align: center; line-height: 1.5;
}
.qh-credit a { color: var(--gf-accent-deep); text-decoration: none; }
.qh-credit a:hover { color: var(--gf-accent); text-decoration: underline; }

body {
    background: #000;
    overflow: hidden;
    font-family: 'Segoe UI', sans-serif;
    color: #fff;
    user-select: none;
}

#canvas-container {
    position: fixed;
    inset: 0;
}

#canvas-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Crosshair */
#crosshair {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 20px; height: 20px;
    pointer-events: none;
}
#crosshair::before, #crosshair::after {
    content: '';
    position: absolute;
    background: rgba(255,255,255,0.85);
}
#crosshair::before { width: 2px; height: 100%; left: 50%; transform: translateX(-50%); }
#crosshair::after  { width: 100%; height: 2px; top: 50%; transform: translateY(-50%); }

/* Minimap — canvas fills its GameWindow content area */
.minimap-canvas-host {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #111;
    position: relative;
}
.minimap-canvas-host canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}
/* Minimap window is compact — less titlebar padding so the canvas dominates */
.game-window[data-window-id="minimap"] .game-window-content {
    overflow: hidden;
    padding: 0;
}

/* ── Map shell: header (expanded only) above the canvas host ── */
.gf-map-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}
.gf-map-shell .minimap-canvas-host {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
}

.gf-map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 9px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--gf-border-soft);
    background: linear-gradient(180deg, rgba(56,52,40,0.35), rgba(30,28,22,0.35));
}
.gf-map-header-title {
    font-family: var(--gf-mono);
    font-size: 11px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--gf-text-2);
}
.gf-map-switcher {
    background: var(--gf-panel-bg-strong);
    color: var(--gf-text-1);
    border: 1px solid var(--gf-border);
    border-radius: var(--gf-radius-sm);
    font-family: var(--gf-mono);
    font-size: 11px;
    padding: 2px 6px;
    cursor: pointer;
}
.gf-map-switcher:disabled { opacity: 0.7; cursor: default; }

/* ── Controls overlay (zoom / recenter / expand) ── */
.gf-map-controls {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 2;
}
.gf-map-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gf-panel-bg-strong);
    color: var(--gf-text-2);
    border: 1px solid var(--gf-border);
    border-radius: var(--gf-radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s, box-shadow 0.12s;
}
.gf-map-btn:hover { border-color: var(--gf-border-accent); color: #fff; }
.gf-map-btn.is-on {
    border-color: var(--gf-border-accent);
    color: var(--gf-accent);
    box-shadow: 0 0 0 1px var(--gf-accent-glow);
}

/* ── Coords + legend readouts ── */
.gf-map-coords {
    position: absolute;
    left: 6px;
    bottom: 6px;
    z-index: 2;
    pointer-events: none;
    font-family: var(--gf-mono);
    font-size: 10px;
    letter-spacing: 0.5px;
    color: var(--gf-text-2);
    background: rgba(0,0,0,0.45);
    padding: 2px 6px;
    border-radius: var(--gf-radius-sm);
}
.gf-map-legend {
    position: absolute;
    right: 6px;
    bottom: 6px;
    z-index: 2;
    pointer-events: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px 8px;
    max-width: 65%;
    background: rgba(0,0,0,0.45);
    padding: 3px 6px;
    border-radius: var(--gf-radius-sm);
}
/* The legend is too busy for the tiny compact map — show it only when expanded
   (the inline display from the toggle still wins to hide it entirely). */
.game-window[data-window-id="minimap"]:not(.gf-map-expanded) .gf-map-legend {
    display: none;
}
.gf-leg-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: var(--gf-mono);
    font-size: 9px;
    color: var(--gf-text-2);
}
.gf-leg-item i {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
}

/* ── Transient "map not available" toast ── */
.gf-map-toast {
    position: fixed;
    left: 50%;
    bottom: 80px;
    transform: translateX(-50%);
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    background: var(--gf-panel-bg-strong);
    color: var(--gf-text-1);
    border: 1px solid var(--gf-border-accent);
    border-radius: var(--gf-radius);
    padding: 8px 14px;
    font-size: 12px;
    box-shadow: var(--gf-shadow);
    transition: opacity 0.2s;
}
.gf-map-toast.show { opacity: 1; }

/* HUD info panel */
#hud-info {
    position: fixed;
    top: 12px; left: 12px;
    font-size: 13px;
    color: #fff;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 8px 12px;
    pointer-events: all;
    line-height: 1.6;
    min-width: 140px;
    z-index: 10;
}

#hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#hud-class {
    font-weight: bold;
    font-size: 15px;
    color: #f0c060;
}

#hud-toggle {
    background: none;
    border: 1px solid rgba(255,255,255,0.2);
    color: #888;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
#hud-toggle:hover { color: #fff; border-color: rgba(255,255,255,0.4); }

#hud-details {
    margin-top: 4px;
}

#hud-fps { color: #8b8; }
#hud-time { color: #aac; }

/* Chat panel */
#chat-area {
    position: fixed;
    bottom: 60px; left: 12px;
    width: 360px;
    background: rgba(0,0,0, var(--chat-opacity, 0.6));
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    pointer-events: all;
    z-index: 10;
}

#chat-resize {
    position: absolute;
    top: -3px; right: -3px;
    width: 14px; height: 14px;
    cursor: ne-resize;
    z-index: 2;
}
#chat-resize::after {
    content: '';
    position: absolute;
    bottom: 3px; right: 3px;
    width: 6px; height: 6px;
    border-right: 2px solid rgba(255,255,255,0.25);
    border-top: 2px solid rgba(255,255,255,0.25);
}

#chat-log {
    max-height: 160px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 6px 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.chat-line {
    font-size: 13px;
    padding: 2px 0;
    word-break: break-word;
    line-height: 1.4;
}

.chat-line .chat-name {
    font-weight: 600;
    color: #7ad;
}

.chat-line.chat-system,
.chat-line[data-category="system"] {
    color: #8fd28f;
    font-style: italic;
    font-size: 12px;
}

.chat-line[data-category="player"] { color: #e0e0e0; }
.chat-line[data-category="skill"]  { color: #7dd3fc; font-size: 12px; }
.chat-line[data-category="stat"]   { color: #a5f3a3; font-size: 12px; }

/* Staff-only channel (/s) — distinct gold so staff can pick it out at a glance. */
.chat-line.chat-staff,
.chat-line[data-category="staff"] { color: #ffd479; }
.chat-line.chat-staff .chat-name { color: #ffb938; }

#chat-box {
    display: none;
    padding: 4px 8px 6px;
    pointer-events: all;
}

#chat-input {
    width: 100%;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 4px;
    outline: none;
}

/* Context menu */
.ctx-menu {
    position: fixed;
    z-index: 300;
    background: rgba(20,20,30,0.95);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 4px 0;
    min-width: 180px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.ctx-item {
    padding: 8px 14px;
    font-size: 13px;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ctx-item:hover { background: rgba(255,255,255,0.08); color: #fff; }

.ctx-label { flex: 1; }

.ctx-slider {
    width: 80px;
    accent-color: #f0c060;
    cursor: pointer;
}

.ctx-val {
    font-family: 'Consolas', monospace;
    font-size: 11px;
    color: #888;
    min-width: 28px;
    text-align: right;
}

.ctx-sep {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 4px 8px;
}

/* Character select overlay */
#overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: all;
}

#overlay-inner {
    width: 520px;
    text-align: center;
    pointer-events: all;
}

#overlay input {
    user-select: text;
    pointer-events: all;
}

#overlay button {
    pointer-events: all;
    cursor: pointer;
}

#overlay h1 {
    font-size: 42px;
    letter-spacing: 4px;
    color: #f0c060;
    text-shadow: 0 0 20px rgba(240,192,96,0.5);
    margin-bottom: 6px;
}

#overlay .subtitle {
    color: #888;
    font-size: 14px;
    margin-bottom: 32px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#input-name,
#input-password {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    font-family: 'Segoe UI', sans-serif;
    font-size: 16px;
    border-radius: 6px;
    outline: none;
    margin-bottom: 12px;
    text-align: center;
    letter-spacing: 1px;
}
#input-password {
    /* Match the visual height/font of the username field */
    font-family: 'Segoe UI', sans-serif;
    letter-spacing: 4px;
}
#input-name:focus,
#input-password:focus {
    border-color: rgba(240,192,96,0.5);
    box-shadow: 0 0 8px rgba(240,192,96,0.15);
}

#auth-buttons {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    margin-bottom: 8px;
}

.auth-btn {
    flex: 1;
    display: block;
    padding: 14px 16px;
    background: #f0c060;
    color: #1a1000;
    font-family: 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid #f0c060;
    border-radius: 6px;
    cursor: pointer;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: all 0.15s;
    text-align: center;
    pointer-events: all;
    text-decoration: none;
}
.auth-btn:hover {
    background: #ffd070;
    border-color: #ffd070;
}

.auth-btn.auth-btn-secondary {
    background: rgba(255,255,255,0.06);
    color: #ccc;
    border: 2px solid rgba(255,255,255,0.2);
}
.auth-btn.auth-btn-secondary:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.35);
    color: #fff;
}

.auth-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

#char-select-links {
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13px;
}
.overlay-link {
    color: #888;
    text-decoration: none;
    letter-spacing: 1px;
    transition: color 0.15s;
}
.overlay-link:hover {
    color: #f0c060;
}
.overlay-link-sep {
    color: #555;
}

#race-select {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.race-btn {
    flex: 1;
    padding: 16px 8px;
    border: 2px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: #ccc;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
    min-height: 90px;
}

.race-btn:hover {
    border-color: rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.1);
}

.race-btn.selected {
    border-color: #f0c060;
    background: rgba(240,192,96,0.12);
    color: #fff;
}

.race-btn .race-name {
    font-size: 16px;
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
    color: #f0c060;
}

.race-btn .race-stats {
    display: block;
    margin-top: 6px;
    color: #888;
    font-size: 11px;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Lore-color hints (optional, admin-changeable in future) */
.race-btn[data-race="hollowed"] .race-name { color: #8870e0; }
.race-btn[data-race="deepkin"] .race-name { color: #40a060; }
.race-btn[data-race="veilborn"] .race-name { color: #f0c060; }

.race-detail {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 12px;
    line-height: 1.55;
    color: #bbb;
    text-align: left;
    min-height: 60px;
}

.race-detail .race-detail-title {
    color: #f0c060;
    font-weight: bold;
    margin-bottom: 4px;
    display: block;
}

.race-detail .race-detail-perks {
    margin-top: 6px;
    color: #80c0c0;
    font-size: 11px;
}

/* (btn-start removed in Phase 4 — replaced by auth buttons) */

/* Character select / create */
#input-char-name {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    font-family: 'Segoe UI', sans-serif;
    font-size: 16px;
    border-radius: 6px;
    outline: none;
    margin-bottom: 12px;
    text-align: center;
    letter-spacing: 1px;
}
#input-char-name:focus {
    border-color: rgba(240,192,96,0.5);
    box-shadow: 0 0 8px rgba(240,192,96,0.15);
}

#char-slots {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 8px;
}

.char-slot {
    padding: 16px;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    color: #ccc;
}
.char-slot:hover {
    border-color: rgba(240,192,96,0.5);
    background: rgba(240,192,96,0.08);
}
.char-slot.empty {
    border-style: dashed;
    color: #888;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 110px;
    font-size: 14px;
    letter-spacing: 1px;
}

.char-slot .char-name {
    font-size: 18px;
    font-weight: bold;
    color: #f0c060;
    display: block;
    margin-bottom: 4px;
}
.char-slot .char-class {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 1px;
    color: #888;
    display: block;
    margin-bottom: 8px;
}
.char-slot .char-stats {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 8px;
}

.char-slot[data-race="veilborn"] .char-name { color: #f0c060; }
.char-slot[data-race="hollowed"] .char-name { color: #8870e0; }
.char-slot[data-race="deepkin"] .char-name { color: #40a060; }

.char-slot-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.char-slot-btn {
    flex: 1;
    padding: 6px 10px;
    background: rgba(240,192,96,0.18);
    color: #f0c060;
    border: 1px solid rgba(240,192,96,0.4);
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.char-slot-btn:hover { background: rgba(240,192,96,0.3); }
.char-slot-btn.danger {
    background: rgba(218,54,51,0.15);
    color: #f85149;
    border-color: rgba(218,54,51,0.4);
}
.char-slot-btn.danger:hover { background: rgba(218,54,51,0.3); }

/* Escape menu */
#escape-menu {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.esc-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
}

.esc-container {
    position: relative;
    z-index: 1;
    width: 380px;
    transition: width 0.2s ease;
}
.esc-container:has(.esc-panel-settings[style*="flex"]) {
    width: 540px;
}

.esc-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(20,20,30,0.95);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 32px 28px;
}

.esc-panel h2 {
    font-size: 22px;
    letter-spacing: 3px;
    color: #f0c060;
    text-align: center;
    margin-bottom: 12px;
}

.esc-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #ddd;
    font-size: 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 1px;
}
.esc-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

.esc-btn-danger { color: #f85149; border-color: rgba(248,81,73,0.3); }
.esc-btn-danger:hover { background: rgba(248,81,73,0.15); }

.esc-btn-secondary { color: #8b949e; font-size: 13px; padding: 8px; margin-top: 8px; }

/* Settings tabs */
.esc-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.esc-tab {
    flex: 1;
    padding: 8px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: #8b949e;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
}
.esc-tab.active { background: rgba(240,192,96,0.15); color: #f0c060; border-color: rgba(240,192,96,0.3); }

/* Settings panel — futuristic scanline overlay */
.esc-panel-settings {
    position: relative;
    max-width: 540px;
}
.esc-panel-settings::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg, transparent, transparent 2px,
        rgba(240,192,96,0.03) 2px, rgba(240,192,96,0.03) 4px
    );
    pointer-events: none;
    border-radius: 12px;
}

.esc-btn-small {
    padding: 8px 16px;
    font-size: 12px;
    width: auto;
}

/* Keybind search */
.keybind-search-wrap {
    position: relative;
    margin-bottom: 10px;
}
.keybind-search-wrap::before {
    content: '\2315';
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 14px;
    pointer-events: none;
}
.keybind-search {
    width: 100%;
    padding: 8px 12px 8px 30px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    font-size: 13px;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}
.keybind-search:focus {
    border-color: rgba(240,192,96,0.5);
    box-shadow: 0 0 8px rgba(240,192,96,0.15);
}

/* Keybind list */
.keybinds-list {
    max-height: 380px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(240,192,96,0.2) transparent;
}

/* ── Unified Options window (Keybinds | Macros | Abilities | Help) ──
   Lives inside a resizable GameWindow, so panes flex to fill rather than
   capping at a fixed height like the old escape-modal layout did. */
.gf-options-menu {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: var(--gf-text-1);
    font-size: 13px;
}
.gf-options-body { flex: 1; min-height: 0; display: flex; }
.gf-options-pane {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
}
.gf-options-pane.macro-pane { padding: 0; }
.gf-options-pane.macro-pane > .gf-macro-editor { flex: 1; min-height: 0; }
.gf-options-menu .keybinds-list { max-height: none; flex: 1; min-height: 0; }
.gf-options-menu .help-list { flex: 1; min-height: 0; overflow-y: auto; }
.gf-options-menu .keybind-footer { align-items: center; gap: 8px; }
.gf-options-menu .gf-reset-confirm-msg {
    margin-right: auto;
    color: var(--gf-text-2);
    font-size: 12px;
}

/* ── Game Options pane ── */
.gf-options-pane.game-options-pane { overflow-y: auto; }
.gf-go-intro { color: var(--gf-text-3); font-size: 12px; line-height: 1.4; margin-bottom: 6px; }
.gf-go-group {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--gf-accent); margin: 14px 0 2px; padding-bottom: 4px;
    border-bottom: 1px solid var(--gf-border-soft);
}
.gf-go-row {
    display: flex; align-items: center; gap: 12px;
    padding: 7px 4px; cursor: pointer; border-radius: var(--gf-radius-sm);
}
.gf-go-row:hover { background: rgba(255,255,255,0.04); }
.gf-go-label { flex: 1; font-size: 13px; color: var(--gf-text-1); }
.gf-go-select { flex: 0 0 130px; }
.gf-go-check { width: 16px; height: 16px; accent-color: var(--gf-accent); cursor: pointer; }

/* Sound options pane (reuses the gf-go-* row/label/group look) */
.gf-options-pane.sound-options-pane { overflow-y: auto; }
.gf-so-slider { flex: 0 0 180px; display: flex; align-items: center; gap: 10px; }
.gf-so-slider input[type="range"] {
    flex: 1; height: 4px; cursor: pointer; accent-color: var(--gf-accent);
    background: transparent;
}
.gf-so-val {
    flex: 0 0 38px; text-align: right; font-size: 12px;
    font-variant-numeric: tabular-nums; color: var(--gf-text-3);
}
.gf-so-np { flex: 1; font-size: 13px; color: var(--gf-accent); font-style: italic; }

.keybind-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* Category headers */
.keybind-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 4px 6px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid rgba(240,192,96,0.15);
    margin-top: 4px;
}
.keybind-cat-arrow {
    color: #666;
    font-size: 12px;
    font-family: 'Consolas', monospace;
    width: 12px;
}
.keybind-cat-label {
    color: #f0c060;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    flex: 1;
}
.keybind-cat-count {
    color: #555;
    font-size: 11px;
    font-family: 'Consolas', monospace;
}
.keybind-category-header:hover .keybind-cat-label { color: #ffd070; }

/* Keybind rows */
.keybind-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 4px 7px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    border-left: 3px solid transparent;
    transition: opacity 0.2s, max-height 0.3s, padding 0.2s, border-color 0.2s;
    max-height: 50px;
    overflow: hidden;
}
.keybind-row:hover { background: rgba(255,255,255,0.03); }
.keybind-row.keybind-filtered {
    opacity: 0;
    max-height: 0;
    padding: 0 4px 0 20px;
    border-bottom: none;
}
.keybind-row.keybind-conflict {
    border-left-color: #f85149;
    animation: conflictPulse 2s ease infinite;
}
.keybind-row.keybind-locked { opacity: 0.5; }

.keybind-category-header.keybind-filtered {
    display: none;
}

/* Help tab (Settings → Help) */
.help-search-wrap {
    position: relative;
    margin-bottom: 10px;
}
.help-search-wrap::before {
    content: '\2315';
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 14px;
    pointer-events: none;
}
.help-search {
    width: 100%;
    padding: 8px 12px 8px 30px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    font-size: 13px;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}
.help-search:focus {
    border-color: rgba(240,192,96,0.5);
    box-shadow: 0 0 8px rgba(240,192,96,0.15);
}
.help-list {
    max-height: 380px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(240,192,96,0.2) transparent;
}
.help-blurb {
    color: #ccc;
    font-size: 12px;
    line-height: 1.55;
    padding: 0 4px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 8px;
}
.help-blurb p { margin: 0 0 6px; }
.help-blurb p:last-child { margin-bottom: 0; }
.help-blurb kbd {
    display: inline-block;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(240,192,96,0.3);
    color: #f0c060;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-family: 'Consolas', monospace;
    vertical-align: baseline;
}
.help-section {
    margin-bottom: 10px;
}
.help-section.help-filtered {
    display: none;
}
.help-section-title {
    color: #f0c060;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 8px 0 4px;
    padding: 6px 4px 4px;
    border-bottom: 1px solid rgba(240,192,96,0.15);
}
.help-rows {
    display: flex;
    flex-direction: column;
}
.help-row {
    display: grid;
    grid-template-columns: 150px 120px 1fr;
    gap: 10px;
    padding: 6px 4px 6px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    align-items: baseline;
    transition: opacity 0.2s, max-height 0.3s, padding 0.2s;
    max-height: 60px;
    overflow: hidden;
}
.help-row:hover { background: rgba(255,255,255,0.03); }
.help-row.help-filtered {
    opacity: 0;
    max-height: 0;
    padding: 0 4px 0 20px;
    border-bottom: none;
}
.help-row-label {
    color: #e0e0e0;
    font-size: 12px;
}
.help-row-bind {
    color: #7dd3fc;
    font-size: 11px;
    font-family: 'Consolas', monospace;
}
.help-row-desc {
    color: #999;
    font-size: 11px;
    line-height: 1.4;
}

/* Quick Help overlay (reuses .help-blurb / .help-row* above) */
.quick-help-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding: 10px 12px 12px;
    background: var(--gf-panel-bg-strong);
}
.help-row-bind.qh-unbound {
    color: var(--gf-text-3);
    opacity: 0.7;
    font-style: italic;
}

/* Floating "?" quick-help button */
#gf-help-btn {
    position: fixed;
    right: 14px;
    bottom: 14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gf-panel-bg);
    border: 1px solid var(--gf-border-accent);
    color: var(--gf-accent);
    font-family: var(--gf-mono);
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    z-index: 50;
    backdrop-filter: blur(var(--gf-blur));
    box-shadow: var(--gf-shadow);
    transition: transform 0.12s, box-shadow 0.12s, color 0.12s;
}
#gf-help-btn:hover {
    color: var(--gf-accent-hot);
    transform: scale(1.12);
    box-shadow: var(--gf-shadow), 0 0 10px var(--gf-accent-glow);
}

/* Chat config tab (Settings → Chat) */
.chat-config-list {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}
.chat-config-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.chat-config-row:hover { background: rgba(255,255,255,0.03); }
.chat-config-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #ccc;
    font-size: 13px;
}
.chat-config-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #f0c060;
    cursor: pointer;
}
.chat-config-row input[type="color"] {
    width: 32px;
    height: 22px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.2);
    background: transparent;
    cursor: pointer;
}
.chat-config-size {
    width: 44px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.15);
    color: #ddd;
    padding: 2px 4px;
    font-size: 12px;
    text-align: right;
    font-family: 'Consolas', monospace;
}
.chat-config-size-suffix {
    color: #666;
    font-size: 11px;
}

@keyframes conflictPulse {
    0%, 100% { border-left-color: #f85149; }
    50% { border-left-color: rgba(248,81,73,0.3); }
}

.keybind-label {
    font-size: 13px;
    color: #ccc;
    flex: 1;
}
.keybind-note {
    display: block;
    font-size: 10px;
    color: #666;
    font-style: italic;
}

.keybind-key-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.keybind-warn {
    color: #f85149;
    font-size: 12px;
    font-weight: bold;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(248,81,73,0.4);
    border-radius: 3px;
    cursor: help;
}
.keybind-warn-browser {
    color: #d29922;
    border-color: rgba(210,153,34,0.4);
}

.keybind-key {
    min-width: 90px;
    padding: 6px 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    border: 1px solid rgba(255,255,255,0.15);
    color: #f0c060;
    font-size: 13px;
    font-family: 'Consolas', 'Monaco', monospace;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    white-space: nowrap;
}
.keybind-key:hover {
    border-color: #f0c060;
    box-shadow: 0 0 8px rgba(240,192,96,0.3);
}
.keybind-key-locked {
    cursor: default;
    opacity: 0.6;
}
.keybind-key-locked:hover {
    border-color: rgba(255,255,255,0.15);
    box-shadow: none;
}
.keybind-key.rebinding {
    background: rgba(240,192,96,0.15);
    border-color: #f0c060;
    color: #fff;
    animation: scanPulse 1.5s ease infinite;
}

@keyframes scanPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(240,192,96,0.2); }
    50% { box-shadow: 0 0 16px rgba(240,192,96,0.5); }
}

/* ═══════════════════════════════════════════
   Phase 4: Stat bars
   ═══════════════════════════════════════════ */

#stat-bars {
    position: fixed;
    bottom: 12px; left: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
    pointer-events: none;
}

.stat-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 16px;
}

.stat-bar-label {
    font-size: 10px;
    font-weight: 600;
    font-family: 'Consolas', monospace;
    color: #999;
    width: 28px;
    text-align: right;
    letter-spacing: 1px;
}

.stat-bar-track {
    width: 180px;
    height: 10px;
    background: rgba(0,0,0,0.6);
    border: 1px solid var(--gf-border-accent);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.45);
    border-radius: 3px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.stat-bar[data-stat="hp"] .stat-bar-fill { background: linear-gradient(90deg, #a03030, #c04040); }
.stat-bar[data-stat="stamina"] .stat-bar-fill { background: linear-gradient(90deg, #907020, #c0a040); }
.stat-bar[data-stat="mana"] .stat-bar-fill { background: linear-gradient(90deg, #304080, #4060c0); }

.stat-bar-value {
    font-size: 10px;
    font-family: 'Consolas', monospace;
    color: #888;
    min-width: 50px;
}

.stat-bar.stat-bar-low .stat-bar-fill {
    animation: lowHpPulse 1s ease infinite;
}

@keyframes lowHpPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ── MobileStatBar (draggable per-mobile stat window) ── */
/* Stat-bar windows are always small; override the generic 100px min-height
 * so content doesn't trigger scrollbars when a bar shows HP only. */
.game-window[data-window-id^="statbar:"] {
    min-height: 0;
    min-width: 0;
}
.game-window[data-window-id^="statbar:"] .game-window-content {
    overflow: visible;
}
.stat-bar-panel {
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
}
.stat-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 14px;
}
.stat-bar-row .stat-bar-label {
    width: 24px;
}
.stat-bar-row .stat-bar-track {
    flex: 1 1 auto;
    width: auto;
    height: 10px;
}
.stat-bar-row .stat-bar-fill {
    width: 0%;
    height: 100%;
    background: #cc3a3a;
    transition: width 0.2s ease;
}
.stat-bar-val {
    font-size: 10px;
    font-family: 'Consolas', monospace;
    color: #bbb;
    min-width: 56px;
    text-align: right;
}

/* ── Companion (pet) bars — compact rows under the self bar ── */
.companion-bars {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid rgba(255,255,255,0.12);
}
.companion-bars:empty { display: none; }
.companion-pet {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 1px 3px;
    border-radius: 3px;
    cursor: pointer;
}
.companion-pet:hover { background: rgba(255,255,255,0.07); }
.companion-pet.companion-hidden { opacity: 0.4; }
.companion-name {
    font-size: 10px;
    font-weight: 600;
    font-family: 'Consolas', monospace;
    color: #9fd0a0;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 172px;
}
.companion-row {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 9px;
}
.companion-row .companion-label {
    font-size: 8px;
    width: 18px;
    text-align: right;
    color: #888;
    font-family: 'Consolas', monospace;
}
.companion-row .companion-track {
    flex: 1 1 auto;
    height: 7px;
    background: rgba(0,0,0,0.6);
    border: 1px solid var(--gf-border-accent, rgba(255,255,255,0.15));
    border-radius: 2px;
    overflow: hidden;
}
.companion-row .companion-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: width 0.2s ease;
}
.companion-row .companion-val {
    font-size: 8px;
    min-width: 44px;
    text-align: right;
    color: #aaa;
    font-family: 'Consolas', monospace;
}

/* Targeting cursor prompt */
#targeting-prompt.targeting-mobile {
    border: 1px solid #60c080;
    color: #c0f0c0;
}
body.targeting-active {
    cursor: crosshair;
}

/* UO-style: a targeting cursor can resolve on UI surfaces, not just the 3D
   world. A mobile cursor → click a health/stat bar; an item cursor → click an
   occupied hotbar/pack slot. Light those surfaces up so the player sees them
   as clickable targets. */
body.gf-targeting-mobile .game-window[data-window-id^="statbar:"],
body.gf-targeting-mobile .game-window[data-window-id^="statbar:"] .game-window-titlebar {
    cursor: crosshair;
}
body.gf-targeting-mobile .game-window[data-window-id^="statbar:"] {
    outline: 1px solid rgba(96, 192, 128, 0.6);
    outline-offset: 1px;
}
body.gf-targeting-mobile .game-window[data-window-id^="statbar:"]:hover {
    outline-color: #66ff88;
    box-shadow: 0 0 9px rgba(102, 255, 136, 0.5);
}
body.gf-targeting-item .gf-bar-builder .gf-slot:not(.gf-slot-empty),
body.gf-targeting-item .gf-slot-itemref {
    cursor: crosshair;
}
body.gf-targeting-item .gf-bar-builder .gf-slot:not(.gf-slot-empty):hover,
body.gf-targeting-item .gf-slot-itemref:hover {
    outline: 1px solid #66ff88;
    box-shadow: 0 0 9px rgba(102, 255, 136, 0.5);
}

/* ═══════════════════════════════════════════
   Phase 4.5: Hotbar (stub — visual only until Phase 5)
   ═══════════════════════════════════════════ */

#hotbar {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    padding: 4px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 5px;
    z-index: 5;
    pointer-events: none;
}
.hotbar-slot {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 3px;
    position: relative;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    pointer-events: auto;
}
.hotbar-slot.hotbar-slot-active {
    border-color: #f0c060;
    background: rgba(240,192,96,0.15);
    box-shadow: 0 0 8px rgba(240,192,96,0.4);
}
.hotbar-slot-key {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 10px;
    font-family: 'Consolas', monospace;
    color: #888;
    pointer-events: none;
}
.hotbar-slot-active .hotbar-slot-key {
    color: #f0c060;
}

/* ═══════════════════════════════════════════
   Phase 4: Character sheet
   ═══════════════════════════════════════════ */

#character-sheet {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 440px;
    max-height: 80vh;
    background: rgba(16,16,24,0.96);
    border: 1px solid rgba(240,192,96,0.2);
    border-radius: 12px;
    z-index: 150;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: all;
}
#character-sheet.open {
    opacity: 1;
}

.cs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(240,192,96,0.15);
}
.cs-title {
    font-size: 16px;
    font-weight: 600;
    color: #f0c060;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.cs-close {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: #888;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
}
.cs-close:hover { color: #fff; border-color: rgba(255,255,255,0.3); }

.cs-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(240,192,96,0.2) transparent;
}

/* Stats section */
.cs-section-header {
    font-size: 11px;
    font-weight: 600;
    color: #f0c060;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 8px 0 6px;
    border-bottom: 1px solid rgba(240,192,96,0.1);
    margin-bottom: 8px;
    cursor: pointer;
}
.cs-section-header:hover { color: #ffd070; }

.cs-stat-row {
    display: flex;
    align-items: center;
    padding: 6px 0;
    gap: 10px;
}
.cs-stat-name {
    font-size: 13px;
    font-weight: 600;
    color: #ccc;
    width: 40px;
}
.cs-stat-value {
    font-size: 14px;
    font-family: 'Consolas', monospace;
    color: #fff;
    width: 36px;
    text-align: right;
}
.cs-stat-toggle {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
    color: #888;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.cs-stat-toggle:hover { border-color: rgba(255,255,255,0.4); }
.cs-stat-toggle[data-toggle="up"] { color: #4caf50; border-color: rgba(76,175,80,0.4); }
.cs-stat-toggle[data-toggle="down"] { color: #f85149; border-color: rgba(248,81,73,0.4); }
.cs-stat-toggle[data-toggle="locked"] { color: #888; border-color: rgba(255,255,255,0.15); }

.cs-cap-display {
    font-size: 11px;
    color: #666;
    font-family: 'Consolas', monospace;
    text-align: right;
    padding: 4px 0 12px;
}

/* Skills section */
.cs-skill-row {
    display: flex;
    align-items: center;
    padding: 4px 0;
    gap: 8px;
}
.cs-skill-name {
    font-size: 12px;
    color: #bbb;
    width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cs-skill-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
}
.cs-skill-bar-fill {
    height: 100%;
    background: #f0c060;
    border-radius: 3px;
    transition: width 0.3s ease;
}
.cs-skill-value {
    font-size: 11px;
    font-family: 'Consolas', monospace;
    color: #999;
    width: 40px;
    text-align: right;
}
.cs-skill-toggle {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.04);
    color: #888;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.cs-skill-toggle[data-toggle="up"] { color: #4caf50; border-color: rgba(76,175,80,0.3); }
.cs-skill-toggle[data-toggle="down"] { color: #f85149; border-color: rgba(248,81,73,0.3); }
.cs-skill-toggle[data-toggle="locked"] { color: #666; }

/* ═══════════════════════════════════════════
   Ghost overlay (shown while is_ghost = true)
   ═══════════════════════════════════════════ */

#ghost-overlay {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 24px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
    z-index: 180;
}
#ghost-overlay.active {
    opacity: 1;
}

.ghost-card {
    min-width: 340px;
    max-width: 420px;
    padding: 20px 28px;
    background: rgba(10, 14, 22, 0.85);
    border: 1px solid rgba(160, 200, 255, 0.35);
    border-radius: 8px;
    box-shadow: 0 0 36px rgba(80, 140, 220, 0.25);
    color: #cfd8e4;
    text-align: center;
    backdrop-filter: blur(4px);
    font-family: sans-serif;
}

.ghost-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 2px;
    color: #a9c7ff;
    text-shadow: 0 0 12px rgba(120, 170, 240, 0.6);
    margin-bottom: 14px;
}

.ghost-body {
    font-size: 13px;
    line-height: 1.6;
    color: #9aa6b8;
}

.ghost-controls {
    margin: 14px 0 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    text-align: left;
    display: inline-block;
}

.ghost-controls-title {
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #6f7c91;
    margin-bottom: 6px;
}

.ghost-key {
    display: inline-block;
    min-width: 46px;
    padding: 1px 6px;
    margin-right: 8px;
    background: rgba(160, 200, 255, 0.1);
    border: 1px solid rgba(160, 200, 255, 0.3);
    border-radius: 3px;
    font-family: monospace;
    font-size: 11px;
    text-align: center;
    color: #cfd8e4;
}

.ghost-footnote {
    margin-top: 10px;
    font-size: 12px;
    color: #6f7c91;
    font-style: italic;
}

.ghost-cmd {
    font-family: monospace;
    color: #a9c7ff;
    background: rgba(160, 200, 255, 0.1);
    padding: 1px 6px;
    border-radius: 3px;
}

/* Desaturate the world while the local player is ghosted. Applied to the
   canvas only so the overlay and HUD keep their colors. */
body.is-ghost canvas {
    filter: saturate(0.45) brightness(0.85);
    transition: filter 0.4s;
}

/* ═══════════════════════════════════════════
   Phase 5: Inventory panel
   ═══════════════════════════════════════════ */

#inventory-panel {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 560px;
    max-height: 85vh;
    background: rgba(16,16,24,0.96);
    border: 1px solid rgba(240,192,96,0.2);
    border-radius: 12px;
    z-index: 160;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
#inventory-panel.open {
    opacity: 1;
    pointer-events: all;
}

.inv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px 10px;
    border-bottom: 1px solid rgba(240,192,96,0.15);
}
.inv-title {
    font-size: 14px;
    font-weight: 600;
    color: #f0c060;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.inv-close {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: #888;
    width: 26px; height: 26px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
}
.inv-close:hover { color: #fff; border-color: rgba(255,255,255,0.3); }

.inv-body {
    display: flex;
    gap: 16px;
    padding: 14px 18px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(240,192,96,0.2) transparent;
}

.inv-section-title {
    font-size: 10px;
    font-weight: 600;
    color: #f0c060;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

/* Equipment column */
.inv-equip-col {
    width: 130px;
    flex-shrink: 0;
}
.inv-equip-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

/* Bag column */
.inv-bag-col {
    flex: 1;
}
.inv-bag-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(240,192,96,0.15) transparent;
}

/* Inventory slot (shared by equip + bag) */
.inv-slot {
    width: 100%;
    aspect-ratio: 1;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}
.inv-slot:hover {
    border-color: rgba(240,192,96,0.4);
    background: rgba(240,192,96,0.06);
}
.inv-slot.inv-slot-filled {
    border-color: rgba(255,255,255,0.15);
}

.inv-slot-label {
    position: absolute;
    bottom: 1px; left: 2px;
    font-size: 7px;
    color: #555;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.inv-slot-swatch {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.1s;
}

.inv-slot-qty {
    position: absolute;
    bottom: 2px; right: 3px;
    font-size: 9px;
    font-family: 'Consolas', monospace;
    color: #ddd;
    pointer-events: none;
    text-shadow: 0 0 3px rgba(0,0,0,0.8);
}

/* Weight bar */
.inv-weight-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.inv-weight-label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 50px;
}
.inv-weight-track {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}
.inv-weight-fill {
    height: 100%;
    width: 0%;
    background: #50a060;
    border-radius: 2px;
    transition: width 0.2s, background 0.2s;
}
.inv-weight-value {
    font-size: 10px;
    font-family: 'Consolas', monospace;
    color: #aaa;
    width: 70px;
    text-align: right;
}

/* Drag ghost */
.inv-drag-ghost {
    position: fixed;
    width: 36px; height: 36px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.3);
    z-index: 9000;
    pointer-events: none;
    opacity: 0.85;
    font-size: 10px;
    font-family: 'Consolas', monospace;
    color: #fff;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 2px;
    text-shadow: 0 0 3px rgba(0,0,0,0.8);
}

/* ═══════════════════════════════════════════
   Phase 5: Tooltip system
   ═══════════════════════════════════════════ */

.gf-tooltip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    background: rgba(12, 12, 18, 0.95);
    border: 1px solid rgba(240, 192, 96, 0.2);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 12px;
    color: #ddd;
    max-width: 260px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.1s ease;
}
.gf-tooltip.visible { opacity: 1; }

.gf-tt-name {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    margin-bottom: 2px;
}
.gf-tt-qty {
    font-size: 11px;
    color: #f0c060;
    font-weight: normal;
}
.gf-tt-type {
    font-size: 10px;
    color: #888;
    margin-bottom: 4px;
}
.gf-tt-sep {
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 5px 0;
}
.gf-tt-prop {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1px 0;
    font-size: 11px;
}
.gf-tt-prop-label {
    color: #999;
}
.gf-tt-prop-value {
    color: #ddd;
    font-family: 'Consolas', monospace;
}
.gf-tt-desc {
    color: #999;
    font-style: italic;
    font-size: 11px;
    line-height: 1.3;
}

/* Hotbar item rendering (inside existing hotbar-slot) */
.hotbar-item-swatch {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 28px; height: 28px;
    border-radius: 3px;
    opacity: 0;
    pointer-events: none;
}
.hotbar-item-qty {
    position: absolute;
    bottom: 2px; right: 3px;
    font-size: 9px;
    font-family: 'Consolas', monospace;
    color: #ddd;
    pointer-events: none;
    text-shadow: 0 0 3px rgba(0,0,0,0.8);
}

/* ── Game Window System (UO-style draggable windows) ── */

.game-window {
    background: var(--gf-panel-bg);
    -webkit-backdrop-filter: blur(var(--gf-blur));
    backdrop-filter: blur(var(--gf-blur));
    /* Gold "trim over glass": a thin recolored 9-slice frame (Kenney Fantasy
       UI Borders, CC0) over the dark-glass background. No `fill` keyword → the
       frame center is omitted and the glass shows through. CREDITS.md. */
    border: 9px solid transparent;
    border-image: url('/assets/ui/frames/frame-gold.png') 15 repeat;
    border-radius: 2px;
    box-shadow: var(--gf-shadow), var(--gf-inset);
    display: flex;
    flex-direction: column;
    min-width: 150px;
    min-height: 100px;
    overflow: hidden;
    transition: box-shadow 0.15s, border-color 0.15s;
}
/* Always-on micro HUD (per-mobile stat bars) keeps a light gold hairline — no
   ornate frame — so combat with several bars open stays uncluttered. */
.game-window[data-window-id^="statbar"] {
    border: 1px solid var(--gf-border-accent);
    border-image: none;
    border-radius: var(--gf-radius);
}
/* Focused (most recently raised) window gets an accent lift. */
.game-window.gf-window-focused {
    border-color: var(--gf-border-accent);
    box-shadow: var(--gf-shadow-strong), 0 0 0 1px var(--gf-accent-glow), var(--gf-inset);
}

.game-window-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 9px;
    background: linear-gradient(180deg, rgba(84,66,30,0.6), rgba(40,32,18,0.62));
    border-bottom: 1px solid var(--gf-border-accent);
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}

.game-window-titlebar:active {
    cursor: grabbing;
}

.game-window-title {
    font-size: 11px;
    font-family: var(--gf-mono);
    color: var(--gf-accent);
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.game-window-close {
    background: none;
    border: none;
    color: var(--gf-text-3);
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.12s, transform 0.12s;
}
.game-window-close:hover {
    color: var(--gf-danger);
    transform: scale(1.15);
}

.game-window-content {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

/* When inventory panel is inside a game window, override its fixed positioning */
.game-window-content #inventory-panel {
    position: static;
    transform: none;
    max-height: none;
    width: 100%;
    display: none;
    opacity: 1;
    pointer-events: auto;
    z-index: auto;
    border: none;
    border-radius: 0;
    background: transparent;
}
.game-window-content #inventory-panel.open {
    display: flex;
}
/* Hide internal header when inside game window (window has its own title bar) */
.game-window-content .inv-header {
    display: none;
}
/* Inside a resizable window the body already scrolls (flex:1 + overflow), so
   drop the bag grid's fixed 260px cap — otherwise enlarging the window just
   leaves empty space below the bag instead of showing more rows. */
.game-window-content .inv-body { padding-top: 4px; }
.game-window-content .inv-bag-grid {
    max-height: none;
    overflow: visible;
}

/* When character sheet is inside a game window, override its fixed positioning */
.game-window-content #character-sheet {
    position: static;
    transform: none;
    width: 100%;
    display: none;
    opacity: 1;
    pointer-events: auto;
    z-index: auto;
    border: none;
    border-radius: 0;
    background: transparent;
}
.game-window-content #character-sheet.open {
    display: flex;
}
/* Hide internal header when inside game window */
.game-window-content .cs-header {
    display: none;
}

.game-window-resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, rgba(100, 120, 160, 0.4) 50%);
}

/* ── Corpse loot window ── */
.corpse-window-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 6px 10px 10px 10px;
    color: #d8d4cc;
    font-family: inherit;
}
.corpse-header {
    padding: 2px 0 6px 0;
    border-bottom: 1px solid rgba(120, 140, 170, 0.3);
    margin-bottom: 6px;
}
.corpse-subtitle {
    font-weight: bold;
    color: #e8dcaa;
    font-size: 14px;
}
.corpse-list {
    flex: 1;
    overflow-y: auto;
    min-height: 80px;
}
.corpse-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 8px;
    margin: 2px 0;
    background: rgba(60, 55, 45, 0.5);
    border: 1px solid rgba(120, 90, 60, 0.4);
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.1s;
}
.corpse-item:hover {
    background: rgba(100, 80, 55, 0.7);
    border-color: rgba(180, 140, 80, 0.6);
}
.corpse-item-name {
    flex: 1;
    font-size: 13px;
}
.corpse-item-qty {
    color: #d0c088;
    font-size: 13px;
    margin-left: 8px;
}
.corpse-empty {
    text-align: center;
    color: #888;
    padding: 16px 0;
    font-style: italic;
}
.corpse-footer {
    padding-top: 6px;
    border-top: 1px solid rgba(120, 140, 170, 0.3);
    margin-top: 6px;
}
.corpse-loot-all {
    width: 100%;
    padding: 6px;
    background: rgba(80, 60, 40, 0.7);
    border: 1px solid rgba(180, 140, 80, 0.6);
    color: #e8dcaa;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    border-radius: 2px;
}
.corpse-loot-all:hover:not(:disabled) {
    background: rgba(120, 85, 50, 0.8);
}
.corpse-loot-all:disabled {
    opacity: 0.4;
    cursor: default;
}
.corpse-loading {
    color: #a89c80;
    padding: 10px;
    text-align: center;
}

/* ── Phase 6: Crafting panel ── */
.crafting-panel {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    color: #e8dcc0;
    font-family: 'Cinzel', 'Times New Roman', serif;
    background: rgba(20, 16, 12, 0.95);
}
.craft-subheader {
    padding: 6px 12px;
    border-bottom: 1px solid #4a3a26;
    background: rgba(0,0,0,0.3);
}
.craft-station-label {
    font-size: 13px;
    color: #c0a070;
    letter-spacing: 0.05em;
}
.craft-body {
    display: flex;
    flex: 1;
    min-height: 0;
}
.craft-list {
    flex: 1 1 55%;
    overflow-y: auto;
    border-right: 1px solid #4a3a26;
    padding: 4px 0;
}
.craft-detail {
    flex: 1 1 45%;
    padding: 12px;
    overflow-y: auto;
}
.craft-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 12px;
    cursor: pointer;
    border-left: 3px solid transparent;
    font-size: 12px;
}
.craft-row:hover {
    background: rgba(160, 120, 60, 0.15);
}
.craft-row.selected {
    background: rgba(160, 120, 60, 0.25);
    border-left-color: #c0a070;
}
.craft-row.no-skill { color: #786858; }
.craft-row.no-mats  { color: #a89c80; }
.craft-row.craftable .craft-name { color: #f0d090; }
.craft-row .craft-skill {
    font-size: 10px;
    color: #807060;
    text-transform: capitalize;
}
.craft-row.exceptional {
    animation: craft-flash-exc 1.2s ease-out;
}
.craft-row.flash {
    animation: craft-flash 0.8s ease-out;
}
@keyframes craft-flash {
    0%   { background: rgba(120,200,120,0.5); }
    100% { background: transparent; }
}
@keyframes craft-flash-exc {
    0%   { background: rgba(240,200,80,0.7); }
    100% { background: transparent; }
}
.craft-detail h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #f0d090;
}
.craft-desc {
    font-size: 11px;
    color: #a89c80;
    margin: 0 0 10px 0;
    font-style: italic;
}
.craft-skill-block {
    margin-bottom: 10px;
    font-size: 11px;
    text-transform: capitalize;
}
.craft-skill-block .ok { color: #80c080; }
.craft-skill-block .fail { color: #c08070; }
.craft-section-hdr {
    margin: 8px 0 4px 0;
    font-size: 11px;
    color: #c0a070;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.craft-ingredients, .craft-output {
    font-size: 12px;
    margin-bottom: 6px;
}
.craft-ing, .craft-output {
    padding: 2px 0;
    text-transform: capitalize;
}
.craft-btn {
    margin-top: 14px;
    padding: 8px 16px;
    width: 100%;
    background: linear-gradient(180deg, #6a4a20 0%, #4a3018 100%);
    color: #f0d090;
    border: 1px solid #8a6840;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    letter-spacing: 0.05em;
}
.craft-btn:hover:not(.disabled) {
    background: linear-gradient(180deg, #8a6830 0%, #6a4a20 100%);
}
.craft-btn.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #2a2018;
}
.craft-empty {
    color: #786858;
    text-align: center;
    margin-top: 40px;
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════
   Command Palette (/commands window) — role-filtered clickable commands
   ═══════════════════════════════════════════════════════════════ */
.cmd-palette-panel {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    color: #e8dcc0;
    font-family: 'Cinzel', 'Times New Roman', serif;
    background: rgba(20, 16, 12, 0.95);
}
.cmd-subheader {
    padding: 6px 12px;
    border-bottom: 1px solid #4a3a26;
    background: rgba(0,0,0,0.3);
    font-size: 11px;
    color: #a89c80;
}
.cmd-subheader .cmd-role {
    color: #c0a070;
    text-transform: capitalize;
    letter-spacing: 0.05em;
}
.cmd-search {
    margin: 8px 10px 4px 10px;
    padding: 6px 10px;
    background: rgba(0,0,0,0.4);
    border: 1px solid #4a3a26;
    border-radius: 4px;
    color: #e8dcc0;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}
.cmd-search:focus { border-color: #c0a070; }
.cmd-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0 10px 0;
    min-height: 0;
}
.cmd-cat-hdr {
    margin: 10px 0 4px 0;
    padding: 0 12px;
    font-size: 11px;
    color: #c0a070;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.cmd-row {
    padding: 6px 12px 8px 12px;
    border-left: 3px solid transparent;
}
.cmd-row:hover {
    background: rgba(160, 120, 60, 0.10);
    border-left-color: #6a5436;
}
.cmd-row-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}
.cmd-label {
    font-size: 13px;
    color: #f0d090;
}
.cmd-slash {
    font-size: 10px;
    color: #807060;
    font-family: 'Courier New', monospace;
}
.cmd-badge {
    margin-left: auto;
    font-size: 9px;
    color: #b0a080;
    background: rgba(160, 120, 60, 0.18);
    border: 1px solid #6a5436;
    border-radius: 3px;
    padding: 1px 5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.cmd-args {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.cmd-arg {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.cmd-arg-input {
    background: rgba(0,0,0,0.35);
    border: 1px solid #4a3a26;
    color: #e8dcc0;
    font-family: inherit;
    font-size: 12px;
    padding: 3px 6px;
    border-radius: 3px;
    width: 86px;
    box-sizing: border-box;
}
.cmd-arg-input:focus {
    outline: none;
    border-color: #c0a070;
}
.cmd-arg-input.invalid {
    border-color: #c06050;
    background: rgba(160, 60, 50, 0.18);
}
select.cmd-arg-input {
    width: auto;
    min-width: 86px;
}
.cmd-arg-player { width: 110px; }
.cmd-pick-btn {
    background: rgba(160, 120, 60, 0.15);
    border: 1px solid #6a5436;
    color: #f0d090;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 3px;
}
.cmd-pick-btn:hover { background: rgba(160, 120, 60, 0.35); }
.cmd-run-btn {
    margin-left: auto;
    padding: 4px 14px;
    background: linear-gradient(180deg, #6a4a20 0%, #4a3018 100%);
    color: #f0d090;
    border: 1px solid #8a6840;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 0.05em;
    border-radius: 3px;
}
.cmd-run-btn:hover {
    background: linear-gradient(180deg, #8a6830 0%, #6a4a20 100%);
}
.cmd-run-btn.confirm {
    background: linear-gradient(180deg, #8a3020 0%, #5a1c12 100%);
    border-color: #c06050;
    color: #f0c0b0;
}
.cmd-empty {
    color: #786858;
    text-align: center;
    margin-top: 40px;
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════
   AAA Action Bars / Hotbars (UO-style hotkeys)
   Multi-bar, floating single-icon buttons, drag-to-assign,
   cooldown sweeps, keybind overlays, slot-state coding.
   ═══════════════════════════════════════════════════════════════ */

.gf-bar {
    position: fixed;
    display: flex;
    gap: var(--gf-slot-gap);
    padding: 6px;
    background: var(--gf-panel-bg);
    -webkit-backdrop-filter: blur(var(--gf-blur));
    backdrop-filter: blur(var(--gf-blur));
    border: 1px solid var(--gf-border-accent);
    border-radius: var(--gf-radius);
    box-shadow: var(--gf-shadow), var(--gf-inset);
    z-index: 40;
    pointer-events: auto;
}
.gf-bar.gf-bar-vertical { flex-direction: column; }
/* Floating single-icon buttons are chromeless until hovered/editing. */
.gf-bar.gf-bar-floating {
    padding: 3px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-color: transparent;
    box-shadow: none;
}
.gf-bar.gf-bar-floating:hover,
body.gf-hud-edit .gf-bar.gf-bar-floating {
    background: var(--gf-panel-bg-soft);
    border-color: var(--gf-border-soft);
}
/* The bar that owns the number keys right now. */
.gf-bar.gf-bar-keyactive {
    border-color: var(--gf-border-accent);
    box-shadow: var(--gf-shadow), 0 0 0 1px var(--gf-accent-glow), var(--gf-inset);
}

/* Drag handle (shown in HUD edit mode) */
.gf-bar-grip {
    display: none;
    align-self: stretch;
    width: 10px;
    margin-right: 2px;
    border-radius: var(--gf-radius-sm);
    background: repeating-linear-gradient(90deg, var(--gf-accent-glow) 0 2px, transparent 2px 4px);
    cursor: grab;
    flex-shrink: 0;
}
.gf-bar.gf-bar-vertical .gf-bar-grip {
    width: auto; height: 10px; margin: 0 0 2px 0;
}
body.gf-hud-edit .gf-bar-grip { display: block; }
body.gf-hud-edit .gf-bar { outline: 1px dashed var(--gf-border-accent); }

/* ── Slots ── */
.gf-slot {
    position: relative;
    width: var(--gf-slot);
    height: var(--gf-slot);
    background: var(--gf-slot-bg);
    border: 1px solid rgba(240,192,96,0.18);
    border-radius: var(--gf-radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    transition: border-color 0.12s, background 0.12s, box-shadow 0.12s, transform 0.06s;
    cursor: pointer;
}
.gf-slot:hover {
    background: var(--gf-slot-bg-hover);
    border-color: var(--gf-border-accent);
}
.gf-slot:active { transform: translateY(1px); }
.gf-slot.gf-slot-empty {
    border-style: dashed;
    border-color: var(--gf-border-soft);
    cursor: default;
}
.gf-slot.gf-slot-empty:hover { background: var(--gf-slot-bg); }
/* The armed (selected-for-placement / active) slot. */
.gf-slot.gf-slot-active {
    border-color: var(--gf-accent);
    box-shadow: 0 0 10px var(--gf-accent-glow), inset 0 0 0 1px var(--gf-accent-glow);
}
/* Drop target highlight while dragging an assignable thing over it. */
.gf-slot.gf-slot-droptarget {
    border-color: var(--gf-success);
    box-shadow: 0 0 10px rgba(111,200,116,0.5);
}

/* Icon layer */
.gf-slot-icon {
    position: absolute;
    inset: 3px;
    border-radius: 3px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(20px * var(--gf-ui-scale));
    font-weight: 700;
    color: rgba(0,0,0,0.55);
    text-shadow: 0 1px 0 rgba(255,255,255,0.25);
}
/* Target-mode colored ring (UO Enhanced Client convention). */
.gf-slot[data-target="self"]    .gf-slot-icon { box-shadow: inset 0 0 0 2px rgba(90,166,224,0.8); }
.gf-slot[data-target="cursor"]  .gf-slot-icon { box-shadow: inset 0 0 0 2px rgba(111,200,116,0.8); }
.gf-slot[data-target="last"]    .gf-slot-icon { box-shadow: inset 0 0 0 2px rgba(150,150,150,0.8); }
.gf-slot[data-target="current"] .gf-slot-icon { box-shadow: inset 0 0 0 2px rgba(224,82,74,0.85); }

/* Keybind overlay (top-left) */
.gf-slot-key {
    position: absolute;
    top: 1px; left: 3px;
    font-size: calc(10px * var(--gf-ui-scale));
    font-family: var(--gf-mono);
    color: var(--gf-text-2);
    text-shadow: 0 1px 2px #000, 0 0 2px #000;
    pointer-events: none;
    z-index: 3;
}
.gf-slot-active .gf-slot-key { color: var(--gf-accent-hot); }

/* Quantity / charges (bottom-right) */
.gf-slot-qty {
    position: absolute;
    bottom: 1px; right: 3px;
    font-size: calc(11px * var(--gf-ui-scale));
    font-family: var(--gf-mono);
    color: var(--gf-text-1);
    text-shadow: 0 1px 2px #000, 0 0 2px #000;
    pointer-events: none;
    z-index: 3;
}

/* On-slot state coding */
.gf-slot.gf-slot-unusable .gf-slot-icon { filter: grayscale(0.85) brightness(0.6); }
.gf-slot.gf-slot-nomana::after,
.gf-slot.gf-slot-oorange::after {
    content: '';
    position: absolute; inset: 0;
    pointer-events: none;
    z-index: 2;
}
.gf-slot.gf-slot-nomana::after { background: rgba(64,96,200,0.30); }
.gf-slot.gf-slot-oorange::after { background: rgba(0,0,0,0.35); }
/* Ready/proc glow */
.gf-slot.gf-slot-proc {
    animation: gfProcGlow 1.1s ease-in-out infinite;
}
@keyframes gfProcGlow {
    0%,100% { box-shadow: 0 0 6px var(--gf-accent-glow); }
    50%     { box-shadow: 0 0 16px var(--gf-accent-hot); }
}

/* Cooldown radial sweep (GPU-composited conic mask) */
.gf-slot-cooldown {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    background: conic-gradient(rgba(0,0,0,0.66) var(--gf-cd, 0deg), transparent 0deg);
    display: none;
}
.gf-slot.gf-slot-cooling .gf-slot-cooldown { display: block; }
.gf-slot-cd-text {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: calc(14px * var(--gf-ui-scale));
    font-weight: 700;
    font-family: var(--gf-mono);
    color: #fff;
    text-shadow: 0 1px 3px #000;
    pointer-events: none;
}
.gf-slot.gf-slot-cooling .gf-slot-cd-text { display: flex; }
/* "bling" pop when a cooldown finishes */
.gf-slot.gf-slot-ready-pop { animation: gfReadyPop 0.32s ease-out; }
@keyframes gfReadyPop {
    0%   { transform: scale(1); box-shadow: 0 0 0 var(--gf-accent-glow); }
    40%  { transform: scale(1.12); box-shadow: 0 0 18px var(--gf-accent-hot); }
    100% { transform: scale(1); box-shadow: none; }
}

/* ── Macro / hotbar context menu hint chip ── */
.gf-bar-addbtn {
    align-self: center;
    display: none;
    margin-left: 4px;
    padding: 0 8px;
    height: calc(var(--gf-slot) * 0.5);
    font-size: 18px;
    line-height: 1;
    color: var(--gf-accent);
    background: var(--gf-slot-bg);
    border: 1px dashed var(--gf-border-accent);
    border-radius: var(--gf-radius-sm);
    cursor: pointer;
}
body.gf-hud-edit .gf-bar-addbtn { display: inline-flex; align-items: center; }

/* ═══════════════════════════════════════════════════════════════
   Macro Editor + Ability Picker (inside a GameWindow)
   ═══════════════════════════════════════════════════════════════ */
.gf-macro-editor { display: flex; flex-direction: column; height: 100%; color: var(--gf-text-1); font-size: 13px; }
.gf-macro-cols { display: flex; flex: 1; min-height: 0; }
.gf-macro-list {
    width: 190px;
    border-right: 1px solid var(--gf-border-soft);
    overflow-y: auto;
    flex-shrink: 0;
}
.gf-macro-list-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--gf-border-soft);
}
.gf-macro-list-item:hover { background: var(--gf-slot-bg-hover); }
.gf-macro-list-item.gf-active { background: rgba(240,192,96,0.14); box-shadow: inset 3px 0 0 var(--gf-accent); }
.gf-macro-list-icon {
    width: 26px; height: 26px; border-radius: 4px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: rgba(0,0,0,0.6); font-size: 13px;
}
.gf-macro-list-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gf-macro-list-key { font-family: var(--gf-mono); font-size: 10px; color: var(--gf-text-3); }

.gf-macro-detail { flex: 1; padding: 12px 14px; overflow-y: auto; min-width: 0; }
.gf-macro-detail h4 { color: var(--gf-accent); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin: 14px 0 6px; }
.gf-macro-detail h4:first-child { margin-top: 0; }
.gf-field { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.gf-field label { width: 78px; color: var(--gf-text-2); font-size: 12px; flex-shrink: 0; }
.gf-input, .gf-select {
    flex: 1;
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--gf-border);
    border-radius: var(--gf-radius-sm);
    color: var(--gf-text-1);
    padding: 5px 7px;
    font-family: inherit;
    font-size: 12px;
    min-width: 0;
}
.gf-input:focus, .gf-select:focus { outline: none; border-color: var(--gf-border-accent); }
.gf-keycap {
    flex: 1; text-align: center;
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--gf-border);
    border-radius: var(--gf-radius-sm);
    color: var(--gf-text-1); padding: 5px 7px; cursor: pointer; font-family: var(--gf-mono); font-size: 12px;
}
.gf-keycap.gf-rebinding { border-color: var(--gf-accent); color: var(--gf-accent-hot); }

.gf-step {
    border: 1px solid var(--gf-border-soft);
    border-radius: var(--gf-radius-sm);
    padding: 9px 10px;
    margin-bottom: 8px;
    background: rgba(0,0,0,0.18);
}
.gf-step-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.gf-step-num { font-size: 11px; color: var(--gf-text-3); font-family: var(--gf-mono); }
.gf-step-del { background: none; border: none; color: var(--gf-text-3); cursor: pointer; font-size: 14px; }
.gf-step-del:hover { color: var(--gf-danger); }
.gf-cond-row { display: flex; gap: 6px; align-items: center; }
.gf-cond-row .gf-select { flex: 1 1 0; }
.gf-cond-row .gf-input { flex: 0 0 60px; }

.gf-btn {
    background: linear-gradient(180deg, rgba(240,192,96,0.22), rgba(240,192,96,0.10));
    border: 1px solid var(--gf-border-accent);
    color: var(--gf-accent-hot);
    border-radius: var(--gf-radius-sm);
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    transition: background 0.12s, transform 0.06s;
}
.gf-btn:hover { background: linear-gradient(180deg, rgba(240,192,96,0.34), rgba(240,192,96,0.16)); }
.gf-btn:active { transform: translateY(1px); }
.gf-btn-sm { padding: 4px 9px; font-size: 11px; }
.gf-btn-danger { color: var(--gf-danger); border-color: var(--gf-danger-deep); background: rgba(224,82,74,0.12); }
.gf-btn-ghost { background: rgba(255,255,255,0.05); border-color: var(--gf-border); color: var(--gf-text-2); }
.gf-macro-toolbar { display: flex; gap: 7px; padding: 9px; border-top: 1px solid var(--gf-border-soft); flex-shrink: 0; }
.gf-macro-empty { color: var(--gf-text-3); text-align: center; margin-top: 48px; font-style: italic; padding: 0 20px; line-height: 1.5; }

/* ── Ability picker grid (drag spells/skills/items onto a bar) ── */
.gf-picker { display: flex; flex-direction: column; height: 100%; }
.gf-picker-tabs { display: flex; gap: 2px; padding: 6px 8px 0; flex-shrink: 0; border-bottom: 1px solid var(--gf-border-soft); }
.gf-picker-tab {
    padding: 6px 12px; cursor: pointer; font-size: 12px; color: var(--gf-text-3);
    border: 1px solid transparent; border-bottom: none; border-radius: var(--gf-radius-sm) var(--gf-radius-sm) 0 0;
}
.gf-picker-tab.gf-active { color: var(--gf-accent); background: var(--gf-slot-bg); border-color: var(--gf-border-soft); }
/* When the macro editor is embedded in the Options window, its own
   Macros/Abilities sub-tab bar is replaced by the Options top-level tabs. */
.gf-macro-editor.gf-embedded > .gf-picker-tabs { display: none; }
/* flex:0 0 auto overrides the inherited `.gf-input { flex:1 }` so the search
   field stays one line tall instead of stretching down the column flex. */
.gf-picker-search { margin: 8px; flex: 0 0 auto; }
.gf-picker-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); gap: 6px; padding: 0 8px 8px; align-content: start; }
.gf-picker-cell {
    display: flex; align-items: center; gap: 7px;
    padding: 6px 8px;
    border: 1px solid var(--gf-border-soft);
    border-radius: var(--gf-radius-sm);
    cursor: grab; background: rgba(0,0,0,0.18);
}
.gf-picker-cell:hover { border-color: var(--gf-border-accent); background: var(--gf-slot-bg-hover); }
.gf-picker-cell-icon { width: 24px; height: 24px; border-radius: 4px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: rgba(0,0,0,0.6); }
.gf-picker-cell-name { flex: 1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gf-picker-cell-meta { font-size: 10px; color: var(--gf-text-3); }

/* Floating drag-ghost used by hotbar/picker assignment. */
.gf-drag-ghost {
    position: fixed; z-index: 9999; pointer-events: none;
    width: 40px; height: 40px; border-radius: var(--gf-radius-sm);
    border: 1px solid var(--gf-accent); background: var(--gf-panel-bg-strong);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: var(--gf-accent-hot); font-size: 16px;
    box-shadow: var(--gf-shadow);
}

/* ═══════════════════════════════════════════════════════════════
   Enriched resource bars (HP / Stamina / Mana)
   Damage-trail sub-fill + regen shimmer + icon/shape coding.
   ═══════════════════════════════════════════════════════════════ */
.stat-bar-row .stat-bar-track { position: relative; }
/* Delayed "damage trail" — a second fill that lags behind on loss. */
.stat-bar-trail {
    position: absolute;
    left: 0; top: 0; height: 100%;
    width: 0%;
    border-radius: inherit;
    background: rgba(255,255,255,0.28);
    transition: width 0.7s cubic-bezier(.4,0,.2,1) 0.12s;
    z-index: 1;
    pointer-events: none;
}
.stat-bar-row .stat-bar-fill { position: relative; z-index: 2; }
/* Subtle moving shimmer to read as "alive / regenerating". */
.stat-bar-row .stat-bar-fill::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
    background-size: 200% 100%;
    animation: gfShimmer 2.6s linear infinite;
    opacity: 0.0;
    transition: opacity 0.3s;
}
.stat-bar-row.gf-regen .stat-bar-fill::after { opacity: 1; }
@keyframes gfShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
/* Mana shimmer intensifies with local Grid density (set via --gf-grid 0..1). */
.stat-bar-row.gf-mana .stat-bar-fill::after { animation-duration: calc(3.2s - var(--gf-grid, 0) * 1.8s); }
/* Icon/shape coding so pools read without color (accessibility). */
.stat-bar-row .stat-bar-label::before {
    margin-right: 3px; font-size: 10px; opacity: 0.85;
}
.stat-bar-row.gf-hp  .stat-bar-label::before { content: '✚'; }
.stat-bar-row.gf-stamina .stat-bar-label::before { content: '⚡'; }
.stat-bar-row.gf-mana .stat-bar-label::before { content: '✦'; }
.stat-bar-row.gf-low .stat-bar-fill { animation: lowHpPulse 1s ease infinite; }

/* ═══════════════════════════════════════════════════════════════
   HUD Edit Mode
   ═══════════════════════════════════════════════════════════════ */
#gf-hud-edit-banner {
    position: fixed;
    top: 14px; left: 50%;
    transform: translateX(-50%);
    z-index: 9000;
    display: none;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--gf-panel-bg-strong);
    border: 1px solid var(--gf-border-accent);
    border-radius: var(--gf-radius);
    box-shadow: var(--gf-shadow-strong);
    color: var(--gf-text-1);
    font-size: 13px;
}
body.gf-hud-edit #gf-hud-edit-banner { display: flex; }
#gf-hud-edit-banner .gf-eb-title { color: var(--gf-accent); font-weight: 700; }

/* ── Phase 10b: Pet Training window ── */
.pet-training-panel {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    color: #e8dcc0;
    font-family: 'Cinzel', 'Times New Roman', serif;
    background: rgba(20, 16, 12, 0.95);
    overflow: hidden;
}
.pt-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}
.pt-empty { padding: 20px; text-align: center; opacity: 0.7; }
.pt-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    border-bottom: 1px solid #4a3a26;
    padding-bottom: 6px;
    margin-bottom: 8px;
}
.pt-name { font-size: 16px; font-weight: 700; }
.pt-level { opacity: 0.85; font-size: 13px; }
.pt-bond-badge {
    background: #2a6aa0; color: #cfe8ff;
    border-radius: 3px; padding: 1px 6px; font-size: 11px;
}
.pt-xp { margin-bottom: 8px; }
.pt-xp-bar {
    height: 8px; background: rgba(0,0,0,0.4);
    border: 1px solid #4a3a26; border-radius: 4px; overflow: hidden;
}
.pt-xp-fill { height: 100%; background: linear-gradient(90deg, #6aa84f, #b7e892); }
.pt-xp-label { font-size: 11px; opacity: 0.7; margin-top: 2px; }
.pt-pending { margin-bottom: 8px; }
.pt-pend-bar {
    height: 6px; background: rgba(0,0,0,0.4);
    border: 1px solid #6a5526; border-radius: 4px; overflow: hidden;
}
.pt-pend-fill {
    height: 100%;
    background: repeating-linear-gradient(45deg, #b8893a, #b8893a 6px, #8a6628 6px, #8a6628 12px);
}
.pt-pend-label { font-size: 11px; color: #d8b86a; opacity: 0.85; margin-top: 2px; }
.pt-points { font-weight: 700; color: #f0d890; margin: 6px 0; }
.pt-section {
    margin: 10px 0 4px; font-size: 12px; text-transform: uppercase;
    letter-spacing: 0.06em; color: #b89a64; border-bottom: 1px solid #3a2e1e;
}
.pt-row {
    display: flex; align-items: center; gap: 8px; padding: 3px 0;
}
.pt-row-label { flex: 1; }
.pt-row-val { min-width: 64px; text-align: right; opacity: 0.9; }
.pt-overcap { color: #f0c040; font-weight: 700; }
.pt-btn {
    background: #3a2e1e; color: #e8dcc0; border: 1px solid #5a4632;
    border-radius: 3px; padding: 2px 8px; cursor: pointer; font-family: inherit;
    min-width: 36px;
}
.pt-btn:hover:not(:disabled) { background: #5a4632; }
.pt-btn:disabled { opacity: 0.35; cursor: default; }
/* Pass 3: up/down/locked toggle button on a pet's skills + stats. */
.pt-toggle { min-width: 26px; font-size: 11px; padding: 2px 5px; }
.pt-toggle-up { color: #7fe084; border-color: #3d7a40; }
.pt-toggle-down { color: #e08a7f; border-color: #7a4036; }
.pt-toggle-locked { color: #c0b070; border-color: #6a5e32; }
.pt-showall { float: right; min-width: auto; font-size: 10px; padding: 1px 6px; opacity: 0.8; }
.pt-bond { font-size: 13px; }
.pt-bond-ok { color: #8fd0ff; }
.pt-hint { font-size: 11px; opacity: 0.65; margin-top: 3px; }
.pt-reset { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.pt-reset-confirm { color: #ffb0a0; border-color: #7a4036; background: #4a2620; }
.pt-reset-confirm:hover:not(:disabled) { background: #6a342a; }
.pt-note {
    margin-top: 10px; font-size: 11px; font-style: italic;
    opacity: 0.55; border-top: 1px solid #3a2e1e; padding-top: 6px;
}
