:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-soft: rgba(29, 29, 31, 0.04);
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(29, 29, 31, 0.08);
  --line-strong: rgba(29, 29, 31, 0.12);
  --accent: #ff9900;
  --accent-dark: #e88a00;
  --accent-tint: rgba(255, 153, 0, 0.12);
  --warn: #a16207;
  --danger: #d94b3d;
  --shadow: 0 18px 48px -28px rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 245, 247, 0.92);
  backdrop-filter: blur(18px) saturate(1.15);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1120px, calc(100vw - 32px));
  min-height: 68px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: auto;
  height: 38px;
  max-width: min(190px, 52vw);
  object-fit: contain;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}

.nav-links a {
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--accent);
}

.page-shell,
.result-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
}

.page-shell {
  min-height: calc(100vh - 68px);
  display: grid;
  place-items: center;
  padding: 40px 0;
}

.submit-panel,
.result-header,
.status-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.submit-panel {
  width: min(820px, 100%);
  padding: 38px;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 26px;
  height: 1px;
  margin-right: 10px;
  vertical-align: middle;
  background: var(--accent);
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.18;
}

.lead {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.member-usage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 24px;
  padding: 16px;
  border: 1px solid rgba(255, 153, 0, 0.22);
  border-radius: 8px;
  background: var(--accent-tint);
}

.member-usage strong {
  display: block;
  font-size: 14px;
}

.member-usage p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.analysis-form {
  margin-top: 30px;
}

label {
  display: block;
  margin-bottom: 9px;
  font-weight: 800;
}

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

input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 16px;
  text-transform: uppercase;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.14);
}

button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

button,
.primary-button {
  background: var(--accent);
  color: #1d1d1f;
}

button:hover,
.primary-button:hover {
  background: var(--accent-dark);
}

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

.secondary-button {
  background: #fff;
  color: var(--ink);
  border-color: var(--line-strong);
}

.secondary-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.small-button {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

.form-error {
  display: none;
  margin: 12px 0 0;
  color: var(--danger);
  font-weight: 700;
}

.form-error.is-visible,
.is-visible {
  display: block;
}

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

.result-shell {
  padding: 28px 0 44px;
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
}

.result-header h1 {
  font-size: 28px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding: 18px 20px;
}

.status-card p {
  margin: 5px 0 0;
  color: var(--muted);
}

.error-card {
  border-color: rgba(217, 75, 61, 0.28);
  color: var(--danger);
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 153, 0, 0.22);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex: 0 0 auto;
}

.report-frame {
  display: block;
  width: 100%;
  min-height: 100vh;
  margin: 16px 0 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 760px) {
  .submit-panel {
    padding: 26px 20px;
  }

  .topbar-inner {
    min-height: 64px;
  }

  .nav-links {
    gap: 12px;
    font-size: 12.5px;
  }

  h1 {
    font-size: 28px;
  }

  .input-row,
  .result-header {
    grid-template-columns: 1fr;
    display: grid;
  }

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

  button,
  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .header-actions {
    width: 100%;
  }
}
