/* Redapple Games docs theme — rebuilt from scratch */
:root {
  --font: "Twemoji Country Flags", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --text: #30353a;
  --muted: #606d78;
  --faint: #8a929b;
  --accent: #6801f5;
  --accent-soft: rgba(104, 1, 245, 0.09);
  --border: #e7e9ec;
  --border-strong: rgba(0, 0, 0, 0.1);
  --bg: #ffffff;
  --bg-subtle: #f7f8f9;

  --code-bg: #292d31;
  --code-head: #1f2225;
  --code-text: #e6e6e6;
  --code-gutter: #6b7177;

  --get: #2bb24c;
  --post: #0074e1;
  --put: #f5a623;
  --delete: #e3220f;
  --patch: #9b4dca;

  --header-h: 100px;
  --sidebar-w: 290px;
  --container: 1360px;

  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
kbd {
  font-family: var(--font);
  font-size: 11px;
  color: var(--faint);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  line-height: 1.4;
}
.ico { display: inline-flex; }
.ico svg { width: 16px; height: 16px; display: block; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.header-row {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.header-top { height: 54px; }
.header-nav { height: 46px; }
.logo img { height: 40px; width: auto; display: block; }
.primary-nav { display: flex; align-items: center; gap: 20px; }
.version {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.nav-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
}
.primary-nav .tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text);
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}
.primary-nav .tab.active { border-bottom-color: var(--accent); }
.primary-nav .tab .ico svg { width: 14px; height: 14px; }
.search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  min-width: 200px;
}
.search-btn:hover { border-color: var(--border-strong); }
.search-btn .ico svg { width: 14px; height: 14px; }
.search-btn kbd { margin-left: auto; }
.login-link {
  font-size: 14px;
  color: var(--muted);
}
.login-link:hover { color: var(--text); }

/* ---------- main layout ---------- */
.site-main {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 48px;
  display: flex;
  align-items: flex-start;
  gap: 28px;
}

/* ---------- sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  position: sticky;
  top: var(--header-h);
  align-self: flex-start;
  height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
  padding-top: 22px;
}
.jump-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 18px;
  color: var(--faint);
}
.jump-box .ico svg { width: 14px; height: 14px; }
.jump-input {
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
}
.jump-input::placeholder { color: var(--faint); }
.nav-scroll { overflow-y: auto; flex: 1; padding-bottom: 40px; padding-right: 6px; }
.nav-section { margin-bottom: 22px; }
.nav-section h2 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.24px;
  color: var(--muted);
  margin: 0 0 8px;
}
.nav-list, .nav-sublist { list-style: none; margin: 0; padding: 0; }
.nav-link, .nav-sublink {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  position: relative;
}
.nav-link:hover, .nav-sublink:hover { background: var(--bg-subtle); }
.nav-link.active, .nav-sublink.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.nav-link-text, .nav-sublink-text { flex: 1; }
.nav-toggle {
  border: 0;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  border-radius: 4px;
}
.nav-toggle .ico svg { width: 14px; height: 14px; transition: transform 0.15s ease; }
.nav-item.open > .nav-link .nav-toggle .ico svg { transform: rotate(90deg); }
.nav-sublist { display: none; margin-left: 10px; padding-left: 8px; border-left: 1px solid var(--border); margin-top: 2px; }
.nav-item.open > .nav-sublist { display: block; }
.method-tag, .method-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #fff;
  border-radius: 9999px;
  padding: 2px 8px;
  line-height: 1.4;
}
.method-tag { font-size: 9px; padding: 1px 6px; margin-left: 6px; }
.method-get { background: var(--get); }
.method-post { background: var(--post); }
.method-put { background: var(--put); }
.method-delete { background: var(--delete); }
.method-patch { background: var(--patch); }
.powered { padding: 14px 10px; font-size: 12px; color: var(--faint); }

/* ---------- content ---------- */
.doc-layout {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 40px;
  padding: 26px 0 80px;
}
.doc-article { flex: 1; min-width: 0; max-width: 920px; }
.api-layout .doc-article { max-width: none; }

.breadcrumb {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}
.breadcrumb .crumb-sep .ico svg { width: 12px; height: 12px; color: var(--faint); }
.article-head h1 {
  font-size: 31px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 14px;
  color: var(--text);
}
.endpoint-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.endpoint-url {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
}
.article-desc { font-size: 16px; line-height: 1.6; color: var(--text); margin: 0 0 12px; }

/* params */
.param-form { margin-top: 28px; }
.form-header {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.param-object-label { font-size: 13px; color: var(--muted); font-family: var(--mono); display: block; margin-bottom: 4px; }
.param-rows { display: flex; flex-direction: column; }
.param-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.param-row:last-child { border-bottom: 0; }
.param-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.param-name { font-weight: 600; font-size: 14px; }
.param-type { font-size: 13px; color: var(--muted); }
.param-required { font-size: 12px; color: #d4332a; font-weight: 500; }
.param-default { font-size: 12px; color: var(--faint); }
.param-desc { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* ---------- code column ---------- */
.code-column { flex: 0 0 420px; width: 420px; position: sticky; top: calc(var(--header-h) + 26px); align-self: flex-start; }
.side-label, .lang-section .side-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  margin: 0 0 8px;
}
.lang-section { margin-bottom: 14px; }
.lang-tabs { display: flex; align-items: center; gap: 8px; }
.lang-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 6px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.lang-tab.active { border-color: var(--border-strong); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.lang-glyph { font-family: var(--mono); color: var(--faint); font-size: 12px; }
.icon-btn {
  border: 0;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.icon-btn:hover { color: var(--text); background: rgba(0,0,0,0.04); }

.code-panel {
  background: var(--code-bg);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
  color: var(--code-text);
}
.code-panel-head, .resp-head {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #b9bec3;
}
.resp-panel { background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.resp-head {
  justify-content: space-between;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.resp-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.resp-toggle .ico svg { width: 14px; height: 14px; transition: transform 0.15s ease; }
.resp-panel:not(.open) .resp-toggle .ico svg { transform: rotate(-90deg); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--get); display: inline-block; }
.resp-panel .copy-btn { color: var(--faint); }
.resp-panel:not(.open) .code-body { display: none; }

.code-body { display: flex; font-family: var(--mono); font-size: 13px; line-height: 1.6; }
.code-gutter {
  display: flex;
  flex-direction: column;
  text-align: right;
  padding: 12px 8px 12px 14px;
  color: var(--code-gutter);
  user-select: none;
  flex: 0 0 auto;
}
.resp-panel .code-gutter { color: #c2c7cc; }
.code-pre { margin: 0; padding: 12px 14px 12px 6px; overflow-x: auto; flex: 1; }
.code { white-space: pre; }
.code-line { display: block; }
.code-panel-foot { display: flex; justify-content: flex-end; padding: 6px 10px; }
.code-panel-foot .copy-btn { color: #b9bec3; }
.copy-btn { position: relative; }
.copied-label {
  position: absolute;
  right: 100%;
  margin-right: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s ease;
  color: inherit;
}
.copy-btn.copied .copied-label { opacity: 1; }

/* code tokens */
.tok-key { color: #9cdcfe; }
.tok-str { color: #ce9178; }
.tok-num { color: #b5cea8; }
.tok-bool { color: #569cd6; }
.tok-flag { color: #c586c0; }
.tok-cmd { color: #4ec9b0; }
.resp-panel .tok-key { color: #0451a5; }
.resp-panel .tok-str { color: #a31515; }
.resp-panel .tok-num { color: #098658; }
.resp-panel .tok-bool { color: #0000ff; }

/* ---------- guide ---------- */
.guide-article .g-p { font-size: 16px; line-height: 1.7; margin: 0 0 16px; }
.guide-article .g-h2 { font-size: 22px; font-weight: 600; margin: 32px 0 12px; }
.guide-article .g-h3 { font-size: 18px; font-weight: 600; margin: 24px 0 10px; }
.g-list { padding-left: 22px; margin: 0 0 16px; line-height: 1.7; }
.g-list li { margin-bottom: 6px; }
.g-img img { max-width: 100%; height: auto; border-radius: 6px; }
.g-quote { border-left: 3px solid var(--accent); margin: 0 0 16px; padding: 4px 16px; color: var(--muted); background: var(--bg-subtle); border-radius: 4px; }
.table-wrap { overflow-x: auto; margin: 0 0 20px; }
.g-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.g-table th, .g-table td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.g-table thead th { background: var(--bg-subtle); font-weight: 600; }
.g-table .ta-right { text-align: right; }
.g-table .code-cell { font-family: var(--mono); }
.g-table tbody tr:nth-child(even) { background: #fafbfc; }

/* ---------- footer ---------- */
.article-footer { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); }
.updated { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--faint); margin: 0 0 18px; }
.updated .ico svg { width: 14px; height: 14px; }
.help { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--muted); }
.help-btns { display: flex; gap: 8px; }
.help-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 6px;
  padding: 5px 16px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.help-btn:hover { border-color: var(--border-strong); }
.help-btn.selected { background: var(--accent); color: #fff; border-color: var(--accent); }

.placeholder { margin-top: 24px; color: var(--muted); }
.placeholder-sub { font-size: 14px; color: var(--faint); }

/* ---------- search palette ---------- */
.palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 26, 0.4);
  z-index: 100;
  display: flex;
  justify-content: center;
  padding-top: 12vh;
}
.palette {
  width: min(560px, 92vw);
  background: var(--bg);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
  height: fit-content;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}
.palette-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.palette-head .ico svg { color: var(--faint); }
.palette-head .palette-close { cursor: pointer; }
.palette-head .palette-close:hover { color: var(--text); border-color: var(--border-strong); }
.palette-input { flex: 1; border: 0; outline: 0; font: inherit; font-size: 16px; background: transparent; }
.palette-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
}
.palette-item:hover, .palette-item.active { background: var(--accent-soft); }
.palette-title { font-size: 14px; font-weight: 500; }
.palette-section { font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.4px; }
.palette-empty { padding: 16px; color: var(--faint); font-size: 14px; text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .api-layout { flex-direction: column; }
  .code-column { width: 100%; flex: 1; position: static; }
  .api-layout .doc-article { max-width: 100%; }
}
@media (max-width: 820px) {
  .sidebar { display: none; }
  .search-btn { min-width: 0; }
  .search-btn span { display: none; }
}
