/* Wulin Saga — character window 'ตัวละคร' (paper doll + stats). Owned by ui-inventory.
 * Builds on style.css (.slot .bar .btn .panel-inset .section-title .stat-row).
 */

.panel-character {
  --fc: #e8e0d0;
  display: flex; flex-direction: column; gap: 10px;
}

/* Header: name, level, job title, faction pill. */
.panel-character .ch-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 10px 7px;
  background:
    radial-gradient(60% 120% at 0% 50%, rgba(179, 38, 30, 0.35), transparent 70%),
    linear-gradient(90deg, rgba(60, 20, 12, 0.6), rgba(20, 10, 6, 0.3));
  border: 1px solid rgba(232, 196, 106, 0.28); border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, 0.08);
}
.panel-character .ch-head-main { min-width: 0; }
.panel-character .ch-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.panel-character .ch-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 18px; font-weight: 600; color: var(--c-gold-light);
  text-shadow: 0 1px 0 #000, 0 0 10px rgba(232, 196, 106, 0.3);
}
.panel-character .ch-level {
  flex: none; padding: 0 7px;
  font-size: 12px; font-weight: 600; line-height: 18px; color: var(--c-gold);
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--c-gold-dark); border-radius: 9px;
}
.panel-character .ch-job { font-size: 12px; color: #d7c7a6; }
.panel-character .ch-faction {
  --fc: #e8e0d0;
  flex: none; padding: 2px 11px;
  font-size: 12px; font-weight: 500; color: var(--fc); white-space: nowrap;
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--fc); border-radius: 12px;
  box-shadow: 0 0 8px color-mix(in srgb, var(--fc) 35%, transparent), inset 0 0 6px color-mix(in srgb, var(--fc) 18%, transparent);
  text-shadow: 0 1px 0 #000;
}
.panel-character .ch-faction[data-faction="0"] { opacity: 0.8; box-shadow: none; border-color: rgba(232, 224, 208, 0.35); }

/* Paper doll. */
.panel-character .ch-doll {
  --fc: #e8e0d0;
  display: grid; grid-template-columns: var(--slot) 1fr var(--slot); align-items: center; gap: 10px;
  padding: 10px 14px;
  background:
    radial-gradient(55% 70% at 50% 58%, rgba(140, 70, 30, 0.32), transparent 72%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 9px),
    rgba(0, 0, 0, 0.32);
  border: 1px solid #3c2717; border-radius: var(--radius);
  box-shadow: inset 0 1px 9px rgba(0, 0, 0, 0.85);
}
.panel-character .ch-col { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.panel-character .ch-portrait-frame {
  position: relative; justify-self: center;
  width: 144px; height: 200px; padding: 5px;
  background:
    radial-gradient(70% 45% at 50% 88%, rgba(0, 0, 0, 0.55), transparent 70%),
    linear-gradient(180deg, rgba(60, 34, 20, 0.55), rgba(18, 10, 6, 0.75));
  border: 1px solid var(--c-gold-dark); border-radius: 60px 60px 6px 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.8), inset 0 0 18px rgba(0, 0, 0, 0.8), 0 0 0 3px rgba(20, 10, 6, 0.9), 0 0 0 4px rgba(232, 196, 106, 0.25);
  overflow: hidden;
}
.panel-character .ch-portrait-frame::after {
  content: ''; position: absolute; left: 12%; right: 12%; bottom: 4px; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--c-gold), transparent); opacity: 0.6;
}
.panel-character .ch-aura {
  position: absolute; inset: 18% 6% 0; pointer-events: none;
  background: radial-gradient(50% 55% at 50% 72%, color-mix(in srgb, var(--fc) 30%, transparent), transparent 70%);
  filter: blur(3px);
  animation: ch-aura 3.2s ease-in-out infinite;
}
.panel-character .ch-doll[data-faction="0"] .ch-aura { opacity: 0.45; }
@keyframes ch-aura { 0%, 100% { opacity: 0.65; transform: scale(1); } 50% { opacity: 1; transform: scale(1.04); } }
.panel-character .ch-portrait {
  position: relative; z-index: 1; display: block;
  width: 132px; height: 188px; margin: 0 auto;
}

/* Equipment slots. */
.panel-character .ch-slot:not(.empty) { cursor: grab; }
.panel-character .ch-slot.empty > .ch-ph { opacity: 0.22; filter: grayscale(1) brightness(1.4); }
.panel-character .ch-slot-label {
  position: absolute; left: 0; right: 0; bottom: 1px; pointer-events: none;
  font-size: 9.5px; line-height: 1.1; text-align: center; color: #b9a684; text-shadow: var(--text-outline);
}
.panel-character .ch-slot[data-rarity="rare"] { box-shadow: inset 0 0 8px rgba(74, 163, 255, 0.3), 0 0 5px rgba(74, 163, 255, 0.4); }
.panel-character .ch-slot[data-rarity="epic"] { box-shadow: inset 0 0 10px rgba(199, 125, 255, 0.4), 0 0 8px rgba(199, 125, 255, 0.55); }
.panel-character .ch-slot[data-rarity="legendary"] { box-shadow: inset 0 0 12px rgba(255, 184, 48, 0.5), 0 0 10px rgba(255, 184, 48, 0.6); }
.panel-character .ch-slot:not(.empty):hover { border-color: var(--c-gold-light); box-shadow: 0 0 10px rgba(232, 196, 106, 0.6); }
.panel-character .ch-slot.dragging-src > img { opacity: 0.3; }

/* HP / MP / EXP. */
.panel-character .ch-bars { display: flex; flex-direction: column; gap: 4px; }
.panel-character .ch-bars .bar { height: 15px; }

/* Stats: base (left) and derived (right). */
.panel-character .ch-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: stretch; }
.panel-character .ch-stats .section-title { margin: 0 0 6px; }
.panel-character .ch-base { display: flex; flex-direction: column; }
.panel-character .ch-stat {
  display: grid; grid-template-columns: 1fr auto 22px; align-items: center; gap: 6px;
  min-height: 29px; padding: 2px 0;
  border-bottom: 1px dotted rgba(232, 196, 106, 0.14);
}
.panel-character .ch-stat-name { font-size: 13px; color: var(--c-text); cursor: help; white-space: nowrap; }
.panel-character .ch-stat-key {
  display: inline-block; min-width: 30px; margin-right: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.6px; color: var(--c-muted);
}
.panel-character .ch-stat.primary .ch-stat-name,
.panel-character .ch-stat.primary .ch-stat-key { color: var(--c-gold); }
.panel-character .ch-stat-num { white-space: nowrap; text-align: right; }
.panel-character .ch-stat-val { font-size: 14px; font-weight: 600; color: var(--c-gold-light); font-variant-numeric: tabular-nums; }
.panel-character .ch-stat-bonus { margin-left: 3px; font-size: 11px; color: var(--c-good); }
.panel-character .ch-stat-bonus.neg { color: var(--c-bad); }
.panel-character .ch-plus {
  width: 22px; min-width: 22px; height: 22px; min-height: 22px; padding: 0;
  font-size: 15px; font-weight: 700; line-height: 1; color: #fff3d0;
  background: linear-gradient(180deg, #cc3a2b 0%, #901e15 55%, #6a130d 100%);
  border-color: var(--c-gold);
  box-shadow: inset 0 1px 0 rgba(255, 220, 180, 0.35), 0 0 6px rgba(232, 196, 106, 0.35);
}
.panel-character .ch-plus.hidden-btn { visibility: hidden; }

.panel-character .ch-points {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-top: 8px; padding: 4px 9px;
  font-size: 12px; color: var(--c-muted);
  background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(232, 196, 106, 0.18); border-radius: var(--radius);
}
.panel-character .ch-points-num { font-size: 17px; font-weight: 700; color: var(--c-muted); font-variant-numeric: tabular-nums; }
.panel-character .ch-points.has-points { color: #e8d8b0; border-color: var(--c-gold); animation: ch-points 1.8s ease-in-out infinite; }
.panel-character .ch-points.has-points .ch-points-num { color: var(--c-gold-light); text-shadow: 0 0 8px rgba(232, 196, 106, 0.7); }
@keyframes ch-points {
  0%, 100% { box-shadow: 0 0 0 rgba(232, 196, 106, 0); }
  50% { box-shadow: 0 0 10px rgba(232, 196, 106, 0.45), inset 0 0 8px rgba(232, 196, 106, 0.15); }
}
.panel-character .ch-info { margin-top: auto; padding-top: 8px; font-size: 12px; }
.panel-character .ch-info .stat-row { padding: 1px 0; }
.panel-character .ch-info-val { font-weight: 600; color: var(--c-text); }
.panel-character .ch-kills { color: #ff9f8f; }

.panel-character .ch-derived-list { display: flex; flex-direction: column; }
.panel-character .ch-drow { padding: 1.5px 0; font-size: 12.5px; border-bottom: 1px dotted rgba(232, 196, 106, 0.1); }
.panel-character .ch-drow:last-child { border-bottom: none; }
.panel-character .ch-drow .value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.panel-character .ch-drow[data-key="atk"] .value { color: #ffb4a0; }
.panel-character .ch-drow[data-key="def"] .value { color: #a8d0ff; }
.panel-character .ch-drow[data-key="healPower"] .value { color: #a5e8a0; }
