:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --text: #1f2421;
  --muted: #5b625e;
  --line: #d9dcd6;
  --accent: #2f5d50;
  --accent-text: #ffffff;
  --warn: #8a3b12;
  --warn-bg: #fdf1e8;
  --focus: #1f6feb;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151816;
    --card: #1e2220;
    --text: #e8ebe8;
    --muted: #a3aba6;
    --line: #353b38;
    --accent: #6fb49d;
    --accent-text: #0e1311;
    --warn: #f3b48c;
    --warn-bg: #2d1f16;
    --focus: #79b0ff;
  }
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  font-size: 17px;
  line-height: 1.5;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 16px;
}
.brand h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.2rem; margin: 8px 0 12px; }

p { margin: 0 0 12px; }

.hint { color: var(--muted); font-size: 0.95rem; }

.message:empty { display: none; }
.message {
  color: var(--warn);
  background: var(--warn-bg);
  border-radius: 8px;
  padding: 10px 12px;
}

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

label { font-weight: 600; }

input, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 44px;
}
textarea { resize: vertical; min-height: 110px; }

button {
  font: inherit;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
button:hover { border-color: var(--muted); }
button:disabled { opacity: 0.6; cursor: default; }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
button.big { min-width: 110px; font-size: 1.05rem; }
button.link {
  background: none;
  border: none;
  padding: 8px 0;
  color: var(--muted);
  text-decoration: underline;
}

:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.status { margin: 0; color: var(--muted); font-size: 0.95rem; }
.status.warn { color: var(--warn); font-weight: 600; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.code-big {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  word-break: break-word;
  background: var(--card);
  border: 1px dashed var(--muted);
  border-radius: 8px;
  padding: 12px;
  user-select: all;
}

.notes { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }

.note {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.note-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 6em;
  overflow: hidden;
  cursor: pointer;
  border-radius: 4px;
}
.note-text.open { max-height: none; }
.note-meta { color: var(--muted); font-size: 0.85rem; margin: 6px 0 8px; }

@media (max-width: 420px) {
  .topbar .row button { flex: 1 1 auto; }
}
