:root {
  --accent: #181818;
  --surface: #ffffff;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  line-height: 1.5; --ink: #1d1d1f; --muted: #6e6e73; --line: #e5e5ea; --canvas: #f5f5f7; --accent-soft: #eaeaec;
}
* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; transition: background 180ms ease, color 180ms ease, border-color 180ms ease; }
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
svg { width: 1.2em; height: 1.2em; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.app-shell { width: min(1240px, 100%); margin: auto; padding: 0 clamp(20px, 4vw, 48px) 32px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); min-height: 84px; padding: 16px 22px; border: 1px solid #ffffff; border-radius: 26px; background: #ffffffc9; box-shadow: 0 8px 32px #1d1d1f05; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.brand, .account { display: flex; align-items: center; }
.brand { gap: 12px; }
.brand-mark, .auth-mark { display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--accent); border-radius: 12px; }
.brand-mark { width: 44px; height: 44px; }
.brand-mark svg { width: 25px; height: 25px; }
.brand p, .eyebrow { margin: 0 0 3px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .2em; }
.brand h1 { margin: 0; font-weight: 600; font-size: 18px; letter-spacing: -.025em; }
.account { gap: 12px; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #eeeeee; color: var(--accent); font-size: 12px; font-weight: 600; }
.account strong { max-width: 140px; overflow: hidden; font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.icon-text-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 0 10px; border: 0; background: transparent; color: var(--muted); font-size: 12px; border-radius: 99px; }
.icon-text-button:hover { background: var(--accent-soft); color: var(--accent); }
.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 32px 0 20px; }
.active-title { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.active-title > span { display: none; }
.active-title p { display: none; }
.active-title h2 { margin: 0; font-size: 28px; letter-spacing: -.045em; font-weight: 650; }
.list-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.search-box { position: relative; min-width: 0; width: 290px; }
.search-box svg { position: absolute; top: 50%; left: 13px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
input, select { width: 100%; height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: var(--surface); color: var(--ink); transition: border-color 180ms ease, box-shadow 180ms ease; }
input::placeholder { color: #757575; }
input:focus, select:focus { border-color: #86868b; box-shadow: 0 0 0 4px #86868b1a; }
.search-box input { padding-left: 39px; font-size: 13px; }
.primary-button, .secondary-button, .danger-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; font-size: 13px; font-weight: 500; white-space: nowrap; min-height: 44px; border-radius: 99px; padding: 0 20px; }
.primary-button { background: var(--accent); color: #fff; }
.primary-button:hover { background: #333333; }
.secondary-button { border-color: var(--line); background: var(--surface); color: var(--ink); }
.secondary-button:hover { background: var(--canvas); }
.danger-button { background: #ac3e36; color: #fff; }
.danger-button:hover { background: #90332c; }
.records { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; gap: 24px; }
.record { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: border-color 180ms ease, box-shadow 180ms ease; }
.record:hover { border-color: #ffffff; box-shadow: 0 12px 32px #1d1d1f0c; transform: translateY(-3px); }
.record-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px; margin: -6px -8px 18px 0; }
.record-type { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; font-size: 12px; font-weight: 600; color: var(--tone); }
.record-type svg { width: 16px; height: 16px; }
.record-main { min-width: 0; padding: 22px 24px 24px; }
.record-main h4 { margin: 0 0 4px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.share-value { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 18px; padding: 6px 4px 6px 12px; border-radius: 12px; background: #f5f5f7; }
.share-value code { min-width: 0; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; letter-spacing: .035em; overflow-wrap: anywhere; }
.icon-button { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--accent-soft); color: var(--accent); }
.icon-button.delete:hover { background: #fbedea; color: #ac3e36; }
.record-actions { display: flex; position: absolute; right: 12px; top: 12px; gap: 4px; }
.state { grid-column: 1 / -1; border: 1px dashed var(--line); border-radius: 14px; display: grid; justify-items: center; align-content: center; min-height: 338px; padding: 36px 24px; color: var(--muted); text-align: center; }
.state-icon { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 20px; border-radius: 18px; background: var(--canvas); color: #777777; }
.state-icon svg { width: 26px; height: 26px; }
.state h3 { margin: 0 0 8px; color: var(--ink); font-size: 16px; font-weight: 500; }
.state p { margin: 0; font-size: 13px; line-height: 1.8; }
.library-footer { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 24px 0 0; color: var(--muted); font-size: 11px; margin-top: 32px; }
.auth-shell { display: grid; place-items: center; min-height: 100vh; padding: 28px 20px; }
.auth-card { width: min(440px, 100%); padding: 42px; background: var(--surface); border: 1px solid #fff; border-radius: 32px; box-shadow: 0 16px 60px #1d1d1f08; }
.auth-mark { width: 52px; height: 52px; margin-bottom: 28px; background: var(--canvas); }
.auth-mark svg { width: 28px; height: 28px; }
.auth-card h1 { margin: 10px 0 12px; font-size: 26px; font-weight: 550; letter-spacing: -.035em; }
.auth-description { margin: 0 0 28px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.auth-card form, .dialog form { display: grid; gap: 20px; }
.auth-card label, .dialog label { display: grid; gap: 8px; color: var(--ink); font-size: 13px; font-weight: 500; }
.full-button { width: 100%; margin-top: 4px; }
.form-error { min-height: 1.3em; margin: -5px 0 0; color: #ac3e36; font-size: 12px; }
.dialog { max-height: calc(100dvh - 32px); padding: 0; color: var(--ink); background: var(--surface); width: min(520px, calc(100% - 32px)); border: 1px solid #fff; border-radius: 28px; box-shadow: 0 32px 100px #00000026; }
.dialog::backdrop { background: #00000066; backdrop-filter: blur(4px); }
.dialog form { padding: 32px; gap: 22px; }
.dialog header { display: flex; align-items: start; justify-content: space-between; margin-bottom: 4px; }
.dialog header p { margin: 0 0 5px; color: var(--muted); font-size: 12px; }
.dialog h2 { margin: 0; font-size: 22px; font-weight: 550; }
.dialog footer { display: flex; justify-content: flex-end; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.close-button { border: 0; color: var(--muted); font-size: 26px; width: 36px; height: 44px; margin: -8px -8px 0 0; border-radius: 99px; background: #f5f5f7; }
.close-button:hover { background: var(--canvas); }
.code-input { font-family: ui-monospace, monospace; font-size: 14px; }
.confirm-dialog { width: min(420px, calc(100% - 32px)); }
.confirm-dialog p { margin: -4px 0 2px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); max-width: calc(100% - 32px); padding: 12px 20px; background: var(--ink); color: #fff; font-size: 13px; opacity: 0; transform: translate(-50%, 12px); transition: opacity 180ms ease, transform 180ms ease; pointer-events: none; border-radius: 99px; box-shadow: 0 8px 32px #00000018; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 900px) {
  .search-box { width: 250px; }
  .records { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .topbar { min-height: 80px; gap: 12px; }
  .account { gap: 4px; }
  .account strong, .icon-text-button span { display: none; }
  .brand h1 { font-size: 15px; }
  .brand p { font-size: 9px; }
  .brand-mark { width: 38px; height: 38px; }
  .list-heading { align-items: stretch; flex-direction: column; gap: 16px; padding: 26px 0 16px; }
  .list-actions { justify-content: stretch; }
  .search-box { width: auto; flex: 1; }
  .primary-button { padding: 0 14px; }
  .records { grid-template-columns: 1fr; gap: 12px; }
  .state { min-height: 298px; padding: 28px 16px; }
  .record { padding: 20px; }
  .record-actions { gap: 4px; }
  .share-value { gap: 2px; }
  .share-value code { font-size: 12px; }
  .auth-card { padding: 32px 24px; }
  .dialog form { padding: 24px; }
}
@media (max-width: 360px) {
  .app-shell { padding-inline: 16px; }
  .avatar { display: none; }
  .brand { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

#back-library { margin: -12px 0 16px -10px; }

.count-badge { display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 8px; background: #eaeaea; color: #555; font-size: 12px; }
.record-type img { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
.record-type { gap: 10px; color: var(--ink); font-weight: 500; }
.brand-mark, .auth-mark { object-fit: cover; border: 0; }
.type-picker { min-width: 0; margin: 0; padding: 0; border: 0; }
.type-picker legend { padding: 0; margin-bottom: 10px; font-size: 13px; font-weight: 500; }
.type-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.type-picker .type-option { position: relative; display: block; cursor: pointer; }
.type-option input { position: absolute; width: 1px; height: 1px; padding: 0; opacity: 0; }
.type-option span { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; transition: border-color 150ms ease, background 150ms ease; }
.type-option img { width: 44px; height: 44px; border-radius: 12px; }
.type-option:hover span { background: #fafafa; border-color: #aaa; }
.type-option input:checked + span { border-color: #181818; box-shadow: inset 0 0 0 1px #181818; background: #f7f7f7; }
.type-option input:focus-visible + span { outline: 2px solid #181818; outline-offset: 3px; }
.app-shell { width: min(1320px, 100%); padding: 24px clamp(20px, 4vw, 56px) 40px; }
.brand-mark { width: 50px; height: 50px; border-radius: 15px; box-shadow: 0 4px 12px #6834d81a; }
.brand p { font-size: 9px; letter-spacing: .15em; }
.avatar { width: 34px; height: 34px; background: #f0edf7; color: #65508a; }
.list-heading { padding: 36px 4px 24px; }
.active-title > .count-badge { display: grid; background: #e8e8ed; border-radius: 99px; height: 28px; min-width: 28px; color: #6e6e73; }
input, select { border-radius: 13px; background: #f5f5f7; border-color: transparent; }
.search-box input { background: #eaeaec; height: 44px; }
.secondary-button { background: #efeff2; border-color: transparent; }
.record { --tint: #eaf4ff; --tone: #215bbb; padding: 0; overflow: hidden; border: 1px solid #ffffff; border-radius: 28px; box-shadow: 0 4px 20px #1d1d1f06; transition: transform 200ms ease, box-shadow 200ms ease; }
.record[data-kind="sliders"] { --tint: #fff4df; --tone: #97580a; }
.record[data-kind="hand"] { --tint: #eafbdf; --tone: #386b21; }
.record[data-kind="crosshair"] { --tint: #ffedf4; --tone: #aa2c64; }
.record-header { position: relative; margin: 0; min-height: 180px; padding: 22px 24px; background: var(--tint); align-items: stretch; }
.record-type img { align-self: center; width: 104px; height: 104px; border-radius: 26px; box-shadow: 0 8px 18px #00000006; }
.record-actions .icon-button { width: 36px; height: 44px; border-radius: 99px; background: #ffffffb3; color: #55555b; }
.record-actions .icon-button:hover { background: #fff; }
.record-main h4 { font-size: 19px; font-weight: 600; line-height: 1.4; letter-spacing: -.035em; }
.share-value code { font-size: 12px; letter-spacing: 0; color: #626269; }
.copy-button { border-radius: 10px; color: #45454a; }
.state { background: #ffffff99; border: 1px solid #fff; border-radius: 28px; }
.auth-mark { width: 72px; height: 72px; border-radius: 22px; }
.dialog::backdrop { background: #2525304d; backdrop-filter: blur(8px); }
.dialog h2 { font-size: 26px; font-weight: 650; letter-spacing: -.04em; }
.dialog footer { border: 0; padding-top: 8px; }
.type-option span { min-height: 72px; border-radius: 16px; padding: 12px; border-color: #efeff2; }
.type-option input:checked + span { border-color: #1d1d1f; background: #f5f5f7; box-shadow: inset 0 0 0 1px #1d1d1f; }
@media (max-width: 1000px) { .records { grid-template-columns: repeat(2, minmax(0,1fr)); } .search-box { width: 240px; } }
@media (max-width: 640px) {
 .app-shell { padding: 12px 16px 28px; }
 .topbar { min-height: 76px; padding: 12px; border-radius: 22px; gap: 8px; }
 .brand { gap: 10px; }
 .brand-mark { width: 42px; height: 42px; border-radius: 13px; }
 .brand h1 { font-size: 15px; }
 .account { gap: 2px; }
 .account .secondary-button { padding-inline: 12px; font-size: 12px; }
 .list-heading { padding: 28px 2px 20px; }
 .active-title h2 { font-size: 25px; }
 .list-actions { gap: 8px; }
 .search-box { width: auto; }
 .search-box input { font-size: 12px; }
 .records { grid-template-columns: 1fr; gap: 20px; }
 .record { padding: 0; border-radius: 24px; }
 .record-header { min-height: 156px; padding: 20px; }
 .record-type img { width: 88px; height: 88px; border-radius: 22px; }
 .record-type { gap: 10px; }
 .record-main { padding: 20px; }
 .auth-card { padding: 30px 24px; }
 .dialog form { padding: 24px; }
}
@media (hover: none) { .record:hover { transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } .record:hover { transform: none; } }

/* Reference layout: bright spatial canvas with two-part scheme cards. */
html { background: #f2f7ff; }
body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 14% 5%, #e5f3ff 0, transparent 34%),
    radial-gradient(circle at 92% 18%, #f1edff 0, transparent 29%),
    linear-gradient(145deg, #f8fbff 0%, #eef5ff 58%, #f6f8ff 100%);
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(ellipse 72% 44% at 68% 23%, transparent 0 54%, #ffffff75 55% 67%, transparent 68%),
    radial-gradient(ellipse 62% 40% at 12% 72%, transparent 0 52%, #ffffff70 53% 66%, transparent 67%);
}
.app-shell { width: min(1450px, 100%); padding: 24px clamp(22px, 4vw, 64px) 44px; }
.topbar {
  min-height: 96px;
  padding: 18px 38px;
  border-radius: 24px;
  background: #ffffffd9;
  box-shadow: 0 18px 45px #5485bd0d;
}
.brand { gap: 20px; }
.brand-mark { width: 64px; height: 64px; border-radius: 18px; }
.brand p { color: #465176; font-size: 10px; letter-spacing: .22em; }
.brand h1 { color: #111a39; font-size: 22px; font-weight: 700; }
.avatar { width: 44px; height: 44px; background: #eee9ff; color: #4e2a9b; font-size: 15px; }
.account strong { color: #111526; font-size: 14px; }
#logout { margin-left: 8px; padding-left: 18px; border-left: 1px solid #dfe4ef; border-radius: 0; }
.list-heading { padding: 38px 6px 24px; }
.active-title { gap: 14px; }
.active-title h2 { color: #101735; font-size: clamp(28px, 3vw, 38px); font-weight: 750; }
.active-title > .count-badge { min-width: 42px; height: 42px; padding: 0 13px; background: #e4e9f5; color: #344063; font-size: 15px; }
.list-actions { gap: 16px; }
.search-box { width: min(340px, 36vw); }
.search-box input { height: 52px; padding-left: 50px; border: 1px solid #ffffff; border-radius: 18px; background: #ffffff8c; color: #1c2747; box-shadow: inset 0 0 0 1px #dce5f45c; backdrop-filter: blur(12px); }
.search-box svg { left: 17px; width: 23px; height: 23px; color: #56617c; }
.primary-button { min-height: 52px; padding: 0 26px; border-radius: 18px; background: #111827; box-shadow: 0 10px 24px #11182719; font-size: 15px; font-weight: 650; }
.primary-button:hover { background: #252f45; }
.records { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.record {
  min-height: 282px;
  border: 1px solid #ffffff;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 15px 40px #4e76a30b;
}
.record-header {
  position: relative;
  display: block;
  min-height: 210px;
  padding: 0;
  overflow: hidden;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(135deg, #e8f4ff 0%, #d9ecff 100%);
}
.record-header::after {
  position: absolute;
  inset: 0;
  content: "";
  background: radial-gradient(ellipse 58% 80% at 82% 16%, transparent 0 43%, #ffffff52 44% 57%, transparent 58%);
  pointer-events: none;
}
.record[data-kind="hand"] .record-header { background: linear-gradient(135deg, #edffed 0%, #d9f8e0 100%); }
.record[data-kind="crosshair"] .record-header { background: linear-gradient(135deg, #fff0f8 0%, #ffe5f1 100%); }
.record[data-kind="sliders"] .record-header { background: linear-gradient(135deg, #fff7e8 0%, #ffedc9 100%); }
.record-type {
  position: absolute;
  top: 70px;
  left: 30px;
  z-index: 2;
  display: inline-flex;
  width: auto;
  padding: 7px 15px;
  border-radius: 999px;
  background: #bfe1ff;
  color: #0865bd;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.record[data-kind="hand"] .record-type { background: #bff2c8; color: #168741; }
.record[data-kind="crosshair"] .record-type { background: #ffc9e2; color: #cc1764; }
.record[data-kind="sliders"] .record-type { background: #ffe3a1; color: #c25b00; }
.record-header > h4 {
  position: absolute;
  bottom: 28px;
  left: 30px;
  z-index: 2;
  max-width: 48%;
  margin: 0;
  color: #101735;
  font-size: clamp(20px, 2vw, 27px);
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -.04em;
  overflow-wrap: anywhere;
}
.record-art {
  position: absolute;
  bottom: 17px;
  left: 62%;
  z-index: 1;
  width: 162px;
  height: 162px;
  border-radius: 30px;
  object-fit: cover;
  transform: translateX(-50%);
  filter: drop-shadow(0 14px 16px #28476a17);
}
.record-actions { z-index: 3; top: 28px; right: 28px; gap: 12px; }
.record-actions .icon-button { width: 48px; height: 48px; border: 1px solid #ffffff; background: #ffffffb8; color: #27324e; backdrop-filter: blur(10px); }
.record-actions .icon-button.delete { color: #ff174f; }
.record-actions .icon-button:hover { background: #fff; transform: translateY(-1px); }
.record-footer { padding: 12px 16px 16px; background: #fff; }
.share-value { min-height: 54px; margin: 0; padding: 5px 6px 5px 22px; border-radius: 15px; background: #f3f6fb; }
.share-value code { color: #354261; font-size: 15px; font-weight: 500; letter-spacing: .02em; }
.copy-button { width: 46px; height: 46px; border-radius: 14px; background: #ffffffc7; box-shadow: 0 6px 16px #4d648114; }
.library-footer { color: #68748d; }

@media (max-width: 900px) {
  .topbar { padding-inline: 24px; }
  .records { grid-template-columns: 1fr; }
  .record-art { left: 63%; }
}
@media (max-width: 640px) {
  .app-shell { padding: 12px 14px 28px; }
  .topbar { min-height: 72px; padding: 10px 12px; border-radius: 20px; }
  .brand { gap: 10px; }
  .brand-mark { width: 46px; height: 46px; border-radius: 14px; }
  .brand h1 { font-size: 15px; }
  .brand p { font-size: 8px; }
  .avatar { width: 36px; height: 36px; }
  #logout { margin-left: 0; padding-left: 8px; border-left: 0; }
  .list-heading { padding: 28px 2px 18px; }
  .active-title h2 { font-size: 28px; }
  .active-title > .count-badge { min-width: 34px; height: 34px; padding: 0 10px; font-size: 13px; }
  .list-actions { gap: 8px; }
  .search-box { width: auto; }
  .search-box input { height: 48px; }
  .primary-button { min-height: 48px; padding-inline: 16px; font-size: 13px; }
  .records { gap: 16px; }
  .record { min-height: 248px; border-radius: 20px; }
  .record-header { min-height: 180px; border-radius: 20px 20px 0 0; }
  .record-type { top: 58px; left: 20px; padding: 6px 11px; font-size: 11px; }
  .record-header > h4 { bottom: 22px; left: 20px; max-width: 48%; font-size: 20px; }
  .record-art { right: 7%; bottom: 13px; left: auto; width: 128px; height: 128px; transform: none; border-radius: 25px; }
  .record-actions { top: 12px; right: 12px; gap: 7px; }
  .record-actions .icon-button { width: 42px; height: 42px; }
  .record-footer { padding: 10px 10px 12px; }
  .share-value { min-height: 52px; padding-left: 14px; }
  .share-value code { font-size: 12px; }
}
@media (max-width: 390px) {
  .brand p { display: none; }
  .brand h1 { font-size: 14px; }
  .record-art { right: 3%; width: 116px; height: 116px; }
}
