:root {
  color-scheme: dark;
  --bg: #081421;
  --sheet: #0f2032;
  --card: #142a40;
  --card-hover: #18334e;
  --line: rgba(148, 192, 220, .18);
  --text: #f6f9fc;
  --muted: #a9bed0;
  --accent: #ffc857;
  --accent-dim: rgba(255, 200, 87, .15);
  --action: #49d6c8;
  --action-text: #06211f;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --content: 520px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-width: 0; overflow-x: clip; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  min-height: 100vh;
  background:
    radial-gradient(600px 280px at 80% -10%, rgba(73, 214, 200, .13), transparent 50%),
    radial-gradient(500px 240px at 0 0, rgba(74, 144, 226, .14), transparent 45%),
    var(--bg);
  color: var(--text);
  font: 15px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--action); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--action); outline-offset: 3px; }
::selection { background: rgba(73, 214, 200, .3); }
.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; }
.skip-link { position: fixed; left: 16px; top: 12px; z-index: 40; padding: 10px 14px; border-radius: 10px; background: var(--action); color: var(--action-text); font-weight: 800; transform: translateY(-180%); }
.skip-link:focus { transform: none; }

.app {
  width: min(100%, var(--content));
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(20px + var(--safe-top)) 16px calc(100px + var(--safe-bottom));
}
.site-header { position: relative; display: grid; min-height: 64px; place-items: center; margin-bottom: 12px; padding: 3px 64px; }
.site-title { display: block; max-width: 100%; padding: 0 4px; overflow: hidden; color: var(--accent); font-weight: 900; font-size: clamp(15px, 5.2vw, 22px); letter-spacing: -.01em; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.checked-total { position: absolute; right: 0; top: 50%; display: flex; min-width: 54px; min-height: 48px; padding: 6px 8px; flex-direction: column; align-items: center; justify-content: center; transform: translateY(-50%); border: 1px solid var(--line); border-radius: 14px; background: var(--sheet); color: var(--muted); font-size: 9px; line-height: 1.1; text-transform: uppercase; letter-spacing: .06em; }
.checked-total strong { color: var(--accent); font-size: 14px; letter-spacing: 0; }
.status-label { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #43e084; box-shadow: 0 0 7px rgba(67, 224, 132, .9); }

.account-trigger { position: absolute; left: 0; top: 50%; display: flex; height: 44px; align-items: center; gap: 5px; padding: 0 10px; transform: translateY(-50%); border: 1px solid var(--line); border-radius: 14px; background: var(--sheet); color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.account-trigger svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.account-trigger:hover { border-color: rgba(73, 214, 200, .55); color: var(--text); }

.account-dialog { position: fixed; inset: 0; width: min(92vw, 420px); max-height: min(86vh, 640px); margin: auto; padding: 0; border: 1px solid var(--line); border-radius: 22px; background: var(--sheet); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.account-dialog::backdrop { background: rgba(5, 10, 16, .72); }
.account-sheet { max-height: inherit; padding: 20px 20px calc(20px + var(--safe-bottom)); overflow-y: auto; }
.account-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.account-kicker { display: inline-block; margin-bottom: 4px; padding: 3px 8px; border-radius: 999px; background: var(--accent-dim); color: var(--accent); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.account-heading h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.account-close { flex: none; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; }
.account-close:hover { background: var(--accent-dim); color: var(--accent); }
.account-lead { margin: 10px 0 12px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.account-message { min-height: 16px; margin-bottom: 10px; color: var(--action); font-size: 12px; font-weight: 700; }
.account-message.is-error { color: #ff8a8a; }
.account-primary, .account-secondary, .account-danger { width: 100%; min-height: 48px; margin-bottom: 8px; border-radius: 14px; font-size: 13.5px; font-weight: 800; }
.account-primary { border: 0; background: var(--action); color: var(--action-text); }
.account-primary:hover { filter: brightness(1.06); }
.account-secondary { border: 1px solid var(--line); background: transparent; color: var(--text); }
.account-secondary:hover { border-color: rgba(73, 214, 200, .55); }
.account-danger { margin-top: 14px; margin-bottom: 0; border: 1px solid rgba(255, 107, 107, .35); background: transparent; color: #ff9d9d; }
.account-danger:hover { background: rgba(255, 107, 107, .1); }
.account-dialog button:disabled, .account-dialog textarea:disabled { opacity: .55; cursor: not-allowed; }
#account-restore label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
#account-restore textarea { width: 100%; margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
.account-actions { display: flex; gap: 8px; }
.account-actions > * { margin-bottom: 0; }
.account-success { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--text); font-size: 14px; }
.account-success span { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: var(--accent-dim); color: var(--accent); font-size: 13px; }
#account-saved p { margin: 0 0 12px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.recovery-code-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.recovery-code-row code { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--accent); font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
.recovery-code-row button { flex: none; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--text); font-size: 11px; font-weight: 800; }
.account-qr { display: grid; justify-items: center; margin: 16px 0 12px; padding: 16px 14px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); text-align: center; }
.account-qr canvas { display: block; width: min(220px, 100%); height: auto; padding: 10px; border-radius: 14px; background: #fff; box-sizing: border-box; }
.account-qr p { margin: 10px 0 0; }
.account-warning { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.5; }

@media (max-width: 430px) {
  .account-dialog { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; border-radius: 0; }
  #account-saved .account-actions { flex-direction: column; }
}

.notice { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(15, 32, 50, .82); color: var(--muted); font-size: 11px; }
.notice-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: var(--text); font-size: 12px; }
.notice-heading strong { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: var(--accent-dim); color: var(--accent); }
.notice-heading span { color: var(--muted); text-align: right; }
.notice p { margin: 0; }
.notice p strong { color: var(--text); }
.disclosure { border-top: 1px solid var(--line); }
.disclosure summary { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text); font-size: 11px; font-weight: 800; cursor: pointer; list-style: none; }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::after { content: "+"; flex: none; color: var(--action); font-size: 18px; font-weight: 500; line-height: 1; }
.disclosure[open] summary::after { content: "−"; }
.disclosure-copy { padding: 2px 0 4px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.disclosure-copy p + p { margin-top: 12px; }

.control-dock-sentinel { position: sticky; top: 0; height: 70px; margin-bottom: -70px; pointer-events: none; }
.control-dock { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 8px; margin: 0 -4px; padding: 8px 4px 10px; background: rgba(8, 20, 33, .92); backdrop-filter: blur(16px); transition: opacity .25s ease; }
.control-dock.is-faded { opacity: 0; pointer-events: none; }
.search, .sort { height: 52px; border: 1px solid var(--line); border-radius: 16px; background: var(--sheet); }
.search { display: flex; min-width: 0; align-items: center; gap: 10px; padding: 0 14px; color: var(--muted); }
.search:focus-within, .sort:focus-within { border-color: var(--action); box-shadow: 0 0 0 3px rgba(73, 214, 200, .1); }
.search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 16px; }
.search input::placeholder { color: #7f9aaf; }
.sort { display: flex; align-items: center; gap: 7px; padding: 0 10px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.sort select { width: 100%; min-width: 0; border: 0; outline: 0; background: var(--sheet); color: var(--text); font-size: 11px; font-weight: 700; text-transform: none; letter-spacing: 0; }

#link-panel { scroll-margin-top: 76px; }
.heading-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 10px 2px; }
.heading-row h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.list { display: flex; margin: 0; padding: 0; flex-direction: column; gap: 10px; list-style: none; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; gap: 4px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.item:hover { border-color: rgba(73, 214, 200, .55); background: var(--card-hover); }
.item:focus-within { border-color: var(--action); }
.item-main { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 11px; min-width: 0; min-height: 54px; color: inherit; text-decoration: none; }
.item-avatar { position: relative; display: grid; width: 46px; height: 46px; overflow: hidden; place-items: center; border-radius: 14px; background: var(--accent-dim); color: var(--accent); font-size: 15px; font-weight: 800; }
.item-avatar.has-icon { background: transparent; }
.item-avatar-icon { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; object-fit: contain; }
.item-copy { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; gap: 3px; }
.item-name { max-width: 100%; overflow: hidden; color: var(--text); font-size: 15px; font-weight: 750; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.item-details { display: flex; max-width: 100%; gap: 2px 8px; flex-wrap: wrap; overflow: hidden; color: var(--muted); font-size: 10px; }
.item-status { color: var(--accent); }
.item-destination { max-width: 100%; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.item-arrow { display: grid; min-width: 58px; height: 40px; padding: 0 10px; grid-auto-flow: column; place-items: center; gap: 3px; border-radius: 12px; background: var(--action); color: var(--action-text); font-size: 11px; font-weight: 800; }
.item-main:hover .item-arrow { filter: brightness(1.07); }
.item-fav { display: grid; width: 44px; height: 44px; place-items: center; border: 0; border-radius: 12px; background: transparent; color: var(--muted); }
.item-fav:hover { background: var(--accent-dim); color: var(--accent); }
.empty { padding: 42px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--sheet); text-align: center; }
.empty-title { font-size: 18px; font-weight: 800; }
.empty p { margin: 7px 0 0; color: var(--muted); }

.site-footer { margin-top: 30px; padding: 18px 2px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.site-footer p { margin: 0 0 10px; }
.site-footer strong { color: var(--text); }
.footer-nav { display: flex; flex-direction: column; gap: 6px; }
.footer-row { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.site-footer a { display: inline-flex; min-height: 44px; align-items: center; font-weight: 800; }
.telegram-link, .whatsapp-link { display: inline-flex; min-height: 44px; align-items: center; gap: 7px; font-weight: 800; }
.telegram-link { color: #54b7ef; }
.whatsapp-link { color: #25d366; }
.telegram-link svg, .whatsapp-link svg { width: 18px; height: 18px; flex: none; fill: currentColor; }
.telegram-link.is-disabled, .whatsapp-link.is-disabled { color: var(--muted); opacity: .6; cursor: default; }
.coming-soon { padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--sheet); color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.footer-update { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.footer-update p { margin: 0; color: var(--text); font-size: 11px; font-weight: 900; letter-spacing: .035em; }
.footer-update p > span:first-of-type { color: #ff6262; }
.back-to-top { flex: none; gap: 6px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--action); text-decoration: none; }
.back-to-top:hover { border-color: rgba(73, 214, 200, .55); background: rgba(73, 214, 200, .08); }

.tabbar { position: fixed; left: 50%; bottom: 0; z-index: 30; display: grid; width: min(var(--content), 100%); padding: 8px 10px calc(9px + var(--safe-bottom)); grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; transform: translateX(-50%); border-top: 1px solid var(--line); background: rgba(8, 20, 33, .94); box-shadow: 0 -10px 30px rgba(0, 0, 0, .2); backdrop-filter: blur(16px); }
.tab { display: grid; min-width: 0; min-height: 54px; padding: 6px 4px 5px; place-items: center; gap: 2px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; }
.tab svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { background: var(--accent-dim); color: var(--accent); }
.tab:hover { color: var(--text); }
.toast { position: fixed; right: 16px; bottom: calc(84px + var(--safe-bottom)); left: 16px; z-index: 35; max-width: 460px; margin: 0 auto; padding: 13px 15px; border-radius: 13px; background: var(--accent); color: #302300; font-size: 13px; font-weight: 800; text-align: center; opacity: 0; pointer-events: none; box-shadow: 0 14px 40px rgba(0, 0, 0, .45); transition: opacity .2s; }
.toast.on { opacity: 1; }
[hidden] { display: none !important; }

@media (max-width: 430px) {
  .app { padding: calc(16px + var(--safe-top)) 12px calc(96px + var(--safe-bottom)); }
  .site-header { min-height: 60px; padding: 2px 58px; }
  .site-title { font-size: clamp(13px, 5.2vw, 18px); }
  .control-dock { grid-template-columns: minmax(0, 1fr) 116px; }
  .sort > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .item { grid-template-columns: minmax(0, 1fr) 42px; padding: 7px; }
  .item-main { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 9px; }
  .item-avatar { width: 44px; height: 44px; }
  .item-fav { width: 42px; height: 44px; }
  .footer-update { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 350px) {
  .app { padding-inline: 9px; }
  .checked-total { min-width: 54px; padding-inline: 6px; }
  .control-dock { grid-template-columns: minmax(0, 1fr) 104px; gap: 6px; }
  .search { padding-inline: 11px; }
  .sort { padding-inline: 7px; }
  .item-main { grid-template-columns: 40px minmax(0, 1fr) 52px; gap: 7px; }
  .item-avatar { width: 40px; height: 40px; }
  .item-arrow { min-width: 52px; padding-inline: 6px; }
}

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

.doc { max-width: 640px; margin: 0 auto; padding: calc(28px + var(--safe-top)) 18px 60px; }
.doc h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.02em; }
.doc .updated { margin: 0 0 22px; color: var(--muted); font-size: 12px; }
.doc h2 { margin: 26px 0 8px; font-size: 15px; color: var(--accent); }
.doc p, .doc li { margin: 0 0 10px; color: var(--text); font-size: 13.5px; line-height: 1.6; }
.doc ul { margin: 0 0 10px; padding-left: 20px; }
.doc a { color: var(--action); }
.doc .back { display: inline-flex; margin-bottom: 18px; }
