/* dFix Quick Links: shared styles for index.html and Flying.html */
:root {
  --bg: #f4f6fb;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, #dfe8ff 0%, transparent 60%), radial-gradient(900px 500px at 110% 0%, #e6f0ff 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f0f3f9;
  --border: #e1e6ef;
  --text: #111827;
  --muted: #5b6475;
  --accent: #1d4ed8;
  --accent-soft: #e0e8ff;
  --hover: #eef2fb;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
  --header-bg: rgba(244,246,251,.82);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020;
    --bg-grad: radial-gradient(1200px 600px at 10% -10%, #14215a 0%, transparent 60%), radial-gradient(900px 500px at 110% 0%, #102048 0%, transparent 55%);
    --surface: #121a2f;
    --surface-2: #19223b;
    --border: #24304d;
    --text: #e7ecf7;
    --muted: #96a1bb;
    --accent: #7aa2ff;
    --accent-soft: #1c2a55;
    --hover: #1b2542;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    --header-bg: rgba(11,16,32,.8);
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, #14215a 0%, transparent 60%), radial-gradient(900px 500px at 110% 0%, #102048 0%, transparent 55%);
  --surface: #121a2f;
  --surface-2: #19223b;
  --border: #24304d;
  --text: #e7ecf7;
  --muted: #96a1bb;
  --accent: #7aa2ff;
  --accent-soft: #1c2a55;
  --hover: #1b2542;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  --header-bg: rgba(11,16,32,.8);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 170px; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1400px; margin: 0 auto; padding: 0 16px; }

/* ---------- Banner ---------- */
.banner {
  background:
    radial-gradient(500px 140px at 0% 50%, #0503ee 0%, transparent 100%),
    linear-gradient(90deg, #0503ee 0%, #0712b8 45%, #0a1670 100%);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.banner .wrap { display: flex; align-items: center; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.banner .logo { display: block; flex-shrink: 0; }
.banner .logo img {
  display: block; height: 48px; width: auto;
  border-radius: 6px;
  box-shadow: 0 4px 18px rgba(0,0,0,.35);
}
.banner .tag { white-space: nowrap; font-weight: 600; font-size: 15px; letter-spacing: .02em; opacity: .9; }
.banner .date { margin-left: auto; font-size: 14px; opacity: .8; white-space: nowrap; }
.banner .theme-btn { margin-left: 4px; }
.banner .wx-link {
  width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 10px; background: #fff; color: #1d4ed8; font-weight: 700; font-size: 13px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.banner .wx-link img { width: 28px; height: 28px; display: block; border-radius: 6px; object-fit: contain; }
.banner .wx-link:hover { box-shadow: 0 0 0 3px rgba(255,255,255,.45); }
@media (max-width: 720px) {
  .banner #editBtn { margin-left: auto; }
  .banner .wx-link { margin-left: auto; width: 36px; height: 36px; }
  .banner .wx-link ~ .theme-btn { margin-left: 0; }
  /* With the weather icon in the banner, show the page label only when all of it fits (no "Quick Li…") */
  .banner:has(.wx-link) .tag { display: flex; flex-wrap: wrap; flex: 1 1 0; height: 1.4em; line-height: 1.4; }
  .banner:has(.wx-link) .tag::before { content: ""; width: 0; height: 100%; }
}
.banner .wordmark { color: #fff; font-size: 30px; font-style: italic; font-weight: 800; }
.banner .wordmark b { color: #ff4d4d; }

/* ---------- Header ---------- */
header {
  position: sticky; top: 0; z-index: 10;
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.bar { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand img { height: 30px; border-radius: 4px; display: block; }
.wordmark { font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.wordmark b { color: var(--accent); }
.search {
  flex: 1; position: relative; max-width: 640px;
}
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 44px; padding: 0 92px 0 42px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; outline: none;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search kbd {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font: 500 11px Inter, sans-serif; color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; background: var(--surface-2);
}
.theme-btn {
  width: 38px; height: 38px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 10px; border: 1px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.1); color: #fff; cursor: pointer;
  font-size: 18px; line-height: 1;
}
.theme-btn:hover { background: rgba(255,255,255,.22); }

/* ---------- Quick access + mail rows (in the header) ---------- */
.section-label {
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 26px 0 10px;
}
.all-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.all-toggle .hint {
  display: none; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--accent); letter-spacing: .04em;
  font: inherit; text-transform: inherit; cursor: pointer;
}
body:has(.card.collapsed) #expandAll { display: inline-block; }
body:has(.card:not(.collapsed)) #collapseAll { display: inline-block; }
.all-toggle .hint:hover { border-color: var(--accent); }
header .chips { padding: 0 0 8px; }
header .chips:last-child { padding-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-weight: 500; font-size: 14px;
}
.chip:hover { border-color: var(--accent); background: var(--hover); }
.chip .fav { width: 20px; height: 20px; }
.chips:empty { display: none; }
@media (min-width: 721px) {
  header .chips { gap: 10px; }
  header .chip { font-size: 18px; padding: 9px 18px 9px 11px; gap: 10px; }
  header .chip .fav { width: 24px; height: 24px; }
}
@media (max-width: 720px) {
  /* Phones: bigger, thumb-friendly shortcut buttons; header scrolls away so they do not cover the page */
  header { position: static; }
  header .chips { gap: 8px; }
  header .chip { font-size: 17px; min-height: 44px; padding: 8px 16px 8px 10px; gap: 9px; }
  header .chip .fav { width: 24px; height: 24px; }
}

/* ---------- Groups ---------- */
.grid { columns: 3 300px; column-gap: 16px; margin-top: 8px; padding-bottom: 48px; }
.card {
  break-inside: avoid; margin: 0 0 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 14px 16px; border: 0; background: none; color: inherit; cursor: pointer;
  font: 600 16px Inter, sans-serif; text-align: left;
  border-top: 3px solid var(--c);
}
.card-head .ico {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 16px;
  background: color-mix(in srgb, var(--c) 18%, transparent);
}
.card-head .count { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted); }
.card-head .chev { color: var(--muted); transition: transform .2s; }
.card.collapsed .chev { transform: rotate(-90deg); }
.card.collapsed .card-body { display: none; }
.card-body { padding: 0 8px 10px; }
.sub {
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); padding: 10px 8px 4px;
}
.links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; }
.links li { min-width: 0; }
.links a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: 8px; font-size: 14px; min-width: 0;
}
.links a:hover { background: var(--hover); color: var(--accent); }
.links a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav { width: 18px; height: 18px; flex-shrink: 0; border-radius: 4px; object-fit: contain; }
.fav.letter {
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff;
  background: var(--c, var(--accent));
}

.empty { display: none; text-align: center; color: var(--muted); padding: 48px 0; }
.empty b { color: var(--text); }
body.searching .hide-on-search { display: none; }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 0 0 32px; }

@media (max-width: 720px) {
  .banner .date { display: none; }
  .banner .logo img { height: 34px; }
  .banner .wrap { gap: 10px; }
  .banner .tag { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .banner .theme-btn { width: 36px; height: 36px; }
  .bar { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .search kbd { display: none; }
  .search input { padding-right: 14px; }
  .links { grid-template-columns: 1fr; }
  html { scroll-padding-top: 170px; }
}

/* ---------- Personalization ---------- */
.qitem { display: inline-flex; align-items: center; gap: 3px; }
.qitem.dragging { opacity: .4; }
.qctl {
  display: none; width: 22px; height: 22px; padding: 0; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  font-size: 13px; line-height: 1; cursor: pointer;
}
.qctl:hover { color: var(--text); border-color: var(--accent); }
body.editing .qctl { display: inline-grid; place-items: center; }
body.editing .qitem { cursor: grab; }
body.editing .qitem .chip { border-style: dashed; }

.card-top { display: flex; align-items: center; border-top: 3px solid var(--c); }
.card-top .card-head { border-top: 0; flex: 1; min-width: 0; }
.hide-btn {
  display: none; margin-right: 12px; height: 28px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  font: 500 12px Inter, sans-serif; cursor: pointer;
}
.hide-btn:hover { color: var(--text); border-color: var(--accent); }
body.editing .hide-btn { display: inline-block; }

.links li { display: flex; align-items: center; }
.links li > a { flex: 1; }
.star, .del {
  flex-shrink: 0; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px;
  background: none; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer;
}
.star { opacity: 0; }
.links li:hover .star, .star:focus-visible, .star.on { opacity: 1; }
.star.on { color: #f5b301; }
.star:hover, .del:hover { background: var(--hover); }
@media (hover: none) { .star { opacity: .55; } }
.del { display: none; }
body.editing .del { display: inline-block; }
.del:hover { color: #dc2626; }

.panel {
  display: none; margin: 18px 0 0; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: 16px; box-shadow: var(--shadow);
}
body.editing .panel { display: block; }
.panel-head { display: flex; align-items: center; gap: 12px; }
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-head .btn { margin-left: auto; }
.panel p { margin: 6px 0 4px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.panel .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.panel .label { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); min-width: 80px; }
.panel input, .panel select {
  height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; outline: none;
}
.panel input:focus, .panel select:focus { border-color: var(--accent); }
.panel input[name="name"] { width: 170px; }
.panel input[name="url"] { flex: 1; min-width: 200px; }
.btn {
  height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: 500 14px Inter, sans-serif;
  cursor: pointer; display: inline-flex; align-items: center;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger:hover { border-color: #dc2626; color: #dc2626; }
#editBtn[aria-pressed="true"] { background: rgba(255,255,255,.3); }
#hiddenList { margin: 0; }
