@import url('https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css');

:root {
  --bg: #ffffff; --bg2: #f7f7f7; --bg3: #efefef;
  --border: #e0e0e0; --text: #0a0a0a; --text2: #555; --text3: #888;
  --code-bg: #0f0f0f; --code-text: #e8e8e8;
  --accent: #5c6bc0; --accent-hover: #4f5b9e; --accent-text: #ffffff;
  --ok-bg: #f0fdf4; --ok-border: #16a34a; --ok-text: #14532d;
  --warn-bg: #fffbeb; --warn-border: #d97706; --warn-text: #78350f;
  --note-bg: #f0f9ff; --note-border: #0284c7; --note-text: #0c4a6e;
}
[data-theme="dark"] {
  --bg: #0a0a0a; --bg2: #141414; --bg3: #1e1e1e;
  --border: #2a2a2a; --text: #f0f0f0; --text2: #aaa; --text3: #666;
  --code-bg: #050505; --code-text: #d4d4d4;
  --accent: #667eea; --accent-hover: #768bf5; --accent-text: #ffffff;
  --ok-bg: #052e16; --ok-border: #166534; --ok-text: #86efac;
  --warn-bg: #1c1006; --warn-border: #b45309; --warn-text: #fcd34d;
  --note-bg: #001a2e; --note-border: #0369a1; --note-text: #7dd3fc;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.65; transition: background .2s, color .2s;
}
body.no-scroll { overflow: hidden; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
[data-theme="dark"] .site-header { background: rgba(10,10,10,.92); }
[data-theme="light"] .site-header { background: rgba(255,255,255,.92); }
.site-header { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

.header-left { display: flex; align-items: center; gap: 16px; }
.menu-toggle {
  display: none; background: transparent; border: none; color: var(--text);
  font-size: 24px; cursor: pointer; line-height: 1; padding: 0;
}
.site-logo { font-size: 15px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.site-logo span { color: var(--accent); }
.theme-btn {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 0;
  width: 34px; height: 34px; font-size: 16px; line-height: 34px; text-align: center;
  cursor: pointer; transition: background .15s; flex-shrink: 0;
}
.theme-btn:hover { background: var(--border); }

/* Layout */
.layout-container { display: flex; max-width: 1300px; margin: 0 auto; align-items: flex-start; }

/* Sidebar */
.sidebar {
  width: 272px; flex-shrink: 0;
  position: sticky; top: 64px; height: calc(100vh - 64px);
  overflow-y: auto; padding: 24px 20px 80px;
  border-right: 1px solid var(--border);
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.nav-group {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text3); margin: 24px 0 6px; padding: 0 12px;
}
.nav-group:first-child { margin-top: 0; }

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; margin: 1px 0; border-radius: 8px;
  color: var(--text2); text-decoration: none; font-size: 13px; font-weight: 500;
  transition: all .15s;
}
.nav-link:hover { color: var(--text); background: var(--bg2); }
.nav-link.active { color: var(--accent-text); background: var(--accent); font-weight: 600; }
.nav-sub {
  padding-left: 36px; font-size: 12.5px;
}
.nav-icon { font-size: 13px; flex-shrink: 0; opacity: 0.7; width: 16px; text-align: center; line-height: 1; }
.nav-link.active .nav-icon { opacity: 1; filter: grayscale(100%) brightness(200%); }

/* Main Content */
.main-content { flex: 1; min-width: 0; padding: 0 48px 80px; }

/* Hero */
.hero { padding: 52px 0 36px; border-bottom: 1px solid var(--border); margin-bottom: 48px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text3); margin-bottom: 14px;
}
.hero-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }
.hero h1 { font-size: clamp(28px, 4.5vw, 40px); font-weight: 800; letter-spacing: -.03em; color: var(--text); line-height: 1.15; margin-bottom: 14px; }
.hero p { font-size: 15.5px; color: var(--text2); max-width: 620px; line-height: 1.7; }

/* Sections */
.section { margin-bottom: 60px; scroll-margin-top: 84px; }
.section-header { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.section h2 { font-size: 21px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.section h3 { font-size: 15.5px; font-weight: 600; margin: 28px 0 14px; color: var(--text); }
.section p { margin-bottom: 14px; color: var(--text2); font-size: 14px; line-height: 1.75; }
.section ul, .section ol { padding-left: 20px; margin-bottom: 14px; color: var(--text2); font-size: 14px; line-height: 1.75; }
.section li { margin-bottom: 5px; }
.section a { color: var(--accent); text-decoration: none; font-weight: 500; }
.section a:hover { text-decoration: underline; }

/* Card */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 22px; margin-bottom: 18px;
}

/* Alert */
.alert {
  border-radius: 10px; padding: 14px 18px; display: flex; gap: 12px; align-items: flex-start;
  font-size: 13.5px; line-height: 1.65; margin-bottom: 18px;
}
.alert .alert-icon { flex-shrink: 0; font-size: 17px; margin-top: 1px; }
.alert.note { background: var(--note-bg); border: 1px solid var(--note-border); color: var(--note-text); }
.alert.warn { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); }
.alert.ok   { background: var(--ok-bg);   border: 1px solid var(--ok-border);   color: var(--ok-text); }

/* Badge */
.badge {
  display: inline-block; font-size: 10.5px; font-weight: 600; padding: 2px 8px;
  border-radius: 6px; background: var(--bg3); border: 1px solid var(--border);
  vertical-align: middle; margin: 0 3px;
}

/* Code */
.code-block { position: relative; margin: 18px 0; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.code-label {
  display: flex; align-items: center; justify-content: space-between;
  background: #1a1a1a; padding: 7px 14px; border-bottom: 1px solid #2a2a2a;
}
.code-lang { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #777; }
.copy-btn {
  font-size: 11px; font-weight: 600; color: #999; background: transparent;
  border: 1px solid #444; border-radius: 5px; padding: 3px 9px; cursor: pointer; transition: all .15s;
}
.copy-btn:hover { color: #fff; border-color: #666; }
.copy-btn.copied { color: #22c55e; border-color: #22c55e; }
pre {
  background: var(--code-bg); color: var(--code-text);
  padding: 18px; margin: 0;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 12.5px; line-height: 1.75;
  overflow-x: auto; white-space: pre-wrap; word-break: break-all;
}
code {
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace; font-size: 12.5px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 6px; color: var(--text);
}
pre code { background: transparent; border: none; padding: 0; font-size: inherit; color: inherit; }

/* Syntax highlight */
.hl-cmd { color: #9cdcfe; } .hl-str { color: #ce9178; } .hl-cmt { color: #6a9955; font-style: italic; } .hl-kw { color: #569cd6; }

/* WIP placeholder */
.wip-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 64px 32px; gap: 16px;
  border: 2px dashed var(--border); border-radius: 16px;
  background: var(--bg2); margin: 40px 0;
}
.wip-icon { font-size: 52px; line-height: 1; }
.wip-wrap h2 { font-size: 20px; font-weight: 700; color: var(--text); }
.wip-wrap p { font-size: 14px; color: var(--text3); max-width: 420px; line-height: 1.7; margin: 0; }
.wip-tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 14px;
}

/* Subsection stub */
.sub-stub {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  border: 1px dashed var(--border); border-radius: 10px;
  background: var(--bg2); margin-bottom: 14px; color: var(--text3); font-size: 13.5px;
}
.sub-stub-icon { font-size: 20px; flex-shrink: 0; }

/* Step number badge */
.step-num {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: var(--text); color: var(--bg);
  font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

/* Requirements grid */
.req-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 540px) { .req-grid { grid-template-columns: 1fr; } }
.req-item { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.req-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--text3); margin-bottom: 4px; }
.req-val { font-size: 14px; font-weight: 600; color: var(--text); }
.req-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* Steps list */
.steps { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: var(--text2); }
.steps .sn {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px;
  background: var(--bg3); border: 1px solid var(--border);
  font-size: 11px; font-weight: 700; color: var(--text3);
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.steps li strong { color: var(--text); }

/* Dialog blocks (script prompts) */
.dialog-block { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.dialog-title {
  background: var(--bg3); padding: 9px 16px;
  font-size: 12px; font-weight: 700; color: var(--text2); letter-spacing: .04em;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--border);
}
.dialog-badge { font-size: 10px; font-weight: 700; letter-spacing: .06em; padding: 2px 7px; border-radius: 4px; text-transform: uppercase; white-space: nowrap; }
.badge-opt { background: var(--note-bg); color: var(--note-text); border: 1px solid var(--note-border); }
.badge-req { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-border); }
.dialog-body { padding: 13px 16px; font-size: 13px; color: var(--text2); line-height: 1.65; }
.dialog-body strong { color: var(--text); }

/* Result box */
.result-box {
  background: var(--ok-bg); border: 1px solid var(--ok-border);
  border-radius: 12px; padding: 18px 22px;
}
.result-box h3 { font-size: 14px; font-weight: 700; color: var(--ok-text); margin-bottom: 12px; }
.result-row { display: flex; flex-direction: column; gap: 6px; }
.result-item { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.result-key { font-weight: 700; color: var(--ok-text); white-space: nowrap; min-width: 130px; }
.result-val { font-family: 'SF Mono','Fira Code',Consolas,monospace; font-size: 12px; color: var(--ok-text); opacity: .85; }

/* Syntax highlight aliases */
.sh-cmd  { color: #9cdcfe; }
.sh-flag { color: #4ec9b0; }
.sh-str  { color: #ce9178; }
.sh-cmt  { color: #6a9955; font-style: italic; }
.sh-ok   { color: #22c55e; }
.sh-dim  { color: #555; }

/* Section sub-label */
.section-sub-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text3); margin-bottom: 12px;
}

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 36px 0; font-size: 12.5px; color: var(--text3); text-align: center; }

/* Sidebar overlay */
.sidebar-overlay { display: none; position: fixed; top: 64px; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.45); z-index: 80; backdrop-filter: blur(3px); }

/* Mobile */
@media (max-width: 900px) {
  .menu-toggle { display: block; }
  .sidebar {
    position: fixed; left: -100%; top: 64px; width: 272px; height: calc(100vh - 64px);
    background: var(--bg); z-index: 90; transition: left .3s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.12); border-right: none;
  }
  .sidebar.open { left: 0; }
  .sidebar.open + .sidebar-overlay { display: block; }
  .main-content { padding: 0 20px 80px; }
}
