:root {
  color-scheme: light;
  --bg: #f3f6f4;
  --surface: #ffffff;
  --surface-strong: #ecf4f1;
  --ink: #17211d;
  --muted: #65736d;
  --line: #d6e0dc;
  --accent: #21795d;
  --accent-dark: #145940;
  --warn: #a8481c;
  --shadow: 0 24px 70px rgba(19, 44, 34, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(33, 121, 93, 0.12), transparent 36%),
    radial-gradient(circle at 82% 18%, rgba(239, 181, 74, 0.24), transparent 30%),
    var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button,
.download-button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 48px;
  padding: 0 20px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

button:hover,
.download-button:hover {
  background: var(--accent-dark);
  box-shadow: 0 10px 24px rgba(33, 121, 93, 0.24);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input {
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 132px;
  resize: vertical;
  padding: 14px;
  line-height: 1.55;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(33, 121, 93, 0.12);
}

label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.redeem-panel,
.admin-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(214, 224, 220, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.redeem-panel {
  width: min(100%, 620px);
  padding: clamp(28px, 6vw, 54px);
}

.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: var(--surface-strong);
  display: grid;
  place-items: center;
  margin-bottom: 28px;
}

.brand-mark span {
  width: 34px;
  height: 24px;
  border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 0 34%, rgba(255, 255, 255, 0.8) 34% 46%, transparent 46%),
    var(--accent);
  box-shadow: 0 10px 20px rgba(33, 121, 93, 0.2);
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.12;
}

h1 {
  max-width: 520px;
  font-size: clamp(34px, 6vw, 56px);
}

h2 {
  font-size: 22px;
}

.redeem-form,
.stack-form {
  display: grid;
  gap: 12px;
  margin-top: 32px;
}

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

.message {
  min-height: 24px;
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.message.error {
  color: var(--warn);
}

.download-box {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.file-label,
small {
  color: var(--muted);
  display: block;
}

.file-label {
  font-size: 13px;
  margin-bottom: 4px;
}

.admin-layout {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.admin-header h1 {
  font-size: clamp(30px, 4vw, 46px);
}

.admin-panel {
  padding: 24px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 20px;
  align-items: start;
}

.upload-panel {
  display: grid;
  gap: 12px;
}

.ghost-button {
  min-height: 40px;
  color: var(--accent);
  background: #fff;
  border: 1px solid var(--line);
  padding: 0 14px;
}

.ghost-button:hover {
  color: #fff;
}

.drop-zone {
  min-height: 168px;
  border: 1.5px dashed #9db2aa;
  border-radius: 8px;
  background: #f8fbfa;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: #ecf8f3;
}

.drop-zone input {
  display: none;
}

.drop-zone span {
  color: var(--muted);
}

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

.card-list {
  display: grid;
  gap: 10px;
}

.card-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.card-row strong,
.card-row code {
  overflow-wrap: anywhere;
}

.card-row code {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--accent-dark);
  font-weight: 800;
}

.card-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.danger-button {
  min-height: 38px;
  background: #b43e2f;
  padding: 0 12px;
}

.danger-button:hover {
  background: #8f2e24;
}

@media (max-width: 760px) {
  .input-row,
  .admin-grid,
  .download-box,
  .card-row,
  .admin-header {
    grid-template-columns: 1fr;
  }

  .admin-header,
  .download-box {
    align-items: stretch;
  }

  .input-row button,
  .download-button {
    width: 100%;
  }

  .redeem-panel {
    padding: 28px;
  }
}
