/* Panel 'enhance' — blacksmith enhancement window. Owned by ui-npc. Theme vars + shared classes from style.css (§7.5). */

.panel-enhance { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 2px; color: var(--c-text); user-select: none; }

/* ---------------------------------------------------------------- top: anvil stage + summary */
.panel-enhance .enh-top { position: relative; display: flex; gap: 12px; align-items: stretch; min-height: 138px; padding: 8px;
  border-radius: 8px; overflow: hidden;
  background: radial-gradient(ellipse at 22% 70%, rgba(255, 120, 40, 0.16), transparent 55%),
    linear-gradient(180deg, #2b1a11 0%, #1c110b 100%);
  border: 1px solid rgba(232, 196, 106, 0.3); box-shadow: inset 0 1px 8px rgba(0, 0, 0, 0.6); }
.panel-enhance.is-hammering .enh-top, .panel-enhance.is-waiting .enh-top {
  background: radial-gradient(ellipse at 22% 70%, rgba(255, 140, 40, 0.34), transparent 60%), linear-gradient(180deg, #2f1b10 0%, #1c110b 100%); }

.panel-enhance .enh-stage { position: relative; width: 124px; flex: none; display: flex; align-items: center; justify-content: center; }
.panel-enhance .enh-anvil { position: absolute; left: 50%; bottom: 4px; width: 112px; height: 34px; transform: translateX(-50%); pointer-events: none;
  background: linear-gradient(180deg, #5b6069 0%, #3a3e45 45%, #24272c 100%);
  clip-path: polygon(0 0, 100% 0, 88% 40%, 74% 40%, 80% 100%, 20% 100%, 26% 40%, 12% 40%);
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.6)); }
.panel-enhance .enh-anvil::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: rgba(255, 255, 255, 0.25); }

.panel-enhance .enh-slot { --slot: 68px; z-index: 1; margin: 0 0 30px; cursor: default; border-width: 2px; border-color: var(--c-frame);
  background: radial-gradient(circle at 50% 40%, #3e2a1c, #140b07);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8), 0 0 0 1px #1a0f0a, 0 0 14px rgba(232, 196, 106, 0.18); transition: box-shadow 0.2s; }
.panel-enhance .enh-slot:hover { border-color: var(--c-frame); }
.panel-enhance .enh-slot[data-rarity="common"] { border-color: #8a7560; }
.panel-enhance .enh-slot[data-rarity="uncommon"] { border-color: var(--r-uncommon); }
.panel-enhance .enh-slot[data-rarity="rare"] { border-color: var(--r-rare); }
.panel-enhance .enh-slot[data-rarity="epic"] { border-color: var(--r-epic); }
.panel-enhance .enh-slot[data-rarity="legendary"] { border-color: var(--r-legendary); }
.panel-enhance .enh-slot.is-empty { border-style: dashed; border-color: rgba(232, 196, 106, 0.45); }
.panel-enhance.has-item .enh-slot { cursor: help; }
.panel-enhance .enh-slot-inner { position: relative; width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; }
.panel-enhance .enh-slot-img { width: 56px; height: 56px; display: block; border-radius: 3px; }
.panel-enhance .enh-plus { position: absolute; left: -1px; top: -3px; font-size: 15px; font-weight: 700; line-height: 1; color: var(--c-gold-light);
  text-shadow: var(--text-outline); pointer-events: none; }
.panel-enhance .enh-slot-hint { font-size: 11px; color: var(--c-muted); text-align: center; line-height: 1.2; }
.panel-enhance.is-hammering .enh-slot, .panel-enhance.is-waiting .enh-slot {
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8), 0 0 0 1px #1a0f0a, 0 0 22px rgba(255, 150, 50, 0.65); }
.panel-enhance .enh-slot.is-struck { animation: enh-struck 0.16s ease-out; }
@keyframes enh-struck { 0% { transform: translateY(3px) scale(0.96); } 100% { transform: none; } }
.panel-enhance .enh-slot.fx-ok { animation: enh-ok 1.1s ease-out; }
@keyframes enh-ok { 0% { box-shadow: 0 0 0 0 rgba(255, 225, 120, 1), 0 0 40px rgba(255, 215, 106, 1); transform: scale(1.12); }
  40% { transform: scale(1); } 100% { box-shadow: 0 0 0 16px rgba(255, 225, 120, 0), 0 0 14px rgba(232, 196, 106, 0.18); } }
.panel-enhance .enh-slot.fx-fail { animation: enh-shake 0.5s ease-in-out; border-color: #b3261e !important; }
@keyframes enh-shake { 0%, 100% { transform: none; } 15% { transform: translateX(-7px) rotate(-3deg); } 30% { transform: translateX(6px) rotate(2deg); }
  45% { transform: translateX(-5px); } 60% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.panel-enhance .enh-slot.fx-broke { animation: enh-broke 0.6s ease-out; border-color: #7a1a12 !important; }
@keyframes enh-broke { 0% { box-shadow: 0 0 0 0 rgba(255, 80, 60, 1), 0 0 40px rgba(255, 60, 40, 0.9); } 100% { box-shadow: 0 0 0 20px rgba(255, 80, 60, 0); } }

.panel-enhance .enh-summary { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; z-index: 1;
  transition: opacity 0.25s; }
.panel-enhance.is-hammering .enh-summary, .panel-enhance.is-waiting .enh-summary { opacity: 0.28; }
.panel-enhance[data-result] .enh-summary { opacity: 0; }
.panel-enhance[data-result="broke"] .enh-stats, .panel-enhance[data-result="broke"] .enh-costs,
.panel-enhance[data-result="broke"] .enh-opts, .panel-enhance[data-result="broke"] .enh-warn { opacity: 0.35; transition: opacity 0.3s; }
.panel-enhance .enh-iname { font-size: 17px; font-weight: 600; line-height: 1.2; text-shadow: 0 1px 0 #000, 0 0 8px rgba(0, 0, 0, 0.6); }
.panel-enhance .enh-intro { font-size: 12.5px; color: var(--c-muted); line-height: 1.5; }
.panel-enhance .enh-levels { display: flex; align-items: center; gap: 10px; }
.panel-enhance .enh-lv { font-size: 24px; font-weight: 700; line-height: 1; color: #e8e0d0; text-shadow: 0 2px 0 #000; font-variant-numeric: tabular-nums; }
.panel-enhance .enh-lv-next { color: #ffe28a; text-shadow: 0 2px 0 #3a1208, 0 0 12px rgba(255, 215, 106, 0.6); }
.panel-enhance .enh-lv-max { color: #ffb830; }
.panel-enhance .enh-maxed { font-size: 12px; padding: 2px 8px; border-radius: 3px; color: #2a1204; background: linear-gradient(180deg, #ffe28a, #e8a93a); font-weight: 600; }
.panel-enhance .enh-arrow { width: 22px; height: 12px; position: relative; }
.panel-enhance .enh-arrow::before { content: ''; position: absolute; left: 0; right: 7px; top: 5px; height: 2px; background: var(--c-gold); }
.panel-enhance .enh-arrow::after { content: ''; position: absolute; right: 0; top: 1px; border-left: 8px solid var(--c-gold); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }

.panel-enhance .enh-chance { display: flex; flex-direction: column; gap: 4px; }
.panel-enhance .enh-chance-row { display: flex; align-items: baseline; gap: 7px; }
.panel-enhance .enh-chance-label { font-size: 12.5px; color: var(--c-muted); }
.panel-enhance .enh-chance-val { font-size: 20px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.panel-enhance .enh-chance-bonus { font-size: 12px; font-weight: 600; color: #7dff9a; padding: 1px 6px; border-radius: 8px; background: rgba(60, 170, 80, 0.2); }
.panel-enhance .enh-chance.is-good .enh-chance-val { color: #7ddc6a; }
.panel-enhance .enh-chance.is-mid .enh-chance-val { color: #ffd24a; }
.panel-enhance .enh-chance.is-low .enh-chance-val { color: #ff6b5b; }
.panel-enhance .enh-chance-bar { position: relative; height: 7px; border-radius: 4px; overflow: hidden; background: rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 0 0 1px rgba(232, 196, 106, 0.25); }
.panel-enhance .enh-chance-bar .bar-fill { height: 100%; border-radius: 4px; transition: width 0.25s; }
.panel-enhance .enh-chance.is-good .bar-fill { background: linear-gradient(90deg, #3c9a3a, #8ce07a); }
.panel-enhance .enh-chance.is-mid .bar-fill { background: linear-gradient(90deg, #b8860b, #ffd24a); }
.panel-enhance .enh-chance.is-low .bar-fill { background: linear-gradient(90deg, #8e1d14, #ff6b5b); }

.panel-enhance .enh-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

/* result banner */
.panel-enhance .enh-banner { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-align: center; opacity: 0; pointer-events: none; transition: opacity 0.2s; padding: 0 12px 0 136px; }
.panel-enhance .enh-banner.is-show { opacity: 1; pointer-events: auto; cursor: pointer; }
.panel-enhance .enh-banner.is-show .enh-bhead { animation: enh-pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes enh-pop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
.panel-enhance .enh-bhead { font-size: 23px; font-weight: 700; line-height: 1.15; letter-spacing: 0.5px; }
.panel-enhance .enh-bsub { font-size: 14px; font-weight: 600; color: var(--c-text); text-shadow: 0 1px 2px #000; }
.panel-enhance .enh-bmsg { font-size: 12px; color: #d9ccb2; text-shadow: 0 1px 2px #000; max-width: 100%; }
.panel-enhance .enh-banner.is-ok { background: radial-gradient(90% 120% at 68% 50%, rgba(92, 56, 12, 0.55), transparent 75%); }
.panel-enhance .enh-banner.is-ok .enh-bhead { color: #ffe28a; text-shadow: 0 2px 0 #5a3408, 0 0 16px rgba(255, 215, 106, 0.9); }
.panel-enhance .enh-banner.is-fail { background: radial-gradient(90% 120% at 68% 50%, rgba(70, 20, 12, 0.5), transparent 75%); }
.panel-enhance .enh-banner.is-fail .enh-bhead { color: #ff8a6b; text-shadow: 0 2px 0 #3a0e08, 0 0 12px rgba(255, 90, 60, 0.6); }
.panel-enhance .enh-banner.is-broke { background: radial-gradient(90% 120% at 68% 50%, rgba(90, 8, 4, 0.6), transparent 75%); }
.panel-enhance .enh-banner.is-broke .enh-bhead { color: #ff4a3a; text-shadow: 0 2px 0 #1a0000, 0 0 16px rgba(255, 40, 20, 0.85); }

/* ---------------------------------------------------------------- stat preview */
.panel-enhance .enh-stats { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.32); border: 1px solid rgba(232, 196, 106, 0.2); }
.panel-enhance .enh-srow { display: flex; align-items: center; gap: 7px; font-size: 13.5px; line-height: 1.55; font-variant-numeric: tabular-nums; }
.panel-enhance .enh-sname { flex: 1; color: var(--c-muted); }
.panel-enhance .enh-scur { color: var(--c-text); }
.panel-enhance .enh-srow.is-up .enh-scur { color: #cfc3aa; }
.panel-enhance .enh-sarrow { width: 0; height: 0; border-left: 6px solid var(--c-gold); border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.panel-enhance .enh-snext { color: #ffe28a; font-weight: 600; }
.panel-enhance .enh-sdiff { min-width: 44px; text-align: right; color: #7ddc6a; font-size: 12.5px; font-weight: 600; }
.panel-enhance .enh-ssame { min-width: 44px; text-align: right; font-size: 12px; }

/* ---------------------------------------------------------------- costs */
.panel-enhance .enh-costs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.panel-enhance .enh-cost { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 6px; row-gap: 1px; padding: 5px 8px;
  border-radius: 6px; background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(139, 90, 43, 0.5); }
.panel-enhance .enh-clabel { grid-column: 1 / 3; font-size: 11.5px; color: var(--c-muted); }
.panel-enhance .enh-cval { grid-column: 1 / 2; display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 600; color: var(--c-gold);
  white-space: nowrap; font-variant-numeric: tabular-nums; }
.panel-enhance .enh-cval.is-bad, .panel-enhance .enh-cval.is-bad .gold-amount { color: var(--c-bad); }
.panel-enhance .enh-stone-ico { width: 18px; height: 18px; flex: none; border-radius: 2px; }
.panel-enhance .enh-chave { grid-column: 2 / 3; justify-self: end; align-self: center; font-size: 11.5px; white-space: nowrap; }
.panel-enhance .enh-chave.is-bad { color: #ff6b5b; }

/* ---------------------------------------------------------------- charm options */
.panel-enhance .enh-opts { display: flex; flex-direction: column; gap: 4px; }
.panel-enhance .enh-opt { position: relative; display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 8px; cursor: pointer; border-radius: 6px;
  background: linear-gradient(180deg, #33201a, #25170f); border: 1px solid rgba(139, 90, 43, 0.65); transition: border-color 0.12s, background 0.12s; }
.panel-enhance .enh-opt:hover:not(.is-disabled) { border-color: rgba(232, 196, 106, 0.7); }
.panel-enhance .enh-opt.is-disabled { cursor: not-allowed; opacity: 0.55; }
.panel-enhance .enh-check { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.panel-enhance .enh-obox { width: 16px; height: 16px; flex: none; border-radius: 3px; border: 1px solid var(--c-gold); background: rgba(0, 0, 0, 0.5);
  display: inline-flex; align-items: center; justify-content: center; box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7); }
.panel-enhance .enh-check:checked + .enh-obox { background: linear-gradient(180deg, #e8c46a, #b8862b); }
.panel-enhance .enh-check:checked + .enh-obox::after { content: ''; width: 4px; height: 8px; margin-top: -2px; border: solid #2a1204; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.panel-enhance .enh-check:focus-visible + .enh-obox { outline: 2px solid var(--c-gold); outline-offset: 1px; }
.panel-enhance .enh-opt:has(.enh-check:checked) { border-color: rgba(232, 196, 106, 0.8); background: linear-gradient(180deg, #45291a, #2e1b11); }
.panel-enhance .enh-oicon { width: 24px; height: 24px; flex: none; border-radius: 4px; }
.panel-enhance .enh-otext { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.panel-enhance .enh-oname { font-size: 13.5px; font-weight: 500; color: var(--c-text); }
.panel-enhance .enh-odesc { font-size: 11.5px; color: var(--c-muted); }
.panel-enhance .enh-ocount { font-size: 12px; color: var(--c-gold); white-space: nowrap; font-variant-numeric: tabular-nums; }
.panel-enhance .enh-opt.is-disabled .enh-ocount { color: #ff6b5b; }

/* ---------------------------------------------------------------- risk warnings */
.panel-enhance .enh-warn { display: flex; flex-direction: column; gap: 3px; padding: 6px 9px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(139, 90, 43, 0.45); }
.panel-enhance .enh-wline { display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px; line-height: 1.45; }
.panel-enhance .enh-wico { width: 15px; height: 15px; flex: none; margin-top: 2px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; line-height: 1; }
.panel-enhance .enh-wline.is-danger { color: #ff7b6b; font-weight: 500; }
.panel-enhance .enh-wline.is-danger .enh-wico { background: #b3261e; color: #fff; box-shadow: 0 0 6px rgba(255, 60, 40, 0.7); }
.panel-enhance .enh-wline.is-danger .enh-wico::before { content: '!'; }
.panel-enhance .enh-wline.is-warn { color: #ffcf6b; }
.panel-enhance .enh-wline.is-warn .enh-wico { background: #c48a12; color: #1a0f0a; }
.panel-enhance .enh-wline.is-warn .enh-wico::before { content: '!'; }
.panel-enhance .enh-wline.is-safe { color: #a9e39a; }
.panel-enhance .enh-wline.is-safe .enh-wico { background: #3c8a3a; color: #fff; }
.panel-enhance .enh-wline.is-safe .enh-wico::before { content: ''; width: 3px; height: 6px; margin-top: -2px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.panel-enhance .enh-wline.is-info { color: var(--c-muted); }
.panel-enhance .enh-wline.is-info .enh-wico { background: rgba(232, 196, 106, 0.25); color: var(--c-gold); }
.panel-enhance .enh-wline.is-info .enh-wico::before { content: 'i'; font-style: italic; font-family: Georgia, serif; }
.panel-enhance:has(.enh-wline.is-danger) .enh-warn { border-color: rgba(179, 38, 30, 0.8); background: rgba(80, 10, 6, 0.3); }

/* ---------------------------------------------------------------- progress + action */
.panel-enhance .enh-prog { height: 6px; border-radius: 3px; overflow: hidden; background: rgba(0, 0, 0, 0.5); opacity: 0; transition: opacity 0.2s;
  box-shadow: inset 0 0 0 1px rgba(232, 196, 106, 0.2); }
.panel-enhance.is-hammering .enh-prog, .panel-enhance.is-waiting .enh-prog, .panel-enhance[data-result] .enh-prog { opacity: 1; }
.panel-enhance .enh-prog-fill { width: 0; height: 100%; background: linear-gradient(90deg, #b8520f, #ff9a3c 60%, #ffe28a); box-shadow: 0 0 8px rgba(255, 154, 60, 0.8); }
.panel-enhance.is-waiting .enh-prog-fill { animation: enh-wait 0.8s ease-in-out infinite; }
@keyframes enh-wait { 50% { filter: brightness(1.5); } }

.panel-enhance .enh-actions { display: flex; align-items: center; gap: 10px; }
.panel-enhance .enh-status { flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.35; color: var(--c-muted); }
.panel-enhance .enh-status.is-bad { color: #ff6b5b; }
.panel-enhance .enh-status.is-info { color: #ffcf6b; }
.panel-enhance .enh-status.is-hint { color: #d9a07a; }
.panel-enhance .enh-go { flex: none; min-width: 128px; min-height: 40px; padding: 6px 22px; font-size: 16px; font-weight: 600; letter-spacing: 1px; }
.panel-enhance.is-hammering .enh-go:disabled { filter: none; animation: enh-go-pulse 0.4s ease-in-out infinite alternate; }
@keyframes enh-go-pulse { to { box-shadow: inset 0 1px 0 rgba(255, 220, 180, 0.35), 0 2px 6px rgba(0, 0, 0, 0.55), 0 0 20px rgba(255, 120, 60, 0.85); } }

/* ---------------------------------------------------------------- inventory picker */
.panel-enhance .enh-pick { display: flex; flex-direction: column; gap: 6px; padding-top: 2px; }
.panel-enhance .enh-pick-title { margin: 2px 0 0; }
.panel-enhance .enh-pick-count { font-size: 11.5px; font-weight: 400; }
.panel-enhance .enh-pick-grid { --slot: 38px; display: grid; grid-template-columns: repeat(auto-fill, var(--slot)); gap: 4px; max-height: 84px; overflow-y: auto; padding: 2px; }
.panel-enhance .enh-pslot .enh-picon { width: 32px; height: 32px; }
.panel-enhance .enh-pslot.is-maxed .enh-picon { filter: saturate(1.3) drop-shadow(0 0 3px rgba(255, 184, 48, 0.9)); }
.panel-enhance.is-busy .enh-pslot { pointer-events: none; opacity: 0.6; }
.panel-enhance .enh-pick-empty { font-size: 12px; padding: 4px 2px 2px; }

/* drag & drop hover: ui.js marks the drop target (the panel root) with .drop-ok / .drop-bad */
.panel-enhance.drop-ok .enh-slot { border-color: var(--c-good); border-style: solid;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--c-good), 0 0 18px rgba(125, 220, 106, 0.7); }
.panel-enhance.drop-bad .enh-slot { border-color: var(--c-bad); border-style: solid; }