/* Theme "Cuộc thi Thiết kế thiệp Pop-up · 20/11": nền cam đào, chữ xanh navy, điểm vàng/cam, confetti. */
:root {
  color-scheme: light;
  --bg: #fff5ea;
  --peach-1: #ffd7bd;
  --peach-2: #ffe9d6;
  --cream: #fff4dc;
  --surface: #ffffff;
  --surface-2: #fff3e6;
  --line: rgb(30 58 114 / 0.12);
  --line-strong: rgb(30 58 114 / 0.24);
  --ink: #1d2a47;
  --muted: #56607a;
  --faint: #7d8599;
  --navy: #1e3a72;
  --navy-deep: #142a55;
  --navy-soft: rgb(30 58 114 / 0.08);
  --orange: #f26a2e;
  --orange-deep: #c94a14;
  --gold: #f4b324;
  --red: #a3271f;
  --sky: #3a8fd6;
  --green: #2e9e6a;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --success: #1f7a4d;
  --radius: 18px;
  --shadow: 0 1px 2px rgb(20 42 85 / 0.06), 0 10px 30px rgb(20 42 85 / 0.08);
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Baloo 2", "Be Vietnam Pro", system-ui, sans-serif;
  /* Bộ màu confetti/cờ dây giống banner */
  --c1: #f26a2e;
  --c2: #f4b324;
  --c3: #3a8fd6;
  --c4: #2e9e6a;
  --c5: #e0457b;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Nền lễ hội: gradient cam đào + confetti ---------- */
.festive-bg {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg opacity='.55'%3E%3Crect x='18' y='24' width='10' height='4' rx='2' fill='%23f26a2e' transform='rotate(28 23 26)'/%3E%3Crect x='150' y='18' width='10' height='4' rx='2' fill='%233a8fd6' transform='rotate(-35 155 20)'/%3E%3Crect x='96' y='92' width='9' height='4' rx='2' fill='%23f4b324' transform='rotate(60 100 94)'/%3E%3Crect x='184' y='128' width='10' height='4' rx='2' fill='%232e9e6a' transform='rotate(15 189 130)'/%3E%3Crect x='40' y='160' width='10' height='4' rx='2' fill='%23e0457b' transform='rotate(-55 45 162)'/%3E%3Ccircle cx='70' cy='60' r='2.5' fill='%233a8fd6'/%3E%3Ccircle cx='200' cy='70' r='2.5' fill='%23f26a2e'/%3E%3Ccircle cx='130' cy='180' r='2.5' fill='%23f4b324'/%3E%3Ccircle cx='12' cy='110' r='2' fill='%232e9e6a'/%3E%3Cpath d='M120 40l2 5 5 .5-4 3.5 1.2 5-4.2-2.7-4.2 2.7 1.2-5-4-3.5 5-.5z' fill='%23f4b324'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(160deg, var(--peach-1) 0%, var(--peach-2) 38%, var(--cream) 100%);
}

/* ---------- Cờ dây (bunting) ---------- */
.bunting {
  display: block;
  width: 100%;
  height: 34px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='34' viewBox='0 0 150 34'%3E%3Cpath d='M0 3 Q75 10 150 3' stroke='%23a3271f' stroke-width='1.2' fill='none' opacity='.5'/%3E%3Cpath d='M4 4 L26 5.6 L15 26z' fill='%23f26a2e'/%3E%3Cpath d='M34 6.2 L56 7.4 L45 29z' fill='%23f4b324'/%3E%3Cpath d='M64 7.6 L86 7.6 L75 30z' fill='%233a8fd6'/%3E%3Cpath d='M94 7.4 L116 6.2 L105 29z' fill='%232e9e6a'/%3E%3Cpath d='M124 5.6 L146 4 L135 26z' fill='%23e0457b'/%3E%3C/svg%3E")
    repeat-x left top / auto 100%;
  pointer-events: none;
}

/* ---------- Tiêu đề cuộc thi (dựng lại theo banner) ---------- */
.contest {
  text-align: center;
  color: var(--navy);
}

.contest-kicker {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.contest-title {
  margin: 0.05em 0 0.1em;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.3em;
  line-height: 1.02;
  text-transform: uppercase;
  color: var(--navy);
  text-shadow:
    0 2px 0 var(--gold),
    0 3px 0 #d99a12,
    0 8px 18px rgb(20 42 85 / 0.18);
  text-wrap: balance;
}

.contest-sub {
  margin: 0.35em 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05em;
  line-height: 1.25;
  text-transform: uppercase;
  color: var(--red);
  text-wrap: balance;
}

.contest-year {
  margin: 0.2em 0 0;
  font-weight: 600;
  font-size: 0.95em;
  color: var(--navy);
}

.flourish {
  color: var(--gold);
  font-size: 0.7em;
  vertical-align: 0.25em;
}

/* Có ảnh banner thật (public/banner.jpg) thì ẩn phần chữ dựng lại. */
.banner-img {
  display: block;
  width: 100%;
  height: auto;
}

.banner-img:not([data-ok]) {
  display: none;
}

.has-banner .contest-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s, opacity 0.15s;
  touch-action: manipulation;
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 3px 0 var(--navy-deep), 0 8px 18px rgb(20 42 85 / 0.22);
}

.btn-primary:hover {
  background: #24467f;
}

.btn-accent {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 3px 0 var(--orange-deep), 0 8px 18px rgb(242 106 46 / 0.28);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--navy);
}

.btn-ghost:hover {
  border-color: var(--navy);
  background: #fff;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-block {
  width: 100%;
}

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Fields ---------- */
.field {
  display: grid;
  gap: 6px;
}

.field label,
.legend {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}

.input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  background: #fff;
  font-size: 17px;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder {
  color: #9aa1b2;
}

.input:focus {
  border-color: var(--navy);
  outline: none;
  box-shadow: 0 0 0 4px rgb(30 58 114 / 0.12);
}

.input[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-error {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
}

.field-error:empty {
  display: none;
}

.alert {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
}

.alert:empty {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
