/* Clipboard — calm, minimal, responsive. No third-party assets. */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #5c6b7a;
  --line: #e3e7ec;
  --accent: #2f6fed;
  --accent-hover: #265fc4;
  --danger: #c93a37;
  --danger-hover: #a72f2c;
  --ok: #1e8e5a;
  --focus: #2f6fed;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 45, .08), 0 8px 24px rgba(20, 30, 45, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181e;
    --card: #1d232c;
    --text: #e6ebf2;
    --muted: #97a4b3;
    --line: #2c3542;
    --accent: #5b8dff;
    --accent-hover: #7aa2ff;
    --danger: #e0625f;
    --danger-hover: #ef817e;
    --ok: #3fbf83;
    --focus: #5b8dff;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}
.main { max-width: 760px; margin: 0 auto; padding: 16px 16px 48px; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner {
  max-width: 760px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--accent); }

/* Buttons: >=44px touch targets on mobile */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: var(--radius);
  font: inherit; font-weight: 550; padding: 10px 18px; min-height: 44px;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary[disabled] { opacity: .6; cursor: default; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.spacer { flex: 1; }

/* Login */
.login-view { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 32px 28px; text-align: center;
}
.login-card .logo { color: var(--accent); margin-bottom: 4px; }
.login-card h1 { margin: 0 0 4px; font-size: 1.4rem; }
.login-sub { margin: 0 0 20px; color: var(--muted); font-size: .9rem; }
.field { text-align: left; margin-bottom: 14px; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; color: var(--muted); }
.field input {
  width: 100%; padding: 10px 12px; min-height: 44px; font: inherit;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text);
}
.field input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.form-error { color: var(--danger); font-size: .9rem; margin: 4px 0 12px; }

/* Composer */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.composer { padding: 14px; margin-bottom: 16px; }
.composer textarea {
  width: 100%; resize: vertical; min-height: 96px; padding: 12px;
  font: inherit; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--text);
}
.composer textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 12px; }
.char-count { color: var(--muted); font-size: .8rem; }

/* Toolbar */
.toolbar { display: flex; gap: 8px; margin-bottom: 8px; min-width: 0; }
.search-wrap {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted);
}
.search-wrap:focus-within { outline: 3px solid var(--focus); outline-offset: 1px; }
.search-wrap input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text);
  font: inherit; min-height: 44px; padding: 0;
}
.search-wrap input:focus { outline: none; }
.status-line { color: var(--muted); font-size: .88rem; min-height: 1.4em; margin: 4px 2px; }
.status-line.error { color: var(--danger); }

/* Clip list */
.clip-list { display: flex; flex-direction: column; gap: 10px; }
.clip-item { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.clip-preview {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88rem; white-space: pre-wrap; word-break: break-word;
  max-height: 5.6em; overflow: hidden; cursor: pointer; color: var(--text);
}
.clip-preview:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.clip-meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.clip-time { color: var(--muted); font-size: .78rem; flex: 1; min-width: 120px; }
.clip-actions { display: flex; gap: 6px; }
.clip-actions .btn { padding: 8px 12px; min-height: 40px; font-size: .88rem; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 16, 24, .55);
  display: grid; place-items: center; padding: 16px; z-index: 50;
}
.modal { width: 100%; max-width: 640px; padding: 18px; max-height: 92dvh; display: flex; flex-direction: column; }
.modal h2 { margin: 0 0 8px; font-size: 1.1rem; }
.modal-sm { max-width: 380px; }
.meta { display: flex; gap: 24px; margin: 0 0 10px; flex-wrap: wrap; }
.meta dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.meta dd { margin: 0; font-size: .85rem; }
.clip-text {
  width: 100%; resize: vertical; min-height: 180px; padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem;
  white-space: pre-wrap; word-break: break-word;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text);
}
.modal-footer { display: flex; gap: 8px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
.confirm-text { color: var(--muted); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: .9rem; box-shadow: var(--shadow); z-index: 99; max-width: 90vw; text-align: center;
}
.toast.error { background: var(--danger); color: #fff; }

/* Loading / empty */
.loading { color: var(--muted); text-align: center; padding: 40px 0; }
.skeleton { height: 72px; border-radius: 14px; background: var(--card); opacity: .6; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty svg { color: var(--line); margin-bottom: 8px; }
.load-more-wrap { text-align: center; margin-top: 14px; }

@media (max-width: 520px) {
  .main { padding: 12px 12px 40px; }
  .clip-actions .btn { flex: 1; }
}
