:root {
  color-scheme: light;
  --background: #f8fafc;
  --surface: rgba(255, 255, 255, .84);
  --text: #172033;
  --muted: #687386;
  --line: #e4e9f0;
  --accent: #4567e8;
  --accent-soft: #edf1ff;
  --danger: #c53d4b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--background); }
body { margin: 0; color: var(--text); background: radial-gradient(circle at 50% -20%, rgba(110,132,255,.12), transparent 38rem), var(--background); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 28px; font-weight: 750; letter-spacing: -.04em; text-decoration: none; }
.brand::before { width: 32px; height: 32px; flex: none; border-radius: 8px; background: url("/assets/favicon.svg?v=2") center / contain no-repeat; content: ""; transition: transform .25s ease; }
.brand:hover::before { transform: rotate(-7deg) scale(1.06); }
.page-shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 72px 0 56px; }
.public-page { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.public-page .bookmark-grid { flex-grow: 1; align-content: start; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 44px; }
.account-link { color: var(--muted); font-size: 14px; text-decoration: none; }
.account-link:hover { color: var(--text); }
.plain-button { border: 0; background: transparent; cursor: pointer; font: inherit; }
.account-menu-wrap { position: relative; }
.account-menu { position: absolute; z-index: 40; top: calc(100% + 9px); right: 0; display: grid; min-width: 130px; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: 0 12px 28px rgba(20,30,50,.14); }
.account-menu button, .account-menu a { border: 0; border-radius: 7px; background: transparent; color: var(--text); text-align: left; padding: 9px 10px; cursor: pointer; text-decoration: none; font: inherit; }
.account-menu button:hover, .account-menu button:focus-visible, .account-menu a:hover, .account-menu a:focus-visible { background: #f4f6f9; }
.manage-mode-actions { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.button.compact { padding: 7px 13px; }
.search-wrap { width: min(720px, 100%); margin: 0 auto 52px; }
.engine-tabs, .category-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.engine-tabs { justify-content: center; margin-bottom: 16px; }
.engine-tab, .category-tab { border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; padding: 8px 13px; text-decoration: none; white-space: nowrap; }
.engine-tab.active, .category-tab.active { color: var(--accent); background: var(--accent-soft); }
.search-form { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 12px 35px rgba(34,48,78,.08); padding: 5px 6px 5px 20px; }
.search-input { width: 100%; height: 52px; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; }
.search-button { width: 44px; height: 44px; flex: none; border: 0; border-radius: 13px; color: white; background: var(--accent); cursor: pointer; font: inherit; }
.field-error { color: var(--danger); font-size: 13px; margin: 9px 4px 0; }
.navigation-intro { margin: 0 0 28px; }
.navigation-intro h1 { margin: 0 0 8px; font-size: clamp(22px, 3vw, 30px); letter-spacing: -.025em; }
.navigation-intro p { max-width: 760px; margin: 0; color: var(--muted); line-height: 1.75; }
.category-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.category-tabs { padding: 0 0 12px; }
.category-tab { border-radius: 10px; }
.category-tab[draggable="true"], .bookmark-card[draggable="true"] { touch-action: none; cursor: grab; }
.category-tab[draggable="true"]:active, .bookmark-card[draggable="true"]:active { cursor: grabbing; }
.is-touch-dragging { opacity: .55; transform: scale(.98); }
.add-category { border: 0; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; padding: 4px 8px 15px; }
.bookmark-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.bookmark-card { min-height: 76px; display: flex; align-items: center; gap: 12px; position: relative; border: 1px solid var(--line); border-radius: 15px; color: var(--text); background: var(--surface); padding: 15px; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.bookmark-card:hover, .bookmark-card:focus-within { transform: translateY(-2px); border-color: #d2d9e6; box-shadow: 0 10px 24px rgba(35,48,75,.07); }
.bookmark-icon { position: relative; width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.bookmark-icon img { position: absolute; width: 18px; height: 18px; object-fit: contain; background: var(--accent-soft); }
.bookmark-content { min-width: 0; display: grid; gap: 5px; }
.bookmark-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.bookmark-card-link { position: absolute; z-index: 1; inset: 0; border-radius: inherit; cursor: pointer; }
.bookmark-icon, .bookmark-title { position: relative; z-index: 2; pointer-events: none; }
.bookmark-menu-button { position: relative; z-index: 3; margin-left: auto; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 8px 2px; }
.public-bookmark-card { min-height: 94px; align-items: flex-start; }
.public-bookmark-card .bookmark-icon { margin-top: 2px; }
.bookmark-description { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.add-card { border-style: dashed; color: var(--muted); justify-content: center; background: transparent; cursor: pointer; font: inherit; }
.category-tools { display: flex; justify-content: flex-end; gap: 12px; margin: -15px 0 14px; }
.category-tools button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; }
.danger-text { color: var(--danger) !important; }
.empty-state { color: var(--muted); text-align: center; padding: 68px 20px; }
.context-menu { position: fixed; z-index: 70; display: grid; min-width: 150px; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: 0 14px 36px rgba(20,30,50,.18); }
.context-menu button { border: 0; border-radius: 7px; background: transparent; color: var(--text); text-align: left; padding: 9px 10px; cursor: pointer; }
.context-menu button:hover, .context-menu button:focus-visible { background: #f4f6f9; }
.context-menu button:disabled { color: #aeb5c0; cursor: not-allowed; }
.move-list { display: grid; gap: 9px; max-height: 300px; overflow: auto; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: 28px; transform: translateX(-50%); background: #1d2638; color: white; border-radius: 11px; padding: 11px 16px; font-size: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.2); }
.site-footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.site-footer nav { display: flex; gap: 16px; }
.site-footer a { color: inherit; }
.content-page { width: min(760px, calc(100% - 40px)); margin: 0 auto; padding: 72px 0; line-height: 1.8; }
.content-page h1 { margin: 42px 0 10px; font-size: 32px; }
.content-page h2 { margin: 34px 0 8px; font-size: 21px; }
.content-page p, .content-page li { color: #4f5b6d; }
.content-page a { color: var(--accent); }
.error-page { min-height: 70vh; display: grid; align-content: center; justify-items: start; }
.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; }
.dialog { width: min(430px, calc(100% - 40px)); border: 0; border-radius: 20px; background: white; box-shadow: 0 24px 80px rgba(17,24,39,.24); padding: 24px; }
.dialog::backdrop { background: rgba(18,25,38,.36); }
.dialog h2 { margin: 0 0 14px; font-size: 20px; }
.dialog p { color: var(--muted); line-height: 1.7; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.button { border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer; background: #eef1f5; color: var(--text); text-decoration: none; font: inherit; }
.button.primary { background: var(--accent); color: white; }
.button.danger { background: var(--danger); color: white; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.auth-shell { width: min(420px, calc(100% - 40px)); margin: 0 auto; padding: 90px 0; }
.auth-notice { margin: 24px 0 -8px; border: 1px solid var(--line); border-radius: 11px; background: var(--accent-soft); color: var(--accent); padding: 11px 14px; font-size: 14px; }
.auth-card { margin-top: 32px; border: 1px solid var(--line); background: white; border-radius: 20px; padding: 26px; box-shadow: 0 16px 45px rgba(34,48,78,.07); }
.auth-card h1 { margin: 0 0 22px; font-size: 23px; }
.auth-card .button { width: 100%; }
.auth-foot { text-align: center; color: var(--muted); margin-top: 18px; font-size: 14px; }
.auth-foot a, .auth-secondary a { color: var(--accent); }
.auth-secondary { margin: 14px 0 0; text-align: right; font-size: 13px; }
.form-field { display: grid; gap: 7px; margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.form-field input { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; color: var(--text); outline: 0; font: inherit; }
.form-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(69,103,232,.12); }
.account-shell { width: min(760px, calc(100% - 40px)); margin: 0 auto; padding: 72px 0; }
.account-shell > h1 { margin: 0 0 24px; font-size: 30px; }
.page-message, .page-error { margin-bottom: 18px; }
.settings-card { margin: 14px 0; border: 1px solid var(--line); border-radius: 16px; background: white; padding: 22px; }
.settings-card h2 { margin: 0 0 14px; font-size: 19px; }
.settings-card p { margin: 8px 0; }
.settings-hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.session-list { display: grid; margin-bottom: 14px; }
.session-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding: 12px 0; }
.session-row span { display: grid; gap: 5px; }
.session-row small { color: var(--muted); }
.import-file { margin-top: 18px; }
.import-preview { display: grid; gap: 10px; margin-top: 16px; border-radius: 12px; background: var(--accent-soft); padding: 14px; }
.import-preview span { color: var(--muted); font-size: 13px; }
.danger-zone { border-color: #f0ccd1; }
.offline-page { width: min(520px, calc(100% - 40px)); min-height: 100vh; margin: 0 auto; display: grid; align-content: center; justify-items: center; gap: 14px; text-align: center; }
.offline-page img { border-radius: 22px; box-shadow: 0 16px 40px rgba(41,73,199,.2); }
.offline-page h1 { margin: 14px 0 0; font-size: 28px; }
.offline-page p { margin: 0 0 14px; color: var(--muted); line-height: 1.7; }

@media (max-width: 640px) {
  .page-shell { width: min(100% - 24px, 1120px); padding-top: 32px; }
  .topbar { margin-bottom: 34px; }
  .search-wrap { margin-bottom: 38px; }
  .engine-tabs { justify-content: flex-start; }
  .bookmark-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .bookmark-card { min-height: 70px; padding: 12px; }
  .public-bookmark-card { min-height: 106px; }
  .site-footer { display: grid; }
}

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