:root {
  color-scheme: light;
  --surface: #fff;
  --canvas: #f5f3ee;
  --ink: #242322;
  --muted: #645e57;
  --line: #e3ded4;
  --stroke: #bbb3a6;
  --gold: #b79a68;
  font-family: "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 14px; }
button, input, a { font: inherit; color: inherit; }
a { text-decoration: none; }
:focus-visible { outline: 2px solid #9a784d; outline-offset: 3px; }
.masthead { background: #191919; color: #fff; border-bottom: 2px solid var(--gold); }
.bar { max-width: 1160px; min-height: 54px; margin: auto; padding: 7px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; }
.brand img { width: 28px; height: 28px; }
.bar button { border-color: #57534d; background: #252525; color: #fff; }
.bar button:hover { background: #3a352d; }
h1, h2, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 15px; }
input, button, .button {
  min-height: 38px; border: 1px solid var(--stroke); border-radius: 6px; background: var(--surface);
  padding: 7px 10px;
}
input { width: 100%; }
button, .button { cursor: pointer; white-space: nowrap; }
.button { display: inline-flex; align-items: center; }
button:hover, .button:hover { background: #f1ece2; border-color: var(--gold); }
.primary { background: var(--ink); border-color: var(--ink); color: white; font-weight: 600; }
.primary:hover { background: #3a352d; }
.login-shell { display: grid; place-items: start center; padding: clamp(45px, 11dvh, 110px) 16px 28px; }
.login-card { width: min(100%, 393px); padding: clamp(19px, 5vw, 29px); border: 1px solid var(--line); border-top: 3px solid var(--gold);
  border-radius: 11px; background: var(--surface); box-shadow: 0 9px 27px #29231710; }
.login-card form { display: grid; gap: 9px; margin-top: 22px; }
.login-card .primary { margin-top: 5px; min-height: 42px; }
label, .error { font-size: 13px; }
.error, .danger { color: #a03931; }
.home { max-width: 1160px; margin: auto; padding: 24px 20px 40px; display: grid; gap: 16px; }
.heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.search { display: flex; gap: 6px; width: min(100%, 380px); }
.editor, .folder { border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.editor summary { padding: 10px 12px; cursor: pointer; width: max-content; font-weight: 600; }
.editor > .error { margin: 0 12px 10px; }
.edit-form { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(180px, 2fr) minmax(80px, 1fr) auto;
  align-items: end; padding: 0 12px 12px; gap: 9px; }
.edit-form label { display: grid; gap: 4px; }
.remove-form { display: flex; gap: 6px; padding: 0 12px 12px; }
.folder { padding: 14px; }
.folder h2 { color: #514b40; margin-bottom: 10px; }
.bookmarks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%,244px),1fr)); gap: 8px; }
.bookmark { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 7px; background: #fdfcf9; min-width: 0; }
.bookmark-link { display: grid; gap: 4px; flex:1; min-width: 0; }
.bookmark-link:hover strong, .small-button:hover { text-decoration: underline; }
.bookmark-link span { color: var(--muted); font-size: 12px; }
.bookmark-link > * { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.small-button { color: #765829; font-size: 12px; padding: 6px 0 6px 4px; }
.empty { padding: 16px 2px; color: var(--muted); }
@media (max-width: 600px) {
  .bar { padding-inline: 12px; }
  .home { padding: 16px 12px 26px; gap: 11px; }
  .heading { display: grid; align-items: stretch; gap: 9px; }
  .search { width: 100%; }
  .edit-form { grid-template-columns: 1fr; }
  .edit-form .primary { justify-self: start; }
  input { font-size: 16px; }
  input::placeholder { font-size: 13px; }
}
