:root {
  color-scheme: light;
  --bg: #f5f5f2;
  --ink: #161616;
  --muted: #656761;
  --line: #d7d8d1;
  --paper: #fffef8;
  --accent: #0f6b5f;
  --danger: #a63b2f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Bahnschrift, "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 7px;
  cursor: pointer;
}

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

button.good {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

button.warn {
  border-color: #d8aaa3;
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.shell {
  min-height: 100vh;
}

.login {
  width: min(420px, calc(100vw - 32px));
  margin: 12vh auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.login h1,
.sidebar h1 {
  margin: 0 0 4px;
  font-size: 28px;
}

.login p,
.sub,
#previewHint {
  color: var(--muted);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  min-height: 38px;
  padding: 7px 9px;
}

.app {
  display: grid;
  grid-template-columns: 320px minmax(360px, 1fr) 300px;
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.sidebar,
.editor,
.preview {
  min-width: 0;
}

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

.badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  background: white;
  font-size: 12px;
}

.list {
  display: grid;
  gap: 8px;
}

.note {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
}

.note.active {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.note.current {
  background: #edf7f5;
}

.note img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 1px solid var(--line);
  image-rendering: pixelated;
}

.note strong,
.note span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.editor {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.editor h2 {
  margin: 0 0 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.small-grid {
  align-items: end;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.check input {
  width: auto;
}

code {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px;
}

.status {
  min-height: 24px;
  margin-top: 10px;
  color: var(--muted);
}

.preview {
  display: grid;
  align-content: start;
  gap: 12px;
}

.device {
  width: 240px;
  max-width: 100%;
  aspect-ratio: 1;
  border: 12px solid #eeeeea;
  border-radius: 18px;
  background: #fdfdf8;
  display: grid;
  place-items: center;
}

canvas,
#storedPreview {
  width: 200px;
  height: 200px;
  border: 1px solid #111;
  image-rendering: pixelated;
  background: white;
}

#storedPreview {
  display: none;
}

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

  .grid {
    grid-template-columns: 1fr;
  }
}
