/* Keepers — a nod to Picasa 3: glossy light chrome, blue selection, dark lightbox. */

:root {
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --text: #1f2933;
  --text-2: #5b6876;
  --text-3: #8a96a3;
  --line: #c9d1db;
  --line-soft: #e3e8ee;
  --bg: #ffffff;
  --chrome-hi: #fbfcfd;
  --chrome-lo: #e4e9ef;
  --side: #eef2f6;
  --blue: #2f78d0;
  --blue-hi: #5fa2ec;
  --blue-soft: #dce9fb;
  --heart: #e0245e;
  --heart-hi: #ff5c80;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(20, 40, 70, 0.08), 0 6px 18px rgba(20, 40, 70, 0.08);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 13px/1.4 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border: 1px solid #c3cbd5;
  border-bottom-width: 2px;
  border-radius: 4px;
  background: linear-gradient(#fff, #f0f3f6);
  font: 600 11px/16px var(--font);
  text-align: center;
  color: #3a4652;
}
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.tiny { width: 12px; height: 12px; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.center { text-align: center; justify-content: center; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid #b4bfcb;
  border-radius: 5px;
  background: linear-gradient(#ffffff, #e9eef3);
  box-shadow: inset 0 1px 0 #fff, 0 1px 1px rgba(0, 0, 0, 0.05);
  color: #24303c;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { border-color: #8fb4e3; box-shadow: inset 0 1px 0 #fff, 0 0 0 3px rgba(47, 120, 208, 0.12); }
.btn:active { background: linear-gradient(#e6ebf1, #f6f8fa); transform: translateY(0.5px); }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; border-color: #c8d0d9; }
.btn.primary {
  border-color: #2462b3;
  background: linear-gradient(#5da1ee, #2f78d0 55%, #2a6cc0);
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 2px rgba(30, 70, 130, 0.25);
}
.btn.primary:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 0 3px rgba(47, 120, 208, 0.22); }
.btn.primary:active { background: linear-gradient(#2a6cc0, #3a83d8); }
.btn.big { height: 44px; padding: 0 26px; font-size: 15px; border-radius: 8px; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: rgba(0, 0, 0, 0.05); }
.btn.like { color: var(--heart); }
.btn.like .icon { fill: var(--heart); stroke: var(--heart); }
.btn .pill {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.28);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.icon-btn { padding: 0 9px; }
.icon-btn span { font-size: 12px; }

/* --------------------------------------------------------------- welcome */

.screen { position: fixed; inset: 0; display: grid; place-items: center; }
.welcome {
  background:
    radial-gradient(1200px 600px at 50% -10%, #ffffff 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(#e9f1fb, #cfdcec);
  overflow: auto;
  padding: 24px 16px;
}
.welcome-card {
  width: min(520px, 100%);
  padding: 40px 40px 30px;
  border: 1px solid #c4d0de;
  border-radius: 14px;
  background: linear-gradient(#ffffff, #f6f9fc);
  box-shadow: inset 0 1px 0 #fff, 0 20px 50px rgba(40, 70, 110, 0.18);
  text-align: center;
}
.welcome-logo { filter: drop-shadow(0 6px 10px rgba(40, 90, 170, 0.25)); }
.welcome h1 { margin: 12px 0 4px; font-size: 30px; letter-spacing: -0.02em; }
.lead { margin: 0 0 26px; color: var(--text-2); font-size: 15px; }
.hint { margin: 12px 0 0; color: var(--text-3); font-size: 12px; }
.recent { margin-top: 12px; }
.recent-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px dashed #a9bdd6;
  border-radius: 8px;
  background: #f3f7fc;
  color: #2c4f7c;
  cursor: pointer;
}
.recent-btn:hover { background: var(--blue-soft); border-style: solid; }
.recent-likes { display: inline-flex; align-items: center; gap: 3px; color: var(--heart); font-weight: 600; }
.recent-likes .icon { fill: currentColor; stroke: none; }
.facts { margin: 28px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line-soft); list-style: none; text-align: left; color: var(--text-2); }
.facts li { position: relative; padding-left: 18px; margin: 6px 0; }
.facts li::before { content: ''; position: absolute; left: 3px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--blue-hi); }
.facts strong { color: var(--text); font-weight: 600; }
.browser-note { margin: 16px 0 0; padding: 10px 12px; border-radius: 8px; background: #fff6df; color: #7a5a00; text-align: left; }

/* -------------------------------------------------------------- indexing */

.indexing { background: linear-gradient(#e9f1fb, #cfdcec); }
.index-card { width: min(440px, calc(100% - 32px)); padding: 28px; border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.index-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.index-sub { margin-top: 10px; color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.progress { height: 10px; border: 1px solid #b6c4d6; border-radius: 6px; background: linear-gradient(#e8edf3, #f7f9fb); overflow: hidden; }
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 5px;
  background: linear-gradient(#7fb8f5, #2f78d0);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: width 0.2s var(--ease);
}
.progress-bar.indeterminate {
  width: 100%;
  background: repeating-linear-gradient(-45deg, #5d9fe9 0 12px, #8bc0f6 12px 24px);
  background-size: 34px 34px;
  animation: stripes 0.8s linear infinite;
}
@keyframes stripes { to { background-position: 34px 0; } }

/* ------------------------------------------------------------------- app */

.app { position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid #b9c3cf;
  background: linear-gradient(var(--chrome-hi), var(--chrome-lo));
  box-shadow: inset 0 1px 0 #fff;
  z-index: 3;
}
.brand { display: flex; align-items: center; gap: 8px; width: 216px; flex: none; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; color: #1e3657; }
.tb-group { display: flex; align-items: center; gap: 10px; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 1px solid #b4bfcb; border-radius: 6px; overflow: hidden; background: linear-gradient(#fff, #e9eef3); box-shadow: inset 0 1px 0 #fff; }
.seg button { height: 28px; padding: 0 12px; border: 0; border-left: 1px solid #d0d7df; background: transparent; cursor: pointer; font-weight: 500; color: #3a4652; }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: rgba(47, 120, 208, 0.07); }
.seg button.on { background: linear-gradient(#cfe2fa, #b8d3f5); color: #123c6e; box-shadow: inset 0 1px 2px rgba(20, 60, 120, 0.2); }
.search { position: relative; display: flex; align-items: center; }
.search-ic { position: absolute; left: 9px; display: flex; color: var(--text-3); pointer-events: none; }
.search-ic .icon { width: 15px; height: 15px; }
.search input {
  width: 210px;
  height: 30px;
  padding: 0 10px 0 30px;
  border: 1px solid #b4bfcb;
  border-radius: 15px;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
  font: inherit;
  outline: none;
  transition: width 0.2s var(--ease), box-shadow 0.15s;
}
.search input:focus { width: 260px; border-color: #7eaae0; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06), 0 0 0 3px rgba(47, 120, 208, 0.15); }

.body { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 0; }

/* sidebar */
.sidebar {
  overflow-y: auto;
  padding: 10px 0 0;
  border-right: 1px solid #c8d1dc;
  background: linear-gradient(90deg, #f2f5f8, #eaeff4);
  display: flex;
  flex-direction: column;
}
.sb-head { padding: 14px 16px 5px; color: #7a8796; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.sb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 12px);
  margin: 1px 6px;
  min-height: 30px;
  padding: 0 10px 0 14px;
  border: 0;
  border-radius: 6px;
  background: none;
  text-align: left;
  cursor: pointer;
  color: #2a3642;
}
.sb-item .icon { width: 16px; height: 16px; color: #5b7aa0; }
.sb-item:hover { background: rgba(47, 120, 208, 0.08); }
.sb-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-count { color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.sb-item.on {
  background: linear-gradient(#64a5ee, #3580d6);
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.sb-item.on .icon, .sb-item.on .sb-count { color: #fff; }
.sb-item.album .icon { color: var(--heart); fill: var(--heart); stroke: var(--heart); }
.sb-item.album.on .icon { color: #fff; fill: #fff; stroke: #fff; }
.sb-item.album .sb-label { font-weight: 600; }
.sb-foot { margin-top: auto; display: flex; gap: 8px; padding: 14px 16px; border-top: 1px solid #d5dde6; color: var(--text-3); font-size: 11px; line-height: 1.45; }
.sb-foot .icon { width: 16px; height: 16px; color: #6aa36f; margin-top: 1px; }
.sb-foot strong { color: var(--text-2); word-break: break-all; }

/* main */
.main { position: relative; display: grid; grid-template-rows: auto 1fr; min-height: 0; background: var(--bg); }
.view-head { display: flex; align-items: center; gap: 12px; padding: 14px 24px 10px; border-bottom: 1px solid var(--line-soft); }
.vh-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(#eef4fb, #dbe7f5); color: #3d6ea8; box-shadow: inset 0 1px 0 #fff, 0 0 0 1px #c9d7e8; }
.vh-icon .icon { width: 20px; height: 20px; }
.view-head.album .vh-icon { background: linear-gradient(#fff0f3, #ffd8e1); color: var(--heart); box-shadow: inset 0 1px 0 #fff, 0 0 0 1px #f5c3cf; }
.view-head.album .vh-icon .icon { fill: var(--heart); }
.vh-text { flex: 1; min-width: 0; }
.vh-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vh-sub { color: var(--text-2); font-size: 12px; white-space: pre; overflow: hidden; text-overflow: ellipsis; }

.scroller { position: relative; overflow-y: auto; overflow-x: hidden; outline: none; overscroll-behavior: contain; }
.grid-canvas { position: relative; width: 100%; }

.section-head { position: absolute; height: 56px; display: flex; align-items: flex-end; gap: 10px; padding-bottom: 10px; }
.section-title { font-size: 15px; font-weight: 700; color: #1f2b38; }
.section-sub { color: var(--text-3); font-size: 12px; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.head-check {
  display: grid; place-items: center;
  width: 20px; height: 20px; margin-left: -28px; margin-right: -2px; margin-bottom: 1px;
  padding: 0; border: 1.5px solid #9aa7b5; border-radius: 50%; background: #fff; color: transparent;
  cursor: pointer; opacity: 0; transition: opacity 0.15s;
}
.head-check .icon { width: 13px; height: 13px; stroke-width: 3; }
.section-head:hover .head-check, .section-head.select-mode .head-check { opacity: 1; }
.section-head.all-selected .head-check { background: var(--blue); border-color: var(--blue); color: #fff; }

/* tiles */
.tile {
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  border-radius: 3px;
  background: #eef1f4;
  cursor: pointer;
  contain: strict;
}
.tile-ph { position: absolute; inset: 0; background: linear-gradient(100deg, #eef1f4 30%, #f7f9fb 50%, #eef1f4 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
.tile.loaded .tile-ph { display: none; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.25s, transform 0.25s var(--ease); }
.tile.loaded img { opacity: 1; }
.tile.instant img { transition: none; }
.tile.failed .tile-ph { animation: none; background: repeating-linear-gradient(45deg, #f2f4f6 0 8px, #e9ecf0 8px 16px); }
.tile.failed::after { content: attr(aria-label); position: absolute; inset: auto 8px 8px; color: var(--text-3); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-shade { position: absolute; inset: 0; background: linear-gradient(rgba(0, 0, 0, 0.38), rgba(0, 0, 0, 0) 34%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.3)); opacity: 0; transition: opacity 0.15s; pointer-events: none; }
.tile:hover .tile-shade { opacity: 1; }
.tile:hover img { transform: scale(1.02); }
.tile-check, .tile-heart {
  position: absolute; top: 6px;
  display: grid; place-items: center;
  width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 50%;
  background: transparent; color: #fff; cursor: pointer;
  opacity: 0; transition: opacity 0.15s, transform 0.15s;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}
.tile-check { left: 6px; }
.tile-check .icon { width: 20px; height: 20px; padding: 3px; border: 2px solid #fff; border-radius: 50%; stroke-width: 3; color: transparent; }
.tile-check:hover .icon { color: #fff; }
.tile-heart { right: 6px; }
.tile-heart .icon { width: 22px; height: 22px; }
.tile-heart:hover { transform: scale(1.15); }
.tile:hover .tile-check, .tile:hover .tile-heart, .tile.select-mode .tile-check { opacity: 1; }
.tile.is-liked .tile-heart .icon { fill: var(--heart-hi); stroke: #fff; }

.tile-liked { position: absolute; left: 7px; bottom: 6px; display: none; color: var(--heart); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); pointer-events: none; }
.tile-liked .icon { width: 20px; height: 20px; fill: var(--heart-hi); stroke: #fff; stroke-width: 1.6; }
.tile.is-liked .tile-liked { display: block; animation: pop 0.35s var(--ease); }
.tile.is-liked:hover .tile-liked { display: none; }

.tile-badges { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 4px; pointer-events: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 10px; background: rgba(10, 16, 24, 0.6); color: #fff; font-size: 11px; font-weight: 600; backdrop-filter: blur(4px); }
.badge.raw { background: rgba(10, 16, 24, 0.45); font-size: 10px; letter-spacing: 0.04em; }
.badge .icon { fill: #fff; stroke: none; }

.tile.is-selected { background: #cfe0f7; }
.tile.is-selected img, .tile.is-selected .tile-ph { transform: scale(0.88); border-radius: 4px; }
.tile.is-selected .tile-check { opacity: 1; filter: none; }
.tile.is-selected .tile-check .icon { background: var(--blue); border-color: #fff; color: #fff; box-shadow: 0 0 0 1px var(--blue); }
.tile.is-selected .tile-shade { opacity: 0 !important; }

@keyframes pop { 0% { transform: scale(0.3); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

.empty { display: grid; place-content: center; justify-items: center; gap: 4px; padding: 40px; color: var(--text-2); text-align: center; }
.empty h2 { margin: 8px 0 0; color: var(--text); font-size: 18px; }
.empty p { max-width: 380px; margin: 4px 0 16px; line-height: 1.6; }
.empty-heart { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: linear-gradient(#fff0f3, #ffdbe3); box-shadow: inset 0 1px 0 #fff, 0 0 0 1px #f5c3cf; }
.empty-heart .icon { width: 36px; height: 36px; fill: var(--heart); stroke: var(--heart); }

/* tray */
.tray {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 52px;
  padding: 0 14px;
  border-top: 1px solid #b9c3cf;
  background: linear-gradient(var(--chrome-hi), var(--chrome-lo));
  box-shadow: inset 0 1px 0 #fff;
}
.tray-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.tray-right { display: flex; align-items: center; gap: 16px; }
.tray-count { font-weight: 600; }
.tray-album { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px; border: 0; border-radius: 6px; background: none; cursor: pointer; white-space: nowrap; }
.tray-album:hover { background: rgba(0, 0, 0, 0.05); }
.tray-heart { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(#ff7b97, #e0245e); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4); }
.tray-heart .icon { width: 13px; height: 13px; fill: #fff; stroke: #fff; }
.tray-hint { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.size-slider { display: flex; align-items: center; gap: 8px; }
.size-slider input { width: 120px; accent-color: var(--blue); }
.sz { display: block; border: 1.5px solid #8794a3; border-radius: 2px; }
.sz.small { width: 9px; height: 7px; }
.sz.big { width: 15px; height: 11px; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 70px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100% - 32px);
  padding: 10px 14px 10px 16px;
  border-radius: 8px;
  background: rgba(28, 34, 42, 0.94);
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; background: none; color: #8ec2ff; font-weight: 700; cursor: pointer; padding: 2px 4px; }
body.viewer-open .toast { bottom: 150px; z-index: 120; }

.drop-overlay { position: fixed; inset: 10px; z-index: 200; display: grid; place-items: center; border: 3px dashed var(--blue-hi); border-radius: 16px; background: rgba(220, 233, 251, 0.85); color: #1d4f8f; font-size: 22px; font-weight: 700; pointer-events: none; }

/* Friend lists */
.friend-picker { display: none; }
.friend-choices { max-height: 36vh; overflow-y: auto; margin-bottom: 10px; }
.friend-create { display: flex; flex-wrap: wrap; gap: 8px; }
.friend-create input, .friend-picker {
  padding: 6px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font: inherit;
}
.friend-create input { flex: 1; min-width: 0; }
.friend-create + p:empty { display: none; }

/* dialogs */
.dialog {
  width: min(520px, calc(100% - 32px));
  padding: 24px 26px 20px;
  border: 1px solid #b8c4d2;
  border-radius: 12px;
  background: linear-gradient(#fff, #f7f9fb);
  box-shadow: 0 30px 80px rgba(20, 40, 70, 0.35);
  color: var(--text);
}
.dialog::backdrop { background: rgba(30, 45, 65, 0.35); backdrop-filter: blur(2px); }
.dialog h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 18px; }
.dialog h2 .icon { color: var(--blue); }
.dialog p { margin: 0 0 14px; line-height: 1.55; }
.dialog fieldset { margin: 0 0 12px; padding: 8px 12px 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fff; }
.dialog legend { padding: 0 6px; color: var(--text-2); font-size: 12px; font-weight: 600; }
.opt { display: flex; align-items: flex-start; gap: 10px; padding: 6px 4px; border-radius: 6px; cursor: pointer; }
.opt:hover { background: #f3f7fc; }
.opt input { margin-top: 3px; accent-color: var(--blue); }
.opt small { display: block; color: var(--text-2); font-size: 12px; }
.ex-summary { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 14px; padding: 12px 14px; border-radius: 8px; background: linear-gradient(#eef5fd, #e3eefb); }
.ex-big { font-size: 22px; font-weight: 700; color: #1d4f8f; }
.ex-small { color: var(--text-2); }
.ex-counts { margin-top: 10px; font-variant-numeric: tabular-nums; }
.ex-current { margin-top: 4px; color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-done { display: grid; place-items: center; width: 56px; height: 56px; margin: 4px auto 12px; border-radius: 50%; background: linear-gradient(#6fd08b, #2f9e55); color: #fff; box-shadow: 0 6px 16px rgba(47, 158, 85, 0.35); }
.ex-done .icon { width: 30px; height: 30px; stroke-width: 2.6; }
.ex-failed { max-height: 140px; overflow: auto; margin: 0 0 12px; padding-left: 18px; color: #a12a2a; font-size: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dialog .progress { margin-top: 16px; }
.help { width: min(640px, calc(100% - 32px)); }
.k-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 10px 0 14px; }
.k-cols h4 { margin: 0 0 8px; color: var(--text-2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.k-row { display: flex; align-items: center; gap: 12px; padding: 4px 0; }
.k-keys { display: flex; gap: 3px; width: 96px; flex: none; }

/* ================================================================ viewer */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  background: radial-gradient(ellipse at 50% 40%, #4a4d52 0%, #2a2c30 55%, #17181a 100%);
  color: #e9edf2;
  outline: none;
  user-select: none;
}
.viewer.open { display: grid; animation: vfade 0.18s ease-out; }
@keyframes vfade { from { opacity: 0; } }
body.viewer-open .app { visibility: hidden; }

.v-top { display: flex; align-items: center; gap: 14px; height: 54px; padding: 0 12px; background: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0)); z-index: 2; transition: opacity 0.3s; }
.v-title { flex: 1; min-width: 0; }
.v-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-sub { color: #a9b2bd; font-size: 12px; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.v-counter { color: #a9b2bd; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.vbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 34px; min-width: 34px; padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: linear-gradient(rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #e9edf2; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.vbtn:hover { background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.07)); border-color: rgba(255, 255, 255, 0.25); }
.vbtn.back { padding: 0 12px 0 9px; }
.vbtn.round { width: 44px; height: 44px; border-radius: 50%; }
.vbtn.round .icon { width: 22px; height: 22px; }

.v-body { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 0; min-height: 0; transition: grid-template-columns 0.2s var(--ease); }
.viewer.info-open .v-body { grid-template-columns: minmax(0, 1fr) 300px; }
.v-stage { position: relative; overflow: hidden; touch-action: none; cursor: zoom-in; }
.viewer.zoomed .v-stage { cursor: grab; }
.v-stage.grabbing { cursor: grabbing !important; }
.viewer.is-video .v-stage { cursor: default; }
.v-media { position: absolute; inset: 16px 24px; display: flex; align-items: center; justify-content: center; }
.v-media .media {
  /* flex item inside a definite-size box: both limits resolve, so photos always fit */
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  flex: none;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  will-change: transform;
}
.v-media img.media { image-rendering: auto; }
.v-media img.is-preview { filter: blur(0.6px); }
.v-media video.media { width: 100%; height: 100%; background: #000; box-shadow: none; }
.v-stage.bump-r .v-media { animation: bumpR 0.3s var(--ease); }
.v-stage.bump-l .v-media { animation: bumpL 0.3s var(--ease); }
@keyframes bumpR { 40% { transform: translateX(-18px); } }
@keyframes bumpL { 40% { transform: translateX(18px); } }

.v-nav {
  position: absolute; top: 50%; z-index: 2;
  width: 54px; height: 54px; border-radius: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.3); border-color: rgba(255, 255, 255, 0.1);
  opacity: 0; transition: opacity 0.2s;
}
.v-nav .icon { width: 26px; height: 26px; }
.v-nav.prev { left: 16px; }
.v-nav.next { right: 16px; }
.v-stage:hover .v-nav { opacity: 0.85; }
.v-nav:hover { opacity: 1 !important; background: rgba(0, 0, 0, 0.5); }
.viewer.zoomed .v-nav { display: none; }

.v-burst { position: absolute; left: 50%; top: 50%; z-index: 3; width: 120px; height: 120px; margin: -60px 0 0 -60px; pointer-events: none; opacity: 0; }
.v-burst .icon { width: 100%; height: 100%; fill: #fff; stroke: none; filter: drop-shadow(0 6px 20px rgba(224, 36, 94, 0.8)); }
.v-burst.go { animation: burst 0.7s var(--ease); }
@keyframes burst { 0% { opacity: 0; transform: scale(0.3); } 25% { opacity: 0.95; transform: scale(1.1); } 60% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.25); } }

.v-spinner { position: absolute; right: 22px; top: 18px; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, 0.2); border-top-color: #fff; border-radius: 50%; opacity: 0; transition: opacity 0.2s 0.25s; animation: spin 0.8s linear infinite; }
.v-spinner.on { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.v-zoom-label { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); padding: 3px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.5); font-size: 12px; font-variant-numeric: tabular-nums; }
.v-zoom-label:empty { display: none; }
.v-error { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); max-width: 80%; padding: 8px 14px; border-radius: 8px; background: rgba(160, 30, 40, 0.85); text-align: center; }
.v-error:empty { display: none; }

.v-info { overflow-y: auto; overflow-x: hidden; border-left: 1px solid rgba(255, 255, 255, 0.08); background: rgba(16, 18, 21, 0.55); user-select: text; }
.viewer:not(.info-open) .v-info { visibility: hidden; }
.v-info h3 { margin: 18px 18px 8px; color: #8e99a6; font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; }
.i-row { display: grid; grid-template-columns: 76px 1fr; gap: 10px; padding: 5px 18px; width: 300px; }
.i-k { color: #8e99a6; }
.i-v { color: #eef1f5; word-break: break-word; white-space: pre-wrap; }
.i-file { display: flex; align-items: center; gap: 8px; width: 300px; padding: 5px 18px; }
.i-ext { padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); font-size: 10px; font-weight: 700; letter-spacing: 0.04em; }
.i-fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.i-size { color: #8e99a6; font-variant-numeric: tabular-nums; }
.i-note { width: 300px; margin: 10px 0; padding: 0 18px; color: #8e99a6; font-size: 12px; line-height: 1.5; }

.v-bottom { background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.45) 30%); padding-bottom: 10px; z-index: 2; }
.v-strip { display: flex; gap: 4px; height: 62px; padding: 6px 50%; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); }
.v-strip::-webkit-scrollbar { display: none; }
.strip-thumb { position: relative; flex: none; width: 66px; height: 50px; padding: 0; border: 2px solid transparent; border-radius: 4px; overflow: hidden; background: #333; cursor: pointer; opacity: 0.55; transition: opacity 0.15s, transform 0.15s; }
.strip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.strip-thumb:hover { opacity: 0.9; }
.strip-thumb.current { opacity: 1; border-color: #fff; transform: scale(1.08); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); z-index: 1; }
.strip-play { position: absolute; right: 3px; bottom: 2px; color: #fff; }
.strip-play .icon { fill: #fff; stroke: none; }
.strip-heart { position: absolute; left: 3px; bottom: 1px; display: none; }
.strip-heart .icon { fill: var(--heart-hi); stroke: #fff; stroke-width: 2; }
.strip-thumb.liked .strip-heart { display: block; }

.v-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 6px 16px 0; }
.v-ctl-group { display: flex; gap: 6px; }
.v-ctl-group.right { justify-content: flex-end; }
.v-ctl-main { display: flex; align-items: center; gap: 18px; }

.like-btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 24px 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  background: linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 14px rgba(0, 0, 0, 0.3);
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  min-width: 128px; justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}
.like-btn .icon { width: 24px; height: 24px; stroke-width: 2; }
.like-btn:hover { border-color: rgba(255, 120, 150, 0.6); }
.like-btn:active { transform: scale(0.96); }
.like-btn.on { background: linear-gradient(#ff6d8e, #e0245e 60%, #c81c51); border-color: #ff8aa5; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 18px rgba(224, 36, 94, 0.45); }
.like-btn.on .icon { fill: #fff; animation: pop 0.35s var(--ease); }

.viewer.slideshow .v-top, .viewer.slideshow .v-strip { opacity: 0; transition: opacity 0.6s; }
.viewer.slideshow:hover .v-top, .viewer.slideshow:hover .v-strip { opacity: 1; }
.viewer.is-fullscreen .v-media { inset: 6px; }

/* ---------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .brand span, .tb-right .btn:not(.icon-btn), .tray-hint, .size-slider { display: none; }
  .brand { width: auto; }
  .body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .friend-picker { display: block; max-width: 100%; }
  .view-head:has(.friend-picker) { flex-wrap: wrap; }
  .search input { width: 140px; }
  .search input:focus { width: 170px; }
  .viewer.info-open .v-body { grid-template-columns: minmax(0, 1fr) 0; }
  .v-ctl-group .vbtn:not(:first-child) { display: none; }
  .vbtn.back .label { display: none; }
}
@media (max-width: 620px) {
  .toolbar { gap: 8px; padding: 0 10px; }
  #group-filter, #order { display: none; }
  .search { display: none; }
  .v-controls { grid-template-columns: auto 1fr; }
  .v-ctl-group.right { grid-column: 1 / -1; justify-content: center; }
  .like-btn { min-width: 0; padding: 0 16px; }
  .k-cols { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
