/* ui.css - UI lane base: tokens, real-art buttons, icons with quality frames, bars, coins, tooltips, toasts.
   Art comes only from assets/ui (tools/ui-bake.mjs: real Blizzard client textures). Sizes are in em; js/ui/core.js sets the root font-size from the overlay size. */
.ui {
  --ink: #ece4cf; --muted: #a79e87; --gold: #f0c84b; --line: #3a3223; --bad: #ff7a68; --good: #7be39a; --panel: #0d0a08;
  --serif: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; --sans: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  position: absolute; inset: 0; pointer-events: none; color: var(--ink); font-family: var(--sans); line-height: 1.3; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.ui * { box-sizing: border-box; }
.ui button { font-family: inherit; }
.ui [hidden] { display: none !important; }
.ui ::-webkit-scrollbar { width: .7em; height: .7em; }
.ui ::-webkit-scrollbar-thumb { background: #4a4030; border-radius: .4em; border: 2px solid #15110c; }
.ui ::-webkit-scrollbar-track { background: #15110c; }

/* ---- red button (real 3-slice) ---- */
.rbtn {
  --h: 2.7em; --cap: calc(var(--h) * .22); --pad: 1.7em;  /* the caps' outer edge is transparent: side borders keep the middle strip out from under it */
  position: relative; height: var(--h); min-width: 6.5em; padding: 0 calc(var(--pad) - var(--cap)); border: 0 solid transparent; border-width: 0 var(--cap); margin: 0; cursor: pointer; color: #ffd24a; font: 700 1em/1 var(--serif); letter-spacing: .02em;
  text-shadow: 0 1px 0 #000, 0 0 .4em rgba(0, 0, 0, .8); white-space: nowrap; pointer-events: auto; touch-action: manipulation;
  background-origin: border-box !important; background-clip: border-box, border-box, padding-box !important;
  background: url("../assets/ui/btn-left.png") left center / auto 100% no-repeat, url("../assets/ui/btn-right.png") right center / auto 100% no-repeat, url("../assets/ui/btn-mid.png") center / auto 100% repeat-x;
}
.rbtn:hover { filter: brightness(1.18); }
.rbtn:active, .rbtn.down {
  padding-top: .1em; color: #e0b43c;
  background: url("../assets/ui/btn-left-down.png") left center / auto 100% no-repeat, url("../assets/ui/btn-right-down.png") right center / auto 100% no-repeat, url("../assets/ui/btn-mid-down.png") center / auto 100% repeat-x;
}
.rbtn:disabled { cursor: default; color: #8c8574; filter: none; text-shadow: none;
  background: url("../assets/ui/btn-left-off.png") left center / auto 100% no-repeat, url("../assets/ui/btn-right-off.png") right center / auto 100% no-repeat, url("../assets/ui/btn-mid-off.png") center / auto 100% repeat-x; }
.rbtn.primary { font-size: 1.12em; min-width: 9em; color: #fff0a8; }
.rbtn.primary:not(:disabled) { animation: glow 2.4s ease-in-out infinite; }
.rbtn.small { --h: 2.2em; --pad: 1.4em; min-width: 4.8em; font-size: .92em; }
.rbtn.wide { width: 100%; max-width: 16em; }
@keyframes glow { 50% { filter: brightness(1.22) drop-shadow(0 0 .35em rgba(255, 190, 40, .5)); } }
.ui :focus { outline: none; }
.ui .kbd :focus, .ui.kbd :focus { outline: .16em solid #fff3b0; outline-offset: .12em; border-radius: .2em; }
.ui .kbd .rbtn:focus { filter: brightness(1.3); }

/* ---- icons with real quality frames ---- */
.ico { position: relative; display: inline-block; flex: none; vertical-align: middle; background: #000; border-radius: .15em; overflow: hidden; }
.ico.s { width: 1.9em; height: 1.9em; } .ico.m { width: 2.7em; height: 2.7em; } .ico.l { width: 4.2em; height: 4.2em; }
.ico img { position: absolute; inset: 7%; width: 86%; height: 86%; display: block; image-rendering: auto; border-radius: .1em; }
.ico .ring { position: absolute; inset: 0; background: center / 100% 100% no-repeat; pointer-events: none; }
.ico.q-poor .ring { background-image: url("../assets/ui/ring-poor.png"); } .ico.q-common .ring { background-image: url("../assets/ui/ring-common.png"); }
.ico.q-uncommon .ring { background-image: url("../assets/ui/ring-uncommon.png"); } .ico.q-rare .ring { background-image: url("../assets/ui/ring-rare.png"); }
.ico.q-epic .ring { background-image: url("../assets/ui/ring-epic.png"); } .ico.q-legendary .ring { background-image: url("../assets/ui/ring-legendary.png"); }
.ico:not([class*="q-"]) { box-shadow: inset 0 0 0 1px #6b6046; }
.ico .count { position: absolute; right: 8%; bottom: 4%; font: 700 max(10.5px, .8em)/1 var(--sans); color: #fff; text-shadow: 0 0 3px #000, 0 1px 1px #000, 0 0 2px #000; }

/* ---- bars ---- */
.bar { position: relative; height: 1.5em; min-width: 6em; background: #0a0807; border: 1px solid #000; border-radius: .25em; box-shadow: 0 0 0 1px #6b5b3a, 0 0 0 2px #1c1710; }
.bar .track { position: absolute; inset: 1px; overflow: hidden; border-radius: .2em; background: linear-gradient(#17120d, #0b0907); }
.bar .fill { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(1); transition: transform .12s linear; }
.bar.hp .fill { background: linear-gradient(#d83a2c, #8e1a14 70%, #6c120e); }
.bar.res .fill { background: linear-gradient(#e8b43a, #a8761a); }
.bar.boss .fill { background: linear-gradient(#c43a86, #7c1f56); }
.bar .txt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 max(10.5px, .78em)/1 var(--sans); color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; letter-spacing: .02em; }
.bar.small { height: .6em; min-width: 3em; } .bar.small .txt { display: none; }

/* ---- coins, kv, tabs, misc ---- */
.coins { display: inline-flex; align-items: center; gap: .3em; font-weight: 700; color: #ffe27a; white-space: nowrap; }
.coins .coin { width: 1em; height: 1em; background: url("../assets/ui/coin-gold.png") center / contain no-repeat; display: inline-block; }
.coins.marks { color: #9cc8ff; } .coins .mkimg { width: 1.3em; height: 1.3em; border-radius: .15em; }
.kv { display: flex; justify-content: space-between; gap: 1em; padding: .22em 0; border-bottom: 1px solid rgba(255, 255, 255, .06); } .kv .k { color: var(--muted); } .kv .v { font-weight: 700; }
.tabs { display: flex; flex-wrap: wrap; gap: .35em; }
.tab { pointer-events: auto; cursor: pointer; padding: .4em .9em; background: #17130d; color: var(--muted); border: 1px solid #3d3322; border-radius: .3em; font: 600 .9em var(--sans); }
.tab.on { color: #fff0b0; background: #2b2314; border-color: #a8873a; } .tab:hover { color: #fff; }
.hint { color: var(--muted); } .hint.big { font-size: 1.1em; padding: 2em 1em; text-align: center; }
.sec { margin: 1.1em 0 .5em; font: 700 max(10.5px, .8em) var(--serif); letter-spacing: .16em; text-transform: uppercase; color: #c9a85a; border-bottom: 1px solid #3a3020; padding-bottom: .3em; }
.good { color: var(--good); } .bad { color: var(--bad); }

/* ---- item tooltip (real border art) ---- */
.tt { min-width: 13em; max-width: 21em; padding: .7em .85em; font: .95em/1.35 var(--sans); background: rgba(8, 6, 14, .96); color: #ffd100; border: 7px solid transparent; border-image: url("../assets/ui/tooltip-9slice.png") 16 / 7px stretch; }
.tt-tag { font-size: max(10.5px, .72em); letter-spacing: .14em; text-transform: uppercase; color: #8fa8c4; margin-bottom: .4em; }
.tt-head { display: flex; align-items: center; gap: .6em; margin-bottom: .2em; }
.tt-name { font: 700 1.1em/1.2 var(--serif); }
.tt-sub { color: #bdb69f; font-size: .88em; margin-bottom: .45em; }
.tt-stat { color: #1eff00; } .tt-stat.up em { color: var(--good); font-style: normal; } .tt-stat.down { color: #ff9c8c; } .tt-stat.down em { color: var(--bad); font-style: normal; } .tt-stat.gone { color: var(--bad); }
.tt-ench { color: #1eff00; } .tt-effect { color: #1eff00; margin-top: .35em; } .tt-effect b { color: #fff; }
.tt-use { color: #1eff00; margin-top: .35em; } .tt-flavor { color: #ffd100; font-style: italic; margin-top: .4em; }
.tt-foot { color: #bdb69f; font-size: max(10.5px, .85em); margin-top: .5em; }
.tt.empty .tt-name { color: #7a7566; }
.tt-pair { display: flex; gap: .6em; flex-wrap: wrap; }

/* ---- toasts ---- */
#ui-toasts { position: absolute; left: 50%; top: 4.2em; transform: translateX(-50%); display: flex; flex-direction: column; gap: .4em; align-items: center; z-index: 30; pointer-events: none; }
.toast { padding: .5em 1em; background: rgba(12, 9, 6, .94); border: 1px solid #6b5b3a; border-radius: .3em; font-weight: 600; box-shadow: 0 .3em 1em rgba(0, 0, 0, .6); transition: opacity .5s, transform .5s; }
.toast.good { border-color: #3d8a55; color: #c8f5d3; } .toast.bad { border-color: #a33a2a; color: #ffd0c8; } .toast.out { opacity: 0; transform: translateY(-.5em); }
.legal { margin: 0; font-size: max(10.5px, .72em); line-height: 1.35; color: #8d8573; text-align: center; max-width: 60em; }
@media (prefers-reduced-motion: reduce) { .rbtn.primary:not(:disabled) { animation: none; } .bar .fill { transition: none; } }

#overlay > .ui { pointer-events: none; }
