/* Светлая тема. Без сборки. */
:root {
  --bg: #f6f6f3;
  --panel: #ffffff;
  --text: #1f2328;
  --muted: #5d6470;
  --line: #dfe1e4;
  --accent: #2f5fb3;
  --accent-text: #ffffff;
  --error: #b42318;
  --ok: #1d7a3a;
  --focus: #1a56c4;
  --radius: 10px;
  --tabbar: 56px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}
h1 { font-size: 1.4rem; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 1.25rem 0 .5rem; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
pre, table { display: block; max-width: 100%; overflow-x: auto; }

/* Шапка */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem;
  height: 56px; padding: 0 1rem;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; color: var(--text); text-decoration: none; }
.tabs { display: flex; gap: .25rem; }
.tabs a {
  padding: .4rem .9rem; border-radius: 8px;
  color: var(--muted); text-decoration: none;
}
.tabs a[aria-current="page"] { background: #e8eefa; color: var(--accent); font-weight: 600; }
.tools { margin-left: auto; display: flex; align-items: center; gap: .25rem; }
.icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 0; border-radius: 8px;
  background: none; color: var(--muted); cursor: pointer;
  padding: 0; flex: none; -webkit-appearance: none; appearance: none;
}
.icon:hover, .icon[aria-current="page"] { background: #eef0f3; color: var(--text); }
.icon svg { display: block; flex: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.logout { margin: 0; flex: none; }
/* Индикатор заполнения диска: полоска и процент, ведёт на «Настройки» с графиком нагрузки */
.disk {
  display: inline-flex; align-items: center; gap: .4rem; flex: none;
  height: 40px; padding: 0 .5rem; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: .85rem; font-variant-numeric: tabular-nums;
}
.disk:hover { background: #eef0f3; color: var(--text); }
.disk-bar { width: 42px; height: 8px; border-radius: 4px; background: #e3e5e8; overflow: hidden; }
.disk-bar span { display: block; height: 100%; background: var(--ok); }
.disk--warn { color: #b26a00; }
.disk--warn .disk-bar span { background: #f08c00; }
.disk--alarm { color: var(--error); font-weight: 700; }
.disk--alarm .disk-bar span { background: var(--error); }

/* Содержимое */
.content { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem; }
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem;
}
.muted { color: var(--muted); }
.error { color: var(--error); }
.ok { color: var(--ok); }

/* Формы */
.stack { display: flex; flex-direction: column; gap: .9rem; }
.narrow { max-width: 360px; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .95rem; }
input {
  font: inherit; padding: .6rem .7rem;
  border: 1px solid #c6cad1; border-radius: 8px; background: #fff; color: var(--text);
}
input:focus { border-color: var(--focus); }
button { font: inherit; cursor: pointer; }
.primary {
  padding: .65rem 1rem; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--accent-text); font-weight: 600;
}
.primary:hover { background: #264f97; }
.link { border: 0; background: none; color: var(--accent); padding: .4rem .5rem; text-decoration: underline; }

/* Вход и шторка */
.door { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.card {
  width: 100%; max-width: 380px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .05);
}
.card .stack + .stack { margin-top: .75rem; }
.curtain { background: #e9ebef; }

/* Телефон: вкладки — в нижнюю панель */
@media (max-width: 700px) {
  .top { gap: .5rem; padding: 0 .5rem; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    height: var(--tabbar); gap: 0;
    background: var(--panel); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabs a {
    flex: 1; display: flex; align-items: center; justify-content: center;
    border-radius: 0; font-size: 1rem;
  }
  .content { padding: 1rem .75rem calc(var(--tabbar) + 1rem); }
  /* На телефоне шапка занята до края. Надпись «Claude» дублирует вкладку «Чат»
     внизу, поэтому на её месте — процент диска без полоски */
  .brand { display: none; }
  .tools { margin-left: 0; flex: 1; }
  .top { gap: .35rem; }
  .disk { padding: 0; margin-right: auto; font-size: .78rem; }
  .disk-bar { display: none; }
}

/* Только для чтения с экрана */
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
select {
  font: inherit; padding: .35rem .5rem; border: 1px solid #c6cad1;
  border-radius: 8px; background: #fff; color: var(--text);
}
textarea {
  font: inherit; padding: .6rem .7rem; border: 1px solid #c6cad1;
  border-radius: 8px; background: #fff; color: var(--text); resize: vertical;
}
.wide { max-width: 100%; overflow-x: auto; }

/* Чат: список слева, разговор справа */
.chat-page .content { max-width: none; padding: 0; }
.chat {
  display: grid; grid-template-columns: 280px minmax(0, 1fr);
  height: calc(100dvh - 56px);
}
.convs {
  display: flex; flex-direction: column; gap: .6rem;
  padding: .75rem; border-right: 1px solid var(--line); background: var(--panel);
  min-height: 0;
}
.wide-btn { width: 100%; }
.search input { width: 100%; }
.convs nav { overflow-y: auto; min-height: 0; flex: 1; }
.conv-list { list-style: none; margin: 0; padding: 0; }
.conv-list a {
  display: block; padding: .5rem .6rem; border-radius: 8px;
  color: var(--text); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv-list a:hover { background: #f0f2f5; }
.conv-list a[aria-current="page"] { background: #e8eefa; color: var(--accent); font-weight: 600; }

.talk { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.talk.empty { align-items: center; justify-content: center; }
.talk-head {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  padding: .5rem 1rem; border-bottom: 1px solid var(--line); background: var(--panel);
}
.talk-head h1 {
  font-size: 1.1rem; margin: 0; flex: 1; min-width: 8rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.talk-head form { margin: 0; flex: none; }
.talk-head .icon { font-size: 1.15rem; }
.weight { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.to-list { display: none; }
.rename {
  display: flex; gap: .5rem; padding: .5rem 1rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.rename[hidden] { display: none; }
.access-bar { display: flex; align-items: center; gap: .3rem 1rem; flex-wrap: wrap; margin: 0;
  padding: .35rem 1rem; border-bottom: 1px solid var(--line); background: var(--panel); }
.access-bar .check { flex-direction: row; align-items: center; gap: .4rem; }
.access-bar .small { margin: 0; }
.rename input { flex: 1; min-width: 10rem; }

.feed { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .8rem; }
.msg {
  max-width: 820px; padding: .7rem .9rem; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); overflow-wrap: anywhere;
}
.msg-user { align-self: flex-end; background: #e8eefa; border-color: #d3dcf0; }
.msg-assistant { align-self: flex-start; width: 100%; }
.msg-error { align-self: flex-start; color: var(--error); border-color: #f1c4bf; background: #fdf3f2; }
.msg time, .msg .status { display: block; margin-top: .3rem; font-size: .8rem; color: var(--muted); }
.plain { margin: 0; white-space: pre-wrap; }
.pending { opacity: .75; }
.more, .empty-feed { text-align: center; margin: 0; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md pre { background: #f3f4f6; padding: .6rem .8rem; border-radius: 8px; }
.md code { background: #f3f4f6; padding: .05rem .3rem; border-radius: 4px; font-size: .92em; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; display: table; }
.md th, .md td { border: 1px solid var(--line); padding: .3rem .6rem; text-align: left; }
.md blockquote { margin: 0; padding-left: .8rem; border-left: 3px solid var(--line); color: var(--muted); }

.composer {
  display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: end;
  padding: .75rem 1rem; border-top: 1px solid var(--line); background: var(--panel);
}
.composer textarea { min-height: 2.8rem; max-height: 40vh; }
.composer .hint, .composer .error { grid-column: 1 / -1; margin: 0; font-size: .9rem; }
.composer .hint { color: #8a5a00; }

/* Проект: шапка списка тем, галочки, удаление */
.back-link { font-size: .95rem; }
.proj-head { display: flex; align-items: center; gap: .3rem; }
.proj-head h2 { margin: 0; flex: 1; font-size: 1.1rem; overflow-wrap: anywhere; }
.proj-head form { margin: 0; flex: none; }
.proj-head .icon { font-size: 1.15rem; }
.proj-rename { padding: .4rem 0; border-bottom: 0; background: none; }
.proj-rename input { min-width: 0; width: 100%; flex-basis: 100%; }
.folder { margin: -.4rem 0 0; font-size: .85rem; overflow-wrap: anywhere; }
.access { display: flex; flex-direction: column; gap: .2rem; margin: 0; }
.check { flex-direction: row; align-items: center; gap: .5rem; cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; padding: 0; }
.small { font-size: .85rem; margin: .2rem 0 0; }
.actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.actions form { margin: 0; }
.danger { background: var(--error); }
.danger:hover { background: #8f1c13; }
.status-line { color: var(--muted); }
.report { background: #f8f9fa; border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; overflow-wrap: anywhere; }

/* Файлы проекта: колонка справа на компьютере, отдельная страница на телефоне */
.chat.with-files { grid-template-columns: 280px minmax(0, 1fr) 300px; }
.files-col {
  display: flex; flex-direction: column; gap: .6rem; min-height: 0; overflow-y: auto;
  padding: .75rem; border-left: 1px solid var(--line); background: var(--panel);
}
.files-link { display: none; font-size: .95rem; }
.files-btn { display: none; }
.files-title { margin: 0; font-size: 1.05rem; }
.upload { margin: 0 0 .6rem; display: flex; flex-direction: column; gap: .3rem; }
.upload-btn {
  position: relative; display: block; text-align: center; cursor: pointer;
  padding: .55rem 1rem; border: 1px dashed var(--accent); border-radius: 8px;
  color: var(--accent); font-weight: 600;
}
.upload-btn:hover { background: #f0f4fb; }
.upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.upload-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.upload .small { margin: 0; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center;
  column-gap: .3rem; padding: .45rem 0; border-bottom: 1px solid var(--line);
}
.file-list .fname { overflow-wrap: anywhere; grid-column: 1; }
.file-list .muted { grid-column: 1; }
.file-list .dl { grid-column: 2; grid-row: 1 / span 2; }
.file-list .del { grid-column: 3; grid-row: 1 / span 2; margin: 0; }
.file-list li.muted { display: block; border: 0; }
.view-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.fname-big { flex: 1; margin: 0; overflow-wrap: anywhere; }
.btn-link { text-decoration: none; display: inline-block; }
.file-text { background: #f8f9fa; border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem;
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; }
.files-page { max-width: 640px; margin: 0 auto; }
@media (max-width: 1000px) {
  .chat.with-files { grid-template-columns: 280px minmax(0, 1fr); }
  .files-col { display: none; }
  .files-link { display: inline; }
  .files-btn { display: inline-flex; }
}

/* Поиск */
.search-row { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search-row input { flex: 1; min-width: 0; }
.results { list-style: none; padding: 0; margin: 0; }
.results li { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.results p { margin: .3rem 0 0; overflow-wrap: anywhere; }

@media (max-width: 700px) {
  .chat, .chat.with-files { grid-template-columns: 1fr; height: calc(100dvh - 56px - var(--tabbar)); }
  .chat-page .content { padding: 0; }
  .has-conv .convs { display: none; }
  .has-conv.show-list .convs { display: flex; }
  .has-conv.show-list .talk { display: none; }
  .to-list { display: inline-block; padding-left: 0; }
  .talk-head { padding: .4rem .6rem; }
  .feed { padding: .75rem .6rem; }
  .composer { padding: .5rem .6rem; }
  .convs { border-right: 0; }
  /* Кнопки под палец: все значки одного размера — 44 точки, рисунок 26 */
  .icon { width: 44px; height: 44px; }
  .icon svg { width: 26px; height: 26px; min-width: 26px; min-height: 26px; }
  #rename-btn { font-size: 1.6rem; }
  .talk-head { gap: .15rem; }
}

/* Кружки: красный — работает, оранжевый — ждёт разрешения, зелёный — свободен */
.light {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: .45rem; vertical-align: middle; flex: none;
  background: #2e9e57;
}
.light.busy { background: #d92d20; }
.light.wait { background: #f08c00; box-shadow: 0 0 0 3px #fde3bf; }
.talk-head .light, .proj-head .light { margin-right: 0; }

/* Щит с числом ждущих разрешений */
.shield { position: relative; }
.badge {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: #f08c00; color: #fff;
  font-size: .72rem; font-weight: 700; line-height: 18px; text-align: center;
}
.badge[hidden] { display: none; }

/* Страница «Разрешения» */
.perms h2 { margin-top: 1.5rem; font-size: 1.1rem; }
.asks pre.report { white-space: pre-wrap; margin: .5rem 0; font-size: .9rem; }
.ask-buttons { display: flex; gap: .5rem; flex-wrap: wrap; }
.ask-buttons form { margin: 0; }
.verdict { font-weight: 600; }
.v-yes { color: var(--ok); }
.v-no, .v-late { color: var(--error); }
.v-gone { color: var(--muted); }
.detail { font-family: ui-monospace, monospace; font-size: .85rem; }

/* Настройки */
.settings h2 { margin-top: 1.75rem; font-size: 1.15rem; }
.settings h3 { margin: 1.25rem 0 .5rem; font-size: 1rem; }
.row-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.power { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.power button:disabled, #load-btn:disabled { opacity: .55; cursor: default; }
.load-now { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .75rem; display: flex; flex-direction: column; gap: .1rem; }
.tile-name { color: var(--muted); font-size: .9rem; }
.tile-val { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.charts { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.chart { margin: 0; }
.chart figcaption { font-size: .9rem; color: var(--muted); margin-bottom: .2rem; }
.chart-box { position: relative; }
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart .grid { stroke: #e6e8eb; stroke-width: 1.5; }
.chart .axis { fill: var(--muted); font-size: 19px; }   /* в точках графика: он ужат почти вдвое */
.chart .series { fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-dot { fill: var(--accent); }
.chart .cross { stroke: #9aa1ab; stroke-width: 2; }
.chart .cross-dot { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.tip {
  position: absolute; top: -.2rem; transform: translateX(-50%);
  background: var(--text); color: #fff; border-radius: 6px; padding: .15rem .45rem;
  font-size: .8rem; white-space: nowrap; pointer-events: none;
}
.tip[hidden] { display: none; }
.hours { margin-top: .75rem; }
.hours table { margin-top: .5rem; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
  .tile-val { font-size: 1.3rem; }
  .load-now { gap: .35rem; }
  .tile { padding: .5rem; }
}

/* Безопасность */
.sec h3 { margin: 1.4rem 0 .5rem; font-size: 1.05rem; }
.sec-run { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.sec-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.sec-tiles .tile-val { font-size: 1.25rem; }
.tile-ok { border-left: 4px solid var(--ok); }
.tile-warn { border-left: 4px solid #f08c00; }
.sec-list { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .35rem; }
.sec-items { list-style: none; margin: .2rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .15rem; }
.sec-items li, .sec-list .detail { overflow-wrap: anywhere; }
.sec-alert strong { color: var(--error); }
.plus, .minus { font-size: .78rem; font-weight: 600; border-radius: 4px; padding: 0 .3rem; margin-right: .3rem; white-space: nowrap; }
.plus { background: #e5f2ea; color: var(--ok); }
.minus { background: #fdecd6; color: #8a4b00; }
.sec-reports { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.sec-report pre { background: #f8f9fa; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; font-size: .85rem; }
.snap summary { cursor: pointer; margin-top: 1rem; }

/* VPN */
.light.off { background: #9aa1ab; }
.vpn-list p { margin: 0; }
.vpn-secret summary { cursor: pointer; font-weight: 600; margin: .5rem 0; }
.vpn-how { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; }
.qr { width: 280px; height: 280px; max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; image-rendering: pixelated; }
.vpn-how > div { flex: 1; min-width: 220px; }
#vpn-name { min-width: 0; flex: 1 1 200px; max-width: 320px; }

@media (max-width: 700px) {
  .sec-tiles { grid-template-columns: 1fr; }
  .qr { width: 100%; height: auto; aspect-ratio: 1; }
}
.sec-changes { display: flex; flex-direction: column; gap: .3rem; }
.sec-change { border: 1px solid var(--line); border-radius: 8px; padding: .45rem .7rem; }
.sec-change summary { cursor: pointer; }
.sec-change summary .plus, .sec-change summary .minus { margin-left: .4rem; }
.sec-change .sec-items { margin-top: .5rem; }

/* Картинки: дерево слева, сетка справа, просмотрщик поверх */
.pics-page .content { max-width: none; padding: 0; }
.pics { display: grid; grid-template-columns: 280px minmax(0, 1fr); height: calc(100dvh - 56px); }
.pics-side { border-right: 1px solid var(--line); background: var(--panel); padding: .75rem; overflow-y: auto;
  display: flex; flex-direction: column; gap: .6rem; }
.pics-side input { width: 100%; }
.pic-tree { display: flex; flex-direction: column; gap: 2px; }
.pic-node { display: flex; align-items: baseline; gap: .5rem; width: 100%; text-align: left;
  border: 0; border-radius: 8px; background: none; color: var(--text); padding: .45rem .6rem; }
.pic-node:hover { background: #eef0f3; }
.pic-node.is-current { background: #e8eefa; color: var(--accent); font-weight: 600; }
.pic-node.proj { font-weight: 600; }
.pic-node.folder { padding-left: calc(.6rem + var(--depth, 1) * 1rem); font-size: .93rem; }
.pic-node-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pic-node-count { color: var(--muted); font-size: .85rem; font-weight: 400; }
.pics-main { overflow-y: auto; padding: 1rem; }
.pics-head { display: flex; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.pics-head h1 { margin: 0; overflow-wrap: anywhere; }
.pics-tools { margin-left: auto; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.pic-size { flex-direction: row; align-items: center; gap: .4rem; color: var(--muted); }
.pic-size input { width: 90px; padding: 0; }
.pics-toggle { display: none; border: 1px solid #c6cad1; border-radius: 8px; background: #fff; padding: .4rem .7rem; }
.pic-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr)); }
.pic-grid.size-0 { --tile: 110px; }
.pic-grid.size-1 { --tile: 160px; }
.pic-grid.size-2 { --tile: 230px; }
.pic-grid.size-3 { --tile: 320px; }
.pic-tile { display: flex; flex-direction: column; gap: .25rem; min-width: 0; padding: .4rem; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); }
.pic-tile:hover { border-color: var(--accent); }
.pic-frame { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border-radius: 6px;
  overflow: hidden; background: #eceee9 repeating-conic-gradient(#e2e4df 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
.pic-frame img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.pic-frame.broken { color: var(--muted); font-size: .85rem; }
.pic-name { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pic-meta { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: #16181c; color: #f2f2f2; }
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgba(0, 0, 0, .7); }
.viewer .muted { color: #b3b8c0; }
.viewer-bar { display: flex; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; padding: .5rem .75rem;
  background: #202329; }
.viewer-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.viewer-btns { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.viewer-btns button, .viewer-btns a { min-width: 40px; height: 40px; padding: 0 .7rem; border: 0; border-radius: 8px;
  background: #33373f; color: #f2f2f2; text-decoration: none; display: inline-flex; align-items: center;
  justify-content: center; font-size: .95rem; }
.viewer-btns button:hover, .viewer-btns a:hover { background: #454a54; }
#v-zoom { min-width: 4.5rem; text-align: center; }
.viewer-stage { position: relative; flex: 1; min-height: 0; overflow: auto; display: flex; outline: none; }
.viewer-stage img { display: block; max-width: none; margin: auto; flex: none; }
.viewer-stage img.fit { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-nav { position: fixed; top: 50%; transform: translateY(-50%); width: 48px; height: 72px; border: 0;
  border-radius: 10px; background: rgba(32, 35, 41, .75); color: #fff; font-size: 2.2rem; line-height: 1; }
.viewer-nav.prev { left: .5rem; }
.viewer-nav.next { right: .5rem; }
.viewer-nav[hidden] { display: none; }
.viewer-pos { text-align: center; margin: 0; padding: .3rem; color: #b3b8c0; }

@media (max-width: 700px) {
  .pics { grid-template-columns: 1fr; height: auto; min-height: calc(100dvh - 56px - var(--tabbar)); }
  .pics-side { display: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .pics-side.open { display: flex; }
  .pics-toggle { display: inline-block; }
  .pics-main { overflow: visible; padding: .75rem .6rem calc(var(--tabbar) + 1rem); }
  .pics-head h1 { width: 100%; font-size: 1.2rem; order: 2; }
  .pics-head .muted { order: 3; }
  .pics-tools { order: 4; margin-left: 0; width: 100%; justify-content: space-between; }
  .pic-grid { gap: .5rem; }
  .pic-grid.size-0 { --tile: 90px; }
  .pic-grid.size-1 { --tile: 140px; }
  .pic-grid.size-2 { --tile: 200px; }
  .pic-grid.size-3 { --tile: 300px; }
  .viewer-btns button, .viewer-btns a { min-width: 44px; height: 44px; }
  .viewer-nav { width: 40px; height: 60px; }
}
