:root {
  color-scheme: light;
  --bg: #f7f7f2;
  --panel: #ffffff;
  --ink: #1e2329;
  --muted: #68717d;
  --line: #d8d9d2;
  --accent: #1f766f;
  --accent-ink: #ffffff;
  --warn: #946300;
  font-family: system-ui, "Noto Sans JP", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button {
  min-height: 32px;
  border: 1px solid #bfc4be;
  border-radius: 6px;
  padding: 4px 10px;
  color: var(--ink);
  background: #fff;
}

button:hover {
  border-color: var(--accent);
}

button.primary {
  color: var(--accent-ink);
  background: var(--accent);
}

input {
  min-width: 0;
  min-height: 32px;
  border: 1px solid #bfc4be;
  border-radius: 6px;
  padding: 4px 8px;
}

.appbar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 52px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #f0f1ea;
}

.brand {
  flex: 0 0 auto;
  font-weight: 700;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  height: calc(100vh - 52px);
}

.editor-pane {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 30px;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.drop-zone {
  position: relative;
  min-height: 0;
}

.drop-zone.dragging::after {
  position: absolute;
  inset: 12px;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 8px;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.8);
  content: "ここにファイルをドロップ";
  font-weight: 700;
  pointer-events: none;
}

#editor,
#fallback-editor {
  width: 100%;
  height: 100%;
}

#fallback-editor {
  display: none;
  resize: none;
  border: 0;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  font: 14px/1.5 "Cascadia Mono", "Consolas", monospace;
}

.cm-editor {
  height: 100%;
  font-size: 14px;
}

.cm-scroller {
  font-family: "Cascadia Mono", "Consolas", monospace;
}

.statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 4px 10px;
  border-top: 1px solid var(--line);
  color: #35404a;
  background: #f0f1ea;
  font-size: 12px;
  white-space: nowrap;
}

.statusbar span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidepane {
  overflow: auto;
  padding: 12px;
  background: #fbfbf8;
}

.sidepane section + section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

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

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

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

.results {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.results li {
  margin-bottom: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.results button {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  border: 0;
  padding: 8px;
  text-align: left;
  background: transparent;
}

.results .meta {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.compact li {
  margin-bottom: 4px;
}

.log {
  min-height: 180px;
  max-height: 320px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  color: #17212b;
  background: #fff;
  font: 12px/1.45 "Cascadia Mono", "Consolas", monospace;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .appbar {
    display: block;
  }

  .brand {
    margin-bottom: 8px;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(60vh, 1fr) auto;
    height: auto;
    min-height: calc(100vh - 52px);
  }

  .editor-pane {
    min-height: 60vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
