:root {
  --bg: #0A0614;
  --surface: #160E2A;
  --surface-elevated: #1E1438;
  --gold: #E5C158;
  --gold-soft: rgba(229, 193, 88, 0.14);
  --hairline: rgba(229, 193, 88, 0.22);
  --text: #F8F5FF;
  --muted: #B8AECB;
  --danger-soft: rgba(229, 115, 115, 0.14);
  --danger-border: rgba(229, 115, 115, 0.35);
  --radius: 16px;
  --radius-sm: 10px;
}

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

html {
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans KR", "Noto Sans TC", "Noto Sans Arabic", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -10%, rgba(229, 193, 88, 0.10), transparent 52%),
    radial-gradient(circle at 85% 20%, rgba(114, 72, 185, 0.16), transparent 45%),
    var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  opacity: 0.88;
}

.site-header {
  border-bottom: 1px solid var(--hairline);
  background: rgba(10, 6, 20, 0.88);
  position: static;
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 12px 16px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}

.menu-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 12px;
  background: rgba(22, 14, 42, 0.85);
  border: 1px solid rgba(229, 193, 88, 0.34);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.menu-toggle:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold);
}

.menu-toggle:focus-visible,
.drawer-close:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.menu-toggle svg,
.drawer-close svg {
  width: 20px;
  height: 20px;
  display: block;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  min-height: 44px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--hairline);
  object-fit: cover;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.brand-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--gold);
}

.lang-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lang-btn {
  appearance: none;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0 12px;
  min-height: 44px;
  min-width: 44px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.lang-btn:hover {
  color: var(--text);
  border-color: var(--gold);
}

.lang-btn[aria-pressed="true"] {
  background: var(--gold);
  color: #0A0614;
  border-color: var(--gold);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--hairline);
}

.nav-link[aria-current="page"] {
  color: var(--gold);
  background: var(--gold-soft);
  border-color: var(--hairline);
}

body.drawer-open {
  overflow: hidden;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 2, 10, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  z-index: 90;
}

.drawer-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.site-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-end: 0;
  width: min(320px, 86vw);
  background: #110A21;
  border-inline-start: 1px solid var(--hairline);
  padding: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  transform: translateX(100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.24s ease;
}

[dir="rtl"] .site-drawer {
  transform: translateX(-100%);
}

.site-drawer.is-open,
[dir="rtl"] .site-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
}

.drawer-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.drawer-close {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.16s ease, color 0.16s ease, background-color 0.16s ease;
}

.drawer-close:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-soft);
}

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-label {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.site-drawer .site-nav {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 4px;
}

.site-drawer .nav-link {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  white-space: normal;
}

.site-drawer .lang-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.site-drawer .lang-btn {
  width: 100%;
  min-height: 44px;
}

@media (prefers-reduced-motion: reduce) {
  .drawer-backdrop,
  .site-drawer {
    transition: none;
  }
}

main {
  flex: 1;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 16px 56px;
}

.hero {
  background: linear-gradient(160deg, var(--surface-elevated), var(--surface));
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 28px 22px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--gold-soft);
  border: 1px solid var(--hairline);
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3.8vw, 2.05rem);
  line-height: 1.35;
  color: var(--text);
  letter-spacing: 0.01em;
}

.hero-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
  line-height: 1.45;
  color: var(--gold);
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 8px;
}

.card h3 {
  margin: 18px 0 8px;
  font-size: 1.02rem;
  color: var(--text);
}

.card p {
  margin: 0 0 12px;
  color: var(--text);
}

.card p:last-child {
  margin-bottom: 0;
}

.muted {
  color: var(--muted);
}

ul, ol {
  margin: 8px 0 14px;
  padding-inline-start: 22px;
}

li {
  margin-bottom: 8px;
}

.callout {
  background: var(--gold-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 14px 0;
}

.callout-danger {
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.feature-tile {
  background: var(--surface-elevated);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.feature-tile h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--gold);
}

.feature-tile p {
  margin: 0;
  font-size: 0.93rem;
  color: var(--muted);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.94rem;
  text-decoration: none;
  border: 1px solid var(--hairline);
  cursor: pointer;
}

.btn-primary {
  background: var(--gold);
  color: #0A0614;
  border-color: var(--gold);
}

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--text);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 12px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

th, td {
  text-align: start;
  padding: 11px 12px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}

th {
  color: var(--gold);
  font-weight: 600;
  background: rgba(229, 193, 88, 0.06);
  width: 34%;
}

.site-footer {
  border-top: 1px solid var(--hairline);
  background: rgba(10, 6, 20, 0.92);
  padding: 28px 16px 36px;
}

.footer-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.footer-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.85rem;
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: var(--gold);
  opacity: 1;
}

[dir="rtl"] .brand-text,
[dir="rtl"] main,
[dir="rtl"] .footer-inner {
  text-align: right;
}

@media (max-width: 520px) {
  .hero {
    padding: 20px 16px;
  }

  .card {
    padding: 18px 16px;
  }

  th, td {
    padding: 9px 8px;
  }
}

.card,
.card a,
.card code,
table,
th,
td {
  overflow-wrap: anywhere;
  word-break: normal;
}

section[id],
div[id] {
  scroll-margin-top: 24px;
}

.legal-meta {
  font-size: 0.88rem;
  color: var(--gold);
  margin: 0;
}

.callout-info {
  background: rgba(114, 72, 185, 0.14);
  border: 1px solid rgba(229, 193, 88, 0.35);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 14px 0;
}

.callout-info h3,
.callout h3 {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 1rem;
}

.lang-notice {
  font-size: 0.9rem;
  color: var(--muted);
  background: var(--surface-elevated);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 18px;
}

.article-lead {
  color: var(--muted);
  font-size: 0.96rem;
  margin-bottom: 12px;
}

.toc {
  background: var(--surface-elevated);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.toc h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: var(--gold);
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 6px;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 14px;
}

.toc-list li {
  margin: 0;
}

.toc-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.4;
}

.toc-link:hover {
  background: var(--gold-soft);
  color: var(--gold);
}
