:root {
  color-scheme: light dark;
  --accent: #0b7a5b;
  --accent-deep: #075d45;
  --ink: #16201d;
  --muted: #62706b;
  --line: #d7dfda;
  --surface: #ffffff;
  --canvas: #f4f7f5;
  --success: #087353;
  --danger: #b42318;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.shell {
  width: min(100% - 40px, 880px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 28px 0 34px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}

.brand {
  color: var(--ink);
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.header-note, .eyebrow, .success-label, .how-it-works span {
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro { padding: 88px 0 52px; }

.intro h1 {
  max-width: 650px;
  margin: 12px 0 16px;
  font-size: clamp(38px, 7vw, 68px);
  font-weight: 800;
  letter-spacing: -0.065em;
  line-height: 1.05;
}

.intro p:not(.eyebrow) {
  max-width: 540px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.redeem-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgb(20 43 34 / 0.07);
}

.panel-heading { padding: 30px 32px 16px; }
.panel-heading h2, .how-it-works h2 { margin: 0; font-size: 20px; letter-spacing: -0.03em; }
.panel-heading p { margin: 8px 0 0; color: var(--muted); line-height: 1.6; }

form { padding: 12px 32px 28px; }
label { display: block; margin-bottom: 10px; font-size: 14px; font-weight: 700; }

.input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.input-row button { align-self: end; }

input, textarea {
  min-width: 0;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid #b8c4be;
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 15px;
  letter-spacing: 0.04em;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea {
  height: 132px;
  padding-top: 12px;
  line-height: 1.6;
  resize: vertical;
}

input::placeholder, textarea::placeholder { color: #81908a; letter-spacing: 0; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(11 122 91 / 0.16); }

button {
  min-height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms ease, transform 100ms ease;
}

button:hover { background: var(--accent-deep); }
button:active { transform: translateY(1px); }
button:disabled { cursor: wait; opacity: 0.68; }

.input-help, .result-message { min-height: 20px; margin: 9px 0 0; font-size: 13px; line-height: 1.5; }
.input-help { color: var(--muted); }
.result-message { font-weight: 650; }
.result-message.pending { color: var(--muted); }
.result-message.success { color: var(--success); }
.result-message.error { color: var(--danger); }

.download-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 32px;
  border-top: 1px solid var(--line);
  background: #f1f8f4;
  border-radius: 0 0 16px 16px;
}

.download-result strong { display: block; margin-top: 5px; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.secondary-button { min-height: 42px; border: 1px solid #9ab7aa; color: var(--accent-deep); background: transparent; }
.secondary-button:hover { background: #e0f0e7; }

.how-it-works { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px; padding: 54px 0; }
.how-it-works h2 { margin-top: 10px; font-size: 17px; }
.how-it-works p { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.65; }

footer { color: var(--muted); font-size: 13px; text-align: center; }

@media (max-width: 640px) {
  .shell { width: min(100% - 32px, 880px); padding-top: 18px; }
  .intro { padding: 66px 0 38px; }
  .intro h1 { font-size: clamp(36px, 11vw, 50px); }
  .intro p:not(.eyebrow) { font-size: 16px; }
  .panel-heading, form { padding-left: 20px; padding-right: 20px; }
  .input-row { grid-template-columns: 1fr; }
  .input-row button { width: 100%; }
  .download-result { align-items: flex-start; flex-direction: column; padding: 20px; }
  .secondary-button { width: 100%; }
  .how-it-works { grid-template-columns: 1fr; gap: 28px; padding: 44px 0; }
}

@media (prefers-color-scheme: dark) {
  :root { --ink: #edf5f0; --muted: #afc0b8; --line: #34443d; --surface: #17231e; --canvas: #111914; --success: #66d6a9; --danger: #ffb4a9; }
  input { border-color: #53645c; background: #101813; }
  input::placeholder { color: #899b92; }
  .redeem-panel { box-shadow: none; }
  .download-result { background: #14251c; }
  .secondary-button { border-color: #5f8670; color: #9ce8c1; }
  .secondary-button:hover { background: #1b3527; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
