:root {
  --bg-0: #08090d;
  --bg-1: #10131b;
  --bg-2: #171b26;
  --ink: #efe6d2;
  --ink-dim: #b7ae9a;
  --ink-mute: #7d776b;
  --gold: #d7b25a;
  --gold-2: #f0d48a;
  --gold-line: rgba(215, 178, 90, 0.38);
  --cyan: #7ec8c4;
  --pvp: #c45c4a;
  --pve: #4f9d8f;
  --warn: #e0a04a;
  --danger: #d2655c;
  --ok: #8fbf7a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  --radius: 18px;
  --font-display: "Cinzel", "Songti SC", serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font-body);
}

body {
  background-image:
    radial-gradient(1200px 500px at 12% -10%, rgba(126, 200, 196, 0.08), transparent 55%),
    radial-gradient(900px 420px at 90% 0%, rgba(215, 178, 90, 0.09), transparent 50%),
    linear-gradient(180deg, #0c1018 0%, #08090d 42%, #0a0c12 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72'%3E%3Cpath d='M36 2 L38 18 L36 34 L34 18 Z M2 36 L18 38 L34 36 L18 34 Z' fill='none' stroke='%23d7b25a' stroke-width='0.6' opacity='0.35'/%3E%3C/svg%3E");
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-kicker {
  font-family: var(--font-display);
  letter-spacing: 0.42em;
  font-size: 11px;
  color: var(--gold);
}

.brand h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand p {
  margin: 0;
  color: var(--ink-dim);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: rgba(16, 19, 27, 0.72);
  color: var(--ink-dim);
  font-size: 12px;
  white-space: nowrap;
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(143, 191, 122, 0.12);
}

.status-pill.is-mock .dot {
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(215, 178, 90, 0.14);
}

.status-pill.is-error .dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(210, 101, 92, 0.16);
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

#calc-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 118px);
  overflow: hidden;
}

.form-scroll {
  overflow: auto;
  padding-right: 2px;
}

.form-scroll::-webkit-scrollbar {
  width: 8px;
}

.form-scroll::-webkit-scrollbar-thumb {
  background: rgba(215, 178, 90, 0.28);
  border-radius: 99px;
}

.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(23, 27, 38, 0.94), rgba(12, 14, 20, 0.94));
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--gold);
  pointer-events: none;
}

.panel::before {
  top: 10px;
  left: 10px;
  border-right: 0;
  border-bottom: 0;
}

.panel::after {
  right: 10px;
  bottom: 10px;
  border-left: 0;
  border-top: 0;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(215, 178, 90, 0.16);
}

.section-title:first-child {
  margin-top: 0;
}

.section-title h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.section-title span {
  color: var(--ink-mute);
  font-size: 12px;
}

.stack {
  display: grid;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--ink-dim);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.field .hint {
  color: var(--ink-mute);
  font-size: 11px;
}

.field.is-error input,
.field.is-error select {
  border-color: rgba(210, 101, 92, 0.7);
}

.field-error {
  color: var(--danger);
  font-size: 11px;
}

.field-error:empty {
  display: none;
}

.input-wrap {
  position: relative;
}

.input-wrap input,
.field select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(215, 178, 90, 0.22);
  background: rgba(8, 9, 13, 0.55);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-wrap input {
  padding-right: 54px;
  font-variant-numeric: tabular-nums;
}

.input-wrap .unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-mute);
  font-size: 12px;
  pointer-events: none;
}

.input-wrap input:focus,
.field select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(215, 178, 90, 0.12);
}

.input-wrap input:disabled,
.field select:disabled {
  opacity: 0.55;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-switch button {
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(215, 178, 90, 0.22);
  background: rgba(8, 9, 13, 0.45);
  color: var(--ink-dim);
}

.mode-switch button.is-active[data-mode="PVP"] {
  border-color: rgba(196, 92, 74, 0.7);
  background: rgba(196, 92, 74, 0.16);
  color: #f3c7bf;
}

.mode-switch button.is-active[data-mode="PVE"] {
  border-color: rgba(79, 157, 143, 0.7);
  background: rgba(79, 157, 143, 0.16);
  color: #c6ebe4;
}

.preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(126, 200, 196, 0.08);
  border: 1px solid rgba(126, 200, 196, 0.18);
}

.preview strong {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
  letter-spacing: 0.04em;
}

.preview small {
  display: block;
  color: var(--ink-mute);
  font-size: 11px;
  margin-bottom: 2px;
}

.preview.is-empty strong {
  color: var(--ink-mute);
  font-size: 16px;
}

.actions {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(215, 178, 90, 0.16);
  flex-shrink: 0;
}

.btn {
  height: 42px;
  border-radius: 11px;
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(180deg, #ecd392 0%, #c9a24d 100%);
  color: #2a210f;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  border-color: var(--gold-line);
  color: var(--gold-2);
}

.stone-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  font-size: 11px;
  color: var(--ink-dim);
  border: 1px solid rgba(215, 178, 90, 0.18);
  border-radius: 999px;
  padding: 4px 8px;
}

.alerts {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.alert {
  display: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.alert.is-on {
  display: block;
}

.alert-warn {
  background: rgba(224, 160, 74, 0.12);
  border: 1px solid rgba(224, 160, 74, 0.35);
  color: #f0d09a;
}

.alert-danger {
  background: rgba(210, 101, 92, 0.12);
  border: 1px solid rgba(210, 101, 92, 0.35);
  color: #f0b8b3;
}

.alert-error {
  background: rgba(210, 101, 92, 0.14);
  border: 1px solid rgba(210, 101, 92, 0.4);
  color: #f3c2bd;
  display: block;
}

.result-grid {
  display: grid;
  gap: 12px;
}

.result-card h3 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--gold);
}

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

.metric {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(8, 9, 13, 0.38);
}

.metric b {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.metric span {
  color: var(--ink-mute);
  font-size: 11px;
}

.cost-lines {
  display: grid;
  gap: 8px;
  color: var(--ink-dim);
  font-size: 13px;
  line-height: 1.55;
}

.plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.plan {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(215, 178, 90, 0.18);
  background: rgba(8, 9, 13, 0.3);
}

.plan.is-cheaper {
  border-color: rgba(143, 191, 122, 0.55);
  background: rgba(143, 191, 122, 0.08);
}

.plan .tag {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--ok);
}

.plan b {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.advice {
  margin: 0;
  color: var(--ink);
  line-height: 1.7;
  font-size: 14px;
}

.empty {
  min-height: 360px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--ink-mute);
}

.empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-dim);
  font-size: 16px;
}

.empty p {
  margin: 0;
  max-width: 28em;
}

.veil {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(8, 9, 13, 0.72);
  backdrop-filter: blur(6px);
}

.veil[hidden],
[hidden] {
  display: none !important;
}

.veil-card {
  width: min(420px, calc(100% - 32px));
  text-align: center;
}

.veil-card p {
  margin: 8px 0 0;
  color: var(--ink-dim);
}

footer.note {
  margin-top: 18px;
  color: var(--ink-mute);
  font-size: 12px;
  text-align: center;
}

#result-panel {
  position: sticky;
  top: 16px;
  max-height: calc(100dvh - 118px);
  overflow: auto;
}

@media (max-width: 860px) {
  .layout,
  .row-2,
  .plans,
  .actions {
    grid-template-columns: 1fr;
  }

  .brand h1 {
    font-size: 24px;
  }

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

  #calc-form,
  #result-panel {
    max-height: none;
    position: static;
  }
}
