:root {
  --bg: #ffffff;
  --fg: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --gutter-bg: #f9fafb;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --btn: #111827;
  --btn-bg: #f3f4f6;
  --btn-bg-hover: #e5e7eb;
  --accent: #2563eb;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
  --nav-h: 46px;
  --toolbar-h: 54px;
}

html[data-theme="dark"] {
  --bg: #0b1220;
  --fg: #e5e7eb;
  --muted: #9ca3af;
  --border: #1f2937;
  --gutter-bg: #0f172a;
  --surface: #0b1220;
  --surface-2: #0f172a;
  --btn: #e5e7eb;
  --btn-bg: #111827;
  --btn-bg-hover: #0b1220;
  --accent: #60a5fa;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
}

.navbar__inner {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 12px;
  gap: 10px;
}

.navbar__title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.navbar__meta {
  font-size: 12px;
  color: var(--muted);
}

.toolbar {
  position: sticky;
  top: var(--nav-h);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.toolbar__left,
.toolbar__right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--btn);
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.btn:hover {
  background: var(--btn-bg-hover);
}

.btn:active {
  transform: translateY(1px);
}

.btn--ghost {
  background: transparent;
}

.btn--file {
  display: inline-flex;
  align-items: center;
}

#fileInput {
  display: none;
}

.field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  height: 32px;
}

.field__label {
  font-size: 12px;
  color: var(--muted);
}

.select {
  background: transparent;
  color: var(--fg);
  border: none;
  outline: none;
  font-size: 13px;
  height: 26px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  height: 32px;
}

.toggle input {
  accent-color: var(--accent);
}

.divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 4px;
}

.main {
  height: calc(100vh - var(--nav-h) - var(--toolbar-h));
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 0;
}

@media (max-width: 980px) {
  .main {
    grid-template-columns: 1fr;
    min-height: 0;
  }
}

.panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}

.panel:last-child {
  border-right: none;
}

.panel__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.panel__title {
  font-weight: 600;
}

.panel__meta {
  font-size: 12px;
  color: var(--muted);
  min-height: 16px;
  text-align: right;
}

.editorWrap,
.editor {
  flex: 1;
  min-height: 0;
}

.editorWrap {
  display: flex;
}

.editor {
  width: 100%;
  height: 100%;
}

.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 12px 34px;
}

.about {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.about__title {
  margin: 0;
  font-size: 18px;
}

.about__p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.about__ref {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.about__ref a {
  color: var(--accent);
  text-decoration: none;
}

.about__ref a:hover {
  text-decoration: underline;
}

.about__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 980px) {
  .about__grid {
    grid-template-columns: 1fr;
  }
}

.about__card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 12px;
}

.about__card--wide {
  padding: 12px;
}

.about__h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.about__list {
  margin: 0;
  padding-left: 18px;
  color: color-mix(in oklab, var(--fg) 82%, var(--muted));
  line-height: 1.7;
}

.about__k {
  color: var(--fg);
  font-weight: 600;
}

.about__code {
  margin: 0;
  overflow: auto;
  border: 1px solid color-mix(in oklab, var(--border) 80%, transparent);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  font-size: 13px;
  line-height: 1.6;
}

.about code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  font-size: 12px;
  background: color-mix(in oklab, var(--surface) 80%, transparent);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  padding: 1px 6px;
  border-radius: 999px;
}

.faq {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
