:root {
  --red: #d93449;
  --red-deep: #be243b;
  --cream: #f7eed7;
  --cream-soft: #fff9eb;
  --yellow: #f9e5b0;
  --ink: #211e1b;
  --ink-muted: #5b554d;
  --line: #35312b;
  --soft-line: #d7cbb1;
  --focus: #005fcc;
  --page-max: 1366px;
  --content-max: 1120px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --shadow-card: 0 12px 32px rgba(67, 42, 18, .09);
}

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

html {
  background: var(--red-deep);
  scroll-behavior: smooth;
  scroll-padding-top: 82px;
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: var(--red);
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  z-index: 0;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(calc(100% + 140px), var(--page-max));
  content: "";
  pointer-events: none;
  transform: translateX(-50%);
  background-color: var(--red);
  background-image: url("assets/campaign-pattern.webp");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% auto;
}

@media (min-width: 1500px) {
  body::before {
    background-color: transparent;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 8%, #000 92%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 8%, #000 92%, transparent 100%);
  }
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 11px 16px;
  color: #fff;
  background: var(--ink);
  border-radius: 6px;
  font-weight: 800;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus { transform: translateY(0); }

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

::selection { color: #fff; background: var(--red-deep); }

.poster {
  position: relative;
  z-index: 1;
  width: min(100%, var(--page-max));
  min-height: 100vh;
  margin-inline: auto;
  padding: 28px 72px 72px;
}

.campaign-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 44px;
  min-height: 148px;
  padding: 8px 18px 12px;
  color: #fff;
}

.jollibee-logo { width: 216px; height: auto; }
.school-logo { justify-self: end; width: 238px; height: auto; }

.campaign-header h1 {
  display: grid;
  gap: 3px;
  margin: 0;
  color: #fff7e7;
  font-size: clamp(1.9rem, 2.55vw, 2.35rem);
  font-weight: 800;
  letter-spacing: .005em;
  line-height: 1.08;
  text-align: center;
  text-transform: uppercase;
}

.campaign-header h1 small {
  font-size: .92em;
  font-weight: 800;
  letter-spacing: .01em;
}

.campaign-header h1 span {
  display: block;
  padding: 0;
  color: inherit;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.rule-sheet {
  position: relative;
  overflow: clip;
  padding: 22px 34px 54px;
  background: linear-gradient(180deg, #fff8e8 0, var(--cream) 360px);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 20px;
  box-shadow: 0 1px 0 rgba(255,255,255,.75) inset, 0 24px 60px rgba(103, 8, 26, .18);
}

.nav-disclosure {
  position: sticky;
  z-index: 10;
  top: 10px;
  width: min(100%, var(--content-max));
  margin: 0 auto 46px;
}

.nav-disclosure > summary { display: none; }

/* Trên desktop <details> luôn mở (JS ở cuối index.html). Dòng dưới là lớp
   phòng vệ khi JS không chạy: bỏ content-visibility:hidden mà UA stylesheet
   đặt lên ::details-content của <details> đang đóng. */
@media (min-width: 721px) {
  .nav-disclosure::details-content { content-visibility: visible; }
}

.section-nav {
  position: static;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 3px;
  width: 100%;
  margin: 0;
  padding: 7px;
  background: rgba(255, 252, 244, .94);
  border: 1px solid var(--soft-line);
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(61, 40, 20, .1);
  backdrop-filter: blur(10px);
}

.section-nav a {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 9px 11px;
  white-space: nowrap;
  border-radius: 9px;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 800;
  text-decoration: none;
  transition: color 150ms ease, background-color 150ms ease;
}

.section-nav a span {
  color: var(--red-deep);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .04em;
}

.section-nav a:hover,
.section-nav a:focus-visible {
  color: #fff;
  background: var(--red-deep);
}

.section-nav a:hover span,
.section-nav a:focus-visible span { color: var(--yellow); }

.rule-section { scroll-margin-top: 84px; }
.rule-section + .rule-section { margin-top: 38px; }
.rule-section h2, .rule-section h3 { margin: 0; font-weight: 900; }
.rule-section h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 0;
  border: 0;
  font-size: 1.12rem;
  letter-spacing: .01em;
  line-height: 1.3;
  text-transform: uppercase;
}

.section-index {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  min-width: 42px;
  height: 38px;
  padding-inline: 9px;
  color: #fff;
  background: var(--red-deep);
  border-radius: 9px;
  box-shadow: 0 4px 0 rgba(116, 14, 33, .18);
  font-size: .8rem;
  letter-spacing: 0;
}
.rule-section h3 { margin-top: 18px; margin-bottom: 8px; font-size: 1.03rem; line-height: 1.4; }
.rule-section p { margin: 0 0 12px; }
.rule-section ul, .rule-section ol { margin: 0; padding-left: 24px; }
.rule-section li::marker { font-weight: 700; }
/* Link "Tại đây" trong phần Cách thức tham gia */
.rule-link {
  color: var(--red-deep);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  border-radius: 4px;
  transition: color 150ms ease, background-color 150ms ease;
}

.rule-link:hover,
.rule-link:focus-visible {
  color: #fff;
  background: var(--red-deep);
  box-shadow: 0 0 0 3px var(--red-deep);
}

.intro-section {
  position: relative;
  max-width: var(--content-max);
  margin-inline: auto;
  padding: 25px 28px;
  background: rgba(255, 252, 244, .82);
  border: 1px solid rgba(215, 203, 177, .9);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

#doi-tuong { background: linear-gradient(135deg, #fff8e4, #ffefbd); }
#cach-thuc { background: rgba(255, 252, 244, .9); }

.intro-section li + li,
.general-notes li + li,
.long-rules > ul > li + li,
.long-rules > ol > li + li { margin-top: 7px; }

.steps-list strong { color: var(--red-deep); }
.steps-list li::marker,
.intro-section li::marker { color: var(--red-deep); }

.prize-section { max-width: var(--content-max); margin-inline: auto; }

.award-table {
  overflow: hidden;
  margin-top: 20px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--line);
  box-shadow: 0 12px 30px rgba(53, 49, 43, .12);
  font-size: .95rem;
  line-height: 1.58;
}
.award-columns { display: grid; grid-template-columns: 18.5% 36.5% 45%; gap: 1.6px; }
.award-table-head { margin-bottom: 1.6px; }
.award-table-head > div { padding: 16px 10px; color: #fff; background: var(--red-deep); font-size: .82rem; font-weight: 900; letter-spacing: .035em; text-align: center; text-transform: uppercase; }
.award-group + .award-group { margin-top: 6px; border-top: 1.6px solid var(--line); }
.award-period { margin: 0 0 1.6px !important; padding: 12px; background: var(--yellow); font-size: .86rem; font-weight: 900; text-align: center; }
.award-period span { display: block; }
.award-row > div { background: var(--cream-soft); }

.award-name {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 100%;
  padding: 28px 14px;
  background: var(--yellow) !important;
  font-size: .94rem;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
}

.award-name strong { font-size: 1.02rem; }
.award-name span { display: block; margin-top: 4px; font-size: .83rem; }
.award-cell { min-width: 0; padding: 18px 17px; }
.award-cell p:last-child, .award-cell ul:last-child, .award-cell ol:last-child { margin-bottom: 0; }
.award-cell ul, .award-cell ol { padding-left: 19px; }
.award-cell .note {
  margin-top: 12px;
  padding: 12px 13px;
  border-left: 3px solid var(--red);
  background: #fff2ed;
  border-radius: 0 7px 7px 0;
  font-style: italic;
}
.award-cell .note strong { font-style: italic; }
.dash-list { padding-left: 0 !important; list-style: none; }
.dash-list li::before { content: "– "; }
.general-notes {
  margin: 24px auto 0;
  padding: 18px 20px;
  background: linear-gradient(135deg, #ffe9a9, #fff2c9);
  border: 1px solid #d9bd72;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(101, 72, 18, .08);
}
.general-notes > ul { margin-top: 3px; }
.long-rules {
  max-width: 76ch;
  margin-inline: auto;
  padding-top: 42px;
  border-top: 1px solid var(--soft-line);
}
.long-rules h2 { margin-bottom: 24px; }
.long-rules h3 {
  margin-top: 32px;
  margin-bottom: 13px;
  padding: 14px 17px;
  color: var(--ink);
  background: linear-gradient(90deg, var(--yellow), #fff8e6);
  border: 1px solid #dfcb98;
  border-left: 5px solid var(--red-deep);
  border-radius: 0 11px 11px 0;
  box-shadow: 0 6px 16px rgba(75, 51, 19, .06);
}

.long-rules > ul,
.long-rules > ol {
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.long-rules > ol { counter-reset: rule-number; }

.long-rules > ul > li,
.long-rules > ol > li {
  position: relative;
  margin: 0;
  padding: 17px 20px 17px 54px;
  color: var(--ink);
  background: rgba(255, 252, 244, .9);
  border: 1px solid #ddd0b5;
  border-radius: 12px;
  box-shadow: 0 7px 18px rgba(61, 40, 20, .055);
  line-height: 1.68;
}

.long-rules > ul > li + li,
.long-rules > ol > li + li { margin-top: 0; }

.long-rules > ul > li::before {
  position: absolute;
  top: 25px;
  left: 22px;
  width: 8px;
  height: 8px;
  content: "";
  background: var(--red-deep);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(190, 36, 59, .1);
}

.long-rules > ol > li { counter-increment: rule-number; padding-left: 62px; }
.long-rules > ol > li::before {
  position: absolute;
  top: 15px;
  left: 18px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  content: counter(rule-number);
  color: #fff;
  background: var(--red-deep);
  border-radius: 8px;
  box-shadow: 0 3px 0 rgba(116, 14, 33, .16);
  font-size: .78rem;
  font-weight: 900;
}

.long-rules li strong { color: var(--red-deep); font-weight: 800; }
.long-rules .plus-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.long-rules .plus-list li {
  position: relative;
  margin: 0 !important;
  padding: 9px 10px 9px 30px;
  color: var(--ink);
  background: #fff2c9;
  border: 1px solid #e3cd8f;
  border-radius: 8px;
  line-height: 1.45;
}
.long-rules .plus-list li::before {
  position: absolute;
  left: 11px;
  content: "+";
  color: var(--red-deep);
  font-weight: 900;
}

.contact-section {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 280px);
  align-items: center;
  gap: 28px;
  overflow: hidden;
  max-width: var(--content-max);
  margin: 42px auto 0 !important;
  padding: 30px 28px 30px 32px;
  background: linear-gradient(120deg, #fff8e9 0%, #fff0c9 100%);
  border: 1px solid #d8c38d;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.contact-section > div { min-width: 0; }
.contact-section ol { padding-left: 22px; line-height: 1.8; }
.contact-section a { color: #9d0d29; font-weight: 800; overflow-wrap: anywhere; }
.contact-section img {
  justify-self: end;
  width: min(100%, 280px);
  height: auto;
  aspect-ratio: 2018 / 1572;
  object-fit: contain;
  margin: 0;
  filter: drop-shadow(0 5px 5px rgba(23, 15, 10, .26));
}

@media (min-width: 1100px) {
  .rule-sheet { font-size: 1rem; }
}

/* Dưới 1240px không còn đủ chỗ cho 7 mục trên một hàng (cần ~926px nội dung),
   nên chuyển sang lưới 4 cột / 2 hàng thay vì để nhãn xuống dòng lộn xộn. */
@media (max-width: 1239.98px) {
  .nav-disclosure { position: static; }
  .section-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .section-nav a { flex: initial; white-space: normal; }
}

/* 4 cột: hàng cuối 3 mục được đẩy vào giữa. */
@media (min-width: 801px) and (max-width: 1239.98px) {
  .section-nav a:nth-last-child(3) { grid-column: 2; }
}

/* Dưới 800px, cột 4 hẹp hơn nhãn dài nhất ("Cách tham gia" ~160px) nên chuyển
   sang 3 cột; mục cuối trải hết hàng để không bị lệch về một bên. */
@media (min-width: 721px) and (max-width: 800px) {
  .section-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .section-nav a:last-child { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .poster { padding: 22px 24px 38px; }
  .campaign-header { gap: 22px; min-height: 105px; }
  .jollibee-logo { width: 165px; }
  .school-logo { width: 185px; }
  .campaign-header h1 { font-size: 1.7rem; }
  .rule-sheet { padding-inline: 24px; }
  .award-cell { padding: 16px 14px; }
  .contact-section { grid-template-columns: minmax(0, 1fr) 220px; gap: 18px; padding: 24px; }
  .contact-section img { width: 220px; }
}

@media (max-width: 720px) {
  html { scroll-padding-top: 70px; }
  body { font-size: 16px; line-height: 1.62; }
  .poster { width: 100%; padding: 18px 12px 28px; }
  .campaign-header { grid-template-columns: 1fr 1fr; gap: 12px 18px; min-height: 174px; padding: 4px 6px 18px; }
  .jollibee-logo { width: min(42vw, 170px); }
  .school-logo { width: min(42vw, 178px); }
  .campaign-header h1 { grid-column: 1 / -1; grid-row: 2; font-size: clamp(1.55rem, 7vw, 2rem); }
  .campaign-header h1 span { padding: 0; }
  .rule-sheet { overflow: visible; padding: 14px 14px 34px; border-radius: 14px; }
  .nav-disclosure {
    width: 100%;
    margin: 0 0 32px;
  }
  .nav-disclosure > summary {
    display: flex;
    align-items: center;
    min-height: 54px;
    padding: 10px 15px;
    color: var(--ink);
    background: rgba(255, 252, 244, .96);
    border: 1px solid var(--soft-line);
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(61, 40, 20, .09);
    cursor: pointer;
    list-style: none;
    touch-action: manipulation;
    font-size: .95rem;
    font-weight: 900;
  }
  .nav-disclosure > summary::-webkit-details-marker { display: none; }
  .nav-disclosure > summary small {
    margin-left: auto;
    color: var(--red-deep);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .03em;
  }
  .nav-disclosure > summary::after {
    width: 9px;
    height: 9px;
    margin: -4px 3px 0 13px;
    content: "";
    border-right: 2px solid var(--red-deep);
    border-bottom: 2px solid var(--red-deep);
    transform: rotate(45deg);
    transition: transform 180ms ease, margin 180ms ease;
  }
  .nav-disclosure[open] > summary::after {
    margin-top: 4px;
    transform: rotate(225deg);
  }
  .nav-disclosure:not([open]) > .section-nav { display: none; }
  .nav-disclosure[open] > .section-nav { display: grid; }
  .section-nav {
    grid-template-columns: 1fr;
    gap: 4px;
    margin: 8px 0 0;
    padding: 6px;
    overflow: visible;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(61, 40, 20, .09);
  }
  .section-nav a {
    justify-content: flex-start;
    min-height: 48px;
    padding: 8px 11px;
    font-size: .92rem;
  }
  .section-nav a span {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    color: var(--red-deep);
    background: var(--yellow);
    border-radius: 7px;
    font-size: .68rem;
  }
  .section-nav a:last-child { grid-column: auto; justify-content: flex-start; }
  .rule-section { scroll-margin-top: 74px; }
  .rule-section + .rule-section { margin-top: 30px; }
  .rule-section h2 { align-items: flex-start; gap: 10px; margin-bottom: 14px; font-size: 1.02rem; }
  .section-index { min-width: 38px; height: 34px; padding-inline: 8px; border-radius: 8px; font-size: .72rem; }
  .intro-section { padding: 20px 18px; border-radius: 12px; }
  .award-table { margin-top: 13px; border: 0; background: transparent; }
  .award-table-head { display: none; }
  .award-group { overflow: hidden; border: 1.5px solid var(--line) !important; border-radius: 7px; }
  .award-group + .award-group { margin-top: 15px; }
  .award-period { margin: 0 !important; padding: 11px 12px; border-bottom: 1.5px solid var(--line); font-size: .82rem; line-height: 1.45; }
  .award-columns.award-row { display: block; }
  .award-name { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 7px; padding: 15px 12px; border-bottom: 1.5px solid var(--line); }
  .award-name strong { font-size: 1.05rem; }
  .award-name br { display: none; }
  .award-name span { margin: 0; font-size: .72rem; }
  .award-cell { padding: 17px 15px 19px; }
  .award-cell + .award-cell { border-top: 1.5px solid var(--line); }
  .award-cell::before { display: block; margin-bottom: 10px; padding-bottom: 7px; border-bottom: 1px solid rgba(53,49,43,.3); content: attr(data-label); font-size: .8rem; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
  .award-cell .note { padding: 10px 11px; }
  .long-rules { max-width: 100%; padding-top: 30px; }
  .long-rules h2 { margin-bottom: 19px; }
  .long-rules h3 { margin-top: 26px; padding: 12px 13px; }
  .long-rules > ul,
  .long-rules > ol { gap: 9px; padding: 0; }
  .long-rules > ul > li,
  .long-rules > ol > li { padding: 15px 14px 15px 45px; border-radius: 10px; line-height: 1.64; }
  .long-rules > ul > li::before { top: 24px; left: 18px; }
  .long-rules > ol > li { padding-left: 53px; }
  .long-rules > ol > li::before { top: 14px; left: 13px; }
  .long-rules .plus-list { grid-template-columns: 1fr; gap: 7px; }
  .contact-section { grid-template-columns: minmax(0, 1fr) 145px; gap: 12px; padding: 22px 16px 22px 18px; }
  .contact-section img { width: 145px; }
}

@media (max-width: 390px) {
  .poster { padding-inline: 8px; }
  .rule-sheet { padding-inline: 13px; }
  .campaign-header { padding-inline: 4px; }
  .campaign-header h1 { font-size: 1.45rem; }
  .contact-section { grid-template-columns: 1fr; }
  .contact-section img { justify-self: center; width: min(100%, 190px); margin-top: 4px; }
}

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

@media print {
  body { background: var(--red); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .poster { width: 100%; max-width: none; }
}
