@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+JP:wght@400;500;700&display=swap');

:root{
  /* Lark風トーン（※公式のデザイントークンではありません：雰囲気寄せ） */
  --app-bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(15, 23, 42, .10);
  --border-strong: rgba(15, 23, 42, .16);
  --link: #3370ff;
  --link-hover: #245bdb;
  --primary: #3370ff;
  --primary-weak: rgba(51,112,255,.12);
  --primary-weak-2: rgba(106,92,255,.10);
  --code-bg: #0b1220;
  --code-text: #e5e7eb;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 12px 32px rgba(15,23,42,.10);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 8px 18px rgba(15,23,42,.08);
  --radius-lg: 14px;
  --radius-md: 12px;
  --topbar-h: 56px;
}

@media (prefers-color-scheme: dark){
  :root{
    --app-bg: #0b0f19;
    --surface: #0f172a;
    --surface-2: #0b1326;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: rgba(226,232,240,.14);
    --border-strong: rgba(226,232,240,.20);
    --link: #79a6ff;
    --link-hover: #9fc0ff;
    --primary: #79a6ff;
    --primary-weak: rgba(121,166,255,.16);
    --primary-weak-2: rgba(172,140,255,.14);
    --code-bg: #050814;
    --code-text: #e5e7eb;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 14px 30px rgba(0,0,0,.35);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.30), 0 10px 22px rgba(0,0,0,.30);
  }
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  color: var(--text);
  background: var(--app-bg);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  line-height: 1.7;
}

.skip-link{
  position: absolute;
  left: -9999px;
  top: 0;
  padding: .75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: .5rem;
  z-index: 10;
}
.skip-link:focus{ left: 1rem; top: 1rem; }

/* Top bar (Lark風) */
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
}
.topbar-inner{
  max-width: 1320px;
  margin: 0 auto;
  padding: .65rem 1.1rem;
  display: grid;
  grid-template-columns: 1fr minmax(240px, 520px) 1fr;
  gap: 1rem;
  align-items: center;
}
.topbar-left,
.topbar-right{
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 0;
}
.topbar-right{ justify-content: flex-end; }
.topbar-divider{
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 .15rem;
}
.brand{
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  letter-spacing: .01em;
  user-select: none;
}
.brand-mark{
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background:
    radial-gradient(10px 10px at 30% 35%, rgba(51,112,255,.75), transparent 65%),
    radial-gradient(14px 14px at 65% 70%, rgba(106,92,255,.55), transparent 70%),
    linear-gradient(135deg, rgba(51,112,255,.22), rgba(106,92,255,.14));
  box-shadow: 0 6px 18px rgba(51,112,255,.14);
  border: 1px solid color-mix(in srgb, var(--border), rgba(51,112,255,.25) 55%);
}
.brand-text{ font-size: .98rem; white-space: nowrap; }
.brand-sub{ color: var(--muted); font-weight: 600; }
.topbar-context{
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  min-width: 0;
}
.context-title{
  font-size: .92rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.context-sub{
  font-size: .78rem;
  color: var(--muted);
}

.icon-btn{
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: color-mix(in srgb, var(--text) 88%, var(--muted));
  cursor: default;
}
.icon-btn svg{ opacity: .92; }

.search{
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
}
.search input{
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: .92rem;
}
.search svg{ opacity: .8; }

.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  height: 34px;
  padding: 0 .75rem;
  border-radius: 11px;
  border: 1px solid color-mix(in srgb, var(--primary) 55%, var(--border));
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  color: color-mix(in srgb, var(--text) 92%, var(--primary));
  text-decoration: none;
  font-weight: 650;
  font-size: .88rem;
}
.btn:hover{ border-color: color-mix(in srgb, var(--primary) 72%, var(--border)); }
.btn.btn-ghost{
  background: var(--surface);
  border-color: var(--border);
  color: color-mix(in srgb, var(--text) 92%, var(--muted));
}

.avatar{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 750;
  font-size: .9rem;
  color: color-mix(in srgb, var(--text) 90%, var(--primary));
  background: linear-gradient(135deg, var(--primary-weak), var(--primary-weak-2));
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
}

.layout{
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.25rem;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar{
  position: sticky;
  top: calc(var(--topbar-h) + 1rem);
  align-self: start;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: .95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.sidebar-head{
  padding: .85rem .85rem .75rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 12%, var(--surface)), var(--surface));
  margin-bottom: .85rem;
}
.sidebar-kicker{
  font-size: .74rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.sidebar-title{ font-weight: 750; margin-top: .15rem; }
.sidebar-sub{ font-size: .84rem; color: var(--muted); margin-top: .1rem; }

.content{
  min-width: 0;
}

.toc-nav .toc-title{
  font-weight: 700;
  margin: .1rem 0 .55rem;
}
.toc-list{
  list-style: none;
  margin: 0;
  padding-left: 0;
}
.toc-list .toc-list{
  padding-left: 1rem;
  margin-top: .4rem;
  border-left: 1px solid var(--border);
}
.toc-list li{
  margin: .25rem 0;
}
.toc-list a{
  color: var(--link);
  text-decoration: none;
}
.toc-list a:hover{
  color: var(--link-hover);
  text-decoration: underline;
}

.toc-mobile{
  display: none;
  margin-bottom: 1rem;
  padding: .75rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.toc-mobile summary{
  cursor: pointer;
  font-weight: 700;
}

.doc-toolbar{
  display: flex;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  padding: .95rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}
.doc-toolbar-left{
  display: flex;
  gap: .65rem;
  align-items: center;
  min-width: 0;
}
.doc-toolbar-title{
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill{
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 .55rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: color-mix(in srgb, var(--text) 92%, var(--primary));
  font-weight: 800;
  font-size: .72rem;
  letter-spacing: .08em;
}
.doc-toolbar-actions{
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.chip{
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 .65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: color-mix(in srgb, var(--text) 88%, var(--muted));
  text-decoration: none;
  font-weight: 650;
  font-size: .84rem;
}
.chip:hover{ border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }

.ui-mocks{
  margin: 0 0 1rem;
}
.ui-mocks-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.ui-card{
  margin: 0;
  padding: .9rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.ui-card figcaption{
  font-weight: 750;
  font-size: .92rem;
  margin: 0 0 .6rem;
}
.ui-svg{
  width: 100%;
  height: auto;
  display: block;
}
.ui-img{
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.ui-mocks-note{
  margin: .75rem 0 0;
  color: var(--muted);
  font-size: .92rem;
}

.doc{
  padding: 1.25rem 1.25rem 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.doc h1, .doc h2, .doc h3, .doc h4, .doc h5, .doc h6{
  line-height: 1.25;
  margin-top: 2.2rem;
  margin-bottom: .75rem;
  scroll-margin-top: calc(var(--topbar-h) + 1rem);
}
.doc h1{ font-size: 1.75rem; }
.doc h2{ font-size: 1.4rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.doc h3{ font-size: 1.15rem; }
.doc h4{ font-size: 1.05rem; }

.doc p{ margin: .8rem 0; }
.doc ul, .doc ol{ padding-left: 1.4rem; }
.doc li{ margin: .25rem 0; }

.doc a{
  color: var(--link);
}
.doc a:hover{
  color: var(--link-hover);
}

.doc hr{
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

.anchor{
  margin-left: .5rem;
  font-size: .9em;
  opacity: 0;
  text-decoration: none;
}
.doc h1:hover .anchor,
.doc h2:hover .anchor,
.doc h3:hover .anchor,
.doc h4:hover .anchor,
.doc h5:hover .anchor,
.doc h6:hover .anchor{
  opacity: .65;
}
.anchor:focus{ opacity: 1; outline: none; }

pre{
  background: var(--code-bg);
  color: var(--code-text);
  padding: 2.35rem 1rem 1rem;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  position: relative;
}
pre::before{
  content: "";
  position: absolute;
  top: .85rem;
  left: .95rem;
  width: .7rem;
  height: .7rem;
  border-radius: 999px;
  background: #ff5f57;
  box-shadow: 1.05rem 0 0 #febc2e, 2.1rem 0 0 #28c840;
  opacity: .95;
}
pre::after{
  content: "Lark Base";
  position: absolute;
  top: .7rem;
  left: 3.35rem;
  font-size: .78rem;
  letter-spacing: .02em;
  color: rgba(229,231,235,.72);
}
code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Noto Sans Mono", monospace;
  font-size: .92em;
}
:not(pre) > code{
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: .1rem .35rem;
  border-radius: .35rem;
}

table{
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  display: block;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}
thead th{
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--surface-2) 75%, var(--surface));
}
th, td{
  border: 1px solid var(--border);
  padding: .55rem .6rem;
  vertical-align: top;
}
tbody tr:nth-child(even){
  background: color-mix(in srgb, var(--surface), transparent 45%);
}

.task-list-item{
  list-style: none;
  margin-left: -1.4rem;
}
.task-list-item-checkbox{
  margin-right: .5rem;
  transform: translateY(1px);
}

.site-footer{
  margin-top: 1.25rem;
  padding: 0 .25rem;
  color: var(--muted);
  font-size: .9rem;
}

@media (max-width: 980px){
  .layout{
    grid-template-columns: 1fr;
  }
  .sidebar{
    display: none;
  }
  .toc-mobile{
    display: block;
  }
  .topbar-inner{ grid-template-columns: 1fr; }
  .topbar-center{ display: none; }
  .doc-toolbar{ flex-direction: column; align-items: flex-start; }
  .doc-toolbar-actions{ justify-content: flex-start; }
  .ui-mocks-grid{ grid-template-columns: 1fr; }
  .doc{
    padding: 1rem 1rem 1.75rem;
  }
}

@media print{
  .topbar, .sidebar, .toc-mobile, .site-footer, .doc-toolbar, .ui-mocks{ display: none !important; }
  .layout{ padding: 0; }
  .doc{ box-shadow: none; border: none; }
  a{ color: inherit; text-decoration: none; }
}
