:root {
  --paper: #f4f0e8;
  --paper-deep: #e9e2d5;
  --ink: #17201d;
  --muted: #6f756e;
  --line: rgba(23, 32, 29, .14);
  --green: #1f6b50;
  --lime: #c9f36a;
  --white: #fffdf8;
  --red: #a33b31;
  --shadow: 0 24px 80px rgba(46, 42, 33, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .32;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(31, 107, 80, .08), transparent 29%),
    radial-gradient(circle at 82% 74%, rgba(201, 243, 106, .11), transparent 25%);
}

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; position: relative; }
.topbar { height: 104px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-weight: 700; letter-spacing: .06em; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; background: var(--ink); color: var(--lime); border-radius: 50%; font-size: 17px; }
.status { font-family: "DM Mono", monospace; font-size: 11px; letter-spacing: .12em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.status i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(31,107,80,.12); }
.quiet-button { border: 1px solid var(--line); background: transparent; padding: 10px 15px; border-radius: 999px; cursor: pointer; font-size: 13px; }
.quiet-button:hover { background: var(--ink); color: var(--white); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions form { margin: 0; }

.eyebrow { display: block; font: 500 11px/1.2 "DM Mono", monospace; letter-spacing: .16em; color: var(--green); margin-bottom: 20px; }
.login-layout { min-height: calc(100vh - 180px); display: grid; grid-template-columns: 1.08fr .92fr; gap: 9vw; align-items: center; padding: 78px 0 100px; }
.intro h1, .dashboard-head h1, .empty-page h1 { margin: 0; font: 700 clamp(50px, 6.2vw, 86px)/1.08 "Noto Serif SC", serif; letter-spacing: -.055em; }
.intro h1 em, .dashboard-head h1 em { font-style: normal; color: var(--green); position: relative; }
.intro h1 em::after, .dashboard-head h1 em::after { content: ""; position: absolute; left: 4px; right: 0; bottom: -7px; height: 5px; background: var(--lime); transform: rotate(-1deg); z-index: -1; }
.intro > p { max-width: 570px; margin: 34px 0 42px; color: var(--muted); font-size: 16px; line-height: 1.9; }
.feature-line { max-width: 490px; padding: 15px 0; border-top: 1px solid var(--line); color: #4f5751; font-size: 13px; }
.feature-line:last-child { border-bottom: 1px solid var(--line); }
.feature-line span { color: var(--green); font: 500 10px "DM Mono", monospace; margin-right: 16px; }

.login-card { position: relative; padding: clamp(34px, 4.5vw, 58px); background: var(--white); border: 1px solid rgba(23,32,29,.09); box-shadow: var(--shadow); }
.login-card::before { content: ""; position: absolute; inset: 9px; border: 1px solid var(--line); pointer-events: none; }
.lock-orbit { position: absolute; right: -23px; top: -24px; width: 78px; height: 78px; display: grid; place-items: center; border-radius: 50%; background: var(--lime); border: 1px solid var(--ink); }
.lock-orbit::before { content: "PRIVATE • PRIVATE •"; position: absolute; font: 500 7px "DM Mono", monospace; letter-spacing: .16em; width: 62px; text-align: center; transform: rotate(-18deg); }
.lock-orbit span { font-size: 16px; }
.login-card h2 { margin: 0; font: 700 32px "Noto Serif SC", serif; }
.login-card > p { color: var(--muted); line-height: 1.7; margin: 12px 0 30px; font-size: 14px; }
.stack-form { display: grid; gap: 12px; }
.stack-form label, .field label { font-weight: 600; font-size: 12px; }
.password-field { display: flex; border-bottom: 1px solid var(--ink); }
.password-field input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 16px 0; outline: none; }
.peek { border: 0; background: transparent; cursor: pointer; color: var(--green); font-size: 12px; }
.primary-button { margin-top: 16px; padding: 17px 20px; background: var(--ink); color: white; border: 0; display: flex; justify-content: space-between; cursor: pointer; font-weight: 600; }
.primary-button:hover { background: var(--green); }
.primary-button span { color: var(--lime); font-size: 18px; }

.alert { padding: 12px 14px; font-size: 13px; line-height: 1.5; border-left: 3px solid; margin: 0 0 14px; }
.alert.error { color: var(--red); background: rgba(163,59,49,.07); border-color: var(--red); }
.alert.success { color: var(--green); background: rgba(31,107,80,.08); border-color: var(--green); }
.alert.floating { margin: -16px 0 24px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.alert.floating button { border: 0; background: transparent; color: inherit; cursor: pointer; font-weight: 700; text-decoration: underline; overflow-wrap: anywhere; }

.dashboard-head { padding: 72px 0 58px; display: flex; justify-content: space-between; align-items: end; }
.dashboard-head h1 { font-size: clamp(45px, 5.5vw, 74px); }
.metrics { display: flex; border: 1px solid var(--line); }
.metrics div { min-width: 130px; padding: 22px 26px; display: grid; gap: 3px; }
.metrics div + div { border-left: 1px solid var(--line); }
.metrics strong { font: 500 27px "DM Mono", monospace; }
.metrics span { color: var(--muted); font-size: 11px; }

.creator-card { padding: 12px; background: var(--ink); box-shadow: 0 22px 60px rgba(23,32,29,.16); }
.creator-form { display: grid; grid-template-columns: 1.45fr .85fr auto; gap: 1px; background: #38403d; }
.field { background: #202925; padding: 20px 24px 16px; color: var(--white); }
.field label { display: block; color: #b8c0ba; margin-bottom: 7px; }
.field label span { color: #758079; font-weight: 400; margin-left: 5px; }
.field input { width: 100%; border: 0; outline: 0; background: transparent; color: white; padding: 7px 0; font-family: "DM Mono", monospace; font-size: 14px; }
.field input::placeholder { color: #66716a; }
.alias-input { display: flex; align-items: center; }
.alias-input b { color: var(--lime); font: 500 17px "DM Mono", monospace; margin-right: 6px; }
.create-button { min-width: 160px; padding: 24px; border: 0; background: var(--lime); cursor: pointer; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.create-button:hover { background: #dcff8d; }
.create-button b { font-size: 22px; font-weight: 400; }

.library { padding: 78px 0 80px; }
.section-title { display: flex; justify-content: space-between; align-items: end; padding-bottom: 22px; border-bottom: 1px solid var(--ink); }
.section-title .eyebrow { margin-bottom: 8px; }
.section-title h2 { margin: 0; font: 700 30px "Noto Serif SC", serif; }
.search { display: flex; align-items: center; gap: 8px; width: 250px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.search span { font-size: 21px; }
.search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 12px; }
.link-row { min-height: 110px; display: grid; grid-template-columns: minmax(0, 1fr) 90px 110px 145px; align-items: center; gap: 26px; border-bottom: 1px solid var(--line); transition: background .18s ease; }
.link-row:hover { background: rgba(255,255,255,.32); }
.link-identity { min-width: 0; display: flex; align-items: center; gap: 16px; }
.link-icon { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--green); }
.link-identity div { min-width: 0; }
.link-identity a { color: var(--ink); text-decoration: none; font: 500 15px "DM Mono", monospace; overflow-wrap: anywhere; }
.link-identity a:hover { color: var(--green); }
.link-identity p { margin: 7px 0 0; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-meta, .link-date { display: grid; gap: 5px; }
.link-meta strong, .link-date strong { font: 500 13px "DM Mono", monospace; }
.link-meta span, .link-date span { color: var(--muted); font-size: 10px; }
.row-actions { display: flex; justify-content: end; gap: 7px; }
.copy-button, .delete-button { border: 1px solid var(--line); background: transparent; padding: 9px 12px; cursor: pointer; font-size: 11px; }
.copy-button:hover { background: var(--ink); color: var(--white); }
.delete-button { color: var(--red); }
.delete-button:hover { background: var(--red); color: white; border-color: var(--red); }
.empty-state { padding: 80px 20px; display: grid; justify-items: center; text-align: center; border-bottom: 1px solid var(--line); }
.empty-state > span { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--paper-deep); color: var(--green); font-size: 20px; }
.empty-state h3 { margin: 18px 0 8px; font: 700 20px "Noto Serif SC", serif; }
.empty-state p, .no-results { margin: 0; color: var(--muted); font-size: 13px; }
.no-results { padding: 50px 0; text-align: center; border-bottom: 1px solid var(--line); }
[hidden] { display: none !important; }

.empty-page { min-height: calc(100vh - 180px); display: grid; align-content: center; justify-items: start; max-width: 780px; padding: 80px 0; }
.empty-page h1 { margin-bottom: 25px; }
.empty-page p { color: var(--muted); }
.primary-link { margin-top: 20px; display: inline-block; background: var(--ink); color: white; text-decoration: none; padding: 14px 20px; }

footer { min-height: 78px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; color: var(--muted); font: 500 9px "DM Mono", monospace; letter-spacing: .12em; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 28px; transform: translate(-50%, 30px); background: var(--ink); color: white; padding: 11px 17px; font-size: 12px; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.password-dialog { width: min(520px, calc(100% - 28px)); max-width: none; padding: 0; border: 0; background: transparent; color: var(--ink); }
.password-dialog::backdrop { background: rgba(17, 25, 22, .68); backdrop-filter: blur(5px); }
.password-panel { background: var(--white); padding: clamp(28px, 5vw, 46px); border: 1px solid rgba(23,32,29,.12); box-shadow: var(--shadow); }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.dialog-head .eyebrow { margin-bottom: 8px; }
.dialog-head h2 { margin: 0; font: 700 30px "Noto Serif SC", serif; }
.dialog-close { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; font-size: 21px; line-height: 1; }
.dialog-close:hover { background: var(--ink); color: white; }
.password-panel > p { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 14px 0 28px; }
.dialog-fields { display: grid; gap: 19px; }
.dialog-fields label { display: grid; gap: 8px; font-size: 12px; font-weight: 600; }
.dialog-fields label span { color: var(--muted); font-weight: 400; }
.dialog-fields input { width: 100%; border: 0; border-bottom: 1px solid var(--ink); outline: 0; background: transparent; padding: 11px 0; }
.dialog-fields input:focus { border-color: var(--green); }
.dialog-actions { display: grid; grid-template-columns: .7fr 1.3fr; gap: 9px; margin-top: 32px; }
.cancel-button, .save-password { min-height: 50px; padding: 13px 17px; border: 1px solid var(--line); cursor: pointer; font-weight: 600; }
.cancel-button { background: transparent; }
.cancel-button:hover { background: var(--paper-deep); }
.save-password { display: flex; justify-content: space-between; background: var(--ink); color: white; border-color: var(--ink); }
.save-password:hover { background: var(--green); border-color: var(--green); }
.save-password span { color: var(--lime); }

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; gap: 65px; padding-top: 60px; }
  .login-card { max-width: 600px; }
  .dashboard-head { align-items: start; gap: 38px; flex-direction: column; }
  .creator-form { grid-template-columns: 1fr 1fr; }
  .create-button { grid-column: 1 / -1; }
  .link-row { grid-template-columns: minmax(0, 1fr) 70px 125px; }
  .link-date { display: none; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 28px, 1180px); }
  .topbar { height: 82px; }
  .top-actions { gap: 5px; }
  .quiet-button { padding: 8px 10px; font-size: 11px; }
  .intro h1 { font-size: 46px; }
  .login-layout { padding-top: 48px; }
  .feature-line { font-size: 12px; }
  .login-card { padding: 34px 28px; }
  .lock-orbit { right: -7px; }
  .dashboard-head { padding: 52px 0 43px; }
  .dashboard-head h1 { font-size: 43px; }
  .metrics { width: 100%; }
  .metrics div { flex: 1; min-width: 0; padding: 17px 20px; }
  .creator-form { grid-template-columns: 1fr; }
  .create-button { grid-column: auto; min-height: 72px; }
  .library { padding-top: 60px; }
  .section-title { align-items: start; gap: 22px; flex-direction: column; }
  .search { width: 100%; }
  .link-row { grid-template-columns: 1fr auto; gap: 14px; padding: 20px 0; }
  .link-meta { display: none; }
  .row-actions { grid-column: 1 / -1; justify-content: start; padding-left: 54px; }
  .alert.floating { align-items: flex-start; flex-direction: column; gap: 7px; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 7px; }
}

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