/* =====================================================================
   Polish (loaded last): surface textures for the UI, thin glowing bars,
   volume sliders. Textures are generated SVG noise, no image files.
   ===================================================================== */
:root {
  /* dark grit for stone and leather */
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .5 0'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
  /* soft blotches, like worn leather or stained wood */
  --blotch: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='b'><feTurbulence type='fractalNoise' baseFrequency='.035' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .7 -.2'/></filter><rect width='200' height='200' filter='url(%23b)'/></svg>");
  /* brushed lines for metal trims */
  --brush: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='40'><filter id='m'><feTurbulence type='fractalNoise' baseFrequency='.01 .9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 .9  0 0 0 0 .7  0 0 0 .14 0'/></filter><rect width='160' height='40' filter='url(%23m)'/></svg>");
  --rivet: #c9a45c 0 1.6px, #6a4e26 1.7px 2.4px, rgba(0, 0, 0, .7) 2.5px 3px, transparent 3.2px;
  --rivets:
    radial-gradient(circle at 9px 9px, var(--rivet)),
    radial-gradient(circle at calc(100% - 9px) 9px, var(--rivet)),
    radial-gradient(circle at 9px calc(100% - 9px), var(--rivet)),
    radial-gradient(circle at calc(100% - 9px) calc(100% - 9px), var(--rivet));
  --btn: linear-gradient(180deg, #3e3224 0%, #251d15 55%, #15100b 100%);
  --btn-on: linear-gradient(180deg, #5a1e14, #2a0e08);
}

/* ---------------- carved panels: stone, grit, stains and corner rivets */
#panel, #dock, .screen.solid {
  background: var(--rivets), var(--blotch), var(--grain), var(--stone), #17130f !important;
  background-size: auto, auto, auto, auto, 200px 200px, 120px 120px, 192px 192px, auto !important;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat, repeat, repeat !important;
}

/* ---------------- buttons: worn leather over wood, brushed metal edge */
#dockBtns > button, #sheetClose, .plus, .skill .equip, #attrReset, #autoSell, .chip, .acts button, .crafts button,
.opt button, .back, #itemBody .x, .big, .sheet .row button, #nodeInfo button, #prestige button {
  background: var(--brush) top / 100% 3px no-repeat, var(--grain), var(--blotch), var(--btn) !important;
}
.dbtn.on, .skill .equip.on, .opt button.on, #upgBtn.ready {
  background: var(--brush) top / 100% 3px no-repeat, var(--grain), var(--blotch), var(--btn-on) !important;
}
.plus:disabled, .skill .equip:disabled:not(.on), #attrReset:disabled { filter: grayscale(.6) brightness(.7); }

/* level badge: a red wax seal in a bronze frame */
#lvBadge { background: var(--grain), radial-gradient(circle at 50% 38%, #6a2214, #2a0a06 72%) !important; }

/* rows and slots get the same grit so nothing looks flat */
.skill, .attr, .opt, .sslot, .spts, .derived, #doll, #inv, .cmp {
  background-image: var(--grain), var(--blotch) !important;
  background-size: 120px 120px, 200px 200px !important;
}
#inv { background-image: linear-gradient(#241c12 1px, transparent 1px), linear-gradient(90deg, #241c12 1px, transparent 1px), var(--grain) !important;
  background-size: var(--c) var(--c), var(--c) var(--c), 120px 120px !important; }
.skill, .attr, .opt { background-color: rgba(12, 9, 6, .88) !important; }

/* ---------------- thin glowing bars */
#hud { align-items: center; }
#enemyUnit .nm { display: none; }
#enemyUnit .hp {
  height: 4px; margin-top: 2px; background: #0a0806;
  box-shadow: 0 0 0 1px #050403, 0 0 0 2px #5a4428, 0 0 10px rgba(0, 0, 0, .8);
}
#enemyUnit .hp i {
  background: linear-gradient(90deg, #a8521a, #ffb24a 85%, #ffe2a0) !important;
  box-shadow: 0 0 6px 1px rgba(255, 150, 50, .75), 0 0 14px 2px rgba(255, 110, 30, .35);
}
.unit.xpbar.bossing .hp i {
  background: linear-gradient(90deg, #7a1408, #ff4a2a 85%, #ffb0a0) !important;
  box-shadow: 0 0 6px 1px rgba(255, 60, 40, .8), 0 0 14px 2px rgba(255, 30, 20, .4);
}
#dockMain { gap: 4px; justify-content: flex-end; }
#xpBar { height: 4px; margin-top: 6px; overflow: visible; background: #0a0806; box-shadow: 0 0 0 1px #050403, 0 0 0 2px #5a4428; }
#xpFill {
  background: linear-gradient(90deg, #5a2a96, #b07aff 85%, #e8d4ff);
  box-shadow: 0 0 6px 1px rgba(170, 110, 255, .8), 0 0 14px 2px rgba(140, 80, 255, .35);
}
#xpFill::after {           /* a slow light that runs along the bar */
  content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  background-size: 40px 100%; background-repeat: no-repeat; animation: barShine 3.2s linear infinite;
}
@keyframes barShine { from { background-position: -40px 0; } to { background-position: calc(100% + 40px) 0; } }
#xpTxt { display: none; }

/* ---------------- volume sliders */
.opt.vol { align-items: center; }
.volBox { display: flex; align-items: center; gap: 10px; flex: 0 0 52%; }
.volBox b { font-family: var(--title); font-size: 14px; color: var(--gold); min-width: 44px; text-align: right; }
.volBox input[type=range] {
  -webkit-appearance: none; appearance: none; flex: 1; height: 6px; margin: 0;
  background: linear-gradient(90deg, #c9a45c var(--p, 50%), #0a0806 var(--p, 50%));
  box-shadow: 0 0 0 1px #050403, 0 0 0 2px #5a4428, 0 0 8px rgba(201, 164, 92, .35);
}
.volBox input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 22px; border: 0;
  background: var(--brush) top / 100% 3px no-repeat, linear-gradient(180deg, #f0d08a, #8a6a34); box-shadow: 0 0 0 2px #050403, 0 2px 4px #000;
}
.volBox input[type=range]::-moz-range-thumb { width: 16px; height: 22px; border: 0; border-radius: 0; background: linear-gradient(180deg, #f0d08a, #8a6a34); box-shadow: 0 0 0 2px #050403; }

/* ---------------- class picker */
.clsPick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.clsPick button { border: 0; padding: 6px 5px; text-align: left; color: var(--text); display: flex; flex-direction: column; gap: 2px;
  background: var(--brush) top / 100% 3px no-repeat, var(--grain), var(--blotch), var(--btn); box-shadow: var(--bronze); }
.clsPick button.on { background: var(--brush) top / 100% 3px no-repeat, var(--grain), var(--blotch), var(--btn-on); box-shadow: var(--bronze-hi); }
.clsPick b { font-family: var(--title); font-size: 13px; color: #f2e8d4; }
.clsPick button.on b { color: var(--gold); }
.clsPick small { font-family: var(--px); font-weight: 700; font-size: 11px; line-height: 1.15; color: #9a8a70; }
