:root {
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.12);
  --text: #111827;
  --muted: #6b7280;
  --muted-strong: #4b5563;
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, 0.12);
  --success: #0f9f6e;
  --danger: #d64545;
  --warning: #c57f17;
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 14px 30px rgba(15, 23, 42, 0.06);
  --radius-xl: 30px;
  --radius-lg: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(10, 132, 255, 0.09), transparent 28%),
    radial-gradient(circle at top right, rgba(186, 230, 253, 0.45), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 42%, #eef2f7 100%);
}

body.auth-locked {
  overflow: hidden;
}

.page-glow {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}

.page-glow-left {
  top: -120px;
  left: -90px;
  background: rgba(10, 132, 255, 0.13);
}

.page-glow-right {
  top: 120px;
  right: -120px;
  background: rgba(255, 255, 255, 0.95);
}

.page {
  position: relative;
  z-index: 1;
  width: min(1160px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 52px;
}

.page-narrow {
  width: min(860px, calc(100vw - 24px));
}

.hero {
  padding: 28px 4px 24px;
}

.hero-compact {
  padding-bottom: 18px;
}

.hero-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--muted);
  font: 600 0.84rem/1 "Outfit", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted-strong);
  font: 600 0.84rem/1 "Outfit", sans-serif;
  box-shadow: var(--shadow-md);
}

.hero h1 {
  margin: 0;
  font: 700 clamp(2.3rem, 5vw, 4.6rem) / 1 "Outfit", "Noto Sans SC", sans-serif;
  letter-spacing: -0.05em;
}

.lede {
  max-width: 640px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.85;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px);
}

.compact-summary,
.control-panel,
.side-panel {
  padding: 24px;
}

.compact-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.54);
}

.summary-item span,
.metric-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.summary-item strong,
.metric-card strong {
  font: 600 0.98rem/1.4 "Outfit", "Noto Sans SC", sans-serif;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.admin-workspace {
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
}

.compact-panel {
  padding: 22px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading h2,
.results-head h2,
.panel-head h2 {
  margin: 6px 0 0;
  font: 600 1.35rem/1.1 "Outfit", "Noto Sans SC", sans-serif;
  letter-spacing: -0.03em;
}

.section-heading.compact {
  margin-bottom: 14px;
}

.section-note {
  max-width: 280px;
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 0.96rem;
}

.field span {
  color: var(--muted-strong);
  font-weight: 600;
}

.field-help {
  margin: -2px 0 4px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  padding: 15px 16px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.66);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.field textarea {
  resize: vertical;
  min-height: 140px;
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(10, 132, 255, 0.42);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.09);
  transform: translateY(-1px);
}

.field-block {
  margin-top: 16px;
}

.actions,
.button-row,
.auth-actions,
.inline-form,
.captcha-row,
.user-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.actions {
  justify-content: space-between;
  margin-top: 20px;
}

.button-row {
  justify-content: flex-end;
}

.inline-form {
  margin-bottom: 16px;
}

.inline-field {
  min-width: 140px;
}

.captcha-row {
  margin-top: 12px;
}

.captcha-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 190px;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  overflow: hidden;
}

.captcha-box img {
  display: block;
  width: 180px;
  height: 64px;
}

.primary,
.ghost,
.danger-button,
.warning-button,
.tab-button {
  border-radius: 999px;
  font: 600 0.95rem/1 "Outfit", "Noto Sans SC", sans-serif;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.primary {
  min-width: 148px;
  border: 0;
  background: linear-gradient(180deg, #1790ff 0%, #0a84ff 100%);
  color: #ffffff;
  padding: 14px 22px;
  box-shadow: 0 14px 24px rgba(10, 132, 255, 0.22);
}

.ghost {
  min-width: 104px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  padding: 13px 18px;
}

.ghost-small {
  min-width: auto;
  padding: 12px 16px;
}

.danger-button,
.warning-button {
  border: 0;
  padding: 11px 15px;
  color: #ffffff;
}

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

.warning-button {
  background: var(--warning);
}

.primary:hover,
.ghost:hover,
.danger-button:hover,
.warning-button:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

.primary:disabled,
.ghost:disabled,
.danger-button:disabled,
.warning-button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.status-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.status,
.elapsed,
.auth-message {
  margin: 0;
  color: var(--muted);
}

.status {
  font-size: 0.94rem;
}

.elapsed {
  font: 600 0.84rem/1.3 "Outfit", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.results-shell {
  margin-top: 18px;
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 4px 18px;
}

.subnav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted-strong);
  font: 600 0.9rem/1 "Outfit", "Noto Sans SC", sans-serif;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.subnav a:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.subnav a.active {
  background: linear-gradient(180deg, #1790ff 0%, #0a84ff 100%);
  border-color: transparent;
  color: #ffffff;
}

.results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 0 4px;
}

.results,
.user-grid,
.mini-list,
.hero-metrics {
  display: grid;
  gap: 14px;
}

.one-up {
  grid-template-columns: 1fr;
}

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

.admin-link-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-link-card {
  display: block;
  padding: 24px;
  color: var(--text);
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.admin-link-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(10, 132, 255, 0.24);
}

.admin-link-card h3 {
  margin: 10px 0 10px;
  font: 600 1.4rem/1.1 "Outfit", "Noto Sans SC", sans-serif;
  letter-spacing: -0.03em;
}

.admin-link-card p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

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

.editor-form-panel,
.editor-preview-panel {
  padding: 24px;
}

.editor-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.field-wide {
  grid-column: 1 / -1;
}

.preview-shell {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.preview-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.62);
}

.preview-card h3 {
  margin: 8px 0 10px;
  font: 600 1.25rem/1.1 "Outfit", "Noto Sans SC", sans-serif;
  letter-spacing: -0.03em;
}

.preview-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.preview-summary {
  display: grid;
  gap: 12px;
}

.preview-field {
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  color: var(--muted-strong);
}

.preview-field + .preview-field {
  margin-top: 10px;
}

.preview-button {
  margin-top: 14px;
}

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

.hero-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card,
.mini-item,
.user-card {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.58);
}

.mini-item,
.panel-head,
.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-card,
.user-card {
  padding: 22px 24px 24px;
}

.output {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: 500 0.95rem/1.8 ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.output.empty {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font: 600 0.78rem/1 "Outfit", sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge.idle {
  background: rgba(107, 114, 128, 0.12);
  color: var(--muted);
}

.badge.running {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.done {
  background: rgba(15, 159, 110, 0.12);
  color: var(--success);
}

.badge.error {
  background: rgba(214, 69, 69, 0.12);
  color: var(--danger);
}

.badge.warning {
  background: rgba(197, 127, 23, 0.14);
  color: var(--warning);
}

.user-meta {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted-strong);
  font-size: 0.93rem;
}

.user-actions {
  flex-wrap: wrap;
}

.recharge-actions {
  margin-top: 12px;
}

.auth-gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(245, 245, 247, 0.74);
  backdrop-filter: blur(20px);
  z-index: 20;
}

.auth-gate[hidden] {
  display: none;
}

.auth-card {
  width: min(500px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.12);
}

.auth-card h2 {
  margin: 8px 0 0;
  font: 600 1.95rem/1.05 "Outfit", "Noto Sans SC", sans-serif;
  letter-spacing: -0.04em;
}

.auth-copy {
  margin: 14px 0 20px;
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.75;
}

.auth-tabs {
  display: inline-flex;
  gap: 10px;
  margin-bottom: 22px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
}

.tab-button {
  border: 0;
  background: transparent;
  color: var(--muted-strong);
  padding: 10px 18px;
}

.tab-button.active {
  background: #ffffff;
  color: var(--text);
  box-shadow: var(--shadow-md);
}

.info-banner,
.empty-state {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted-strong);
}

.empty-state {
  grid-column: 1 / -1;
}

@media (max-width: 980px) {
  .workspace,
  .compact-summary,
  .hero-metrics,
  .user-grid,
  .admin-link-grid,
  .admin-link-grid-three,
  .editor-layout,
  .editor-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page,
  .page-narrow {
    width: min(100vw - 18px, 100%);
    padding: 14px 0 32px;
  }

  .control-panel,
  .side-panel,
  .compact-summary,
  .result-card,
  .user-card,
  .auth-card {
    padding: 18px;
  }

  .actions,
  .button-row,
  .auth-actions,
  .admin-toolbar,
  .inline-form,
  .captcha-row,
  .user-actions,
  .panel-head,
  .meta-row,
  .mini-item,
  .results-head,
  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .status-block {
    align-items: flex-start;
  }
}
