/* Nine Graves UI refresh, pass 1.
   Loaded LAST so it wins over style / reference-ui / gameplay / hunt-ui.
   Follow-up: fold the four older sheets into one token-based sheet and delete the overrides. */

/* 1. Readable type. Nothing a player has to read stays below 11px (the XP readout was 7px). */
#status .xp-detail,#status .xp-block .xp-detail{font-size:11px}
.nav-section{font-size:11px}
.nav-section>span{font-size:10px}
.nav-foot{font-size:11px}
#journal .journal-tabs button,#journal .journal-tabs span{font-size:11px}
.journal-live{font-size:12px}
.equip-slot small{font-size:11px}
.equip-slot strong{font-size:13px}
.equip-slot .equip-summary{font-size:11px}
#nav .mobile-navigation button,#nav .mobile-navigation button>span:last-child{font-size:11px}

/* 2. Shared shell. One top bar on every desktop screen, in the combat header's style:
      brand (opens the full menu) · six main tabs · Menu. The old 21-item sidebar is gone; its markup stays in the DOM
      because the Menu dialog is built from it. Landscape phones (short windows) keep their own rail layout. */
.nav-menu-button,.hunt-tabs{display:none}
.hunt-menu .nav-section>span{display:none}
.menu-foot{margin:14px 0 0;color:var(--muted)}
@media(min-width:761px) and (min-height:501px){
 #app:not([data-view="combat"]){grid-template-columns:minmax(0,1fr) clamp(250px,22vw,330px);grid-template-rows:64px 38px minmax(0,1fr) 32px}
 #app:not([data-view="combat"]) #nav{grid-column:1/-1;grid-row:1;display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;gap:clamp(10px,1.6vw,26px);height:64px;padding:0 clamp(12px,2.2vw,34px);overflow:visible;z-index:5;border:0;border-bottom:1px solid #55403e;background:linear-gradient(105deg,#181313,#211a1a 62%,#151111);box-shadow:0 3px 16px #0009}
 #app:not([data-view="combat"]) #nav .desktop-navigation,#app:not([data-view="combat"]) #nav .nav-foot{display:none}
 #app:not([data-view="combat"]) #nav .brand{display:flex;flex:0 0 auto;height:auto;min-height:0;margin:0;padding:0;border:0;background:transparent;color:#dbcbb8}
 #app:not([data-view="combat"]) #status{grid-column:1/-1;grid-row:2;height:38px;min-height:0;padding:0 clamp(12px,2.2vw,34px);background:#140f0f;border-bottom:1px solid #352828}
 #app:not([data-view="combat"]) #view{grid-column:1;grid-row:3}
 #app:not([data-view="combat"]) #bag{grid-column:2;grid-row:3/5}
 #app:not([data-view="combat"]) #journal{grid-column:1;grid-row:4}
 /* Read and config screens use the full width; the bag column only appears where items matter. */
 #app:is([data-view="character"],[data-view="mastery"],[data-view="codex"],[data-view="guide"],[data-view="inventory"]) #bag{display:none}
 #app:is([data-view="character"],[data-view="mastery"],[data-view="codex"],[data-view="guide"],[data-view="inventory"]) :is(#view,#journal){grid-column:1/-1}
 /* Tabs, in the nav bar and in the combat header. */
 #app:not([data-view="combat"]) #nav .mobile-navigation{display:flex!important;flex:1;min-width:0;height:auto;gap:4px;padding:0;justify-content:center}
 .hunt-header .hunt-tabs{display:flex;align-items:center;gap:4px;flex:0 1 auto}
 #app:not([data-view="combat"]) #nav .mobile-navigation button,.hunt-header .hunt-tabs button{display:inline-flex;flex-direction:row;align-items:center;justify-content:center;gap:8px;width:auto;min-height:40px;padding:0 14px;border:0;border-bottom:2px solid transparent;border-radius:6px 6px 0 0;background:transparent;color:#b9af9b;font-size:14px;font-weight:600;white-space:nowrap}
 #app:not([data-view="combat"]) #nav .mobile-navigation button>span:last-child,.hunt-header .hunt-tabs button>span:last-child{font-size:14px}
 #app:not([data-view="combat"]) #nav .mobile-navigation button .nav-icon,.hunt-header .hunt-tabs button .nav-icon{width:auto;flex:0 0 auto;font-size:16px}
 #app:not([data-view="combat"]) #nav .mobile-navigation button:hover,.hunt-header .hunt-tabs button:hover{color:#ece4da;background:#dbcbb814}
 #app:not([data-view="combat"]) #nav .mobile-navigation button.active,.hunt-header .hunt-tabs button.active{color:#ece4da;border-bottom-color:#dbcbb8;background:linear-gradient(#dbcbb824,#0000)}
 /* Menu button, styled like the combat header's action buttons. */
 #app:not([data-view="combat"]) #nav .nav-menu-button{display:inline-flex;align-items:center;gap:8px;flex:0 0 auto;min-height:39px;padding:5px 14px;color:#dbcbb8;background:linear-gradient(150deg,#271e1e,#181313);border:1px solid #503d3d;border-radius:7px;font-weight:700}
 /* Combat already has Gear as a tab, so drop the duplicate Inventory/Gear buttons on desktop. */
 .hunt-header-actions [data-view="inventory"]{display:none}
}
@media(min-width:761px) and (min-height:501px) and (max-width:1280px){
 .hunt-header .hunt-tabs button>span:last-child{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
 .hunt-header .hunt-tabs button{padding:0 11px}
}
@media(min-width:761px) and (min-height:501px) and (max-width:900px){
 #app:not([data-view="combat"]) #nav .brand>span:last-child{display:none}
 #app:not([data-view="combat"]) #nav .mobile-navigation button{padding:0 9px}
}
/* Phones: combat gets the bottom tab bar too, so every screen has navigation. */
@media(max-width:760px){
 #app[data-view="combat"]{grid-template:minmax(0,1fr) 56px / minmax(0,1fr)}
 #app[data-view="combat"]>#view{grid-area:1/1}
 #app[data-view="combat"]>#nav{display:block;grid-column:1;grid-row:2;height:56px}
}

/* 3. Toasts sit above the bottom controls instead of covering them (they hid the mobile tab bar). */
#toasts{bottom:48px;width:max-content;max-width:calc(100vw - 24px)}
#toasts>*{max-width:100%}
@media(max-width:760px){#toasts{bottom:68px}}

/* 5. Character: attributes as compact rows, stats as a tile strip. */
section[aria-label="Character progression"] .recipe-grid{display:grid;grid-template-columns:1fr;gap:8px;margin:14px 0}
section[aria-label="Character progression"] .recipe{display:grid;grid-template-columns:minmax(140px,190px) minmax(0,1fr) 48px 48px;grid-template-areas:"name preview one five" "alloc preview one five";align-items:center;column-gap:10px;row-gap:2px;padding:10px 14px;margin:0;min-height:0}
section[aria-label="Character progression"] .recipe h4{grid-area:name;margin:0}
section[aria-label="Character progression"] .recipe>p.small{grid-area:alloc;margin:0;color:var(--muted)}
section[aria-label="Character progression"] .recipe .attribute-preview{grid-area:preview;margin:0;font-size:12px;color:var(--muted)}
section[aria-label="Character progression"] .recipe button{min-height:40px;min-width:44px;padding:0}
section[aria-label="Character progression"] .recipe button:nth-of-type(1){grid-area:one}
section[aria-label="Character progression"] .recipe button:nth-of-type(2){grid-area:five}
.stat-strip{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:8px;margin:12px 0}
.stat-strip>div{background:#0000002e;border:1px solid var(--line);border-radius:6px;padding:8px 10px}
.stat-strip dt{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.8px}
.stat-strip dd{margin:2px 0 0;font-size:16px;font-weight:600;color:var(--text)}
@media(max-width:760px){
 section[aria-label="Character progression"] .recipe{grid-template-columns:minmax(0,1fr) 48px 48px;grid-template-areas:"name one five" "alloc one five" "preview preview preview"}
 section[aria-label="Character progression"] .recipe .attribute-preview{margin-top:6px}
}

/* 6. Abilities: slot cards in two columns on wide screens, tidy header row, readable help text. */
.scroll-view[data-scroll="abilities"]>p{max-width:72ch;color:var(--muted);font-size:13px}
#ability-config .ability-order{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}
@media(max-width:1000px){#ability-config .ability-order{grid-template-columns:1fr}}
#ability-config .ability-editor>div:first-child strong{order:1;margin-right:auto;font-size:14px}
#ability-config .ability-editor .priority-controls{order:2}
#ability-config .ability-editor select[name^="active-"]{order:3;flex:1 1 100%}
#ability-config .ability-editor>div:first-child label{order:4}
#ability-config .ability-editor input[name^="priority-"]{width:56px!important}
#ability-config .ability-editor .small,#ability-config .condition-fields label,.passive-description{font-size:12px}

/* 7. Empty equipment slots show a faded silhouette of what belongs there. */
.slot-ghost{width:40px;height:40px;object-fit:contain;opacity:.32;filter:grayscale(.7) brightness(.9);transition:opacity .15s}
.equip-slot:hover .slot-ghost,.equip-slot:focus-visible .slot-ghost{opacity:.6}

/* ---- Loot and crafting redesign ---- */
.stat-diff{width:100%;border-collapse:collapse;margin:8px 0;font-size:14px}
.stat-diff caption{text-align:left;font-size:12px;color:var(--muted);padding-bottom:4px}
.stat-diff th{font-weight:600;text-align:left;padding:3px 6px 3px 0;white-space:nowrap}
.stat-diff td{padding:3px 4px;text-align:right;font-variant-numeric:tabular-nums}
.stat-diff td.delta{font-weight:700;min-width:64px}
.stat-diff tr.gain td.delta{color:#7fd08a}
.stat-diff tr.loss td.delta{color:#e8806f}
.modifier-slots{display:grid;gap:8px;margin:8px 0}
.modifier-slot{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px;border:1px solid var(--line,#423232);border-radius:10px;background:rgba(0,0,0,.18)}
.modifier-slot[data-state=empty]{border-style:dashed}
.modifier-slot small{display:block;color:var(--muted);letter-spacing:.06em;font-size:11px}
.modifier-slot strong{display:block;font-size:15px}
.modifier-slot button{flex:none;min-height:44px}
.modifier-options{display:grid;gap:8px;margin:12px 0;max-height:50vh;overflow:auto}
.modifier-option{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 12px;border:1px solid var(--line,#423232);border-radius:10px}
.modifier-option small{display:block;color:var(--muted)}
.modifier-option button{min-height:44px}
.loot-preview{margin:10px 0;border:1px solid var(--line,#423232);border-radius:10px;padding:8px 12px;background:rgba(0,0,0,.14)}
.loot-preview summary{cursor:pointer;font-weight:600;min-height:32px;display:flex;align-items:center}
.loot-block{margin-top:10px}
.loot-block h4{margin:0 0 4px;font-size:13px;letter-spacing:.04em;color:var(--muted);text-transform:uppercase}
.loot-block p{margin:2px 0}
.rarity-odds{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:4px 12px}
.rarity-odds li{display:flex;justify-content:space-between;gap:8px;border-left:3px solid var(--rarity);padding-left:8px}
.loot-signature{margin-top:10px;padding:8px 10px;border-radius:8px;background:rgba(242,207,107,.08);border:1px solid rgba(242,207,107,.35)}
@media(max-width:560px){.modifier-slot{flex-direction:column;align-items:stretch}.modifier-slot button{width:100%}}
