:root {
  --text-cream: #f4ecd8;
  --panel-bg: rgba(10, 16, 30, 0.72);
  --panel-border: rgba(244, 236, 216, 0.18);
  --green-1: #3fce3f;
  --green-2: #1f9a2f;
  --red-1: #ff4d4d;
  --red-2: #c81f1f;
  --amber-1: #ffb020;
  --amber-2: #cc7a00;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  min-height: 100vh;
  font-family: "Baloo 2", "Comic Sans MS", "Segoe UI", sans-serif;
  color: var(--text-cream);
  overflow-x: hidden;
  position: relative;
  background-color: #050b16;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 30%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.5) 100%);
  animation: bg-breathe 8s ease-in-out infinite;
}

@keyframes bg-breathe {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

/* ---------- Layout ---------- */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 24px;
}

.download-card {
  width: 100%;
  max-width: 480px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 26px 22px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.download-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.download-hint {
  margin: -6px 0 4px;
  font-size: 14px;
  text-align: center;
  color: rgba(244, 236, 216, 0.75);
  line-height: 1.6;
}

/* ---------- Link buttons ---------- */
.link-button-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 8px; /* rectangular, not a pill — matches the reference */
  border: 2px solid rgba(255,255,255,0.2);
  background: linear-gradient(180deg, var(--red-1), var(--red-2));
  color: #fff0f0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.link-btn:hover:not(:disabled),
.link-btn:focus-visible:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0,0,0,0.4);
}

.link-btn:active:not(:disabled) {
  transform: translateY(0);
}

.link-btn.in-progress {
  background: linear-gradient(180deg, var(--amber-1), var(--amber-2));
  color: #2a1a00;
}

.link-btn.completed {
  background: linear-gradient(180deg, var(--green-1), var(--green-2));
  color: #f4fff0;
  cursor: default;
}

.link-btn.skipped {
  background: rgba(255,255,255,0.08);
  color: rgba(244, 236, 216, 0.6);
  border-color: rgba(244, 236, 216, 0.15);
  cursor: default;
  box-shadow: none;
}

.link-btn:disabled {
  cursor: default;
}

.link-btn-status {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0.9;
}

/* ---------- Download count + buttons ---------- */
.download-count {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  color: rgba(244, 236, 216, 0.85);
}

.download-btn-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.download-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 20px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.25);
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

/* A backup/secondary download button reads a little less "loud" than
   the primary one so the main link still stands out. */
.download-btn-list .download-btn:not(:first-child).unlocked {
  background: rgba(255, 255, 255, 0.1);
  color: #f4ecd8;
  box-shadow: none;
  font-size: 15px;
  padding: 12px 18px;
}

.download-btn.locked {
  background: rgba(255,255,255,0.08);
  color: rgba(244, 236, 216, 0.55);
  cursor: not-allowed;
  box-shadow: none;
}

.download-btn.unlocked {
  background: linear-gradient(180deg, var(--green-1), var(--green-2));
  color: #f4fff0;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.25);
}

.download-btn.unlocked:hover,
.download-btn.unlocked:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
}

.download-note {
  margin: 0;
  font-size: 13px;
  text-align: center;
  color: rgba(244, 236, 216, 0.65);
  min-height: 1.4em;
}

@media (max-width: 420px) {
  .download-title { font-size: 19px; }
  .link-btn { font-size: 14px; padding: 12px 14px; }
}

.download-share{display:flex;justify-content:center;margin-top:14px}
.download-comments{width:100%;max-width:640px;margin-top:22px;color:var(--text-cream,#f4ecd8)}
.download-comments h2{margin:0 0 12px;font-size:20px}

/* ---------- Danh sách /download/ ---------- */
.download-index { max-width: 560px; }
.download-list { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.download-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-cream);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.download-item:hover, .download-item:focus-visible { transform: translateY(-2px); border-color: rgba(244, 236, 216, 0.45); background: rgba(255, 255, 255, 0.08); outline: none; }
.download-item-title { font-weight: 800; font-size: 16px; line-height: 1.35; }
.download-item-desc { font-size: 13.5px; line-height: 1.5; color: rgba(244, 236, 216, 0.72); }
@media (prefers-reduced-motion: reduce) { .download-item { transition: none; } .download-item:hover, .download-item:focus-visible { transform: none; } }

/* ---------- /download/ — lưới thẻ (thay danh sách chữ) ---------- */
.dl-hub.download-index { max-width: 920px; width: 100%; margin: 0 auto; padding: 8px 4px 40px; }
.dl-hub [hidden] { display: none !important; }
.dl-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 10px 0 20px; text-align: center; }
.dl-hero .download-title { margin: 0; font-size: clamp(28px, 6vw, 40px); }
.dl-sub { margin: 0; font-size: 15px; color: rgba(244, 236, 216, 0.75); }
.dl-count { padding: 3px 14px; border-radius: 999px; font-size: 13px; font-weight: 800; background: rgba(255, 255, 255, 0.1); border: 1px solid var(--panel-border); }
.dl-search { max-width: 460px; margin: 0 auto 18px; }
.dl-search input { width: 100%; padding: 11px 18px; border-radius: 999px; border: 1px solid var(--panel-border); background: rgba(10, 16, 30, 0.6); color: var(--text-cream); font: inherit; font-size: 15px; outline: none; }
.dl-search input:focus { border-color: #7db4ff; box-shadow: 0 0 0 3px rgba(125, 180, 255, 0.25); }
.dl-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.dl-grid > li { display: flex; }
.dl-card {
  position: relative; display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 16px 16px 14px; overflow: hidden;
  border-radius: 18px; border: 1px solid var(--panel-border); color: var(--text-cream); text-decoration: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.dl-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--green-1), #3b82f6, #a855f7); opacity: .85; }
.dl-card:hover, .dl-card:focus-visible { transform: translateY(-4px); border-color: rgba(244, 236, 216, 0.5); box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45); outline: none; }
.dl-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dl-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; font-size: 24px; background: linear-gradient(135deg, rgba(63, 206, 63, .28), rgba(59, 130, 246, .28)); border: 1px solid var(--panel-border); }
.dl-new { padding: 2px 11px; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: .3px; color: #2b1a00; background: linear-gradient(180deg, #ffd166, #f2a516); }
.dl-title { font-weight: 800; font-size: 17px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.dl-desc { font-size: 14px; line-height: 1.55; color: rgba(244, 236, 216, 0.75); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.dl-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.dl-chip { padding: 2px 10px; border-radius: 999px; font-size: 12px; line-height: 1.6; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(244, 236, 216, 0.12); color: rgba(244, 236, 216, 0.85); }
.dl-chip b { font-weight: 800; }
.dl-cta { margin-top: auto; padding-top: 6px; display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-weight: 800; font-size: 14px; color: #7dff8a; }
.dl-cta i { font-style: normal; font-size: 20px; line-height: 1; transition: transform .18s ease; }
.dl-card:hover .dl-cta i, .dl-card:focus-visible .dl-cta i { transform: translateX(4px); }
.dl-empty { text-align: center; color: rgba(244, 236, 216, 0.7); margin: 24px 0; }
@media (prefers-reduced-motion: reduce) { .dl-card, .dl-cta i { transition: none; } .dl-card:hover, .dl-card:focus-visible { transform: none; } }
