/* zepp-theme.soralis.org — 文字盤そのものの配色に寄せた暗い画面 */

:root {
  --bg: #0b0d10;
  --panel: #12161b;
  --line: #222a33;
  --fg: #e7edf3;
  --muted: #8d99a4;
  --dim: #5b666f;
  --accent: #ff6700;
  --accent-soft: #ff670022;
  --accent-text: #ff9458;
  --code-bg: #10141a;

  /* コードの色（highlight.js） */
  --hl-keyword: #ff9458;
  --hl-string: #9ece6a;
  --hl-number: #7aa2f7;
  --hl-comment: #5f6b76;
  --hl-attr: #7dcfff;
  --hl-title: #e5c07b;
  --hl-type: #bb9af7;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.75;
  font-size: 16px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre { font-family: var(--mono); }
code { background: #1a1f26; color: var(--accent-text); padding: 0.12em 0.42em; border-radius: 4px; font-size: 0.88em; }
pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; overflow-x: auto; line-height: 1.6; }
pre code { background: none; color: #d7e0e8; padding: 0; font-size: 0.85em; }

/* highlight.js のトークン */
.hljs-keyword, .hljs-built_in, .hljs-literal, .hljs-selector-tag { color: var(--hl-keyword); }
.hljs-string, .hljs-regexp, .hljs-addition { color: var(--hl-string); }
.hljs-number, .hljs-symbol, .hljs-bullet { color: var(--hl-number); }
.hljs-comment, .hljs-quote, .hljs-meta { color: var(--hl-comment); font-style: italic; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable { color: var(--hl-attr); }
.hljs-title, .hljs-section, .hljs-name, .hljs-function .hljs-title { color: var(--hl-title); }
.hljs-type, .hljs-class .hljs-title, .hljs-params { color: var(--hl-type); }
.hljs-property { color: #d7e0e8; }
.hljs-punctuation, .hljs-operator { color: #7d8894; }
.hljs-deletion { color: #ff6b5e; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* --- ヘッダー ------------------------------------------------------------ */

.top {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(11, 13, 16, 0.92);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.brand { font-weight: 700; color: var(--fg); letter-spacing: 0.02em; }
.top nav { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; }
.top nav a { color: var(--muted); font-size: 0.92rem; }
.top nav a.on, .top nav a:hover { color: var(--fg); text-decoration: none; }
.repo { color: var(--muted); font-size: 0.92rem; }

main { max-width: 1040px; margin: 0 auto; padding: 32px 24px 64px; }

footer {
  border-top: 1px solid var(--line);
  padding: 24px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
footer p { margin: 4px 0; }
.muted { color: var(--dim); }

/* --- 見出しまわり -------------------------------------------------------- */

h1 { font-size: 1.9rem; line-height: 1.3; margin: 0 0 12px; letter-spacing: 0.01em; }
h2 {
  font-size: 1.32rem;
  color: var(--accent-text);
  margin: 2.4em 0 0.7em;
  padding: 0 0 8px 14px;
  border-left: 3px solid var(--accent);
  border-bottom: 1px solid var(--line);
  line-height: 1.4;
}
h3 {
  font-size: 1.06rem;
  margin: 2em 0 0.5em;
  padding-left: 14px;
  border-left: 3px solid #39424d;
  color: #eef3f7;
  line-height: 1.5;
}
h4 { font-size: 0.95rem; margin: 1.6em 0 0.3em; color: var(--muted); }
.lead { color: var(--muted); font-size: 1.02rem; max-width: 68ch; }
.tag {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 10px;
  vertical-align: middle;
}

.anchor { color: var(--dim); margin-right: 8px; font-weight: 400; opacity: 0; }
h2:hover .anchor, h3:hover .anchor { opacity: 1; }

/* --- トップ -------------------------------------------------------------- */

.hero { padding: 24px 0 8px; }
.hero h1 { font-size: 2.3rem; }
.hero-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

.button, button {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg);
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
}
.button:hover, button:hover { border-color: var(--accent); text-decoration: none; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #140800; font-weight: 600; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; }
.card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--fg);
}
.card:hover { border-color: var(--accent); text-decoration: none; }
.card h3 { margin: 0 0 4px; font-size: 1rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.6; }
.card .tag { margin-bottom: 8px; }
.face-card .thumb { aspect-ratio: 1; margin: -4px 0 14px; display: grid; place-items: center; }
.face-card .thumb img { width: 100%; border-radius: 50%; display: block; }

/* --- ドキュメント -------------------------------------------------------- */

.doc-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr) 180px; gap: 32px; align-items: start; }
.side, .toc { position: sticky; top: 76px; font-size: 0.85rem; display: flex; flex-direction: column; gap: 2px; }
.side p, .toc p { color: var(--dim); margin: 0 0 8px; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
.side a, .toc a { color: var(--muted); padding: 3px 0; line-height: 1.5; }
.side a.on { color: var(--accent); }
.side a:hover, .toc a:hover { color: var(--fg); text-decoration: none; }
.toc { max-height: calc(100vh - 110px); overflow-y: auto; }

.prose { min-width: 0; }
.prose > h1:first-child { margin-top: 0; }
.prose img { max-width: 100%; border-radius: 8px; display: block; margin: 8px 0; }
.prose table { border-collapse: collapse; width: 100%; margin: 18px 0; font-size: 0.9rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 13px; text-align: left; vertical-align: top; }
.prose th { background: #181f27; color: var(--accent-text); font-weight: 600; white-space: nowrap; letter-spacing: 0.02em; }
.prose tbody tr:nth-child(even) { background: #11161c; }
.prose td strong { color: #fff; }
.prose blockquote {
  border-left: 3px solid var(--accent);
  background: #12161b;
  border-radius: 0 8px 8px 0;
  margin: 18px 0;
  padding: 10px 18px;
  color: var(--muted);
}
.prose blockquote p:first-child { margin-top: 0; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }
.prose li { margin: 5px 0; }
.prose li::marker { color: var(--dim); }
.prose strong { color: #fff; font-weight: 600; }
.prose p { margin: 0.9em 0; }

/* --- 文字盤のプレビュー --------------------------------------------------- */

.face-layout { display: grid; grid-template-columns: minmax(0, 480px) minmax(260px, 1fr); gap: 32px; align-items: start; margin-top: 24px; }

.stage { min-width: 0; }
.watch {
  width: 100%;
  max-width: var(--size, 480px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #000;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 0 10px #1a1d21, 0 0 0 11px #2b3138, 0 24px 60px #0007;
}
.layer { position: absolute; left: 0; top: 0; transform-origin: top left; }
.w { position: absolute; }
.w img { display: block; width: 100%; height: 100%; }
.w-text { display: flex; }
.hint { color: var(--dim); font-size: 0.82rem; margin-top: 20px; }

.panel { min-width: 0; }
.panel h2 { margin-top: 0; }
.panel h2 + .row { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-size: 0.9rem; color: var(--muted); }
.row input[type="range"] { flex: 1; accent-color: var(--accent); min-width: 0; }
.row input[type="time"] { background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-family: var(--mono); }
.row input[type="checkbox"] { accent-color: var(--accent); }
.row output { font-family: var(--mono); color: var(--fg); min-width: 4.5ch; text-align: right; }
.row.buttons { margin-top: 18px; gap: 8px; }

.console {
  height: 180px;
  overflow-y: auto;
  font-size: 0.78rem;
  line-height: 1.6;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.console .line { color: var(--muted); }
.console .warn { color: #e0b341; }
.console .err { color: #ff6b5e; }

.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 16px 0; }
.meta > div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.meta dt { color: var(--dim); font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; }
.meta dd { margin: 4px 0 0; font-family: var(--mono); font-size: 0.86rem; line-height: 1.5; }

/* --- 狭い画面 ------------------------------------------------------------ */

@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; gap: 20px; }
  .side, .toc { position: static; flex-direction: row; flex-wrap: wrap; gap: 12px; max-height: none; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
  .side p, .toc p { width: 100%; margin: 0; }
  .face-layout { grid-template-columns: 1fr; }
  main { padding: 24px 16px 48px; }
  .top { padding: 12px 16px; gap: 12px; }
  .hero h1 { font-size: 1.8rem; }
}
