:root {
  color-scheme: light;
  --background: #fbf7f1;
  --surface: #fffdf9;
  --subtle: #f3ece2;
  --line: #e6ded2;
  --ink: #2b2420;
  --muted: #6f665e;
  --primary: #4a3427;
  --on-primary: #fbf7f1;
  --control-border: #7c6f64;
  --spine: #4a3427;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --background: #1c1714;
    --surface: #2a2320;
    --subtle: #332a25;
    --line: #3a3029;
    --ink: #f2ece4;
    --muted: #b3a79b;
    --primary: #f2ece4;
    --on-primary: #1c1714;
    --control-border: #81756c;
    --spine: #f2ece4;
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
}

body {
  min-width: 280px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family:
    'IBM Plex Sans KR',
    -apple-system,
    BlinkMacSystemFont,
    'Apple SD Gothic Neo',
    'Noto Sans KR',
    sans-serif;
  font-size: 16px;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

[hidden] {
  display: none !important;
}

.page-shell {
  display: grid;
  align-items: start;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.page-shell.wide {
  max-width: 680px;
}

.card {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 32px 24px 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--spine);
  content: '';
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-family: 'Gowun Batang', 'AppleMyungjo', 'Batang', serif;
  font-size: clamp(28px, 8vw, 36px);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.035em;
}

p {
  margin: 0;
}

.lead {
  margin-top: 16px;
  color: var(--ink);
  font-size: 17px;
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  margin-top: 28px;
  padding: 13px 18px;
  border: 1px solid var(--primary);
  border-radius: 12px;
  background: var(--primary);
  color: var(--on-primary);
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  appearance: none;
}

.button:hover {
  opacity: 0.92;
}

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

.button.secondary {
  margin-top: 12px;
  border-color: var(--control-border);
  background: transparent;
  color: var(--ink);
}

#invite {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.code {
  margin-top: 10px;
  padding: 15px 12px;
  border-radius: 12px;
  background: var(--subtle);
  color: var(--ink);
  font-size: clamp(29px, 10vw, 38px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.16em;
  text-align: center;
  text-indent: 0.16em;
  user-select: all;
}

.help {
  margin-top: 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.help.rule {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.card.document {
  padding-bottom: 32px;
}

.document .brand {
  margin: 0 0 28px;
  font-size: 14px;
  line-height: 1.65;
}

.document .meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.document h2 {
  margin: 32px 0 0;
  color: var(--ink);
  font-family: 'Gowun Batang', 'AppleMyungjo', 'Batang', serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: -0.02em;
}

.document h3 {
  margin: 24px 0 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.6;
}

.document p,
.document ul,
.document ol,
.document table {
  margin-top: 16px;
  font-size: 16px;
  line-height: 1.7;
}

.document ul,
.document ol {
  margin-bottom: 0;
  padding-left: 24px;
}

.document li + li {
  margin-top: 8px;
}

.document table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.document th,
.document td {
  padding: 12px;
  border: 1px solid var(--line);
  vertical-align: top;
}

.document th {
  background: var(--subtle);
  font-weight: 700;
}

.document a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.document .button {
  text-decoration: none;
}

.document .document-links {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

@media (max-width: 519px) {
  .document table {
    display: block;
    overflow-x: auto;
  }

  .document th,
  .document td {
    min-width: 180px;
  }
}

@media (min-width: 520px) {
  .page-shell {
    align-items: center;
    padding-top: max(40px, env(safe-area-inset-top));
    padding-bottom: max(40px, env(safe-area-inset-bottom));
  }

  .card {
    padding: 40px 36px 36px;
  }

  .card.document {
    padding-bottom: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
