@font-face {
  font-family: Manrope;
  src: url("fonts/manrope-cyrillic.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: Manrope;
  src: url("fonts/manrope-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  color-scheme: dark;
  --bg: #040823;
  --text: #edf1ff;
  --muted: #aab6d1;
  --accent: #8adfff;
  --line: rgba(162, 190, 240, .17);
  --glass-line: rgba(188, 236, 229, .22);
  --surface: rgba(16, 24, 52, .82);
  --panel-background: linear-gradient(135deg, rgba(111, 164, 242, .055), transparent 60%), var(--surface);
  --panel-shadow: inset 0 1px rgba(207, 224, 255, .10), 0 8px 28px rgba(0, 0, 12, .12);
  --active-background: linear-gradient(120deg, rgba(74, 208, 255, .25), rgba(165, 118, 255, .23));
  --active-shadow: inset 0 1px rgba(255, 255, 255, .20), 0 0 21px rgba(72, 195, 255, .20);
  --glass-background: linear-gradient(118deg, rgba(204, 255, 247, .04), transparent 30%, rgba(81, 185, 163, .024) 78%, rgba(204, 255, 247, .04));
  --glass-shadow: inset 0 1px rgba(229, 255, 250, .20), 0 8px 26px rgba(0, 7, 18, .20);
  --radius: 18px;
  --gutter: clamp(16px, 4vw, 72px);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: Manrope, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(75vw 600px at 5% 0%, rgba(111, 164, 242, .055), transparent 75%),
              radial-gradient(60vw 550px at 95% 45%, rgba(111, 164, 242, .055), transparent 75%),
              var(--bg);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { color: #b5ecff; }
button, input { font: inherit; }
button, a, summary { touch-action: manipulation; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { color: #040823; background: var(--accent); }
img { display: block; max-width: 100%; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.18; letter-spacing: -.04em; }
h1 { font-size: clamp(30px, 3.4vw, 52px); font-weight: 700; }
h2 { font-size: clamp(20px, 2vw, 28px); font-weight: 700; }
h3 { font-size: clamp(18px, 1.6vw, 22px); font-weight: 700; }

.head-inner, .page, .foot-inner {
  width: min(1480px, calc(100% - var(--gutter) - var(--gutter)));
  margin-inline: auto;
}
.skip {
  position: fixed;
  top: 12px;
  left: var(--gutter);
  z-index: 10;
  padding: 9px 15px;
  border-radius: 9px;
  color: #040823;
  background: var(--accent);
}
.skip:not(:focus) { clip-path: inset(50%); }
.skip:hover { color: #040823; }
.site-head {
  border-bottom: 1px solid var(--glass-line);
  background: var(--glass-background), #0a1132;
  box-shadow: var(--glass-shadow);
}
.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 87px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
}
.brand img { width: auto; height: clamp(32px, 4.8vw, 48px); }
.account-link { flex: none; }
.account-link span, .foot a span { color: var(--accent); }
.page { flex: 1 0 auto; min-width: 0; padding-block: clamp(24px, 3.2vw, 46px) clamp(32px, 5vw, 64px); }
.foot { border-top: 1px solid var(--line); }
.foot-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 70px;
  color: var(--muted);
  font-size: 13px;
}
.foot-separator { margin-inline: 5px; opacity: .56; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--accent); }

.primary, .secondary, .quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
}
.primary, .secondary[aria-current="page"] {
  border-color: rgba(138, 223, 255, .8);
  color: #fff;
  background: var(--active-background), #131f43;
  box-shadow: var(--active-shadow);
}
.primary:hover:not(:disabled), .secondary[aria-current="page"]:hover {
  border-color: #b5ecff;
  color: #fff;
  background: var(--active-background), #253660;
}
.secondary {
  border-color: rgba(162, 190, 240, .27);
  background: linear-gradient(140deg, #182749, #101936);
}
.secondary:hover:not(:disabled), .quiet:hover:not(:disabled) { color: #fff; background: #1a2a4e; }
.quiet { padding-inline: 11px; color: var(--muted); background: transparent; }
.minor, .count { color: var(--muted); font-size: 14px; }
.actions, .cabinet-head, .account-tools, .section-top, .card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.cabinet-head, .section-top { justify-content: space-between; gap: 14px; }
.cabinet-head h1 { margin-bottom: 4px; }
#my-name:empty { display: none; }
.account-tools { margin-top: 18px; padding: 11px; }
.library { margin-top: clamp(23px, 3vw, 38px); }
.library .section-top { margin-bottom: 15px; }
.count { vertical-align: middle; letter-spacing: 0; font-weight: 600; }
.panel, .login-card, .viewer, .card, .empty, dialog {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--panel-background);
  box-shadow: var(--panel-shadow);
}
.login-card {
  max-width: 660px;
  margin: clamp(8px, 3vh, 34px) auto;
  padding: clamp(21px, 4vw, 42px);
}
.login-card h1 { font-size: clamp(28px, 3.5vw, 40px); }
.login-card > img { width: 48px; height: 48px; margin-bottom: 14px; }
.login-card p, dialog p { margin-block: 12px 18px; color: var(--muted); }
.login-card a { overflow-wrap: anywhere; }
.login-card .underlink { display: inline-block; margin-top: 18px; font-size: 14px; }
.login-card form > button { margin-top: 12px; }
.login-card #code:empty { display: none; }
.login-card p:has(> #code:empty) { display: none; }
.phone-request { border-top: 1px solid var(--line); margin-top: 19px; padding-top: 16px; }
.phone-request h2 { font-size: 20px; }
.phone-request summary { color: var(--accent); font-size: 14px; font-weight: 700; }
.phone-request .phone-qr {
  display: block;
  width: min(100%, 185px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #fff;
  image-rendering: pixelated;
}
.pair-instructions {
  display: grid;
  grid-template-columns: minmax(112px, 185px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  margin-block: 15px;
}
.pair-instructions p { margin-top: 0; }
.pair-instructions [role="status"] { margin: 8px 0 0; font-size: 14px; }
.pair-code {
  display: inline-block;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0a1434;
  color: var(--text);
  font: 650 clamp(16px, 4.8vw, 24px)/1.4 var(--mono);
  overflow-wrap: anywhere;
}
.title-label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 600; }
.title-label input, dialog input, .viewer input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid rgba(162, 190, 240, .32);
  border-radius: 10px;
  color: var(--text);
  background: #080e29;
  font-size: 16px;
}
#copy-safari-address { margin-top: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(246px, 100%), 1fr)); gap: 14px; }
.card { overflow: hidden; }
.card .preview, .image-stage {
  background-color: #101833;
  background-image: repeating-conic-gradient(#172140 0% 25%, transparent 0% 50%);
  background-size: 16px 16px;
}
.card .preview { display: grid; place-items: center; height: 152px; border-bottom: 1px solid var(--line); }
.preview img { max-height: 152px; object-fit: contain; }
.card-body { padding: 15px; }
.card-title { display: block; overflow-wrap: anywhere; color: var(--text); font-weight: 700; text-decoration: none; }
.card .minor { display: block; margin-top: 3px; font-size: 13px; }
.card-actions { margin-top: 7px; }
.card-actions button { min-height: 36px; padding: 5px 7px; }
.empty { padding: clamp(20px, 3vw, 30px); }
.empty p { margin-top: 5px; color: var(--muted); }
.more { margin-top: 16px; }
#device-list { margin-top: 12px; }
#device-list .actions { padding: 10px 0; border-bottom: 1px solid var(--line); }
.viewer { padding: clamp(15px, 3vw, 28px); }
.viewer-head { margin-bottom: 17px; }
.viewer-head > div { flex: 1 1 260px; min-width: 0; }
.viewer-head h1 { overflow-wrap: anywhere; font-size: clamp(25px, 4vw, 40px); }
.viewer-head p { margin-top: 4px; }
.image-stage { display: grid; place-items: center; min-height: 120px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.image-stage a { max-width: 100%; cursor: zoom-in; }
.image-stage img { width: auto; height: auto; max-width: 100%; max-height: 76vh; object-fit: contain; }
.viewer input { margin-top: 12px; }
.error, #notice:not([hidden]) {
  margin-block: 15px;
  padding: 11px 14px;
  border: 1px solid #8a4c5d;
  border-radius: 11px;
  color: #ffd6d9;
  background: #361d31;
}
.toast {
  position: fixed;
  z-index: 5;
  bottom: 20px;
  left: 50%;
  max-width: 90vw;
  transform: translateX(-50%);
  padding: 11px 18px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  color: var(--text);
  background: #141f40;
  text-align: center;
}
dialog { width: min(470px, 92vw); padding: 25px; background: #101832; }
dialog::backdrop { background: rgba(1, 3, 17, .74); }
dialog .actions { margin-top: 15px; }

@media (max-width: 620px) {
  .head-inner { flex-wrap: wrap; min-height: 0; gap: 8px 12px; padding-block: 11px 9px; }
  .brand { width: 100%; gap: 9px; }
  .brand img { width: calc(50% - 5px); height: auto; max-height: 34px; object-fit: contain; object-position: left; }
  .account-link { min-height: 33px; margin-left: auto; padding: 5px 10px; font-size: 12px; }
}
@media (max-width: 520px) {
  .pair-instructions { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}
@media (max-width: 400px) {
  .foot-inner { flex-wrap: wrap; align-content: center; gap: 4px 12px; padding-block: 12px; }
}
