/* ===========================================================================
   Private Search — stylesheet
   Flat, calm, DuckDuckGo-leaning. Light/dark · responsive · motion-aware.
   =========================================================================== */

:root {
  --accent: #6f5cff;
  --accent-ink: #ffffff;

  --radius: 24px;
  --radius-md: 14px;
  --radius-sm: 9px;

  --col: 680px;
  --gutter: clamp(16px, 7vw, 172px);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --fast: 0.15s;
  --med: 0.24s;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji";

  /* light */
  --bg: #ffffff;
  --bg-soft: #f4f5f7;
  --bg-softer: #fafbfc;
  --fg: #16181c;
  --fg-soft: #41464d;
  --muted: #6b727b;
  --line: #e8eaee;
  --line-strong: #d9dce2;
  --field: #ffffff;
  --link: #1a4fd6;
  --link-visited: #6b4bc0;
  --url: #0a7c4a;
  --card: #ffffff;
  --danger: #d8453d;
}

:root[data-theme="dark"] {
  --bg: #15171c;
  --bg-soft: #1d2026;
  --bg-softer: #191c22;
  --fg: #e8eaed;
  --fg-soft: #b4b9c1;
  --muted: #828893;
  --line: #282c34;
  --line-strong: #353a44;
  --field: #1e2128;
  --link: #84a9ff;
  --link-visited: #b79bff;
  --url: #56c089;
  --card: #1c1f25;
  --danger: #ff6b63;
}
/* OLED black theme */
:root[data-theme="black"] {
  --bg: #000000;
  --bg-soft: #121316;
  --bg-softer: #0a0b0d;
  --fg: #f0f1f3;
  --fg-soft: #b9bdc4;
  --muted: #7e848d;
  --line: #1f2126;
  --line-strong: #2c2f35;
  --field: #0d0e11;
  --link: #8fb4ff;
  --link-visited: #c0a8ff;
  --url: #5fcf92;
  --card: #0c0d10;
  --danger: #ff6b63;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="black"]) {
    --bg: #15171c;
    --bg-soft: #1d2026;
    --bg-softer: #191c22;
    --fg: #e8eaed;
    --fg-soft: #b4b9c1;
    --muted: #828893;
    --line: #282c34;
    --line-strong: #353a44;
    --field: #1e2128;
    --link: #84a9ff;
    --link-visited: #b79bff;
    --url: #56c089;
    --card: #1c1f25;
    --danger: #ff6b63;
  }
}

* { box-sizing: border-box; }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: 8px;
  border: 3px solid transparent; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body { min-height: 100dvh; }
[hidden] { display: none !important; }
a { color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* --------------------------------- Logo --------------------------------- */
.logo {
  display: inline-flex; align-items: center; gap: 11px;
  text-decoration: none; color: var(--fg);
  font-size: 30px; font-weight: 600; letter-spacing: -0.5px;
}
.logo-text b { color: var(--accent); font-weight: 800; }
.logo-img { display: block; width: 30px; height: 30px; flex: none; }
.logo-img.sm { width: 30px; height: 30px; }
.logo-img.big { width: 64px; height: 64px; }
.logo-sm { font-size: 0; }

/* ----------------------- Holiday effects layer -------------------------- */
/* In front of page content (so it's always visible) but under settings/lightbox/
   lock overlays, and click-through. */
.fx-layer { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.fx-layer canvas { position: absolute; inset: 0; }

/* -------------------------------- Home --------------------------------- */
.home { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; position: relative; }
.home-main { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.home-inner {
  width: 100%; max-width: 580px; display: flex; flex-direction: column;
  align-items: center; gap: 26px;
  animation: rise var(--med) var(--ease) both;
}
.home .logo { font-size: 38px; gap: 15px; }
.home .logo-img { width: 46px; height: 46px; }
.holiday {
  margin: 0; font-size: 15px; color: var(--fg-soft);
  background: var(--bg-soft); border: 1px solid var(--line);
  padding: 7px 16px; border-radius: 999px;
}
.settings-fab { position: absolute; top: 16px; right: 18px; }

.quick-row { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.chip {
  border: 1px solid var(--line); background: var(--bg-softer);
  color: var(--fg-soft); font: inherit; font-size: 13.5px;
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
  transition: border-color var(--fast), color var(--fast), background var(--fast);
}
.chip:hover { border-color: var(--accent); color: var(--fg); background: var(--bg-soft); }
.chip-accent {
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-softer));
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line)); color: var(--fg); font-weight: 600;
}
.chip-accent:hover { background: color-mix(in srgb, var(--accent) 22%, var(--bg-soft)); border-color: var(--accent); }

/* ------------------------------ Search box ------------------------------ */
.searchbox {
  position: relative; width: 100%; display: flex; align-items: center;
  background: var(--field); border: 1.5px solid var(--line-strong);
  border-radius: var(--radius); padding: 0 0 0 18px;
  transition: border-color var(--med) var(--ease), box-shadow var(--med) var(--ease);
}
.searchbox:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.search-icon {
  width: 19px; height: 19px; flex: none; opacity: 0.5;
  background: currentColor;
  -webkit-mask: var(--mag) center / contain no-repeat;
  mask: var(--mag) center / contain no-repeat;
  transition: opacity var(--fast), color var(--fast);
}
.searchbox:focus-within .search-icon { opacity: 0.9; color: var(--accent); }
:root {
  --mag: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M15.5 14h-.79l-.28-.27a6.5 6.5 0 1 0-.7.7l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0A4.5 4.5 0 1 1 14 9.5 4.5 4.5 0 0 1 9.5 14z'/></svg>");
}
.search-input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  color: var(--fg); font-size: 17px; padding: 14px 10px; font-family: inherit;
}
.search-input::placeholder { color: var(--muted); }
/* Search button = the right segment of the pill: square inner edge, rounded
   outer edge matching the box, full height — so it reads as one piece. */
.go-btn {
  flex: none; width: 54px; align-self: stretch; border: none;
  border-radius: 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0;
  background: var(--accent); cursor: pointer; position: relative;
  transition: filter var(--fast);
}
.go-btn:hover { filter: brightness(1.07); }
.go-btn:active { filter: brightness(0.95); }
.go-btn::after {
  content: ""; position: absolute; inset: 0; background: var(--accent-ink);
  -webkit-mask: var(--mag) center / 21px no-repeat;
  mask: var(--mag) center / 21px no-repeat;
}
.clear-btn {
  flex: none; width: 34px; height: 34px; margin-right: 4px; border: none; background: transparent;
  color: var(--muted); font-size: 21px; cursor: pointer; line-height: 1;
  border-radius: 50%; transition: color var(--fast), background var(--fast);
}
.clear-btn:hover { color: var(--fg); background: var(--bg-soft); }

/* ----------------------------- Suggestions ------------------------------ */
.suggestions {
  position: absolute; top: calc(100% + 7px); left: 0; right: 0; margin: 0;
  padding: 6px; list-style: none; background: var(--field);
  border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  z-index: 30; overflow: hidden; animation: pop var(--fast) var(--ease) both;
  box-shadow: 0 12px 32px rgba(8, 10, 14, 0.14);
}
.suggestions li {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px;
  border-radius: 9px; cursor: pointer; font-size: 15px; color: var(--fg-soft);
  transition: background var(--fast), color var(--fast);
}
.suggestions li .s-ic { opacity: 0.5; font-size: 13px; width: 14px; text-align: center; flex: none; }
.suggestions li .s-tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestions li.active, .suggestions li:hover { background: var(--bg-soft); color: var(--fg); }

/* -------------------------------- Topbar -------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center;
  gap: 16px; padding: 11px clamp(14px, 4vw, 28px); padding-left: var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.3) blur(12px); -webkit-backdrop-filter: saturate(1.3) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .logo { flex: none; }
.searchbox-top { max-width: 620px; padding: 0 0 0 14px; border-radius: var(--radius-md); }
.searchbox-top .search-input { font-size: 16px; padding: 10px 8px; }
.searchbox-top .go-btn { width: 46px; border-radius: 0 calc(var(--radius-md) - 2px) calc(var(--radius-md) - 2px) 0; }
.searchbox-top .go-btn::after { -webkit-mask-size: 18px; mask-size: 18px; }
.searchbox-top .clear-btn { width: 30px; height: 30px; margin-right: 3px; font-size: 19px; }

.icon-btn {
  flex: none; width: 40px; height: 40px; border: none; background: transparent;
  color: var(--fg-soft); font-size: 19px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--fast), color var(--fast), transform var(--fast);
}
.icon-btn:hover { background: var(--bg-soft); color: var(--fg); }
.icon-btn:active { transform: scale(0.92); }
.settings-fab { transition: background var(--fast), transform var(--med) var(--ease); }
.settings-fab:hover { transform: rotate(40deg); }

/* --------------------------------- Tabs --------------------------------- */
.tabs {
  display: flex; gap: 2px; padding: 3px clamp(14px, 4vw, 28px) 0;
  padding-left: var(--gutter); border-bottom: 1px solid var(--line);
  position: sticky; top: 58px; background: var(--bg); z-index: 10;
}
.tab {
  position: relative; border: none; background: transparent; color: var(--muted);
  padding: 12px 15px; font-size: 14px; font-weight: 600; cursor: pointer;
  margin-bottom: -1px; transition: color var(--fast);
}
.tab::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: 0; height: 2px;
  border-radius: 2px 2px 0 0; background: var(--accent);
  transform: scaleX(0); transition: transform var(--med) var(--ease);
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--accent); }
.tab.active::after { transform: scaleX(1); }

/* ------------------------------- Content -------------------------------- */
.content {
  max-width: var(--col); margin-left: var(--gutter); margin-right: auto;
  padding: 20px clamp(14px, 4vw, 28px) 40px; min-height: 60vh;
}
/* Images use the full page width, not the narrow reading column */
.content[data-type="images"] {
  max-width: none;
  margin-left: clamp(14px, 3vw, 30px);
  margin-right: clamp(14px, 3vw, 30px);
}

/* Web results — flat DDG style: favicon · breadcrumb · title · snippet */
.result { padding: 15px 0; }
.result + .result { border-top: 1px solid var(--line); }
.r-head { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; min-width: 0; }
.r-fav {
  width: 18px; height: 18px; border-radius: 4px; flex: none; object-fit: cover;
  background: var(--bg-soft); border: 1px solid var(--line);
}
.r-crumb {
  font-size: 12.5px; color: var(--fg-soft); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.r-crumb { flex: 0 1 auto; }
.r-crumb .r-dom { color: var(--fg); font-weight: 600; }
.r-crumb .r-path { color: var(--url); }
.no-favicons .r-fav { display: none; }
.risk-badge {
  flex: none; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  white-space: nowrap; letter-spacing: 0.2px;
}
.risk-badge.warn {
  color: #c07d18; background: color-mix(in srgb, #f0972b 16%, transparent);
  border: 1px solid color-mix(in srgb, #f0972b 45%, transparent);
}
:root[data-theme="dark"] .risk-badge.warn, :root[data-theme="black"] .risk-badge.warn { color: #f0b25a; }
.risk-badge.http { color: var(--muted); background: var(--bg-soft); border: 1px solid var(--line-strong); }
.result a.r-title {
  color: var(--link); font-size: 19px; line-height: 1.3; text-decoration: none; font-weight: 500;
  display: inline-block; margin: 1px 0 3px;
}
.result a.r-title:visited { color: var(--link-visited); }
.result a.r-title:hover { text-decoration: underline; }
.result .r-url {
  display: none; color: var(--url); font-size: 12.5px; margin: 0 0 4px;
  word-break: break-all;
}
.detail-url .result .r-url { display: block; }
.result .r-snip { color: var(--fg-soft); font-size: 14px; line-height: 1.55; margin: 0; }
.result.sel { background: var(--bg-soft); box-shadow: inset 3px 0 0 var(--accent);
  padding-left: 14px; padding-right: 14px; margin: 0 -14px; border-radius: 8px; }

.result, .news-item { animation: rise var(--med) var(--ease) both; }
.result:nth-child(-n+6) { animation-delay: calc(0.02s * var(--i, 0)); }

/* ----------------------- Smart answers / widgets ------------------------ */
.kpanel, .calc, .timer, .weather {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md);
  margin-bottom: 20px; animation: rise var(--med) var(--ease) both;
}

/* Knowledge panel */
.kpanel { display: flex; gap: 18px; padding: 18px 20px; }
.kp-media { width: 104px; flex: none; }
.kp-media img { width: 104px; height: 104px; object-fit: cover; border-radius: 10px; background: var(--bg-soft); }
.kp-body { min-width: 0; flex: 1; }
.kp-title { margin: 0 0 2px; font-size: 20px; letter-spacing: -0.2px; }
.kp-cat { font-size: 12px; color: var(--muted); margin-bottom: 8px; text-transform: capitalize; }
.kp-text { margin: 0; color: var(--fg-soft); font-size: 14px; line-height: 1.6; }
.kp-info { margin: 12px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kp-info dt { color: var(--muted); }
.kp-info dd { margin: 0; color: var(--fg); overflow: hidden; text-overflow: ellipsis; }
.kp-src { margin-top: 10px; font-size: 12px; }
.kp-src a { color: var(--accent); text-decoration: none; font-weight: 600; }
.kp-src a:hover { text-decoration: underline; }
.related { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.related a {
  font-size: 13px; color: var(--fg-soft); text-decoration: none;
  border: 1px solid var(--line); background: var(--bg-softer);
  padding: 6px 12px; border-radius: 999px; max-width: 320px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: border-color var(--fast), color var(--fast);
}
.related a:hover { border-color: var(--accent); color: var(--fg); }

/* Calculator */
.calc { padding: 16px 18px; }
.calc-top { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.calc-expr { font-size: 14px; color: var(--muted); min-height: 18px; word-break: break-all; }
.calc-result { font-size: 30px; font-weight: 700; letter-spacing: -0.5px; word-break: break-all; }
.calc-unit { font-size: 13px; color: var(--muted); margin-top: 4px; }
.calc-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.calc-key {
  border: 1px solid var(--line); background: var(--bg-softer); color: var(--fg);
  font: inherit; font-size: 16px; padding: 12px 0; border-radius: 9px; cursor: pointer;
  transition: background var(--fast), border-color var(--fast), transform var(--fast);
}
.calc-key:hover { background: var(--bg-soft); }
.calc-key:active { transform: scale(0.95); }
.calc-key.op { color: var(--accent); font-weight: 600; }
.calc-key.eq { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.calc-key.fn { font-size: 14px; color: var(--fg-soft); }

/* Timer */
.timer { padding: 18px 20px; text-align: center; }
.timer-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.timer-display { font-size: 46px; font-weight: 700; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.timer-display.done { color: var(--accent); animation: pulse 1s var(--ease) infinite; }
.timer-controls { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.timer-btn {
  border: 1px solid var(--line-strong); background: var(--field); color: var(--fg);
  font: inherit; font-size: 14px; font-weight: 600; padding: 9px 20px; border-radius: 999px; cursor: pointer;
  transition: border-color var(--fast), color var(--fast);
}
.timer-btn:hover { border-color: var(--accent); color: var(--accent); }
.timer-btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* Weather */
.weather { padding: 18px 20px; }
.wx-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wx-place { font-size: 17px; font-weight: 600; }
.wx-place small { color: var(--muted); font-weight: 400; font-size: 13px; }
.wx-now { display: flex; align-items: center; gap: 16px; margin: 10px 0 6px; }
.wx-emoji { font-size: 52px; line-height: 1; }
.wx-temp { font-size: 42px; font-weight: 700; letter-spacing: -1px; }
.wx-desc { color: var(--fg-soft); font-size: 14px; }
.wx-meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 2px; }
.wx-days { display: flex; gap: 8px; margin-top: 16px; }
.wx-day {
  flex: 1; text-align: center; background: var(--bg-softer); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 4px; font-size: 12.5px;
}
.wx-day .d-name { color: var(--muted); margin-bottom: 4px; }
.wx-day .d-emoji { font-size: 22px; }
.wx-day .d-temp { margin-top: 4px; }
.wx-day .d-hi { font-weight: 600; }
.wx-day .d-lo { color: var(--muted); }

/* Images — justified rows that fill the width */
.img-just { display: flex; flex-direction: column; gap: 6px; }
.img-row { display: flex; gap: 6px; }
.img-cell {
  position: relative; overflow: hidden; border-radius: 10px; background: var(--bg-soft);
  text-decoration: none; cursor: zoom-in; border: 1px solid var(--line); display: block;
  transition: filter var(--fast);
}
.img-cell:hover { filter: brightness(1.04); }
.img-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-cell .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 8px 6px;
  font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,0.72));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity var(--med);
}
.img-cell:hover .cap, .img-cell:focus-visible .cap { opacity: 1; }

/* News */
.news-item { display: flex; gap: 16px; padding: 16px 0; }
.news-item + .news-item { border-top: 1px solid var(--line); }
.news-item img { width: 120px; height: 82px; object-fit: cover; border-radius: 10px; flex: none; background: var(--bg-soft); }
.news-item .n-meta { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.news-item a.n-title { color: var(--link); font-size: 16px; text-decoration: none; font-weight: 500; line-height: 1.35; }
.news-item a.n-title:hover { text-decoration: underline; }
.news-item p { margin: 6px 0 0; color: var(--fg-soft); font-size: 13.5px; line-height: 1.5; }

/* Pager / states / note */
.pager { display: flex; justify-content: center; gap: 12px; margin-top: 30px; }
.pager button {
  border: 1px solid var(--line-strong); background: var(--field); color: var(--fg);
  padding: 10px 20px; border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: border-color var(--fast), color var(--fast), transform var(--fast);
}
.pager button:hover { border-color: var(--accent); color: var(--accent); }
.pager button:active { transform: scale(0.96); }
.state { text-align: center; color: var(--muted); padding: 56px 16px; font-size: 15px; line-height: 1.6; }
.state .state-emoji { font-size: 30px; display: block; margin-bottom: 10px; }
.state .retry { margin-top: 14px; }
.pager-retry { border: 1px solid var(--line-strong); background: var(--field); color: var(--fg);
  padding: 9px 18px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600;
  transition: border-color var(--fast), color var(--fast); }
.pager-retry:hover { border-color: var(--accent); color: var(--accent); }
.result-note { text-align: center; color: var(--muted); font-size: 12px; margin: 26px 0 0; }

/* Loading skeletons */
.spinner { width: 26px; height: 26px; margin: 60px auto; border: 3px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
.skeleton { padding-top: 4px; }
.sk-row { padding: 15px 0; border-top: 1px solid var(--line); }
.sk-row:first-child { border-top: none; }
.sk-line { height: 12px; border-radius: 7px; background: var(--bg-soft); position: relative; overflow: hidden; }
.sk-line + .sk-line { margin-top: 9px; }
.sk-line.t { height: 17px; width: 60%; } .sk-line.u { width: 34%; }
.sk-line.s1 { width: 94%; } .sk-line.s2 { width: 78%; }
.sk-line::after, .sk-tile::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--fg) 7%, transparent), transparent);
  transform: translateX(-100%); animation: shimmer 1.3s infinite;
}
.sk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; }
.sk-tile { aspect-ratio: 4/3; border-radius: 10px; background: var(--bg-soft); position: relative; overflow: hidden; }

/* ------------------------------ Footer ---------------------------------- */
.site-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; padding: 18px clamp(14px, 4vw, 28px); padding-left: var(--gutter);
  border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px;
}
.home-footer { width: 100%; padding-left: clamp(16px, 4vw, 28px); }
.foot-brand { display: flex; align-items: center; gap: 12px; }
.foot-logo { width: 34px; height: 34px; flex: none; }
.foot-text { display: flex; flex-direction: column; line-height: 1.35; }
.foot-name { font-weight: 700; color: var(--fg); font-size: 14.5px; letter-spacing: -0.2px; }
.foot-desc { color: var(--muted); font-size: 12px; max-width: 42ch; }
.foot-links { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.foot-links.left { gap: 14px; }
.priv { display: inline-flex; align-items: center; gap: 6px; }
.link { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; padding: 2px 0; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--danger); margin-top: 16px; display: block; }

/* ------------------------------ Lightbox -------------------------------- */
.lightbox { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; }
.lb-backdrop { position: absolute; inset: 0; background: rgba(8, 9, 12, 0.84);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); animation: fade var(--fast) var(--ease) both; }
.lb-figure { position: relative; z-index: 1; margin: 0; max-width: min(1100px, 94vw); max-height: 92vh;
  display: flex; flex-direction: column; align-items: center; gap: 12px; animation: zoom var(--med) var(--ease) both; }
.lb-stage { position: relative; display: flex; align-items: center; justify-content: center; min-width: 120px; min-height: 120px; }
.lb-stage img { max-width: 100%; max-height: 78vh; border-radius: 10px; background: #1b1d22; display: block; }
.lb-stage img[hidden] { display: none; }
.lb-spinner { position: absolute; width: 30px; height: 30px; border: 3px solid rgba(255,255,255,0.25);
  border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
.lb-cap { color: #f2f3f5; text-align: center; max-width: 760px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.lb-cap #lb-title { font-weight: 600; line-height: 1.4; }
.lb-cap #lb-meta { color: #aeb4bf; font-size: 12.5px; }
.lb-actions { display: flex; gap: 16px; justify-content: center; margin-top: 4px; }
.lb-actions a { color: #fff; text-decoration: none; font-size: 13px; font-weight: 600; padding: 7px 14px;
  border-radius: 20px; border: 1px solid rgba(255,255,255,0.25); transition: background var(--fast); }
.lb-actions a:hover { background: rgba(255,255,255,0.12); }
.lb-close { position: absolute; top: 18px; right: 22px; z-index: 2; width: 44px; height: 44px; border: none;
  border-radius: 50%; background: rgba(255,255,255,0.1); color: #fff; font-size: 24px; cursor: pointer;
  transition: background var(--fast), transform var(--fast); }
.lb-close:hover { background: rgba(255,255,255,0.22); transform: rotate(90deg); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 50px; height: 50px;
  border: none; border-radius: 50%; background: rgba(255,255,255,0.1); color: #fff; font-size: 30px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background var(--fast); }
.lb-nav:hover { background: rgba(255,255,255,0.22); }
.lb-prev { left: max(14px, 3vw); } .lb-next { right: max(14px, 3vw); }

/* ------------------------------ Lock screen ----------------------------- */
.auth-gate { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 350px; display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center; animation: rise var(--med) var(--ease) both; }
.auth-card h1 { margin: 6px 0 0; font-size: 23px; letter-spacing: -0.4px; }
.auth-card .muted { margin: 0; font-size: 14px; }
.auth-note { font-size: 12px !important; margin-top: 6px !important; }
.auth-card input[type="password"] { width: 100%; border: 1px solid var(--line-strong); background: var(--field);
  color: var(--fg); border-radius: var(--radius-md); padding: 14px 16px; font-size: 16px; font-family: inherit;
  outline: none; transition: border-color var(--fast); }
.auth-card input[type="password"]:focus { border-color: var(--accent); }
.auth-btn { width: 100%; border: none; background: var(--accent); color: var(--accent-ink); font-size: 16px;
  font-weight: 600; padding: 14px; border-radius: var(--radius-md); cursor: pointer; transition: filter var(--fast), transform var(--fast); }
.auth-btn:hover { filter: brightness(1.06); }
.auth-btn:active { transform: scale(0.98); }
.auth-btn:disabled { opacity: 0.6; cursor: default; }
.auth-error { margin: 0; color: var(--danger); font-size: 13px; min-height: 1em; }
.shake { animation: shake 0.4s var(--ease); }

/* --------------------------- Settings / overlay ------------------------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.42);
  display: flex; justify-content: flex-end; animation: fade var(--fast) var(--ease) both; }
.panel { width: min(400px, 100%); height: 100%; background: var(--bg); display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,0.26); animation: slidein var(--med) var(--ease); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 19px; }
.panel-body { padding: 6px 20px; overflow-y: auto; flex: 1; }
.panel-foot { padding: 14px 20px; border-top: 1px solid var(--line); font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.field.row { flex-direction: row; align-items: center; justify-content: space-between; }
.field.col > span:first-child, .field.row > span:first-child { font-weight: 600; }
.field select { border: 1px solid var(--line-strong); background: var(--field); color: var(--fg);
  border-radius: 9px; padding: 10px 11px; font-size: 14px; font-family: inherit; cursor: pointer; transition: border-color var(--fast); }
.field select:focus { border-color: var(--accent); outline: none; }

/* segmented control */
.seg { display: flex; gap: 4px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 11px; padding: 4px; }
.seg-btn { flex: 1; border: none; background: transparent; color: var(--fg-soft); font: inherit; font-size: 13px;
  font-weight: 600; padding: 8px 2px; border-radius: 8px; cursor: pointer; transition: background var(--fast), color var(--fast); }
.seg-btn:hover { color: var(--fg); }
.seg-btn.active { background: var(--field); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

/* accent swatches */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer;
  position: relative; transition: transform var(--fast); }
.swatch:hover { transform: scale(1.1); }
.swatch.active { border-color: var(--fg); }
.swatch.active::after { content: "✓"; position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: #fff; font-size: 14px; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }

/* toggle switch */
.field input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 44px; height: 26px;
  border-radius: 14px; background: var(--line-strong); position: relative; cursor: pointer; flex: none;
  transition: background var(--med) var(--ease); }
.field input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform var(--med) var(--ease); }
.field input[type="checkbox"]:checked { background: var(--accent); }
.field input[type="checkbox"]:checked::after { transform: translateX(18px); }
.muted { color: var(--muted); }
.field.col small { line-height: 1.9; }
kbd { background: var(--bg-soft); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px;
  padding: 1px 6px; font-size: 11px; font-family: inherit; }

/* ------------------------------ Doc pages ------------------------------- */
.doc-overlay { justify-content: center; align-items: flex-start; padding: 4vh 16px; overflow-y: auto; }
.doc { width: min(760px, 100%); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-md);
  display: flex; flex-direction: column; max-height: 92vh; animation: rise var(--med) var(--ease) both; }
.doc-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.doc-head h2 { margin: 0; font-size: 21px; }
.doc-body { padding: 22px 24px 28px; overflow-y: auto; }
.doc-body h3 { font-size: 16px; margin: 22px 0 8px; }
.doc-body h3:first-child { margin-top: 0; }
.doc-body p, .doc-body li { font-size: 14px; line-height: 1.7; color: var(--fg-soft); }
.doc-body ul { padding-left: 20px; margin: 8px 0; }
.doc-body code { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: 12.5px; }
.doc-body .bang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; margin: 8px 0; }
.doc-body .muted-note { color: var(--muted); font-size: 12.5px; }

/* ------------------------------ Keyframes ------------------------------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes rise { from { opacity: 0; transform: translateY(9px); } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.99); } }
@keyframes fade { from { opacity: 0; } }
@keyframes zoom { from { opacity: 0; transform: scale(0.95); } }
@keyframes slidein { from { transform: translateX(26px); opacity: 0.4; } }
@keyframes pulse { 50% { opacity: 0.55; } }
@keyframes shake { 10%,90% { transform: translateX(-2px); } 20%,80% { transform: translateX(4px); }
  30%,50%,70% { transform: translateX(-7px); } 40%,60% { transform: translateX(7px); } }

/* ----------------------------- Responsive ------------------------------- */
@media (max-width: 1000px) { :root { --gutter: clamp(16px, 4vw, 36px); } }

@media (max-width: 640px) {
  :root { --gutter: 14px; --radius: 22px; }
  .home .logo { font-size: 32px; }
  .home-main { padding: 18px; }
  .home-inner { gap: 22px; }
  .topbar { gap: 10px; padding: 9px 12px; }
  .topbar .logo-sm { display: none; }
  .searchbox-top { padding-left: 13px; }
  .tabs { top: 56px; padding-left: 12px; padding-right: 12px; }
  .tab { padding: 12px 12px; }
  .content { padding: 14px 14px 30px; max-width: 100%; }
  .content[data-type="images"] { max-width: 100%; }
  .news-item img { width: 92px; height: 66px; }
  .kpanel { flex-direction: column; gap: 14px; }
  .kp-media, .kp-media img { width: 100%; }
  .kp-media img { height: 180px; }
  .result a.r-title { font-size: 18px; }
  .wx-days { gap: 6px; }
  .lb-nav { width: 44px; height: 44px; font-size: 26px; }
  .panel { width: 100%; }
  .site-footer { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .spinner, .lb-spinner { animation-duration: 0.7s !important; }
}
