:root {
  --bg: #0b1020;
  --bg-soft: #121a30;
  --card: #16203a;
  --card-2: #1b274571;
  --line: #27345a;
  --text: #eaf0ff;
  --muted: #93a1c4;
  --accent: #5b8cff;
  --cool: #2ec5ff;
  --warm: #ffb020;
  --hot: #ff4d4d;
  --good: #28c785;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: radial-gradient(1200px 600px at 80% -10%, #1a2b50, transparent),
    radial-gradient(900px 500px at -10% 10%, #161f3a, transparent),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 32px 20px 60px; }

/* Hero */
.hero { text-align: center; margin-bottom: 28px; }
.hero-tag {
  display: inline-block; font-size: 12px; letter-spacing: 2px;
  color: var(--cool); background: rgba(46, 197, 255, 0.1);
  border: 1px solid rgba(46, 197, 255, 0.25);
  padding: 5px 14px; border-radius: 999px; margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 44px); font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(90deg, #fff, #9fc1ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .sub {
  max-width: 720px; margin: 12px auto 0; color: var(--muted);
  font-size: 15.5px;
}
.hero .sub strong { color: var(--text); }

/* Layout */
.grid { display: grid; grid-template-columns: 1fr 0.92fr; gap: 22px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 22px; }

.card {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 17px; font-weight: 700; }
.hint { font-size: 12px; color: var(--muted); }

/* Asset rows */
.asset-list { display: flex; flex-direction: column; gap: 10px; }
.asset-row {
  display: grid; grid-template-columns: 1.4fr 1.1fr 1fr auto; gap: 8px; align-items: center;
}
.asset-row input, .asset-row select {
  width: 100%; background: #0e1730; border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 9px 10px; font-size: 14px;
  font-family: inherit;
}
.asset-row input:focus, .asset-row select:focus { outline: none; border-color: var(--accent); }
.asset-row .wpct { font-size: 12px; color: var(--muted); text-align: right; min-width: 42px; }
.del-asset {
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 4px 6px; border-radius: 8px;
}
.del-asset:hover { color: var(--hot); background: rgba(255, 77, 77, 0.1); }

.asset-actions { display: flex; gap: 14px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.totals { margin-top: 14px; font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 12px; }
.totals b { color: var(--text); }

/* Factors */
.factor-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.factor {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  background: #0e1730; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.factor:hover { border-color: var(--accent); }
.factor.on { border-color: var(--warm); background: rgba(255, 176, 32, 0.08); }
.factor input { margin-top: 3px; accent-color: var(--warm); width: 16px; height: 16px; flex: none; }
.factor .ftxt { font-size: 13.5px; }
.factor .fwt { font-size: 11px; color: var(--muted); }

/* Gauge */
.card-gauge { padding-top: 24px; }
.gauge { display: flex; gap: 22px; align-items: center; }
.thermo { position: relative; width: 46px; flex: none; display: flex; flex-direction: column; align-items: center; }
.thermo-track {
  width: 18px; height: 180px; background: #0e1730; border: 1px solid var(--line);
  border-radius: 999px; overflow: hidden; position: relative; display: flex; align-items: flex-end;
}
.thermo-fill {
  width: 100%; height: 0%;
  background: linear-gradient(180deg, var(--hot), var(--warm) 55%, var(--cool));
  border-radius: 999px; transition: height 0.5s cubic-bezier(.2,.7,.2,1);
}
.thermo-bulb {
  width: 34px; height: 34px; border-radius: 50%; margin-top: -8px;
  background: var(--cool); border: 3px solid #0e1730; box-shadow: 0 0 18px currentColor;
  transition: background 0.4s;
}
.gauge-readout { flex: 1; }
.score { font-size: 56px; font-weight: 800; line-height: 1; letter-spacing: -2px; }
.score-unit { font-size: 13px; color: var(--muted); margin-top: 2px; }
.level-badge {
  display: inline-block; margin-top: 12px; padding: 6px 14px; border-radius: 999px;
  font-weight: 700; font-size: 14px; background: rgba(91,140,255,.15); color: var(--accent);
}
.level-desc { font-size: 13px; color: var(--muted); margin-top: 8px; }

.breakdown { margin-top: 20px; display: flex; flex-direction: column; gap: 9px; }
.bd-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.bd-label { width: 96px; flex: none; color: var(--muted); }
.bd-bar { flex: 1; height: 7px; background: #0e1730; border-radius: 999px; overflow: hidden; }
.bd-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .4s; }
.bd-val { width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

/* Actions */
.actions { list-style: none; display: flex; flex-direction: column; gap: 10px; counter-reset: a; }
.actions li {
  position: relative; padding: 12px 14px 12px 44px; background: #0e1730;
  border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px;
}
.actions li::before {
  counter-increment: a; content: counter(a);
  position: absolute; left: 12px; top: 12px; width: 22px; height: 22px;
  background: var(--accent); color: #fff; border-radius: 50%; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.actions li.crit { border-color: rgba(255,77,77,.5); }
.actions li.crit::before { background: var(--hot); }
.actions li b { color: #fff; }
.actions .empty { padding: 14px; color: var(--muted); text-align: center; border-style: dashed; }
.actions .empty::before { display: none; }

/* Buttons */
.btn {
  background: var(--accent); color: #fff; border: none; border-radius: 10px;
  padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-link { background: transparent; border: none; color: var(--cool); padding: 8px 4px; }
.btn-link:hover { text-decoration: underline; }

.export-row { display: flex; gap: 10px; flex-wrap: wrap; }
.save-note { font-size: 12px; color: var(--muted); margin-top: 12px; }

/* Footer */
.foot { margin-top: 36px; text-align: center; color: var(--muted); font-size: 12.5px; }
.foot p { max-width: 760px; margin: 0 auto 8px; }
.foot strong { color: var(--text); }
.foot-meta { font-size: 11.5px; opacity: .8; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--good); color: #04231a; padding: 11px 20px; border-radius: 12px;
  font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s;
  box-shadow: var(--shadow); z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Responsive */
@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .factor-list { grid-template-columns: 1fr; }
  .asset-row { grid-template-columns: 1.3fr 1.1fr 1fr auto; }
}
@media (max-width: 520px) {
  .wrap { padding: 22px 14px 48px; }
  .asset-row { grid-template-columns: 1fr 1fr; grid-template-areas: "name name" "class amt" "pct del"; gap: 6px; }
  .asset-row .a-name { grid-area: name; }
  .asset-row .a-class { grid-area: class; }
  .asset-row .a-amt { grid-area: amt; }
  .asset-row .wpct { grid-area: pct; text-align: left; }
  .asset-row .del-asset { grid-area: del; justify-self: end; }
  .gauge { flex-direction: row; }
  .score { font-size: 44px; }
}

/* Print */
@media print {
  body { background: #fff; color: #000; }
  .asset-actions, .export-card, .btn, .factor:not(.on), .toast, .del-asset { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; background: #fff; }
  .hero h1, .score { color: #000 !important; -webkit-text-fill-color: #000; }
}
