/* mayPaste —— 克制的中性底色 + 单一强调色，浅深色随系统切换。 */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f1f1ee;
  --text: #1b1b19;
  --muted: #77776f;
  --faint: #a2a29a;
  --border: #e5e4df;
  --border-strong: #d5d4cd;
  --accent: #5b53d8;
  --accent-soft: #ecebfb;
  --accent-fg: #ffffff;
  --danger: #c0453b;
  --danger-soft: #fbeceb;
  --ok: #2f8a5b;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(20, 20, 18, .05);
  --shadow: 0 1px 2px rgba(20, 20, 18, .04), 0 10px 28px rgba(20, 20, 18, .06);

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --surface: #1c1c1b;
    --surface-2: #242423;
    --text: #edece9;
    --muted: #9b9b93;
    --faint: #6f6f68;
    --border: #2d2d2b;
    --border-strong: #3b3b38;
    --accent: #8d85ff;
    --accent-soft: #262338;
    --accent-fg: #14131f;
    --danger: #ef6b60;
    --danger-soft: #2e1d1b;
    --ok: #5cc08a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .28);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
}

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

/* ---------- 图标 ---------- */

.mark { width: 44px; height: 44px; }
.mark-sm { width: 22px; height: 22px; }
.mark-body { fill: var(--accent); }
.mark-clip { fill: var(--accent); }
.mark-line { stroke: var(--accent-fg); stroke-width: 2; stroke-linecap: round; }

/* ---------- 锁屏 ---------- */

.lock {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.lock-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
}

.lock-card h1 {
  margin: 16px 0 0;
  font-size: 25px;
  font-weight: 620;
  letter-spacing: -.015em;
}

.lock-sub {
  margin: 6px 0 26px;
  color: var(--muted);
  font-size: 14px;
}

.field {
  position: relative;
  width: 100%;
}

.field input {
  width: 100%;
  height: 48px;
  padding: 0 44px 0 16px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}

.field input::placeholder { color: var(--faint); }

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.reveal {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--faint);
}

.reveal:hover { color: var(--muted); background: var(--surface-2); }
.reveal.on { color: var(--accent); }

.reveal svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.lock-note {
  margin: 20px 0 0;
  color: var(--faint);
  font-size: 12.5px;
  line-height: 1.7;
}

/* ---------- 按钮 ---------- */

.btn-primary {
  width: 100%;
  height: 46px;
  margin-top: 10px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--radius);
  font-weight: 560;
  transition: filter .15s, opacity .15s;
}

.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { filter: brightness(.94); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; filter: none; }

.btn-sm {
  width: auto;
  height: 34px;
  margin: 0;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.btn-ghost {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
  transition: background .15s, color .15s;
}

.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-text {
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  transition: background .15s, color .15s;
}

.btn-text:hover { background: var(--surface-2); color: var(--text); }
.btn-text.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-text.armed { background: var(--danger-soft); color: var(--danger); font-weight: 560; }

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.room {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 4px 10px 4px 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: default;
}

.room-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--room-color, var(--faint));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

.room-code {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .02em;
  color: var(--muted);
}

/* ---------- 主体 ---------- */

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 22px max(16px, env(safe-area-inset-left)) 80px max(16px, env(safe-area-inset-right));
}

.compose {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}

.compose:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.compose textarea {
  display: block;
  width: 100%;
  min-height: 78px;
  max-height: 44vh;
  padding: 14px 16px 4px;
  border: 0;
  background: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.65;
  resize: none;
}

.compose textarea:focus { outline: none; }
.compose textarea::placeholder { color: var(--faint); font-family: var(--sans); font-size: 14.5px; }

.compose-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 16px;
}

/* 撑开右侧的是计数器，不是快捷键提示：提示在小屏会被隐藏，把 auto 边距挂在
   会消失的元素上，按钮就会跟着跑到左边。 */
.counter {
  margin-right: auto;
  font-size: 12.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.counter.over { color: var(--danger); }

.kbd {
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 11.5px;
}

/* ---------- 列表 ---------- */

.list-head {
  display: flex;
  align-items: center;
  min-height: 30px;
  margin: 26px 2px 10px;
}

.list-count {
  color: var(--faint);
  font-size: 12.5px;
  letter-spacing: .02em;
}

.list-head .btn-text { margin-left: auto; }

.items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: rise .22s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: none; }
}

.item.leaving {
  animation: fade .18s ease both;
}

@keyframes fade {
  to { opacity: 0; transform: scale(.985); }
}

.item-body {
  position: relative;
  margin: 0;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.item-body.clamped {
  max-height: 260px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 200px, transparent 258px);
  mask-image: linear-gradient(to bottom, #000 200px, transparent 258px);
}

.item-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px 7px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.item-meta {
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.item-bar .spacer { margin-left: auto; }

.item-bar .btn-text.ok { color: var(--ok); font-weight: 560; }

.empty {
  padding: 48px 16px;
  text-align: center;
}

.empty-title { margin: 0; color: var(--muted); font-size: 14.5px; }
.empty-sub { margin: 6px 0 0; color: var(--faint); font-size: 13px; }

.warn {
  margin: 18px 0 0;
  padding: 11px 14px;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ---------- 提示条 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 50;
  transform: translate(-50%, 8px);
  max-width: calc(100vw - 32px);
  padding: 9px 16px;
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  opacity: 0;
  transition: opacity .18s, transform .18s;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); color: #fff; }

/* ---------- 小屏 ---------- */

@media (max-width: 560px) {
  .wrap { padding-top: 16px; }
  .brand span { display: none; }
  .kbd { display: none; }
  .item-body { font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
