:root {
    --bg-gold: #ffd76a;
    --bg-gold-dim: #d6a84f;
    --bg-green: #9cff66;
    --bg-border: rgba(116, 84, 26, .9);
    --bg-panel: rgba(8, 7, 4, .86);
    --bg-panel-alt: rgba(18, 12, 5, .82);
    --bg-muted: #b9b7a8;
    --bg-danger: #ff765f;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Arial, Helvetica, sans-serif; color: #f5e6b8; background: #000; }
body {
    background-image: url("../images/portal-bg.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}
a { color: var(--bg-gold); }
button, input { font: inherit; }
.bg-page-shade {
    min-height: 100vh;
    padding: 24px 16px;
    background: radial-gradient(circle at center, rgba(20,80,20,.09), rgba(0,0,0,.78)), rgba(0,0,0,.30);
}
.bg-app {
    width: min(1450px, 98vw);
    margin: 0 auto;
    border: 2px solid var(--bg-border);
    border-radius: 5px;
    background: linear-gradient(to bottom, rgba(20,12,4,.80), rgba(0,0,0,.90));
    box-shadow: inset 0 0 30px rgba(255,210,90,.08), 0 0 40px rgba(0,0,0,.95);
    overflow: hidden;
}
.bg-header { padding: 18px 22px 16px; text-align: center; border-bottom: 1px solid rgba(214,168,79,.48); background: rgba(0,0,0,.30); }
.bg-header-links { margin-bottom: 8px; font-weight: bold; }
.bg-header-links a { color: var(--bg-green); text-decoration: none; }
.bg-header-links span { margin: 0 10px; color: #70684e; }
.bg-header h1 { margin: 0; color: var(--bg-gold); font: 700 32px Georgia, "Times New Roman", serif; letter-spacing: 3px; text-transform: uppercase; text-shadow: 0 2px 3px #000, 0 0 12px rgba(80,255,40,.28); }
.bg-subtitle { margin: 5px 0 13px; color: #d8ffd0; }
.bg-search-wrap { position: relative; width: min(800px, 100%); margin: 0 auto; display: flex; }
#bg-search-input { flex: 1; min-width: 0; padding: 11px 13px; color: #fff; background: rgba(0,0,0,.78); border: 1px solid rgba(80,180,55,.68); border-radius: 3px 0 0 3px; outline: none; }
#bg-search-input:focus { border-color: var(--bg-green); box-shadow: 0 0 0 2px rgba(156,255,102,.12); }
#bg-search-clear { padding: 0 16px; color: var(--bg-gold); background: linear-gradient(#7b100c,#3d0705); border: 1px solid var(--bg-gold-dim); border-left: 0; border-radius: 0 3px 3px 0; cursor: pointer; }
.bg-search-results { position: absolute; z-index: 50; top: calc(100% + 5px); left: 0; right: 0; max-height: 480px; overflow: auto; padding: 8px; text-align: left; background: #090806; border: 1px solid var(--bg-gold-dim); box-shadow: 0 12px 30px rgba(0,0,0,.9); }
.bg-search-group { margin: 4px 0 10px; }
.bg-search-group-title { padding: 5px 7px; color: var(--bg-gold); font-family: Georgia, serif; border-bottom: 1px solid rgba(214,168,79,.30); }
.bg-search-result { width: 100%; padding: 7px 9px; text-align: left; color: #f5e6b8; background: transparent; border: 0; cursor: pointer; }
.bg-search-result:hover, .bg-search-result:focus { background: rgba(156,255,102,.12); color: #fff; }
.bg-search-result small { display: block; color: var(--bg-muted); margin-top: 2px; }
.bg-browser { display: grid; grid-template-columns: minmax(175px,.8fr) minmax(250px,1.1fr) minmax(430px,2fr); min-height: 650px; height: min(76vh, 860px); overflow: hidden; }
.bg-panel { min-width: 0; display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: var(--bg-panel); border-right: 1px solid rgba(214,168,79,.33); }
.bg-panel:last-child { border-right: 0; }
.bg-panel-heading { min-height: 42px; padding: 12px 14px; color: var(--bg-gold); font: 700 16px Georgia, "Times New Roman", serif; text-transform: uppercase; letter-spacing: 1px; background: linear-gradient(to bottom, rgba(20,55,100,.68), rgba(5,15,35,.75)); border-bottom: 1px solid rgba(214,168,79,.50); }
.bg-panel-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 8px; scrollbar-width: thin; scrollbar-color: #b8892e #090806; }
.bg-panel-scroll::-webkit-scrollbar { width: 12px; }
.bg-panel-scroll::-webkit-scrollbar-track { background: #090806; border-left: 1px solid rgba(214,168,79,.20); }
.bg-panel-scroll::-webkit-scrollbar-thumb { background: linear-gradient(#c89a3b, #6e5420); border: 2px solid #090806; border-radius: 8px; }
.bg-panel-scroll::-webkit-scrollbar-thumb:hover { background: linear-gradient(#e0b85b, #8b6b2c); }
.bg-category-button, .bg-instance-button, .bg-encounter-button, .bg-tree-toggle, .bg-set-button {
    width: 100%; display: block; padding: 9px 10px; color: #e7e0c5; background: transparent; border: 0; border-bottom: 1px solid rgba(80,180,55,.10); text-align: left; cursor: pointer;
}
.bg-category-button:hover, .bg-instance-button:hover, .bg-encounter-button:hover, .bg-tree-toggle:hover, .bg-set-button:hover { color: #fff; background: rgba(156,255,102,.08); }
.bg-category-button.is-selected, .bg-encounter-button.is-selected, .bg-set-button.is-selected {
    color: #fff; background: linear-gradient(90deg, rgba(255,215,106,.22), rgba(156,255,102,.08)); box-shadow: inset 3px 0 0 var(--bg-gold);
}
.bg-category-button { font-weight: bold; color: var(--bg-gold); }
.bg-instance { margin-bottom: 5px; border: 1px solid rgba(80,180,55,.15); background: rgba(0,0,0,.22); }
.bg-instance-button { color: var(--bg-green); font-weight: bold; }
.bg-instance-button::before, .bg-tree-toggle::before { content: "▸"; display: inline-block; width: 16px; color: var(--bg-gold); }
.bg-instance.is-open > .bg-instance-button::before, .bg-tree-node.is-open > .bg-tree-toggle::before { content: "▾"; }
.bg-instance-encounters, .bg-tree-children { display: none; }
.bg-instance.is-open > .bg-instance-encounters, .bg-tree-node.is-open > .bg-tree-children { display: block; }
.bg-encounter-button { padding-left: 25px; }
.bg-custom-badge, .bg-bartcraft-badge { display: inline-block; margin-left: 7px; padding: 1px 5px; color: #ffbd54; border: 1px solid rgba(255,157,0,.45); border-radius: 2px; font-size: 10px; font-weight: bold; text-transform: uppercase; vertical-align: middle; }
.bg-level-range { float: right; color: #888; font-size: 11px; font-weight: normal; }
.bg-tree-node { margin-left: 7px; }
.bg-tree-toggle { color: #d8ffd0; font-weight: bold; }
.bg-tree-node.depth-0 { margin-left: 0; }
.bg-set-button { padding-left: 28px; }
.bg-state, .bg-empty-state { padding: 22px 14px; color: var(--bg-muted); text-align: center; }
.bg-spinner::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; border: 2px solid #555; border-top-color: var(--bg-green); border-radius: 50%; vertical-align: -3px; animation: bg-spin .8s linear infinite; }
@keyframes bg-spin { to { transform: rotate(360deg); } }
.bg-retry { margin-top: 10px; padding: 7px 15px; color: var(--bg-gold); background: #4b0b08; border: 1px solid var(--bg-gold-dim); cursor: pointer; }
.bg-detail-title { margin: 0 0 3px; color: var(--bg-gold); font: 700 24px Georgia, serif; }
.bg-detail-subtitle { margin: 0 0 15px; color: #b9dbae; }
.bg-section, .bg-pool, .bg-group, .bg-independent, .bg-condition, .bg-warning, .bg-item-row { padding-left: calc(8px + var(--depth, 0) * 14px); }
.bg-section { margin-top: 9px; padding-top: 9px; padding-bottom: 7px; color: var(--bg-gold); font: 700 17px Georgia, serif; border-top: 1px solid rgba(214,168,79,.35); }
.bg-pool { padding-top: 7px; padding-bottom: 7px; color: #f1bf54; font-weight: bold; }
.bg-group, .bg-independent { padding-top: 4px; padding-bottom: 4px; color: #c8c8c8; font-weight: bold; font-size: 13px; }
.bg-condition { padding-top: 3px; padding-bottom: 4px; color: #a8a8a8; font-size: 12px; font-style: italic; }
.bg-warning { margin: 4px 0; padding-top: 7px; padding-bottom: 7px; color: #ffbd83; background: rgba(120,35,15,.25); border-left: 2px solid var(--bg-danger); }
.bg-item-row { position: relative; display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 8px; min-height: 50px; padding-top: 6px; padding-bottom: 6px; border-bottom: 1px solid rgba(80,180,55,.10); }
.bg-item-icon-wrap { position: relative; width: 36px; height: 36px; }
.bg-item-icon-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: #b49a5b; background: radial-gradient(circle at 35% 30%, #4c4530, #111); border: 1px solid #716039; border-radius: 4px; font: bold 16px Georgia, serif; }
.bg-wowhead-icon-source { position: absolute; inset: 0; z-index: 2; display: block; width: 36px; height: 36px; overflow: hidden; color: transparent !important; font-size: 0; line-height: 0; text-decoration: none; pointer-events: none; }
.bg-wowhead-icon-source ins, .bg-wowhead-icon-source img, .bg-wowhead-icon-source.iconsmall, .bg-wowhead-icon-source.icontiny, .bg-wowhead-icon-source.iconmedium, .bg-wowhead-icon-source .iconsmall, .bg-wowhead-icon-source .icontiny, .bg-wowhead-icon-source .iconmedium { display: block !important; width: 36px !important; height: 36px !important; margin: 0 !important; background-size: 36px 36px !important; }
.bg-item-icon-override { position: absolute; inset: 0; z-index: 3; display: block; width: 36px; height: 36px; box-sizing: border-box; object-fit: cover; border: 1px solid #716039; border-radius: 4px; }
.bg-item-icon-wrap.has-custom-icon .bg-item-icon-fallback, .bg-item-row.has-wowhead-icon .bg-item-icon-fallback, .bg-set-piece.has-wowhead-icon .bg-item-icon-fallback { display: none; }
.bg-item-copy { min-width: 0; }
.bg-item-name { display: inline; font-weight: bold; text-decoration: none; overflow-wrap: anywhere; }
.bg-item-name:hover { text-decoration: underline; }
.bg-item-id { margin-left: 6px; color: #777; font-size: 11px; }
.bg-item-meta { margin-top: 3px; color: #cbd8c7; font-size: 12px; line-height: 1.35; }
.bg-set-summary { margin-bottom: 12px; padding: 10px; background: rgba(0,0,0,.32); border: 1px solid rgba(80,180,55,.22); }
.bg-set-piece { display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 8px; min-height: 50px; padding: 8px 10px; border-bottom: 1px solid rgba(80,180,55,.12); }
.bg-set-piece-copy { min-width: 0; }
.bg-set-piece-meta { display: block; margin-top: 3px; color: var(--bg-muted); font-size: 12px; line-height: 1.35; }
.bg-bonus-row { padding: 8px 10px; border-left: 2px solid var(--bg-gold-dim); margin: 4px 0; background: rgba(255,215,106,.05); }
.bg-live-item-tooltip {
    position: fixed;
    z-index: 10000;
    width: min(360px, calc(100vw - 24px));
    max-height: min(620px, calc(100vh - 24px));
    overflow-y: auto;
    padding: 11px 13px;
    color: #fff;
    background: linear-gradient(to bottom, rgba(8,10,32,.98), rgba(2,3,16,.99));
    border: 1px solid #727acb;
    border-radius: 4px;
    box-shadow: 0 0 0 1px #05050a, 0 10px 28px rgba(0,0,0,.92);
    font-size: 13px;
    line-height: 1.28;
    pointer-events: none;
}
.bg-live-item-tooltip[hidden] { display: none; }
.bg-tooltip-name { margin-bottom: 2px; font-size: 16px; font-weight: bold; }
.bg-tooltip-ilvl { color: #ffd100; font-weight: bold; }
.bg-tooltip-binding, .bg-tooltip-type, .bg-tooltip-normal, .bg-tooltip-requirement, .bg-tooltip-money { color: #fff; }
.bg-tooltip-stat, .bg-tooltip-spell { color: #1eff00; }
.bg-tooltip-socket { color: #9d9d9d; }
.bg-tooltip-socket-bonus { color: #ffd100; }
.bg-tooltip-description { margin-top: 4px; color: #ffd100; }
.bg-tooltip-id { margin-top: 7px; color: #7f86a8; font-size: 11px; }
.bg-item-row.has-live-tooltip, .bg-set-piece.has-live-tooltip { cursor: default; }
.q-poor { color: #9d9d9d !important; } .q-common { color: #fff !important; } .q-uncommon { color: #1eff00 !important; } .q-rare { color: #0070dd !important; } .q-epic { color: #a335ee !important; } .q-legendary { color: #ff8000 !important; } .q-artifact, .q-heirloom { color: #e6cc80 !important; }
.bg-mobile-toolbar { display: none; }
.bg-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 1000px) { .bg-browser { grid-template-columns: 170px 235px minmax(360px,1fr); } }
@media (max-width: 800px) {
    .bg-page-shade { padding: 0; }
    .bg-app { width: 100%; min-height: 100vh; border-left: 0; border-right: 0; }
    .bg-header { padding: 14px 12px; }
    .bg-header h1 { font-size: 26px; }
    .bg-browser { display: block; height: calc(100vh - 215px); min-height: 500px; }
    .bg-panel { display: none; height: 100%; border-right: 0; }
    .bg-app[data-mobile-stage="categories"] [data-panel="categories"],
    .bg-app[data-mobile-stage="content"] [data-panel="content"],
    .bg-app[data-mobile-stage="detail"] [data-panel="detail"] { display: block; }
    .bg-mobile-toolbar { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 6px 10px; background: rgba(0,0,0,.65); border-bottom: 1px solid rgba(214,168,79,.35); }
    #bg-back-button { padding: 6px 11px; color: var(--bg-gold); background: #3d0705; border: 1px solid var(--bg-gold-dim); }
    #bg-mobile-title { color: var(--bg-green); font-weight: bold; }
    .bg-panel-heading { display: none; }
    .bg-panel-scroll { height: 100%; }
    .bg-search-results { max-height: 55vh; }
}
