:root {
  color-scheme: dark;
  --ink: #101522;
  --ink-2: #192338;
  --paper: #f8f3e8;
  --paper-2: #fffaf0;
  --line: rgba(255, 255, 255, 0.14);
  --muted: rgba(248, 243, 232, 0.72);
  --acid: #19f7b5;
  --sun: #ffe85a;
  --hot: #ff3d6e;
  --sky: #74d7ff;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  font-family: "Bahnschrift", "Microsoft YaHei UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 18% 8%, rgba(116, 215, 255, 0.33), transparent 28rem),
    radial-gradient(circle at 92% 18%, rgba(255, 61, 110, 0.23), transparent 24rem),
    linear-gradient(135deg, #101522 0%, #15253e 46%, #0d1220 100%);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--paper);
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 28px 28px;
}

button,
input { font: inherit; }

.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px 48px;
}

.hero {
  position: relative;
  padding: 24px 4px 18px;
}

.hero::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 20px;
  width: 86px;
  height: 86px;
  border: 2px solid rgba(25, 247, 181, 0.42);
  border-radius: 50%;
  box-shadow: inset 0 0 0 12px rgba(25, 247, 181, 0.07), 0 0 28px rgba(25, 247, 181, 0.22);
  pointer-events: none;
}

.hero__eyebrow {
  width: fit-content;
  padding: 6px 10px;
  border: 1px solid rgba(255, 232, 90, 0.42);
  border-radius: 999px;
  color: var(--sun);
  background: rgba(255, 232, 90, 0.08);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2, p { margin: 0; }

h1 {
  margin-top: 14px;
  max-width: 780px;
  font-size: clamp(38px, 12vw, 86px);
  line-height: 0.92;
  letter-spacing: -0.07em;
  text-wrap: balance;
}

h1 span {
  display: block;
  color: var(--acid);
  text-shadow: 0 0 22px rgba(25, 247, 181, 0.34);
}

.hero p {
  margin-top: 16px;
  max-width: 720px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.055));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.upload-panel,
.controls,
.canvas-card {
  padding: 14px;
  margin-top: 14px;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 190px;
  padding: 24px 18px;
  border: 2px dashed rgba(116, 215, 255, 0.48);
  border-radius: 22px;
  color: var(--paper-2);
  background:
    linear-gradient(135deg, rgba(25, 247, 181, 0.14), rgba(255, 61, 110, 0.10)),
    rgba(16, 21, 34, 0.56);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
  text-align: center;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  transform: translateY(-2px);
  border-color: var(--acid);
  background:
    linear-gradient(135deg, rgba(25, 247, 181, 0.25), rgba(255, 61, 110, 0.18)),
    rgba(16, 21, 34, 0.66);
}

.drop-zone input { display: none; }

.drop-zone__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 12px;
  border-radius: 24px;
  color: var(--ink);
  background: var(--sun);
  box-shadow: 8px 8px 0 rgba(255, 61, 110, 0.9), 0 18px 38px rgba(0,0,0,.25);
  font-size: 42px;
  font-weight: 900;
}

.drop-zone__title {
  display: block;
  font-size: 22px;
  font-weight: 900;
}

.drop-zone__hint {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.status[data-tone="busy"] { color: var(--sky); }
.status[data-tone="ok"] { color: var(--acid); }
.status[data-tone="error"] { color: var(--hot); }

.error-box {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 61, 110, 0.5);
  border-radius: 18px;
  color: #ffd8e0;
  background: rgba(255, 61, 110, 0.12);
  line-height: 1.5;
}

.panel__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel__heading.compact { margin-bottom: 8px; }

h2 {
  font-size: 19px;
  letter-spacing: -0.02em;
}

.panel__heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.ghost-btn,
.accent-btn {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  font-weight: 900;
  cursor: pointer;
}

.ghost-btn {
  color: var(--paper);
  background: rgba(255,255,255,0.11);
  border: 1px solid rgba(255,255,255,0.14);
}

.accent-btn {
  color: var(--ink);
  background: var(--acid);
  box-shadow: 0 10px 24px rgba(25, 247, 181, 0.2);
}

.accent-btn:disabled { opacity: .45; cursor: not-allowed; }

.control-row {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.control-row span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.control-row b { color: var(--sun); }

input[type="range"] {
  width: 100%;
  accent-color: var(--acid);
}

.results { margin-top: 14px; }

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

.stat-card {
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 8px 8px 0 rgba(25, 247, 181, 0.16);
}

.stat-card span {
  display: block;
  color: rgba(16, 21, 34, 0.68);
  font-size: 12px;
  font-weight: 900;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(20px, 7vw, 34px);
  line-height: 1;
  word-break: break-word;
}

.canvas-card canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  background: rgba(255,255,255,0.08);
  image-rendering: auto;
}

.primary-result canvas {
  border: 2px solid rgba(255, 232, 90, 0.32);
}

.compare-grid {
  display: grid;
  gap: 14px;
}

.compare-grid h2 { margin-bottom: 10px; }

@media (min-width: 760px) {
  .app-shell { padding-inline: 24px; }
  .upload-panel,
  .controls,
  .canvas-card { padding: 18px; }
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .compare-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: no-preference) {
  .panel, .hero__eyebrow, .hero p {
    animation: rise .52s ease both;
  }
  .controls { animation-delay: .05s; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
