:root {
  --yd-yellow: #f7c600;
  --yd-black: #1a1a1a;
  --yd-dark: #232323;
  --text: #2b2b2b;
  --muted: #6b6b6b;
  --border: #e6e6e6;
  --bg: #ffffff;
  --panel: #fafafa;
  --link: #8a6d00;
  --max-width: 1180px;
  --sidebar-width: 300px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
}

/* ---------- Masthead (utility strip) ---------- */
.masthead {
  background: var(--yd-black);
  border-bottom: 1px solid #000;
}
.masthead-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.masthead-brand {
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: 0.86rem;
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
}
.masthead-brand span {
  font-weight: 400;
  color: #9a9a9a;
  text-transform: none;
  margin-left: 4px;
}
.masthead-nav {
  display: flex;
  gap: 18px;
  font-size: 0.8rem;
}
.masthead-nav a {
  color: #b7b7b7;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.masthead-nav a:hover {
  color: #fff;
  border-bottom-color: var(--yd-yellow);
}

/* ---------- Document header (letterhead style) ---------- */
.doc-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.doc-header::before {
  content: "";
  display: block;
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    var(--yd-yellow) 0,
    var(--yd-yellow) 28px,
    var(--yd-black) 28px,
    var(--yd-black) 30px
  );
}
.doc-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px 30px;
  border-left: 5px solid var(--yd-black);
}
.doc-kicker {
  margin: 0 0 10px;
  font-size: 0.72rem;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding-left: 18px;
}
.doc-header h1 {
  margin: 0 0 14px;
  padding-left: 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  line-height: 1.2;
  color: #111;
}
.doc-sub {
  padding-left: 18px;
  max-width: 760px;
  margin: 0 0 24px;
  color: #4a4a4a;
  font-size: 0.95rem;
}
.doc-meta {
  padding-left: 18px;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 18px 24px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.doc-meta > div {
  min-width: 0;
}
.doc-meta dt {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 3px;
}
.doc-meta dd {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: #1a1a1a;
}

@media (max-width: 760px) {
  .doc-meta { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Layout ---------- */
.layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 36px 24px 80px;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 40px;
  align-items: start;
}

/* ---------- Sidebar / TOC ---------- */
.toc-wrap {
  position: sticky;
  top: 20px;
  align-self: start;
}
.toc-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  background: var(--panel);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.toc-box h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin: 0 0 12px;
}
.toc-box ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc-box > ol > li {
  margin-bottom: 6px;
}
.toc-box ol ol {
  margin-top: 4px;
  padding-left: 16px;
}
.toc-box a {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  border-left: 3px solid transparent;
}
.toc-box > ol > li > a {
  font-weight: 600;
}
.toc-box ol ol a {
  font-size: 0.82rem;
  color: var(--muted);
}
.toc-box a:hover {
  background: #fff;
  border-left-color: var(--yd-yellow);
}
.toc-box a.active {
  background: #fff;
  border-left-color: var(--yd-yellow);
  color: #000;
  font-weight: 700;
}

.toc-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
}
.btn {
  flex: 1;
  border: 1px solid var(--border);
  background: #fff;
  padding: 8px 10px;
  font-size: 0.82rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  color: var(--text);
}
.btn:hover {
  border-color: var(--yd-black);
}
.btn-primary {
  background: var(--yd-yellow);
  border-color: var(--yd-yellow);
  color: #1a1a1a;
  font-weight: 700;
}

/* ---------- Content ---------- */
.content {
  min-width: 0;
}

.notice-box {
  background: #fff9e0;
  border: 1px solid #f0dd8a;
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 32px;
  font-size: 0.92rem;
}
.notice-box strong {
  display: block;
  margin-bottom: 6px;
}

section.tc-section {
  border-top: 1px solid var(--border);
  padding-top: 28px;
  margin-bottom: 6px;
  scroll-margin-top: 20px;
}
section.tc-section:first-of-type {
  border-top: none;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 12px;
  user-select: none;
}
.section-header h2 {
  font-size: 1.25rem;
  margin: 0 0 4px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.section-num {
  color: var(--yd-black);
  background: var(--yd-yellow);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}
.chevron {
  border: none;
  background: none;
  font-size: 1.1rem;
  color: var(--muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  line-height: 1;
  padding: 6px;
}
.tc-section.collapsed .chevron {
  transform: rotate(-90deg);
}

.section-body {
  padding: 10px 0 30px;
}
.tc-section.collapsed .section-body {
  display: none;
}

.subsection {
  margin-bottom: 22px;
  scroll-margin-top: 20px;
}
.subsection h3 {
  font-size: 1.02rem;
  margin: 0 0 8px;
  color: #111;
}
.subsection p,
.subsection li {
  font-size: 0.94rem;
  color: #333;
}
.subsection ul {
  padding-left: 20px;
  margin: 8px 0;
}

table.prize-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 4px;
  font-size: 0.9rem;
}
table.prize-table th,
table.prize-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}
table.prize-table th {
  background: var(--panel);
  font-weight: 700;
}
.prize-note {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 6px;
}

.back-to-top {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
}
.back-to-top:hover {
  color: var(--link);
}

/* ---------- Mobile TOC toggle ---------- */
.toc-toggle {
  display: none;
  width: 100%;
  padding: 12px 16px;
  background: var(--yd-black);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 14px;
  cursor: pointer;
}

/* ---------- Footer ---------- */
footer {
  background: var(--yd-black);
  color: #ccc;
  padding: 30px 24px;
  font-size: 0.85rem;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.footer-inner a {
  color: #ddd;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .toc-toggle {
    display: block;
  }
  .toc-wrap {
    position: static;
  }
  .toc-box {
    display: none;
    max-height: 60vh;
  }
  .toc-box.open {
    display: block;
  }
}

@media print {
  .masthead,
  .doc-header,
  .toc-wrap,
  .toc-toggle,
  .back-to-top,
  footer {
    display: none !important;
  }
  .layout {
    display: block;
    padding: 0;
  }
  section.tc-section.collapsed .section-body {
    display: block !important;
  }
  .chevron {
    display: none;
  }
}
