:root {
  --accent: #6558f5;
  --accent-rgb: 101, 88, 245;
  --ink: #1e2030;
  --muted: #77798b;
  --line: #e8e7ef;
  --panel: rgba(255, 255, 255, 0.82);
  --surface: #f7f7fa;
  --page: #fcfcfd;
  --shadow: 0 18px 50px rgba(31, 31, 50, 0.08);
  --radius: 20px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--page); color: var(--ink); overflow-x: hidden; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(var(--accent-rgb), .24); outline-offset: 2px; }
.shell { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }

.ambient { position: fixed; z-index: -1; width: 520px; height: 520px; border-radius: 50%; filter: blur(4px); opacity: .38; pointer-events: none; }
.ambient-one { top: -290px; left: 15%; background: radial-gradient(circle, rgba(var(--accent-rgb), .22), transparent 68%); }
.ambient-two { right: -260px; top: 440px; background: radial-gradient(circle, rgba(255, 182, 122, .25), transparent 68%); }

.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(232, 231, 239, .85); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 760; font-size: 19px; letter-spacing: -.5px; }
.brand-mark { width: 32px; height: 32px; display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); gap: 3px; padding: 5px; background: var(--ink); border-radius: 9px; transform: rotate(-3deg); box-shadow: 0 5px 15px rgba(31,31,46,.16); }
.brand-mark span { background: #fff; border-radius: 2px; }
.brand-mark span:first-child { grid-row: span 2; }
.top-actions, .view-actions { display: flex; gap: 10px; align-items: center; }
.admin-login-button { height: 42px; border: 1px solid var(--line); border-radius: 12px; padding: 0 13px; display: inline-flex; align-items: center; gap: 7px; background: rgba(255,255,255,.78); color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 650; transition: .2s; }
.admin-login-button:hover { color: var(--accent); border-color: rgba(var(--accent-rgb),.3); }
.admin-login-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.admin-login-button.admin-active { color: #278861; background: rgba(39,136,97,.08); border-color: rgba(39,136,97,.2); }
.admin-login-button em { padding-left: 5px; color: var(--muted); font-style: normal; font-size: 10px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #36a879; box-shadow: 0 0 0 4px rgba(54,168,121,.12); }
.icon-button { border: 1px solid var(--line); width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.78); display: inline-grid; place-items: center; cursor: pointer; transition: .2s ease; }
.icon-button:hover { border-color: rgba(var(--accent-rgb), .4); transform: translateY(-1px); }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button.active { color: var(--accent); background: rgba(var(--accent-rgb), .08); border-color: rgba(var(--accent-rgb), .2); }

.button { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 650; cursor: pointer; transition: .2s ease; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--accent); box-shadow: 0 9px 24px rgba(var(--accent-rgb), .22); }
.button-primary:hover { box-shadow: 0 12px 28px rgba(var(--accent-rgb), .3); }
.button-ghost { border: 1px solid var(--line); background: transparent; }
.plus { font-size: 19px; line-height: 1; font-weight: 400; }

.hero { padding: 90px 0 68px; text-align: center; }
.eyebrow { color: var(--accent); font-size: 13px; font-weight: 750; letter-spacing: 1.8px; text-transform: uppercase; display: flex; align-items: center; justify-content: center; gap: 8px; }
.eyebrow span { display: inline-block; width: 18px; height: 2px; background: var(--accent); border-radius: 9px; }
.hero h1 { margin: 20px 0 14px; font-size: clamp(38px, 5vw, 62px); line-height: 1.12; letter-spacing: -3px; font-weight: 780; }
.hero h1 span { color: var(--accent); }
.hero > p { margin: 0; color: var(--muted); font-size: 17px; }
.search-box { position: relative; width: min(690px, 100%); margin: 42px auto 28px; display: flex; align-items: center; padding: 0 18px; height: 62px; background: var(--panel); border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow); backdrop-filter: blur(14px); transition: .2s; }
.search-box:focus-within { border-color: rgba(var(--accent-rgb), .55); box-shadow: 0 20px 55px rgba(var(--accent-rgb), .12); transform: translateY(-1px); }
.search-box svg { width: 21px; fill: none; stroke: #8e8f9e; stroke-width: 1.8; }
.search-box input { flex: 1; align-self: stretch; min-width: 0; margin: 0 14px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 15px; }
.search-box input::placeholder { color: #a2a2af; }
kbd { color: #9697a5; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; font: 11px/1.1 inherit; white-space: nowrap; }
.stats { display: inline-flex; align-items: center; gap: 28px; color: var(--muted); }
.stats div { display: flex; align-items: baseline; gap: 6px; }
.stats strong { color: var(--ink); font-size: 17px; }
.stats span { font-size: 13px; }
.stats i { width: 1px; height: 18px; background: var(--line); }

.workspace { padding: 12px 0 90px; }
.workspace-heading, .section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.workspace-heading h2, .section-heading h2 { margin: 0 0 7px; font-size: 28px; letter-spacing: -1px; }
.workspace-heading p, .section-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.view-actions .icon-button { width: 38px; height: 38px; background: transparent; }
.category-row { margin: 29px 0 23px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.category-tabs { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab { flex: 0 0 auto; border: 1px solid transparent; background: transparent; padding: 9px 14px; border-radius: 10px; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 600; }
.category-tab:hover { color: var(--ink); background: var(--surface); }
.category-tab.active { background: rgba(var(--accent-rgb), .09); color: var(--accent); border-color: rgba(var(--accent-rgb), .1); }
.category-tab span { margin-left: 5px; font-size: 11px; opacity: .75; }
.text-button { border: 0; background: transparent; color: var(--muted); display: flex; align-items: center; gap: 6px; padding: 8px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.text-button:hover { color: var(--accent); }
.text-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }

.site-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.site-card { position: relative; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 20px; min-height: 166px; display: flex; flex-direction: column; cursor: grab; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; backdrop-filter: blur(12px); }
body:not(.is-admin) .site-card { cursor: default; }
.site-card:hover { transform: translateY(-4px); border-color: rgba(var(--accent-rgb), .22); box-shadow: var(--shadow); }
.site-card.dragging { opacity: .4; transform: scale(.98); }
.site-card.drag-over { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.site-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-size: 17px; font-weight: 760; box-shadow: inset 0 1px rgba(255,255,255,.25), 0 8px 18px color-mix(in srgb, var(--icon-color), transparent 72%); background: var(--icon-color); }
.card-menu-button { width: 30px; height: 30px; border: 0; border-radius: 9px; background: transparent; color: #a0a0aa; cursor: pointer; font-size: 20px; line-height: 1; opacity: 0; transition: .2s; }
.site-card:hover .card-menu-button, .card-menu-button:focus { opacity: 1; }
.card-menu { position: absolute; z-index: 3; top: 49px; right: 17px; width: 116px; display: none; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 12px; padding: 5px; }
.card-menu.open { display: block; }
.card-menu button { width: 100%; border: 0; padding: 8px 9px; text-align: left; background: transparent; border-radius: 8px; cursor: pointer; font-size: 12px; }
.card-menu button:hover { background: var(--surface); }
.card-menu button:last-child { color: #d9485f; }
.site-link { margin-top: 20px; color: inherit; text-decoration: none; min-width: 0; }
.site-link h3 { margin: 0 0 6px; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-link p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-bottom { margin-top: auto; padding-top: 15px; display: flex; align-items: center; justify-content: space-between; }
.category-badge { color: var(--accent); background: rgba(var(--accent-rgb), .07); padding: 5px 8px; border-radius: 7px; font-size: 10px; font-weight: 700; }
.external-arrow { color: #aaaab5; font-size: 16px; transition: .2s; }
.site-card:hover .external-arrow { color: var(--accent); transform: translate(2px, -2px); }
.site-grid.list-view { grid-template-columns: 1fr; }
.site-grid.list-view .site-card { min-height: auto; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 17px; }
.site-grid.list-view .card-top { display: contents; }
.site-grid.list-view .site-icon { width: 42px; height: 42px; grid-column: 1; }
.site-grid.list-view .card-menu-button { position: absolute; right: 16px; top: 10px; }
.site-grid.list-view .site-link { margin: 0; grid-column: 2; }
.site-grid.list-view .card-bottom { margin: 0 37px 0 0; padding: 0; grid-column: 3; gap: 14px; }
.empty-state { text-align: center; padding: 74px 20px; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-state > span { font-size: 35px; color: var(--muted); }
.empty-state h3 { margin: 14px 0 7px; }
.empty-state p { margin: 0 0 19px; color: var(--muted); }

.recommendations { padding: 82px 0 95px; border-top: 1px solid var(--line); }
.section-heading .eyebrow { justify-content: flex-start; margin-bottom: 14px; }
.section-heading > p { max-width: 300px; text-align: right; line-height: 1.7; }
.recommend-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; margin-top: 28px; }
.recommend-card { border: 1px solid var(--line); border-radius: 16px; padding: 15px; display: flex; align-items: center; gap: 11px; background: rgba(255,255,255,.5); transition: .2s; }
.recommend-card:hover { border-color: rgba(var(--accent-rgb),.24); background: var(--panel); }
.recommend-card .site-icon { width: 38px; height: 38px; border-radius: 11px; font-size: 13px; flex: 0 0 auto; }
.recommend-info { min-width: 0; flex: 1; }
.recommend-info strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recommend-info span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.quick-add { border: 1px solid var(--line); background: transparent; width: 29px; height: 29px; border-radius: 9px; cursor: pointer; color: var(--accent); }
.quick-add:hover { background: rgba(var(--accent-rgb),.09); border-color: rgba(var(--accent-rgb),.2); }
.quick-add.added { color: #4aa980; cursor: default; }

.footer { min-height: 105px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.footer > div { display: flex; flex-direction: column; gap: 5px; }
.footer strong { font-size: 14px; }
.footer span { color: var(--muted); font-size: 11px; }
.footer nav { display: flex; gap: 4px; }
.footer button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 8px; font-size: 11px; }
.footer button:hover { color: var(--accent); }

.modal { width: min(590px, calc(100% - 30px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 24px; background: var(--page); color: var(--ink); box-shadow: 0 30px 100px rgba(30,31,48,.25); overflow: auto; }
.modal::backdrop { background: rgba(22,23,35,.42); backdrop-filter: blur(5px); }
.modal form { padding: 28px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 25px; }
.modal-head h2 { margin: 4px 0 0; font-size: 23px; }
.modal-kicker { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; }
.modal-head .icon-button { border: 0; background: var(--surface); font-size: 24px; font-weight: 300; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span, .setting-block > span { font-size: 12px; font-weight: 700; }
.field b { color: #dd4e5f; }
.field input, .field textarea { width: 100%; border: 1px solid var(--line); color: var(--ink); background: rgba(255,255,255,.7); border-radius: 11px; padding: 11px 12px; outline: 0; resize: vertical; font-size: 13px; }
.field input:focus, .field textarea:focus { border-color: rgba(var(--accent-rgb),.6); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.08); }
.field-full { grid-column: 1 / -1; }
.color-field { display: grid; grid-template-columns: 1fr 48px auto; align-items: center; }
.color-field input { height: 36px; padding: 3px; cursor: pointer; }
.color-field em { color: var(--muted); font-size: 11px; font-style: normal; }
.privacy-note { display: flex; gap: 10px; margin-top: 18px; padding: 12px; background: rgba(var(--accent-rgb),.06); border-radius: 12px; }
.privacy-note p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.privacy-note strong { display: block; color: var(--ink); }
.modal-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 9px; }
.compact-modal { width: min(440px, calc(100% - 30px)); }
.login-modal { width: min(430px, calc(100% - 30px)); }
.login-description { margin: -9px 0 22px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.login-error { margin: 11px 0 0; padding: 9px 11px; border-radius: 9px; background: rgba(217,72,95,.09); color: #d9485f; font-size: 11px; }
.compact-modal .field { margin-bottom: 22px; }
.setting-block { display: flex; flex-direction: column; gap: 11px; }
.color-options { display: flex; gap: 10px; }
.color-options button { width: 31px; height: 31px; border: 3px solid var(--page); border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.color-options button.selected { box-shadow: 0 0 0 2px var(--ink); }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 28px; transform: translate(-50%, 20px); padding: 11px 16px; border-radius: 11px; color: #fff; background: #252635; box-shadow: var(--shadow); font-size: 12px; opacity: 0; pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

body.dark { --ink: #f3f3f7; --muted: #a5a5b3; --line: #353644; --panel: rgba(36,37,49,.82); --surface: #2b2c39; --page: #1b1c26; --shadow: 0 18px 50px rgba(0,0,0,.22); }
body.dark .icon-button, body.dark .field input, body.dark .field textarea, body.dark .recommend-card { background-color: rgba(35,36,48,.75); }
body.dark .admin-login-button { background-color: rgba(35,36,48,.75); }
body.dark .card-menu { background: #292a37; }
body.dark .button-primary { color: white; }

@media (max-width: 900px) {
  .site-grid, .recommend-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero { padding-top: 70px; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 30px, 1180px); }
  .topbar { height: 70px; }
  .brand { font-size: 16px; }
  .brand-mark { width: 29px; height: 29px; }
  .top-actions .icon-button { display: none; }
  .admin-login-button { width: 42px; padding: 0; justify-content: center; }
  .admin-login-button span:not(.status-dot), .admin-login-button em { display: none; }
  .top-actions .button { padding: 10px 12px; font-size: 12px; }
  .hero { padding: 62px 0 52px; }
  .hero h1 { letter-spacing: -1.8px; }
  .hero > p { font-size: 14px; line-height: 1.7; }
  .search-box { margin-top: 31px; height: 55px; padding-inline: 14px; }
  kbd { display: none; }
  .stats { gap: 14px; }
  .stats div { flex-direction: column; align-items: center; gap: 2px; }
  .workspace-heading { align-items: flex-start; }
  .workspace-heading p { line-height: 1.6; }
  .site-grid, .recommend-grid { grid-template-columns: 1fr; }
  .category-row { align-items: flex-start; }
  .category-tabs { margin-right: -5px; }
  .text-button { display: none; }
  .site-card { min-height: 152px; }
  .card-menu-button { opacity: 1; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .section-heading > p { text-align: left; }
  .recommendations { padding-block: 65px; }
  .footer { padding-block: 25px; flex-direction: column; align-items: flex-start; }
  .footer nav { flex-wrap: wrap; margin-left: -8px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }
  .modal form { padding: 22px; }
}

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