:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --fg: #1d1e20;
  --muted: #6b6d72;
  --border: #e2e2de;
  --accent: #2f5fd0;
  --accent-fg: #ffffff;
  --accent-soft: #e6edfb;
  --danger: #c23a2b;
  --ok: #2e8a4f;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181a;
    --card: #222326;
    --fg: #ececea;
    --muted: #9a9ca1;
    --border: #34353a;
    --accent: #7aa2ff;
    --accent-fg: #0f1320;
    --accent-soft: #263150;
    --danger: #ff7b6b;
    --ok: #6fd08f;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 0 max(16px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
main, .login, .bar { max-width: 720px; margin: 0 auto; }

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 0 12px;
}
.bar h1 { font-size: 22px; margin: 0; letter-spacing: -0.01em; }
.status { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.status.on { background: var(--ok); }
.status.off { background: var(--danger); }
.icon-btn {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--muted);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}
.icon-btn:hover { color: var(--fg); background: var(--card); }

button, .btn, input, textarea { font: inherit; color: inherit; }
.btn, .primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}
.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; font-weight: 600; }
.btn:hover { border-color: var(--muted); }
.primary:hover { filter: brightness(1.06); }
button:disabled { opacity: 0.55; cursor: default; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 14px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.ghost:hover { color: var(--danger); }
.btn.danger { color: var(--danger); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.compose { display: grid; gap: 10px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; }
#pasteBtn, #pasteBtn + .btn { min-height: 52px; }
#pasteBtn { font-size: 17px; }
textarea {
  flex: 1 1 200px;
  min-height: 44px;
  max-height: 240px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  resize: none;
}
.hint { margin: 0; color: var(--muted); font-size: 14px; }
.note { margin: 0; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-size: 14px; }
.search {
  display: block;
  width: 100%;
  margin-top: 16px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  font: inherit;
  color: inherit;
}

.list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 12px 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.item:hover { border-color: var(--muted); }
.item.fresh { animation: fresh 1.6s ease-out; }
.item.copied { animation: copied 0.9s ease-out; }
@keyframes fresh { from { background: var(--accent-soft); } }
@keyframes copied { from { border-color: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); } }
.body pre {
  margin: 0;
  font: 15px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 9.5em;
  overflow: hidden;
}
.body pre.clipped { -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.body img { display: block; max-width: 100%; max-height: 320px; border-radius: 8px; background: var(--bg); }
.item.image .body { min-height: 60px; }
.item.files .body { display: grid; gap: 8px; }
.file-row { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.file-icon {
  flex: none;
  width: 32px;
  height: 40px;
  border-radius: 4px 12px 4px 4px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
}
.file-name { overflow-wrap: anywhere; font-weight: 500; }
.item.broken .body { color: var(--muted); font-size: 14px; }
.foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.info { color: var(--muted); font-size: 13px; flex: 1 1 auto; min-width: 0; }
.acts { display: flex; gap: 6px; flex: none; }
.empty { color: var(--muted); text-align: center; margin: 40px 0; }

.login form { display: grid; gap: 14px; margin-top: 12px; max-width: 420px; }
.more { color: var(--muted); font-size: 14px; }
.more summary { cursor: pointer; padding: 4px 0; }
.more label { margin-top: 10px; }
.lead { margin: 0; color: var(--muted); }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
label input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  font-size: 16px;
}
.error { color: var(--danger); margin: 0; min-height: 1.4em; }
.muted { color: var(--muted); font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.sheet {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--fg);
  width: min(440px, calc(100vw - 32px));
  padding: 20px;
}
.sheet::backdrop { background: rgb(0 0 0 / 35%); }
.sheet h2 { margin: 0 0 14px; font-size: 18px; }
.sheet form { display: grid; gap: 14px; }

.drop {
  position: fixed;
  inset: 12px;
  border: 2px dashed var(--accent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  display: grid;
  place-items: center;
  font-size: 20px;
  pointer-events: none;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px);
  background: var(--fg);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--danger); color: #fff; }

@media (max-width: 480px) {
  .foot { flex-wrap: wrap; }
  .acts { margin-left: auto; }
}
