:root {
  color-scheme: light;
  --page: #f4f7fb;
  --ink: #111827;
  --muted: #667085;
  --line: #d7dee8;
  --panel: #ffffff;
  --navy: #172238;
  --navy-2: #263752;
  --cyan: #20b8c7;
  --amber: #f5a524;
  --green: #16a36f;
  --red: #e45757;
  --shadow: 0 22px 60px rgba(24, 36, 59, 0.12);
  font-family:
    "Inter", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(90deg, rgba(215, 222, 232, 0.62) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(180deg, rgba(215, 222, 232, 0.48) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    radial-gradient(circle at 18% 10%, rgba(245, 165, 36, 0.2), transparent 28%),
    radial-gradient(circle at 82% 14%, rgba(32, 184, 199, 0.18), transparent 30%),
    linear-gradient(145deg, rgba(23, 34, 56, 0.08), transparent 48%);
}

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

.app-shell {
  width: min(1260px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 40px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 28px;
  align-items: stretch;
  min-height: 220px;
  margin-bottom: 24px;
  padding: 34px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(23, 34, 56, 0.96), rgba(38, 55, 82, 0.92)),
    var(--navy);
  box-shadow: var(--shadow);
}

.hero > div:first-child {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 9px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  color: #fff;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.05;
}

h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.subtitle {
  max-width: 620px;
  margin-bottom: 0;
  color: #cbd5e1;
  font-size: 17px;
  line-height: 1.75;
}

.hero-card {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  align-self: center;
  min-height: 122px;
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.05);
}

.route-code {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
}

.route-line {
  position: relative;
  height: 2px;
  min-width: 46px;
  background: linear-gradient(90deg, var(--amber), var(--cyan));
}

.route-line::after {
  position: absolute;
  top: -4px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-top: 2px solid var(--cyan);
  border-right: 2px solid var(--cyan);
  content: "";
  transform: rotate(45deg);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(350px, 0.78fr) minmax(620px, 1.22fr);
  gap: 24px;
  align-items: start;
}

.workspace > *,
.result-stack,
.detail-card {
  min-width: 0;
}

.card,
.summary-panel,
.actions-card {
  border: 1px solid rgba(215, 222, 232, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.card,
.summary-panel {
  padding: 26px;
}

.input-card {
  position: sticky;
  top: 18px;
}

.card-head,
.summary-header,
.actions-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.card-head {
  margin-bottom: 22px;
}

.status-pill,
.summary-status {
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid #cfe9ef;
  border-radius: 999px;
  background: #ecfbfd;
  color: #087b86;
  font-size: 13px;
  font-weight: 800;
}

.field-label {
  display: block;
  margin-bottom: 10px;
  color: #27364f;
  font-size: 14px;
  font-weight: 800;
}

textarea {
  display: block;
  width: 100%;
  min-height: 318px;
  resize: vertical;
  padding: 18px;
  border: 1px solid #cad3df;
  border-radius: 8px;
  outline: none;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(255, 255, 255, 0.95)),
    #fff;
  color: var(--ink);
  line-height: 1.7;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

textarea:focus {
  border-color: var(--cyan);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(32, 184, 199, 0.12);
}

.text-field {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid #cad3df;
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: var(--ink);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.text-field:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(32, 184, 199, 0.12);
}

.hint {
  margin: 14px 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

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

.setting span {
  display: block;
  margin-bottom: 8px;
  color: #475467;
  font-size: 13px;
  font-weight: 800;
}

select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #cad3df;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.button-row,
.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.input-card > .button-row {
  margin-top: 18px;
}

.btn {
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  color: #fff;
  font-weight: 900;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.primary {
  flex: 1 1 220px;
  background: linear-gradient(135deg, #172238, #2450a6);
  box-shadow: 0 14px 26px rgba(24, 36, 59, 0.22);
}

.ghost {
  color: #855a08;
  border: 1px solid rgba(245, 165, 36, 0.5);
  background: #fff8ea;
}

.danger {
  background: var(--red);
}

.success {
  background: var(--green);
}

.message {
  min-height: 22px;
  margin: 16px 0 0;
  color: #475467;
  font-size: 14px;
}

.message.error {
  color: #c33131;
}

.result-stack {
  display: grid;
  gap: 24px;
}

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

.tool-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 18px;
}

.tool-card.wide {
  grid-column: 1 / -1;
}

.is-hidden {
  display: none !important;
}

.tool-form {
  display: grid;
  gap: 14px;
}

.generator-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.mini-result {
  min-height: 84px;
  padding: 16px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #475467;
  font-size: 14px;
  line-height: 1.7;
}

.mini-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid #e5eaf1;
}

.mini-row:last-child {
  border-bottom: 0;
}

.mini-row span {
  color: #667085;
}

.mini-row strong {
  color: #172238;
  text-align: right;
}

.mini-result pre {
  max-height: 220px;
  margin: 14px 0 0;
  padding: 14px;
  overflow: auto;
  border-radius: 8px;
  background: #172238;
  color: #e6fffb;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.warning-text {
  color: #b42318;
  font-weight: 800;
}

.summary-panel {
  background:
    linear-gradient(135deg, rgba(23, 34, 56, 0.98), rgba(37, 52, 76, 0.94)),
    var(--navy);
}

.summary-panel h2 {
  color: #fff;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.summary-card {
  position: relative;
  min-width: 0;
  min-height: 126px;
  padding: 18px 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.summary-card.highlight {
  border-color: rgba(245, 165, 36, 0.46);
  background:
    linear-gradient(180deg, rgba(245, 165, 36, 0.2), rgba(255, 255, 255, 0.06)),
    rgba(255, 255, 255, 0.07);
}

.summary-card.highlight:has(.volume-audit:not([hidden])) {
  border-color: rgba(255, 92, 92, 0.8);
  background:
    linear-gradient(180deg, rgba(230, 57, 70, 0.38), rgba(255, 138, 76, 0.18)),
    rgba(255, 255, 255, 0.07);
}

.summary-label,
.summary-unit {
  display: block;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.summary-card strong {
  display: block;
  margin: 13px 0 9px;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: #fff;
  font-size: clamp(26px, 2.6vw, 38px);
  line-height: 1;
}

.volume-audit {
  display: flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin-top: 12px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 86, 86, 0.95), rgba(255, 145, 77, 0.88));
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.volume-audit[hidden] {
  display: none;
}

.escape-dot {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 0 6px rgba(245, 165, 36, 0.15);
}

.escape-dot::after {
  position: absolute;
  top: -30px;
  right: -8px;
  width: max-content;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
  color: #172238;
  content: "专业逃泡";
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.escape-dot:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
}

th,
td {
  padding: 15px 12px;
  border-bottom: 1px solid #e5eaf1;
  text-align: center;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

td {
  color: #27364f;
  font-size: 14px;
}

tbody tr:nth-child(even) {
  background: #fafcff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-cell {
  height: 150px;
  color: #667085;
}

.actions-card {
  margin-top: 24px;
  padding: 20px 22px;
}

.action-copy {
  display: grid;
  gap: 5px;
}

.action-copy strong {
  color: #1d2939;
  font-size: 16px;
}

.action-copy span {
  color: var(--muted);
  font-size: 14px;
}

.actions .btn {
  min-width: 168px;
}

@media (max-width: 1080px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .input-card {
    position: static;
  }

  .generator-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .hero,
  .card,
  .summary-panel,
  .actions-card {
    padding: 20px;
  }

  .hero-card,
  .summary-grid,
  .settings-grid,
  .tool-grid,
  .generator-grid {
    grid-template-columns: 1fr;
  }

  .tool-card.wide {
    grid-column: auto;
  }

  .hero-card {
    gap: 10px;
  }

  .route-line {
    width: 2px;
    height: 28px;
    min-width: 2px;
    justify-self: center;
    overflow: visible;
  }

  .route-line::after {
    top: auto;
    right: -4px;
    bottom: -1px;
    transform: rotate(135deg);
  }

  .card-head,
  .summary-header,
  .actions-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .button-row .btn,
  .actions,
  .actions .btn {
    width: 100%;
  }
}
