:root {
  color-scheme: dark;
  --bg: #080c14;
  --surface: rgba(18, 25, 40, 0.88);
  --surface-strong: #161e2e;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f3f5f8;
  --muted: #8f9bad;
  --accent: #d6ff43;
  --accent-soft: rgba(214, 255, 67, 0.1);
  --danger: #ff6767;
  --danger-soft: rgba(255, 103, 103, 0.1);
  --radius: 22px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(214, 255, 67, 0.09), transparent 28%),
    radial-gradient(circle at 90% 95%, rgba(57, 91, 255, 0.1), transparent 32%),
    var(--bg);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.14;
  background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

.app-shell { width: min(430px, calc(100% - 24px)); margin: 0 auto; padding: 40px 0 56px; }
.page-header { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 28px; text-align: center; }
h1 { display: flex; margin: 0; align-items: baseline; justify-content: center; gap: 15px; line-height: 1.08; letter-spacing: -.03em; }
.title-primary { color: #f7f9fc; font-size: clamp(27px, 5vw, 38px); font-weight: 900; white-space: nowrap; text-shadow: 0 8px 30px rgba(255,255,255,.08); }
.eyebrow { margin-top: 6px; color: #9db36a; font-size: 8px; font-weight: 800; line-height: 1; letter-spacing: .24em; white-space: nowrap; }
.title-secondary { color: var(--accent); font-size: clamp(21px, 4vw, 29px); font-weight: 850; white-space: nowrap; }
.subtitle { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.form-card, .result-card { padding: 22px 20px; }
.result-card { position: static; }
.section-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 26px; }
.section-heading .step { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: var(--accent); background: var(--accent-soft); font-size: 12px; font-weight: 800; }
.section-heading h2 { margin: 0; font-size: 19px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.required-dot, label span { color: var(--accent); }
.field-grid { display: grid; grid-template-columns: 1fr; gap: 15px; }
.field-wide { grid-column: auto; }
.field { display: grid; grid-template-columns: 82px minmax(0, 1fr); column-gap: 12px; align-items: start; }
.field > :not(label) { grid-column: 2; }
.field label { display: block; margin: 0; padding-top: 14px; color: #dce1e9; font-size: 13px; font-weight: 700; }
input { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--text); background: rgba(7, 11, 19, .65); padding: 0 14px; font: inherit; font-size: 14px; transition: border-color .18s, box-shadow .18s, background .18s; }
input::placeholder { color: #596375; }
input:hover { border-color: rgba(255,255,255,.16); }
input:focus { border-color: rgba(214,255,67,.7); background: rgba(8,13,21,.9); box-shadow: 0 0 0 3px rgba(214,255,67,.08); }
input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.hint { margin: 7px 2px 0; color: #6f7b8d; font-size: 11px; line-height: 1.45; }
.boss-warning { margin: 8px 2px 0; color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.55; }
.error { min-height: 0; margin: 5px 2px 0; color: var(--danger); font-size: 11px; }
.error:empty { display: none; }
.input-affix { position: relative; }
.input-affix span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
.input-affix input { padding-left: 34px; }
.number-control { display: grid; grid-template-columns: 42px 1fr 42px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: rgba(7,11,19,.65); }
.number-control input { border: 0; border-radius: 0; text-align: center; appearance: textfield; }
.number-control input::-webkit-inner-spin-button { appearance: none; }
.number-button { border: 0; color: var(--muted); background: transparent; font-size: 20px; cursor: pointer; transition: color .18s, background .18s; }
.number-button:hover { color: var(--accent); background: var(--accent-soft); }
.discount-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.discount-badge { display: grid; min-width: 78px; place-items: center; border: 1px solid rgba(214,255,67,.18); border-radius: 12px; color: var(--accent); background: var(--accent-soft); padding: 0 13px; font-size: 12px; font-weight: 700; }
.amount-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; }
.amount-item { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: 14px; background: rgba(7,11,19,.52); padding: 15px; }
.amount-item span { color: var(--muted); font-size: 11px; }
.amount-item strong { font-size: 18px; }
.amount-highlight { grid-column: auto; border-color: rgba(214,255,67,.2); background: var(--accent-soft); }
.amount-highlight strong { color: var(--accent); font-size: 18px; }
.preview-wrap { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #090e18; }
.preview-label { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); color: var(--muted); padding: 12px 16px; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.live-indicator { display: flex; align-items: center; gap: 6px; color: #819071; }
.live-indicator i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
pre { min-height: 250px; margin: 0; color: #dfe5ed; padding: 20px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 14px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.copy-button { display: flex; width: 100%; height: 50px; align-items: center; justify-content: center; gap: 9px; margin-top: 16px; border: 0; border-radius: 13px; color: #080b10; background: var(--accent); font: inherit; font-size: 14px; font-weight: 850; cursor: pointer; box-shadow: 0 10px 28px rgba(214,255,67,.12); transition: transform .18s, filter .18s, box-shadow .18s; }
.copy-button:hover { filter: brightness(1.05); box-shadow: 0 12px 34px rgba(214,255,67,.2); transform: translateY(-1px); }
.copy-button:active { transform: translateY(0); }
.copy-button:focus-visible, .number-button:focus-visible { outline: 3px solid rgba(214,255,67,.35); outline-offset: 2px; }
.copy-button.success { color: #07150c; background: #71ed8a; }
.copy-status { min-height: 18px; margin: 9px 0 -5px; color: var(--muted); text-align: center; font-size: 12px; }
.copy-status.error-status { color: var(--danger); }

@media (max-width: 560px) {
  .app-shell { width: min(100% - 24px, 430px); padding: 28px 0 40px; }
  .page-header { align-items: center; margin-bottom: 22px; }
  h1 { gap: 10px; }
  .title-primary { font-size: 27px; }
  .title-secondary { font-size: 21px; }
  .subtitle { line-height: 1.5; }
  .form-card, .result-card { padding: 20px 16px; border-radius: 18px; }
  .field { grid-template-columns: 62px minmax(0, 1fr); column-gap: 8px; }
  .field label { font-size: 12px; }
  .amount-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  pre { min-height: 238px; padding: 17px; font-size: 13px; }
}

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