:root {
  --bg: #f5efe4;
  --panel: #fffaf1;
  --text: #1f1a14;
  --muted: #72695f;
  --line: #d9ccbc;
  --primary: #d45c2f;
  --primary-dark: #b34820;
  --success: #186a3b;
  --error: #a43232;
  --shadow: 0 16px 40px rgba(87, 57, 28, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans TC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(212, 92, 47, 0.16), transparent 28%),
    linear-gradient(180deg, #f8f2e8 0%, var(--bg) 100%);
}

.download-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 14px;
  padding: 0.9rem 1.2rem;
  background: var(--primary);
  color: white;
  transition: background 0.2s ease, transform 0.2s ease;
}

button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: white;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

.shell {
  width: min(1180px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 1rem 0 1.5rem;
}

.topbar h1,
.auth-card h1,
.hero-panel h2,
.section-head h2,
.section-head h3 {
  margin: 0.2rem 0 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav a,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.65);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1.1rem;
}

.flash {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.flash.success {
  background: rgba(24, 106, 59, 0.1);
  color: var(--success);
  border: 1px solid rgba(24, 106, 59, 0.25);
}

.flash.error {
  background: rgba(164, 50, 50, 0.1);
  color: var(--error);
  border: 1px solid rgba(164, 50, 50, 0.25);
}

.auth-card,
.panel {
  background: rgba(255, 250, 241, 0.92);
  border: 1px solid rgba(217, 204, 188, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(760px, 100%);
  margin: 6rem auto 0;
  padding: 2rem;
  display: grid;
  gap: 2rem;
}

.grid {
  display: grid;
  gap: 1.25rem;
}

.two-col {
  grid-template-columns: 1.05fr 1fr;
}

.panel {
  padding: 1.5rem;
}

.hero-panel {
  padding: 2rem;
}

.stack-form {
  display: grid;
  gap: 1rem;
}

.stack-form label {
  display: grid;
  gap: 0.45rem;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 0.75rem;
}

.checkbox-row input {
  width: auto;
}

.eyebrow {
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.82rem;
  font-weight: 700;
}

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

.compact-note {
  margin: -0.25rem 0 0;
  font-size: 0.92rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.4rem 0 1.8rem;
}

.stat-card {
  padding: 1rem;
  background: white;
  border-radius: 18px;
  border: 1px solid var(--line);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

.stat-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.35rem;
}

.primary-button.large {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1rem 1.4rem;
  font-size: 1.05rem;
}

.inline-button,
.inline-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  padding: 0.9rem 1.2rem;
  border: 1px solid var(--line);
}

.inline-button {
  background: var(--primary);
  color: white;
}

.inline-button.secondary,
.inline-link {
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
}

.cta-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.download-only {
  width: min(520px, calc(100vw - 2rem));
  display: grid;
  gap: 1.5rem;
  justify-items: stretch;
}

.download-count {
  display: grid;
  gap: 0.6rem;
  padding: 2rem;
  text-align: center;
  background: rgba(255, 250, 241, 0.92);
  border: 1px solid rgba(217, 204, 188, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.download-count span {
  color: var(--muted);
  font-size: 1rem;
}

.download-count strong {
  font-size: clamp(2.8rem, 10vw, 4.6rem);
  line-height: 1;
}

.download-button {
  width: 100%;
  min-height: 72px;
  font-size: 1.15rem;
  border-radius: 24px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-bottom: 1rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.85rem 0.6rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.badge.green {
  background: rgba(24, 106, 59, 0.12);
  color: var(--success);
}

.badge.gray {
  background: rgba(114, 105, 95, 0.12);
  color: var(--muted);
}

@media (max-width: 920px) {
  .two-col {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  .stats {
    grid-template-columns: 1fr;
  }
}
