:root {
  color-scheme: light;
  --paper: #faf7f0;
  --paper-alt: #f3ede0;
  --card: #ffffff;
  --card-warm: #fffaf0;
  --ink: #1b2538;
  --ink-soft: #4e5666;
  --ink-muted: #6c7382;
  --line: #e2d9c8;
  --line-strong: #c8bca6;
  --accent: #b84a14;
  --accent-hover: #97390b;
  --accent-soft: #fff0e5;
  --ok: #14633a;
  --ok-bg: #ebf7f0;
  --ok-line: #b4dec4;
  --warn: #a6261c;
  --warn-bg: #fdf0ee;
  --warn-line: #eabcb7;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(27, 37, 56, 0.05), 0 6px 20px rgba(27, 37, 56, 0.04);
  font-family: "Pretendard Variable", "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.68;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ── Topbar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 247, 240, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
}
.brand-link:hover { text-decoration: none; }
.brand-link img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: #fff5e8;
}
.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.nav a {
  padding: 7px 13px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover {
  background: var(--paper-alt);
  color: var(--ink);
  text-decoration: none;
}
.nav a[aria-current="page"] {
  background: var(--ink);
  color: #ffffff;
}
.nav a.nav-cta {
  background: var(--accent);
  color: #ffffff;
  margin-left: 4px;
}
.nav a.nav-cta:hover {
  background: var(--accent-hover);
  color: #ffffff;
}

/* ── Layout ── */
main {
  max-width: 1060px;
  margin: 0 auto;
  padding: 28px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.section-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.section-head h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.02em;
  line-height: 1.35;
}
.section-sub {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 14.5px;
}

h1 { margin: 0 0 12px; font-size: 32px; line-height: 1.25; letter-spacing: -0.03em; }
h2 { margin: 0 0 12px; font-size: 21px; line-height: 1.35; letter-spacing: -0.02em; }
h3 { margin: 18px 0 8px; font-size: 16px; line-height: 1.4; }
p { margin: 8px 0; color: var(--ink); }
.muted { color: var(--ink-soft); font-size: 14px; }
ul, ol { margin: 8px 0; padding-left: 20px; }
li + li { margin-top: 6px; }

/* ── Hero ── */
.hero {
  background: var(--card-warm);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.hero-split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 28px;
  align-items: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 750;
  margin-bottom: 12px;
}
.hero-lead {
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 0 0 20px;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--ink);
  color: #ffffff;
}
.btn-primary:hover { background: #2c3a54; }
.btn-accent {
  background: var(--accent);
  color: #ffffff;
}
.btn-accent:hover { background: var(--accent-hover); }
.btn-outline {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-outline:hover { background: var(--paper-alt); border-color: var(--ink); }

.fact-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-soft);
  font-weight: 600;
}
.fact-strip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fact-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
}

/* ── Diagram box ── */
.diagram-box {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}
.diagram-caption {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-muted);
  text-align: center;
}

/* ── Grids & Cards ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

.item-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.item-card.white { background: #ffffff; }
.item-card h3 { margin: 0; font-size: 15.5px; }
.item-card p { margin: 0; font-size: 14px; color: var(--ink-soft); line-height: 1.58; }

.card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-icon.ok { background: var(--ok-bg); color: var(--ok); }
.card-icon.ink { background: #e8edf5; color: var(--ink); }

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

/* ── Tables ── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 0;
}
th, td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
tr:last-child td { border-bottom: none; }
th {
  background: var(--paper-alt);
  font-weight: 750;
  color: var(--ink);
  white-space: nowrap;
}
td strong { color: var(--ink); }

/* ── Badges / Pills ── */
.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--paper-alt);
  color: var(--ink);
  white-space: nowrap;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

/* ── Callouts ── */
.callout {
  margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card-warm);
  font-size: 14px;
}
.callout.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-line); }

.em-action {
  color: var(--accent);
  font-weight: 750;
  text-decoration: underline;
  text-decoration-color: #e6ad87;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}
.em-warn { color: var(--warn); font-weight: 750; }
.em-ok { color: var(--ok); font-weight: 750; }

/* ── Code & Copy block ── */
code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  background: var(--paper-alt);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}
.code-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #1b2538;
  color: #f3f6fb;
  margin-top: 10px;
}
.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #131b2b;
  font-size: 12.5px;
  color: #c2ccde;
  font-weight: 600;
}
.copy-btn {
  background: #2b3954;
  color: #ffffff;
  border: 1px solid #415275;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.copy-btn:hover { background: #3b4d70; }
.code-box pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  background: transparent;
  border: none;
  color: #f3f6fb;
}

/* ── TOC chips ── */
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.toc a {
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 5px 11px;
  border-radius: 999px;
  text-decoration: none;
}
.toc a:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

/* ── FAQ accordion ── */
.faq-list { display: flex; flex-direction: column; gap: 10px; }
details.faq-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  padding: 14px 16px;
}
details.faq-item[open] { background: #ffffff; }
details.faq-item summary {
  font-weight: 750;
  font-size: 15px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item summary::after {
  content: "+";
  font-size: 18px;
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}
details.faq-item[open] summary::after { content: "−"; }
details.faq-item p {
  margin: 10px 0 0;
  font-size: 14.5px;
  color: var(--ink-soft);
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper-alt);
  margin-top: 24px;
}
.footer-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 26px 20px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--ink-soft);
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--ink);
}
.footer-brand img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--ink-soft);
  font-weight: 600;
}
.footer-links a:hover { color: var(--ink); }

/* ── Legacy section compatibility (legal.html) ── */
main > section:not(.section-card) {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

/* ── Responsive ── */
@media (max-width: 860px) {
  .hero-split, .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-split { grid-template-columns: 1fr; }
  h1 { font-size: 26px; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero, .section-card { padding: 20px; }
  .topbar-inner { padding: 10px 14px; }
  .nav a { padding: 6px 10px; font-size: 13.5px; }
}

/* ── Auth Button & Status in Header ── */
.auth-slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
}
.auth-btn {
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.auth-btn:hover { background: var(--paper-alt); border-color: var(--ink); }
.auth-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}

/* ── Tips Board ── */
.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-tab {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.filter-tab.active, .filter-tab:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}
.board-search {
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #ffffff;
  font-size: 14px;
  min-width: 220px;
  color: var(--ink);
}
.tip-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}
.tip-list-head {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr) 176px;
  gap: 14px;
  padding: 10px 18px;
  background: var(--paper-alt);
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 750;
  color: var(--ink-soft);
}
.tip-list-head span:last-child { text-align: right; }
.tip-row {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr) 176px;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s;
  text-align: left;
  background: #ffffff;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  font: inherit;
  color: inherit;
}
.tip-row:last-child { border-bottom: none; }
.tip-row:hover { background: var(--card-warm); }
.tip-badges {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.tip-title {
  font-size: 15.5px;
  font-weight: 750;
  color: var(--ink);
  margin: 0;
}
.tip-summary {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 3px 0 0;
}
.tip-date {
  font-size: 12.5px;
  color: var(--ink-muted);
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Tip Detail & Lock Gate ── */
.tip-detail-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.tip-detail-body {
  font-size: 15px;
  line-height: 1.78;
}
.tip-detail-body h3 { margin-top: 22px; font-size: 17px; }
.tip-detail-body pre {
  background: #1b2538;
  color: #f3f6fb;
  padding: 14px 16px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.65;
}
pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}
.lock-box {
  background: var(--card-warm);
  border: 1.5px dashed var(--accent);
  border-radius: 14px;
  padding: 28px 22px;
  text-align: center;
}
.lock-box h3 { margin: 8px 0; font-size: 19px; }
.lock-box p { color: var(--ink-soft); max-width: 520px; margin: 6px auto 0; }

/* ── Admin Panel ── */
.admin-panel {
  background: #f6f9ff;
  border: 1.5px solid #bfd1ef;
  border-radius: 14px;
  padding: 22px;
}
.admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.member-list-box {
  margin-top: 14px;
  background: #ffffff;
  border: 1px solid #d5e1f4;
  border-radius: 12px;
  padding: 16px;
}
.member-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.member-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
}
.member-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-size: 13.5px;
}
.member-list li.member-empty {
  justify-content: center;
  color: var(--ink-muted);
  background: #ffffff;
}
.roster-box textarea,
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  background: #ffffff;
  color: var(--ink);
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.form-field label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}
.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 44, 0.55);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}
.modal-card.wide { max-width: 720px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-close {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
  color: var(--ink);
}
.demo-roles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}
.demo-role-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
  text-align: left;
}
.demo-role-btn:hover { background: var(--accent-soft); border-color: var(--accent); }

@media (max-width: 680px) {
  .tip-list-head { display: none; }
  .tip-row { grid-template-columns: 1fr; gap: 6px; }
  .tip-date { text-align: left; }
  .roster-grid, .form-row-2 { grid-template-columns: 1fr; }
}
