:root {
  color-scheme: light;
  --bg: #eef1f4;
  --panel: #fbfcfd;
  --panel-strong: #ffffff;
  --ink: #111827;
  --muted: #657181;
  --line: #cfd6df;
  --line-strong: #aeb8c5;
  --teal: #00796b;
  --teal-dark: #004d44;
  --amber: #c47a13;
  --red: #b42318;
  --blue: #2457a6;
  --shadow: 0 18px 50px rgba(17, 24, 39, 0.1);
  --mono: "Bahnschrift", "Cascadia Mono", "Consolas", monospace;
  --body: "Aptos", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(17, 24, 39, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(17, 24, 39, 0.045) 1px, transparent 1px),
    linear-gradient(135deg, rgba(36, 87, 166, 0.12), transparent 34%),
    var(--bg);
  background-size: 44px 44px, 44px 44px, auto, auto;
  color: var(--ink);
  font-family: var(--body);
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 52px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--ink);
}

h1,
h2,
p {
  margin: 0;
}

.kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  font-size: 50px;
  line-height: 0.96;
  font-weight: 900;
}

h2 {
  font-size: 19px;
  line-height: 1.2;
}

.headline p {
  margin-top: 10px;
}

.headline p,
.sectionTitle p,
small,
.status {
  color: var(--muted);
}

button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--teal-dark);
  border-radius: 6px;
  padding: 10px 16px;
  background: var(--teal);
  color: #fff;
  font: 700 15px/1 var(--body);
  cursor: pointer;
  box-shadow: 0 8px 0 var(--teal-dark);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button span {
  font-family: var(--mono);
  font-size: 18px;
  line-height: 1;
}

button:hover {
  background: #00685d;
  transform: translateY(-1px);
  box-shadow: 0 9px 0 var(--teal-dark);
}

button:active {
  transform: translateY(5px);
  box-shadow: 0 3px 0 var(--teal-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.actions span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  white-space: nowrap;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric,
.calculator,
.ruleWrap {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(251, 252, 253, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.metric {
  display: grid;
  gap: 14px;
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--blue), var(--teal), var(--amber), var(--red));
}

.metricHeader {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.metric span,
.calculator label,
.suggestion span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.metric strong {
  font-family: var(--mono);
  font-size: 68px;
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: 0;
}

.meter {
  height: 10px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #e3e8ee;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--amber), var(--red));
  transition: width 360ms ease;
}

.calculator {
  display: grid;
  grid-template-columns: minmax(240px, 0.95fr) 1.35fr;
  align-items: stretch;
  gap: 0;
  margin-bottom: 14px;
  overflow: hidden;
}

.inputBlock {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.amountInput {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--panel-strong);
  color: var(--ink);
  font: 700 22px/1 var(--mono);
}

input:focus {
  outline: 3px solid rgba(0, 121, 107, 0.22);
  border-color: var(--teal);
}

.amountInput span {
  color: var(--muted);
  font-weight: 700;
}

.suggestion {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 22px 24px;
  background:
    linear-gradient(135deg, rgba(0, 121, 107, 0.12), transparent 42%),
    #f7fafb;
  border-left: 1px solid var(--line);
}

.suggestion strong {
  color: var(--teal-dark);
  font-family: var(--mono);
  font-size: 54px;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0;
}

.ruleWrap {
  overflow: hidden;
}

.sectionTitle {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.tableScroll {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px 12px;
  text-align: center;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #1f2937;
  color: #fff;
  font-weight: 800;
}

td {
  background: rgba(255, 255, 255, 0.74);
  font-family: var(--mono);
}

td:first-child,
th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: left;
  font-family: var(--body);
  font-weight: 800;
}

td:first-child {
  background: #f8fafc;
}

td[data-factor="0"] {
  color: #7b2530;
  background: #fff1f2;
}

td[data-factor="low"] {
  background: #eef8f6;
  color: #075e54;
}

td[data-factor="mid"] {
  background: #fff7e8;
  color: #8a4d0b;
}

td[data-factor="high"] {
  background: #fff0e8;
  color: #9f2b12;
}

tr.active td:first-child {
  border-left: 5px solid var(--teal);
  color: var(--teal-dark);
}

td.activeCell {
  position: relative;
  background: #003c36;
  color: #ffffff;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px #00a991;
}

td.activeCell::after {
  content: "当前";
  margin-left: 8px;
  color: #8cf8e8;
  font-family: var(--body);
  font-size: 12px;
  font-weight: 800;
}

.status {
  min-height: 22px;
  padding: 14px 2px 0;
  font-size: 14px;
}

.status.error {
  color: var(--red);
  font-weight: 700;
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding-top: 18px;
  }

  .topbar,
  .sectionTitle {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    width: 100%;
    justify-content: space-between;
  }

  .metrics,
  .calculator {
    grid-template-columns: 1fr;
  }

  .suggestion {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  h1 {
    font-size: 32px;
  }

  .metric strong {
    font-size: 46px;
  }

  .suggestion strong {
    font-size: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
