:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #171714;
  --muted: #77776f;
  --line: #e6e6e0;
  --soft: #f0f0eb;
  --danger: #b42318;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(21, 21, 18, 0.04), 0 14px 40px rgba(21, 21, 18, 0.045);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
}

button,
a,
textarea,
input {
  -webkit-tap-highlight-color: transparent;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, opacity 160ms ease, transform 160ms ease;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(23, 23, 20, 0.18);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
}

.login-card {
  width: min(100%, 390px);
  text-align: center;
}

.mark,
.brand-mark {
  display: inline-grid;
  place-items: center;
  background: var(--text);
  color: #fff;
  font-weight: 750;
  letter-spacing: -0.04em;
}

.mark {
  width: 52px;
  height: 52px;
  margin-bottom: 30px;
  border-radius: 15px;
  font-size: 1.25rem;
  box-shadow: 0 10px 24px rgba(23, 23, 20, 0.16);
}

.login-card h1 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.15rem);
  letter-spacing: -0.045em;
}

.subtle {
  margin: 9px 0 28px;
  color: var(--muted);
  font-size: 0.95rem;
}

.login-form {
  display: grid;
  gap: 12px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:hover,
textarea:hover {
  border-color: #d4d4cc;
}

input:focus,
textarea:focus {
  border-color: #b8b8af;
  box-shadow: 0 0 0 4px rgba(23, 23, 20, 0.045);
}

input {
  height: 54px;
  padding: 0 16px;
  text-align: center;
}

textarea {
  display: block;
  padding: 16px;
  resize: vertical;
  line-height: 1.65;
  outline: none;
}

.primary {
  min-height: 50px;
  padding: 0 20px;
  background: var(--text);
  color: #fff;
  font-weight: 650;
}

.primary:hover:not(:disabled) {
  background: #30302b;
}

.form-error {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 0.86rem;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 10px 5%;
  border-bottom: 1px solid rgba(230, 230, 224, 0.88);
  background: rgba(247, 247, 245, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 0.8rem;
}

.header-actions,
.item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quiet,
.action-button {
  min-height: 44px;
  padding: 0 13px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.quiet:hover,
.action-button:hover:not(:disabled) {
  background: var(--soft);
  color: var(--text);
}

.workspace {
  width: 90%;
  margin: 0 auto;
  padding: 52px 0 max(80px, env(safe-area-inset-bottom));
}

.composer,
.paste-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.composer {
  padding: 28px;
}

.section-heading,
.list-heading,
.card-footer,
.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  margin-bottom: 19px;
}

.section-heading h1,
.list-heading h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.035em;
}

.character-count,
.item-count,
.updated-at,
.shortcut-hint {
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

#newContent {
  min-height: 142px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 2px 0;
  font-size: 1rem;
  box-shadow: none;
}

#newContent::placeholder {
  color: #adada5;
}

.composer-footer {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.add-button {
  min-height: 44px;
}

.paste-section {
  margin-top: 52px;
}

.list-heading {
  margin-bottom: 18px;
  padding: 0 3px;
}

.item-list {
  display: grid;
  gap: 14px;
}

.paste-card {
  padding: 22px 22px 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.paste-card:focus-within {
  border-color: #d3d3cb;
  box-shadow: 0 1px 2px rgba(21, 21, 18, 0.04), 0 18px 44px rgba(21, 21, 18, 0.065);
}

.item-editor {
  min-height: 112px;
  max-height: 460px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none !important;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.card-footer {
  min-height: 49px;
  margin-top: 14px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.updated-at[data-dirty="true"] {
  color: #8a5d00;
}

.copy-button {
  background: var(--text);
  color: #fff;
}

.copy-button:hover:not(:disabled) {
  background: #30302b;
  color: #fff;
}

.save-button[data-visible="false"] {
  visibility: hidden;
}

.delete-button.confirming {
  background: #fff1f0;
  color: var(--danger);
}

.state-message {
  padding: 54px 20px;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 5px;
  border: 1px dashed #d8d8d1;
  border-radius: var(--radius);
}

.empty-state p {
  margin: 4px 0 0;
  color: var(--text);
  font-weight: 650;
}

.empty-state span:last-child {
  font-size: 0.8rem;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--text);
  font-size: 1.2rem;
}

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  max-width: calc(100vw - 40px);
  padding: 11px 16px;
  transform: translateX(-50%);
  border-radius: 10px;
  background: #252521;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  color: #fff;
  font-size: 0.85rem;
  text-align: center;
}

.toast.error {
  background: #8f1d14;
}

.copy-helper {
  position: fixed;
  inset: 0 auto auto -9999px;
  opacity: 0;
}

@media (max-width: 600px) {
  .topbar {
    min-height: 62px;
    padding: 9px 5%;
  }

  .brand span:last-child {
    display: none;
  }

  .workspace {
    width: 90%;
    padding-top: 26px;
  }

  .composer {
    padding: 21px 18px 18px;
  }

  .paste-section {
    margin-top: 38px;
  }

  .paste-card {
    padding: 18px 16px 10px;
  }

  .card-footer {
    align-items: flex-end;
    gap: 8px;
  }

  .item-actions {
    gap: 2px;
  }

  .action-button {
    padding: 0 10px;
  }

  .updated-at {
    max-width: 92px;
  }

  .shortcut-hint {
    display: none;
  }

  .composer-footer {
    justify-content: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
