:root {
  --bg: #fff8ec;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-2: #fff3df;
  --panel-3: #f1f6ff;
  --ink: #222633;
  --muted: #667085;
  --subtle: #9aa4b2;
  --line: rgba(64, 74, 96, 0.11);
  --line-strong: rgba(64, 74, 96, 0.2);
  --accent: #ff6a3d;
  --accent-2: #4b7cff;
  --good: #20b486;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 28px 80px rgba(78, 64, 42, 0.16);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body:not(.is-admin) [data-admin-only] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  font-family: KaiTi, STKaiti, "Kaiti SC", "Yu Mincho", "Hiragino Mincho ProN", "Songti SC", serif;
  background:
    linear-gradient(180deg, rgba(245, 249, 255, 0.22), rgba(13, 28, 76, 0.24)),
    url("assets/583556dc6db26.jpg") center / cover fixed no-repeat,
    var(--bg);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(8, 18, 50, 0.12) 44%, rgba(5, 12, 35, 0.28)),
    linear-gradient(rgba(42, 53, 75, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 53, 75, 0.045) 1px, transparent 1px);
  background-size: auto, 52px 52px, 52px 52px;
  mask-image: linear-gradient(to bottom, black, transparent 76%);
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

.app-shell {
  min-height: 100vh;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  width: min(1180px, calc(100% - 32px));
  min-height: 70px;
  margin: 0 auto;
  padding: 10px 0;
  backdrop-filter: blur(16px);
}

.brand {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 38px;
  aspect-ratio: 1;
  place-items: center;
  color: white;
  font-size: 0.96rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), #ff9f43);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(255, 106, 61, 0.22);
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 760;
}

.brand small {
  margin-top: 2px;
  color: var(--subtle);
  font-size: 0.74rem;
}

.brand small:empty { display: none; }

.nav-menu,
.account-area {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nav-menu {
  justify-content: center;
}

.account-area {
  justify-content: flex-end;
}

.language-switch {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.language-switch select {
  color: var(--ink);
  font: inherit;
  background: transparent;
  border: 0;
  outline: 0;
}

.nav-menu a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 680;
  border-radius: 999px;
}

.nav-menu a:hover,
.nav-menu a.is-active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.main-content {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 90px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-2);
  font-size: 0.68rem;
  font-weight: 820;
  letter-spacing: 0.16em;
  line-height: 1.4;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 14ch;
  margin: 0;
  color: white;
  font-size: clamp(2.6rem, 7vw, 5.8rem);
  font-weight: 780;
  letter-spacing: 0;
  line-height: 0.94;
}

h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 740;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

.command-subtitle {
  display: none;
}

.launcher-panel {
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent 42%),
    var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.15);
}

.search-dock {
  position: sticky;
  top: 82px;
  z-index: 16;
  overflow: hidden;
  margin: 0 0 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.76)),
    var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  box-shadow: 0 18px 52px rgba(22, 30, 68, 0.2);
  backdrop-filter: blur(24px) saturate(1.18);
}

.command-bar {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 0 20px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  border-bottom: 1px solid var(--line);
}

.command-bar svg {
  width: 21px;
  height: 21px;
}

.command-bar path,
.command-bar circle,
.icon-button path,
.icon-button circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.command-bar input {
  min-width: 0;
  color: var(--ink);
  font-size: 1.12rem;
  background: transparent;
  border: 0;
  outline: 0;
}

.command-bar input::placeholder {
  color: var(--subtle);
}

.filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.search-dock .filter-tabs {
  border-bottom: 0;
}

.filter-tabs button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
  white-space: nowrap;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
}

.filter-tabs button:hover,
.filter-tabs button.is-active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--line);
}

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.metrics-strip div {
  padding: 14px 18px;
  border-right: 1px solid var(--line);
}

.metrics-strip div:last-child {
  border-right: 0;
}

.metrics-strip strong {
  display: block;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 780;
  line-height: 1;
}

.metrics-strip span {
  display: block;
  margin-top: 5px;
  color: var(--subtle);
  font-size: 0.76rem;
  font-weight: 760;
}

.panel-section {
  padding: 18px 16px 8px;
  border-bottom: 1px solid var(--line);
}

.panel-section:last-child {
  border-bottom: 0;
}

.section-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}

.section-head .eyebrow {
  margin-bottom: 4px;
  color: var(--subtle);
  font-size: 0.62rem;
}

.site-grid,
.hot-list,
.featured-list,
.admin-list {
  display: grid;
  gap: 6px;
}

.site-card,
.hot-item,
.featured-item,
.admin-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.site-card:hover,
.hot-item:hover,
.featured-item:hover,
.admin-row:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.66);
  border-color: var(--line);
}

.site-initial,
.hot-rank {
  display: grid;
  width: 38px;
  aspect-ratio: 1;
  place-items: center;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 880;
  background: linear-gradient(135deg, #fff7ea, #edf4ff);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.hot-rank {
  color: var(--accent);
  background: rgba(255, 106, 61, 0.1);
  border-color: rgba(255, 106, 61, 0.22);
}

.site-main,
.hot-main,
.featured-main,
.admin-main {
  min-width: 0;
}

.site-card h3,
.hot-item strong,
.featured-item strong,
.admin-row strong {
  display: block;
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-card p,
.hot-item small,
.featured-main span,
.admin-row span {
  display: block;
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--subtle);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-meta,
.hot-score {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  color: var(--subtle);
  font-size: 0.78rem;
  white-space: nowrap;
}

.state-badge,
.tag-list span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 740;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.state-badge.muted {
  color: var(--accent);
  background: rgba(255, 106, 61, 0.08);
  border-color: rgba(255, 106, 61, 0.18);
}

.card-actions,
.row-actions {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: flex-end;
}

.button,
.icon-button,
.row-actions button,
.admin-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 780;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.button:hover,
.icon-button:hover,
.row-actions button:hover,
.admin-tabs button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--line-strong);
}

.button-primary {
  color: white;
  background: var(--accent);
  border-color: rgba(255, 255, 255, 0.12);
}

.button-primary:hover {
  background: #ff784f;
}

.button-ghost {
  color: var(--muted);
}

.icon-button {
  width: 36px;
  padding: 0;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.empty-state {
  margin: 8px 0 0;
  padding: 18px;
  color: var(--subtle);
  text-align: center;
  background: rgba(255, 255, 255, 0.48);
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.admin-strip {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 14px 16px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.publisher-notes {
  width: min(360px, 100%);
  margin: 16px 0 0 auto;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.64)),
    var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: 0 14px 36px rgba(22, 30, 68, 0.14);
  backdrop-filter: blur(18px) saturate(1.1);
}

.publisher-notes summary {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  list-style: none;
  cursor: pointer;
}

.publisher-notes summary::-webkit-details-marker {
  display: none;
}

.publisher-notes summary span {
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 820;
}

.publisher-notes summary strong {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 760;
  line-height: 1.35;
}

.note-grid {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.note-card {
  min-width: 0;
  padding: 10px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.note-card h3 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 760;
  line-height: 1.35;
}

.note-card p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.7;
}

.site-footer {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 14px 4px 0;
}

.site-footer p {
  margin: 0;
  font-size: 0.9rem;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.site-footer a,
.page-links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.site-footer a:hover,
.page-links a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  border-color: var(--line-strong);
}

.page-shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) 0 80px;
}

.page-top {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.page-top .brand {
  width: min(360px, 100%);
}

.page-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.reading-panel {
  padding: clamp(22px, 4vw, 44px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.74)),
    var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(1.14);
}

.reading-panel header {
  max-width: 720px;
  margin-bottom: clamp(22px, 4vw, 34px);
}

.reading-panel h1 {
  max-width: none;
  margin-top: 8px;
  color: var(--ink);
  font-size: 2.6rem;
  line-height: 1.12;
}

.reading-panel h2 {
  margin-bottom: 8px;
  font-size: 1.18rem;
}

.reading-panel p,
.reading-panel li {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
}

.reading-panel p:last-child {
  margin-bottom: 0;
}

.reading-section {
  max-width: 760px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.reading-section + .reading-section {
  margin-top: 18px;
}

.reading-panel ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 1.35em;
}

.reading-panel a.inline-link {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.modal {
  width: min(720px, calc(100% - 24px));
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.admin-modal {
  width: min(980px, calc(100% - 24px));
}

.modal::backdrop {
  background: rgba(28, 34, 48, 0.32);
  backdrop-filter: blur(8px);
}

.modal-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.admin-panel {
  max-height: min(86vh, 820px);
  overflow: auto;
}

.modal-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-head h2 {
  margin: 4px 0 0;
}

.admin-workbench {
  display: grid;
  gap: 14px;
}

.admin-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.admin-tabs button {
  flex: 1 1 0;
  border-color: transparent;
}

.admin-tabs button.is-active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--line);
}

.admin-section {
  display: none;
}

.admin-section.is-active {
  display: grid;
  gap: 14px;
}

.editor-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.modal label,
.editor-form label,
.json-editor {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 720;
}

.modal input,
.modal textarea,
.editor-form input,
.editor-form textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
}

.modal input:focus,
.modal textarea:focus,
.editor-form input:focus,
.editor-form textarea:focus {
  border-color: rgba(255, 106, 61, 0.58);
}

.modal textarea,
.editor-form textarea {
  resize: vertical;
}

.span-2 {
  grid-column: 1 / -1;
}

.inline-controls,
.form-actions,
.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.check-line {
  display: inline-flex !important;
  grid-template-columns: none !important;
  gap: 8px !important;
  align-items: center;
}

.check-line input {
  width: 16px;
  min-height: 16px;
}

.json-editor textarea {
  min-height: 280px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.55;
}

.helper-text {
  min-height: 1.2em;
  margin: 0;
  color: var(--accent-2);
  font-size: 0.86rem;
}

.helper-text a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  max-width: min(360px, calc(100% - 36px));
  padding: 11px 13px;
  color: white;
  font-size: 0.88rem;
  font-weight: 760;
  background: #2f3a52;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.cursor-particles {
  position: fixed;
  inset: 0;
  z-index: 120;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.cursor-mote {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--mote-size, 5px);
  height: var(--mote-size, 5px);
  z-index: 121;
  pointer-events: none;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.78) 0 24%, rgba(166, 221, 255, 0.42) 42%, rgba(166, 221, 255, 0) 76%);
  box-shadow:
    0 0 7px rgba(183, 230, 255, 0.32),
    0 0 14px rgba(106, 172, 255, 0.16);
  opacity: 0;
  filter: blur(0.25px);
  transform: translate(-50%, -50%) scale(1);
  animation: cursorMoteFade var(--mote-life, 640ms) ease-out forwards;
  will-change: transform, opacity;
}

@keyframes cursorMoteFade {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.45);
  }
  18% {
    opacity: 0.58;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--mote-dx, 0px)), calc(-50% + var(--mote-dy, 0px))) scale(0.35);
  }
}

.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;
}

@media (max-width: 860px) {
  .top-nav {
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: stretch;
    padding: 14px 0;
  }

  .nav-menu,
  .account-area {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .main-content {
    padding-top: 34px;
  }

  .search-dock {
    top: 154px;
  }

  .metrics-strip {
    grid-template-columns: 1fr;
  }

  .metrics-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metrics-strip div:last-child {
    border-bottom: 0;
  }

  .site-card,
  .hot-item,
  .featured-item,
  .admin-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .site-meta,
  .hot-score,
  .card-actions,
  .row-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .editor-form {
    grid-template-columns: 1fr;
  }

  .publisher-notes {
    width: 100%;
  }

  .form-actions .button,
  .data-actions .button {
    width: 100%;
  }

  .site-footer,
  .page-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer nav,
  .page-links {
    justify-content: flex-start;
  }

  .reading-panel h1 {
    font-size: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor-particles {
    display: none;
  }
}
