:root {
  color-scheme: dark;
  font-family: Inter, Geist, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #f4f9ff;
  background: #050a12;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #050a12; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(43, 123, 190, .22), transparent 32rem),
    radial-gradient(circle at 90% 8%, rgba(37, 84, 142, .18), transparent 30rem),
    linear-gradient(160deg, #07101d 0%, #03070d 52%, #07111d 100%);
}

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

.page-shell {
  position: relative;
  min-height: 100vh;
  padding: 56px 28px 72px;
  overflow: hidden;
}

.page-shell::before,
.page-shell::after {
  position: fixed;
  z-index: 0;
  width: 28rem;
  height: 28rem;
  border: 1px solid rgba(122, 200, 255, .08);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}
.page-shell::before { top: -18rem; left: -11rem; }
.page-shell::after { right: -18rem; bottom: -20rem; }

.content {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  margin: 0 auto;
}

.page-header {
  position: relative;
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  margin-bottom: 42px;
  text-align: center;
}

.page-header h1 {
  margin: 0;
  color: #f7fbff;
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 750;
  letter-spacing: -.06em;
  text-shadow: 0 8px 32px rgba(102, 187, 255, .18);
}

.page-header h1::after {
  display: block;
  width: 38px;
  height: 3px;
  margin: 15px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #55b6f7, #bce9ff);
  box-shadow: 0 0 18px rgba(85, 182, 247, .65);
  content: "";
}

.manage-link, .back-link {
  color: #b9e7ff;
  font-size: .9rem;
  font-weight: 650;
  text-decoration: none;
}

.manage-link {
  position: absolute;
  right: 0;
  top: 2px;
  padding: 10px 15px;
  border: 1px solid rgba(148, 212, 255, .25);
  border-radius: 10px;
  background: rgba(116, 190, 239, .08);
  backdrop-filter: blur(14px);
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.manage-link:hover { border-color: rgba(148, 212, 255, .5); background: rgba(116, 190, 239, .15); transform: translateY(-1px); }
.back-link { display: inline-block; margin-bottom: 14px; }
.back-link:hover { color: #fff; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 330px));
  justify-content: center;
  gap: 22px;
}

.link-card {
  position: relative;
  min-height: 205px;
  padding: 25px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 34px;
  overflow: hidden;
  border: 1px solid rgba(220, 246, 255, .82);
  border-radius: 18px;
  background: linear-gradient(145deg, #ebf8ff 0%, #d5efff 50%, #c8e7fb 100%);
  color: #0b2034;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .3), 0 0 0 1px rgba(89, 183, 241, .06);
  transition: transform .24s ease, box-shadow .24s ease;
}

.link-card::after {
  position: absolute;
  top: -75px;
  right: -65px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .38);
  content: "";
  pointer-events: none;
}
.link-card:hover { transform: translateY(-5px); box-shadow: 0 24px 60px rgba(0, 0, 0, .38), 0 0 36px rgba(82, 174, 235, .13); }
.card-text { position: relative; z-index: 1; min-width: 0; }
.card-text h2 { margin: 0 0 12px; font-size: 1.1rem; line-height: 1.45; font-weight: 760; letter-spacing: -.02em; }
.card-text p, .manage-row p { margin: 0; overflow: hidden; color: #52738d; font-size: .875rem; line-height: 1.55; text-overflow: ellipsis; white-space: nowrap; }

.card-actions, .form-actions, .row-actions { position: relative; z-index: 1; display: flex; gap: 10px; }
.jump-button, .copy-button, .save-button, .cancel-button, .row-actions button {
  min-width: 76px;
  padding: 10px 17px;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.jump-button, .save-button { border: 1px solid #102a43; background: linear-gradient(145deg, #102b45, #071a2d); color: #fff; box-shadow: 0 8px 18px rgba(7, 25, 42, .2); }
.copy-button, .cancel-button, .row-actions button { border: 1px solid rgba(24, 72, 105, .2); background: rgba(255, 255, 255, .58); color: #173a55; }
.jump-button:hover, .save-button:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(7, 25, 42, .3); }
.copy-button:hover, .cancel-button:hover, .row-actions button:hover { background: rgba(255, 255, 255, .88); transform: translateY(-1px); }

.empty-state, .manage-form, .manage-list {
  border: 1px solid rgba(139, 204, 246, .16);
  border-radius: 18px;
  background: rgba(12, 27, 44, .72);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  backdrop-filter: blur(18px);
}
.empty-state { width: min(500px, 100%); margin: 0 auto; padding: 54px 24px; text-align: center; }
.empty-state p { color: #8facbf; }
.empty-state a { color: #8ed5ff; font-weight: 700; text-decoration: none; }

.gate-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 0%, rgba(52, 136, 203, .25), transparent 40rem), linear-gradient(155deg, #07121f, #03070c 68%);
}
.password-gate {
  width: min(410px, 100%);
  padding: 38px;
  border: 1px solid rgba(143, 211, 255, .18);
  border-radius: 22px;
  background: rgba(9, 22, 37, .82);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .45), inset 0 1px rgba(255, 255, 255, .04);
  backdrop-filter: blur(20px);
}
.gate-mark { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid rgba(167, 226, 255, .35); border-radius: 14px; background: linear-gradient(145deg, #5bbbf4, #2575b4); color: #fff; font-size: 1.1rem; font-weight: 750; box-shadow: 0 10px 28px rgba(50, 151, 216, .28); }
.gate-brand { width: fit-content; margin: 0 auto 30px; padding: 14px 24px; border: 1px solid rgba(177, 231, 255, .42); border-radius: 14px; background: linear-gradient(145deg, #5bbbf4, #2575b4); color: #fff; font-size: 1.4rem; font-weight: 760; letter-spacing: .04em; text-align: center; box-shadow: 0 12px 32px rgba(50, 151, 216, .3), inset 0 1px rgba(255,255,255,.28); }
.password-gate h1 { margin: 22px 0 8px; color: #f6fbff; font-size: 1.75rem; letter-spacing: -.04em; }
.password-gate > p { margin: 0 0 26px; color: #88a4b8; font-size: .95rem; }
.password-gate label, .manage-form label { display: grid; gap: 9px; color: #bcd3e2; font-size: .875rem; font-weight: 650; }
.password-gate label { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; }
.password-gate label span { white-space: nowrap; }
.password-gate input, .manage-form input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid rgba(140, 201, 240, .2); border-radius: 11px; outline: 0; background: rgba(3, 12, 21, .72); color: #f4f9ff; font-size: 1rem; transition: border-color .18s ease, box-shadow .18s ease; }
.password-gate input:focus, .manage-form input:focus { border-color: #62bdf5; box-shadow: 0 0 0 3px rgba(76, 173, 234, .14); }
.password-gate button { width: 100%; margin-top: 18px; padding: 13px; border: 0; border-radius: 11px; background: linear-gradient(135deg, #56b8f3, #287db9); color: #fff; font-weight: 720; cursor: pointer; box-shadow: 0 12px 28px rgba(30, 118, 177, .27); }
.password-gate button:disabled { opacity: .6; cursor: wait; }
.password-gate > a { display: block; margin-top: 20px; color: #87b4d0; font-size: .9rem; text-align: center; text-decoration: none; }
.gate-error, .error { color: #ff9d9d; }
.gate-error { margin-top: 15px; font-size: .875rem; text-align: center; }
.loading { padding: 48px; color: #809bad; text-align: center; }

.manage-content { max-width: 800px; }
.manage-content .page-header { justify-content: flex-start; text-align: left; }
.manage-content .page-header h1::after { margin-left: 0; }
.manage-form { display: grid; gap: 19px; padding: 28px; }
.manage-form h2, .manage-list > h2 { margin: 0; color: #eef8ff; font-size: 1.1rem; }
.form-message { margin: 0; color: #8fd6ff; font-size: .875rem; }
.manage-list { margin-top: 20px; padding: 28px; }
.manage-list > h2 { margin-bottom: 16px; }
.manage-row { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 18px; border-top: 1px solid rgba(139, 204, 246, .1); }
.manage-row:first-of-type { border-top: 0; }
.manage-row h3 { margin: 0 0 6px; color: #eaf7ff; font-size: 1rem; }
.manage-row p { max-width: 490px; color: #7897ad; }
.row-actions button { border-color: rgba(148, 210, 248, .15); background: rgba(109, 184, 231, .08); color: #bde7ff; }
.row-actions .delete-button { color: #ffaaaa; }

button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(98, 189, 245, .35); outline-offset: 3px; }

@media (max-width: 720px) {
  .page-shell { padding: 38px 18px 56px; }
  .page-header { align-items: flex-start; margin-bottom: 34px; }
  .manage-link { top: 4px; right: 0; padding: 9px 12px; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .link-card { min-height: 188px; }
  .manage-row { align-items: flex-start; flex-direction: column; }
  .manage-row p { max-width: calc(100vw - 90px); }
}

@media (max-width: 430px) {
  .page-header { padding-top: 52px; }
  .page-header h1 { width: 100%; }
  .manage-link { top: 0; }
  .manage-content .page-header { padding-top: 0; }
  .password-gate { padding: 29px 24px; }
  .manage-form, .manage-list { padding: 21px; }
}

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