:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --ink: #1d1d1b;
  --muted: #6b6a64;
  --line: #e2e0d8;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --danger: #a3271b;
  --ok: #2c6e3f;
  --code-bg: #f0eee7;
  --tok-key: #8a3b9e;
  --tok-str: #2c6e3f;
  --tok-num: #a85a00;
  --tok-com: #8a8880;
  --tok-fn: #1f5f8b;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}


* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  overflow-wrap: anywhere;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- bar ---------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 64px;
}

.mark {
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
  font-size: 15px;
  text-decoration: none;
}

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: 600 15px/1 var(--sans);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover { border-color: var(--muted); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, .seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.w-copy { width: 108px; }
.btn.w-wide { width: 100%; }

.hidden-keep { visibility: hidden; }

/* ---------- reading ---------- */

.paste {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}

.paste pre.plain {
  margin: 0;
  font: inherit;
  white-space: pre-wrap;
}

.paste pre.code, .md pre {
  margin: 0;
  font: 14.5px/1.55 var(--mono);
  white-space: pre-wrap;
  background: var(--code-bg);
  border-radius: 8px;
  padding: 14px;
}

.paste.is-code { padding: 0; overflow: hidden; }
.paste.is-code pre.code { border-radius: 0; padding: 20px; background: var(--surface); }

.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { line-height: 1.25; margin: 1.4em 0 0.5em; }
.md h1 { font-size: 1.6em; }
.md h2 { font-size: 1.3em; }
.md h3 { font-size: 1.1em; }
.md a { color: var(--accent); }
.md code { font: 0.88em var(--mono); background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
.md pre code { background: none; padding: 0; font-size: inherit; }
.md blockquote { margin: 1em 0; padding-left: 14px; border-left: 3px solid var(--line); color: var(--muted); }
.md table { border-collapse: collapse; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; }
.md img { max-width: 100%; height: auto; }
.md hr { border: 0; border-top: 1px solid var(--line); }

.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-type, .hljs-literal { color: var(--tok-key); }
.hljs-string, .hljs-regexp, .hljs-attr-value, .hljs-template-string { color: var(--tok-str); }
.hljs-number, .hljs-symbol, .hljs-attribute { color: var(--tok-num); }
.hljs-comment, .hljs-quote, .hljs-meta { color: var(--tok-com); font-style: italic; }
.hljs-title, .hljs-function .hljs-title, .hljs-section, .hljs-name, .hljs-attr { color: var(--tok-fn); }

.foot {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  padding: 0 0 40px;
  min-height: 22px;
}

.foot svg { width: 16px; height: 16px; flex: none; color: var(--ok); }

/* ---------- notices and forms ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 20px;
  margin: 8vh auto 24px;
  max-width: 420px;
}

.card h1 { font-size: 21px; line-height: 1.3; margin: 0 0 8px; }
.card p { margin: 0 0 16px; color: var(--muted); }
.card p:last-child { margin-bottom: 0; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }

input[type="text"], input[type="password"], input[inputmode], textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.4 var(--sans);
  padding: 11px 12px;
}

input.pin { font: 600 22px/1.2 var(--mono); letter-spacing: 0.2em; text-align: center; }
input.masked { -webkit-text-security: disc; }
.msg.form-msg { margin: 0 0 12px; }
.card .msg { color: var(--danger); font-weight: 600; }
.card .msg.ok { color: var(--ok); }
input:disabled { opacity: 0.45; }

.msg { min-height: 24px; margin: 10px 0 0; font-size: 15px; color: var(--danger); }
.msg.ok { color: var(--ok); }

/* ---------- editor ---------- */

.editor textarea {
  min-height: 46vh;
  resize: vertical;
  font: 16px/1.55 var(--mono);
  background: var(--surface);
}

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.row.between { justify-content: space-between; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; max-width: 420px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.seg span { display: flex; align-items: center; justify-content: center; height: 42px; font: 600 14px/1 var(--sans); color: var(--muted); cursor: pointer; }
.seg label + label span { border-left: 1px solid var(--line); }
.seg input:checked + span { background: var(--ink); color: var(--bg); }

.count { font: 13px/1.2 var(--mono); color: var(--muted); width: 230px; }
.count.warn { color: var(--danger); }

.lock {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 12px 0;
}

.switch { display: flex; align-items: center; gap: 12px; font-weight: 600; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; width: 48px; height: 28px; border-radius: 14px; background: var(--line); flex: none; transition: background 0.15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.lock-fields { display: grid; grid-template-columns: 1fr; gap: 0 12px; margin-top: 14px; }
.lock-note { font-size: 14px; color: var(--muted); margin: 0; }

@media (min-width: 560px) {
  .lock-fields { grid-template-columns: 180px 1fr; }
}

.result {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 12px 0 28px;
}

.result .link {
  font: 14px/1.4 var(--mono);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 20px;
  margin-bottom: 12px;
}

.result .link.ready { color: var(--ink); }
.result .actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.result .msg { margin-top: 8px; }

h2.section { font-size: 17px; margin: 32px 0 10px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.list .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .meta { grid-column: 1; font-size: 13px; color: var(--muted); }
.list .acts { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 8px; }
.list .acts .btn { width: 72px; }
.list li.dead { opacity: 0.55; }
.list li.empty { display: block; background: none; border: 0; padding: 0; color: var(--muted); font-size: 15px; }

.signout { margin: 32px 0 48px; }
