:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --surface-soft: #eef3fb;
  --surface-raised: rgba(255, 255, 255, 0.92);
  --text: #111827;
  --muted: #65758b;
  --faint: #8a98aa;
  --line: rgba(17, 24, 39, 0.1);
  --line-strong: rgba(17, 24, 39, 0.18);
  --blue: #007aff;
  --cyan: #06b6d4;
  --green: #34c759;
  --orange: #ff9500;
  --pink: #ff2d55;
  --red: #ff3b30;
  --shadow: 0 18px 60px rgba(15, 23, 42, 0.13);
  --shadow-soft: 0 10px 34px rgba(15, 23, 42, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --topbar: 76px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden],
body:not([data-role="admin"]) [data-admin-only] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

html.viewer-open,
html.viewer-open body {
  background: #000000;
}

body {
  min-height: 100dvh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(0, 122, 255, 0.12), transparent 34%),
    linear-gradient(225deg, rgba(255, 45, 85, 0.09), transparent 38%),
    linear-gradient(180deg, rgba(52, 199, 89, 0.08), transparent 46%),
    var(--bg);
  color: var(--text);
  font-size: 16px;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.34);
  outline-offset: 3px;
}

.skip-link,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.skip-link:focus {
  z-index: 99;
  width: auto;
  height: auto;
  clip: auto;
  top: 14px;
  left: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: white;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: var(--topbar);
  padding: 12px clamp(14px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(245, 247, 251, 0.84);
  backdrop-filter: blur(26px) saturate(1.35);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark,
.login-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  color: var(--blue);
  background: linear-gradient(145deg, rgba(0, 122, 255, 0.14), rgba(52, 199, 89, 0.12));
}

.brand-mark svg,
.login-icon svg,
.icon-button svg,
.top-tab svg,
.search svg,
.nav-button svg {
  width: 22px;
  height: 22px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.04rem;
  line-height: 1;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.top-tabs {
  display: flex;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
}

.mobile-tabs {
  display: none;
}

.top-tab,
.pill,
.album-chip,
.icon-button,
.primary-button,
.ghost-button,
.country-card,
.nav-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text);
  background: transparent;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.top-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  color: var(--muted);
  font-weight: 750;
}

.top-tab.active {
  color: var(--blue);
  background: white;
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.13);
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 46px;
  padding: 0;
  border-color: var(--line);
  background: var(--surface);
}

.icon-button:hover,
.pill:hover,
.album-chip:hover,
.primary-button:hover,
.ghost-button:hover,
.country-card:hover,
.nav-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

main {
  width: min(1460px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 42px);
}

.auth-locked main,
.auth-locked .top-tabs,
.auth-locked .top-actions {
  pointer-events: none;
  user-select: none;
  filter: blur(8px) saturate(0.7);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 18px 0 22px;
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.overline {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(3.4rem, 11vw, 7.5rem);
  line-height: 0.88;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
}

.view-switch,
.stats-grid,
.library-tools,
.album-filters,
.vpn-dashboard,
.details-list div,
.lightbox figcaption {
  display: flex;
}

.view-switch {
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
}

.page-head > .primary-button,
.upload-open {
  flex: 0 0 auto;
}

.upload-open {
  gap: 8px;
}

.upload-open svg {
  width: 20px;
  height: 20px;
}

.pill {
  padding: 0 16px;
  color: var(--muted);
  font-weight: 760;
}

.pill.active,
.album-chip.active {
  color: white;
  background: #111827;
}

.memory-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 18px;
  min-height: 236px;
  margin-bottom: 16px;
  padding: clamp(20px, 4vw, 34px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(10, 16, 28, 0.98), rgba(0, 122, 255, 0.78) 44%, rgba(255, 45, 85, 0.52)),
    #111827;
  color: white;
  box-shadow: var(--shadow);
}

.memory-hero::after {
  position: absolute;
  inset: 0;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.11) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.7), transparent);
}

.memory-copy,
.stats-grid {
  position: relative;
  z-index: 1;
}

.memory-copy {
  align-self: end;
  max-width: 620px;
}

.memory-copy p {
  margin: 12px 0 0;
  font-size: clamp(1.45rem, 4vw, 3.2rem);
  font-weight: 760;
  line-height: 1.08;
}

.live-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(52, 199, 89, 0.18);
}

.stats-grid {
  align-items: stretch;
  gap: 10px;
}

.stats-grid div {
  flex: 1;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(18px);
}

.stats-grid strong,
.stats-grid span {
  display: block;
}

.stats-grid strong {
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  line-height: 1;
}

.stats-grid span {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.library-tools {
  position: sticky;
  top: calc(var(--topbar) + 10px);
  z-index: 20;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(24px) saturate(1.3);
}

.search {
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  gap: 10px;
  min-width: 0;
  padding: 0 14px;
  color: var(--faint);
}

.search input {
  width: 100%;
  min-height: 44px;
  border: 0;
  color: var(--text);
  background: transparent;
  outline: none;
}

.album-filters {
  flex: 4 1 360px;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.album-filters::-webkit-scrollbar {
  display: none;
}

.album-chip {
  flex: 0 0 auto;
  padding: 0 15px;
  color: var(--muted);
  background: rgba(17, 24, 39, 0.06);
  font-weight: 780;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  grid-auto-flow: dense;
  gap: 8px;
  min-height: 280px;
}

.month-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 2px 6px;
}

.month-divider strong {
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1;
}

.month-divider span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.gallery.compact {
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
}

.photo-tile {
  position: relative;
  display: block;
  min-height: 170px;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: var(--surface-soft);
  isolation: isolate;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.03);
}

.moments .photo-tile:nth-child(9n + 1),
.moments .photo-tile:nth-child(9n + 6) {
  grid-column: span 2;
  grid-row: span 2;
}

.gallery.compact .photo-tile {
  min-height: 118px;
  grid-column: span 1;
  grid-row: span 1;
}

.photo-tile img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.14), rgba(52, 199, 89, 0.12));
  opacity: 0;
  transition: transform 260ms ease, filter 260ms ease, opacity 220ms ease;
}

.photo-tile.loaded img {
  opacity: 1;
}

.photo-tile:hover img {
  transform: scale(1.04);
  filter: saturate(1.06);
}

.photo-meta {
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  color: white;
  background: rgba(17, 24, 39, 0.58);
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.photo-tile:hover .photo-meta,
.photo-tile:focus-visible .photo-meta {
  opacity: 1;
  transform: translateY(0);
}

.photo-meta strong,
.photo-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-meta strong {
  min-width: 0;
  font-size: 0.84rem;
}

.photo-meta span {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.72rem;
}

.empty-state {
  display: grid;
  place-items: center;
  max-width: 620px;
  margin: 70px auto;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: center;
  background: var(--surface-raised);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
}

.empty-state[hidden] {
  display: none;
}

.empty-art {
  width: min(220px, 70vw);
  color: var(--blue);
}

.empty-state p {
  color: var(--muted);
  line-height: 1.6;
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  color: white;
  background: var(--blue);
  border-color: transparent;
  font-weight: 820;
  box-shadow: 0 12px 28px rgba(0, 122, 255, 0.22);
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-color: var(--line);
  color: var(--text);
  background: rgba(17, 24, 39, 0.04);
  font-weight: 820;
}

.primary-button.small {
  min-height: 42px;
  padding-inline: 16px;
}

.vpn-dashboard {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
}

.vpn-status,
.vpn-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 14px 44px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(20px);
}

.vpn-status {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 210px;
  padding: 24px;
  color: white;
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.94), rgba(30, 58, 95, 0.9)),
    #111827;
}

.vpn-status .overline {
  color: #7dd3fc;
}

.vpn-status p:last-child {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.6;
}

.status-ring {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: conic-gradient(var(--green), rgba(255, 255, 255, 0.16) 36%);
}

.status-ring span {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #111827;
  box-shadow: inset 0 0 0 12px rgba(52, 199, 89, 0.18);
}

.vpn-panel {
  padding: 22px;
}

.vpn-panel.wide {
  grid-column: span 2;
}

.vpn-panel p {
  color: var(--muted);
  line-height: 1.6;
}

.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.country-card {
  min-height: 82px;
  padding: 14px;
  text-align: left;
  border-radius: 8px;
  border-color: var(--line);
  background: rgba(17, 24, 39, 0.04);
}

.country-card strong,
.country-card span {
  display: block;
}

.country-card strong {
  margin-bottom: 7px;
}

.country-card span {
  color: var(--muted);
  font-size: 0.86rem;
}

.country-card.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--blue), #5856d6);
  box-shadow: 0 14px 34px rgba(0, 122, 255, 0.2);
}

.country-card.active span {
  color: rgba(255, 255, 255, 0.78);
}

.details-list {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
}

.details-list div {
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.details-list div:last-child {
  border-bottom: 0;
}

.details-list dt {
  color: var(--muted);
}

.details-list dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.device-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.device-item {
  padding: 14px;
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.05);
}

.device-item strong,
.device-item span {
  display: block;
}

.device-item span {
  margin-top: 6px;
  color: var(--muted);
}

.setup-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding-left: 24px;
  color: var(--muted);
  line-height: 1.6;
}

code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.08);
  color: var(--text);
}

.login-dialog,
.upload-dialog,
.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
}

.login-dialog::backdrop,
.upload-dialog::backdrop,
.lightbox::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(12px);
}

.login-dialog form,
.upload-dialog form {
  width: min(430px, calc(100vw - 32px));
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(26px);
}

.upload-dialog form {
  width: min(620px, calc(100vw - 32px));
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.login-dialog h2,
.upload-dialog h2 {
  margin: 0 0 8px;
  font-size: 2.1rem;
}

.login-dialog p,
.upload-dialog p {
  color: var(--muted);
  line-height: 1.5;
}

.login-dialog label,
.upload-dialog label {
  display: grid;
  gap: 8px;
  margin: 20px 0 12px;
  color: var(--muted);
  font-weight: 800;
}

.login-dialog input,
.upload-dialog input[type="text"] {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  color: var(--text);
  background: white;
}

.drop-zone {
  position: relative;
  place-items: center;
  min-height: 170px;
  padding: 24px;
  border: 1.5px dashed rgba(0, 122, 255, 0.4);
  border-radius: 16px;
  color: var(--text) !important;
  background:
    linear-gradient(135deg, rgba(0, 122, 255, 0.08), rgba(255, 45, 85, 0.06)),
    rgba(255, 255, 255, 0.74);
  text-align: center;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.drop-zone.dragging {
  border-color: var(--blue);
  background: rgba(0, 122, 255, 0.12);
  transform: translateY(-1px);
}

.drop-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.drop-zone svg {
  width: 34px;
  height: 34px;
  color: var(--blue);
}

.drop-zone strong,
.drop-zone span {
  display: block;
}

.drop-zone span {
  color: var(--muted);
  font-weight: 650;
}

.upload-status {
  min-height: 24px;
  margin-bottom: 14px;
  font-weight: 780;
}

.upload-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.08);
}

.upload-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 220ms ease;
}

.upload-queue {
  display: grid;
  gap: 8px;
  max-height: 210px;
  margin: 0 0 14px;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.upload-queue li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.035);
}

.upload-queue strong,
.upload-queue small,
.upload-queue li > span:last-child {
  display: block;
}

.upload-queue strong {
  max-width: 330px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.upload-queue small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.upload-queue li > span:last-child {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.upload-queue li[data-state="uploading"] {
  border-color: rgba(0, 122, 255, 0.3);
  background: rgba(0, 122, 255, 0.08);
}

.upload-queue li[data-state="done"] > span:last-child {
  color: #147a3b;
}

.upload-queue li[data-state="error"] {
  border-color: rgba(255, 59, 48, 0.3);
  background: rgba(255, 59, 48, 0.08);
}

.upload-queue li[data-state="error"] > span:last-child {
  color: var(--red);
}

.upload-dialog form.is-uploading .drop-zone,
.upload-dialog form.is-uploading input {
  pointer-events: none;
  opacity: 0.66;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
}

.login-dialog .primary-button,
.upload-dialog .primary-button {
  width: 100%;
}

.form-error {
  margin: 0 0 12px;
  color: var(--red);
  font-weight: 800;
}

.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  color: white;
}

.lightbox figure {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 72px clamp(16px, 8vw, 98px);
}

.lightbox img {
  max-width: 100%;
  max-height: calc(100dvh - 150px);
  border-radius: 18px;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}

.lightbox figcaption {
  justify-content: center;
  gap: 12px;
  width: min(920px, 100%);
  min-height: 42px;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(8, 11, 16, 0.52);
  backdrop-filter: blur(18px);
}

.lightbox figcaption span {
  color: rgba(255, 255, 255, 0.72);
}

.close-button,
.nav-button {
  position: fixed;
  z-index: 2;
  color: white;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(8, 11, 16, 0.56);
  backdrop-filter: blur(16px);
}

.close-button {
  top: 18px;
  right: 18px;
}

.download-button {
  top: 18px;
  right: 78px;
}

.nav-button {
  top: 50%;
  width: 54px;
  height: 54px;
  transform: translateY(-50%);
}

.prev-button {
  left: 18px;
}

.next-button {
  right: 18px;
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .top-tabs {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .top-tab {
    flex: 1;
    justify-content: center;
  }

  .memory-hero,
  .vpn-dashboard {
    grid-template-columns: 1fr;
  }

  .vpn-panel.wide {
    grid-column: span 1;
  }

  .stats-grid {
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  :root {
    --topbar: 126px;
  }

  .topbar {
    padding-inline: 12px;
  }

  .brand small {
    display: none;
  }

  main {
    padding: 14px;
  }

  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .page-actions {
    justify-content: stretch;
  }

  .view-switch {
    width: 100%;
  }

  .pill {
    flex: 1;
  }

  h1 {
    font-size: clamp(3.1rem, 18vw, 5rem);
  }

  .memory-copy p {
    font-size: clamp(1.5rem, 9vw, 2.8rem);
  }

  .library-tools {
    position: static;
  }

  .gallery,
  .gallery.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
  }

  .photo-tile,
  .gallery.compact .photo-tile {
    min-height: 116px;
    border-radius: 2px;
  }

  .moments .photo-tile:nth-child(9n + 1),
  .moments .photo-tile:nth-child(9n + 6) {
    grid-column: span 2;
    grid-row: span 2;
  }

  .photo-meta {
    display: none;
  }

  .month-divider {
    padding-top: 12px;
  }

  .month-divider span {
    display: none;
  }

  .lightbox figure {
    padding-inline: 12px;
  }

  .nav-button {
    top: auto;
    bottom: 18px;
    transform: none;
  }

  .lightbox figcaption {
    margin-bottom: 62px;
  }
}

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

/* 2026 vision redesign */
:root {
  --bg: #f4f6f9;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-solid: #ffffff;
  --surface-soft: #e9edf4;
  --surface-raised: rgba(255, 255, 255, 0.92);
  --text: #07111f;
  --muted: #5e6b7c;
  --faint: #8b96a6;
  --line: rgba(7, 17, 31, 0.1);
  --line-strong: rgba(7, 17, 31, 0.18);
  --blue: #007aff;
  --cyan: #00a7c8;
  --green: #30d158;
  --orange: #ff9f0a;
  --pink: #ff375f;
  --red: #ff453a;
  --ink: #07111f;
  --ink-soft: #101827;
  --shadow: 0 28px 90px rgba(7, 17, 31, 0.18);
  --shadow-soft: 0 14px 42px rgba(7, 17, 31, 0.1);
  --radius: 8px;
  --radius-sm: 8px;
}

body {
  background:
    linear-gradient(180deg, #fbfcff 0%, #eef2f8 42%, #f7f4f1 100%),
    var(--bg);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(7, 17, 31, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7, 17, 31, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 72%);
}

.topbar {
  border-bottom-color: rgba(7, 17, 31, 0.08);
  background: rgba(250, 251, 253, 0.78);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72) inset;
}

.brand-mark,
.login-icon {
  border-radius: 8px;
  color: white;
  background: linear-gradient(145deg, #007aff, #34c759 120%);
  box-shadow: 0 12px 28px rgba(0, 122, 255, 0.22);
}

.top-tabs,
.view-switch,
.library-tools {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 44px rgba(7, 17, 31, 0.08);
}

.top-tab.active {
  color: var(--ink);
  background: white;
  box-shadow: 0 10px 28px rgba(7, 17, 31, 0.11);
}

main {
  width: min(1640px, 100%);
}

.page-head {
  margin: 26px 0 18px;
}

h1 {
  font-weight: 850;
  letter-spacing: 0;
}

.overline {
  color: #006adc;
}

.primary-button {
  border-radius: 999px;
  background: linear-gradient(135deg, #007aff, #5856d6);
  box-shadow: 0 16px 34px rgba(0, 122, 255, 0.24);
}

.ghost-button {
  border-radius: 999px;
  background: rgba(7, 17, 31, 0.055);
}

.memory-hero {
  grid-template-columns: minmax(280px, 0.86fr) minmax(360px, 1.18fr) minmax(190px, 0.48fr);
  align-items: stretch;
  gap: clamp(14px, 2vw, 22px);
  min-height: 480px;
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(7, 17, 31, 0.98), rgba(17, 24, 39, 0.96) 44%, rgba(39, 27, 39, 0.94)),
    #07111f;
  box-shadow: 0 34px 110px rgba(7, 17, 31, 0.28);
}

.memory-hero::after {
  pointer-events: none;
  opacity: 0.28;
  mask-image: linear-gradient(115deg, rgba(0, 0, 0, 0.75), transparent 66%);
}

.memory-copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  max-width: none;
  min-width: 0;
}

.memory-copy > p:first-of-type:not(.hero-kicker) {
  display: none;
}

.memory-copy .live-dot {
  margin-bottom: auto;
}

.hero-kicker {
  margin: 0 0 12px !important;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem !important;
  font-weight: 860;
  line-height: 1.2 !important;
  text-transform: uppercase;
}

.memory-copy h2 {
  max-width: 660px;
  margin: 0;
  color: white;
  font-size: clamp(2.25rem, 5.2vw, 5.9rem);
  font-weight: 860;
  line-height: 0.9;
  letter-spacing: 0;
  text-wrap: balance;
}

.memory-copy #heroMeta {
  max-width: 560px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(1rem, 1.3vw, 1.12rem);
  font-weight: 650;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.hero-actions .primary-button,
.hero-actions .ghost-button {
  min-height: 48px;
}

.ghost-on-dark {
  color: white;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
}

.hero-preview {
  position: relative;
  z-index: 1;
  min-height: 100%;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    0 24px 70px rgba(0, 0, 0, 0.26);
}

.hero-preview::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, transparent 42%, rgba(7, 17, 31, 0.76)),
    linear-gradient(90deg, rgba(7, 17, 31, 0.18), transparent 44%);
}

.hero-preview img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 260ms ease, transform 420ms ease;
}

.has-photos .hero-preview img {
  opacity: 1;
  transform: scale(1);
}

.hero-fallback {
  position: absolute;
  inset: 18px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  grid-auto-rows: 1fr;
  gap: 8px;
}

.hero-fallback span {
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(0, 122, 255, 0.55), rgba(52, 199, 89, 0.24)),
    rgba(255, 255, 255, 0.12);
}

.hero-fallback span:nth-child(1) {
  grid-row: span 2;
}

.hero-fallback span:nth-child(2) {
  background:
    linear-gradient(135deg, rgba(255, 55, 95, 0.46), rgba(255, 159, 10, 0.28)),
    rgba(255, 255, 255, 0.12);
}

.hero-fallback span:nth-child(4) {
  background:
    linear-gradient(135deg, rgba(88, 86, 214, 0.46), rgba(0, 199, 190, 0.26)),
    rgba(255, 255, 255, 0.12);
}

.has-photos .hero-fallback {
  display: none;
}

.hero-glass {
  position: absolute;
  right: 16px;
  bottom: 90px;
  left: 16px;
  z-index: 2;
  display: grid;
  gap: 5px;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: white;
  background: rgba(7, 17, 31, 0.48);
  backdrop-filter: blur(18px) saturate(1.35);
}

.hero-glass span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.78rem;
  font-weight: 820;
  text-transform: uppercase;
}

.hero-glass strong {
  overflow: hidden;
  font-size: clamp(1.35rem, 2.4vw, 2.35rem);
  line-height: 1.02;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-rail {
  position: absolute;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.hero-thumb {
  min-height: 0;
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0;
  background: rgba(255, 255, 255, 0.12);
}

.hero-thumb.active {
  border-color: white;
}

.hero-thumb img {
  position: static;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 1;
  object-fit: cover;
}

.stats-grid {
  z-index: 1;
  flex-direction: column;
  min-width: 0;
}

.stats-grid div {
  display: grid;
  align-content: end;
  min-height: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.stats-grid strong {
  font-size: clamp(1.55rem, 3.1vw, 3rem);
}

.library-tools {
  top: calc(var(--topbar) + 12px);
  border-radius: 12px;
  padding: 9px;
}

.search {
  min-height: 48px;
  border-radius: 8px;
  background: rgba(7, 17, 31, 0.04);
}

.album-chip {
  border-radius: 999px;
  background: rgba(7, 17, 31, 0.055);
}

.album-chip.active,
.pill.active {
  background: var(--ink);
}

.gallery {
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  grid-auto-rows: 78px;
  grid-auto-flow: dense;
  gap: 8px;
  align-items: stretch;
}

.gallery.compact {
  grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
  grid-auto-rows: 122px;
}

.month-divider {
  grid-column: 1 / -1;
  min-height: 70px;
  padding: 26px 4px 8px;
}

.month-divider strong {
  color: var(--ink);
  font-size: clamp(1.55rem, 3vw, 2.55rem);
  font-weight: 850;
}

.photo-tile {
  min-height: 0;
  border-radius: 8px;
  background: #dfe5ee;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.photo-tile.tile-hero {
  grid-column: span 2;
  grid-row: span 4;
}

.photo-tile.tile-wide,
.photo-tile.tile-cinematic {
  grid-column: span 2;
  grid-row: span 2;
}

.photo-tile.tile-square {
  grid-row: span 2;
}

.photo-tile.tile-tall,
.photo-tile.tile-portrait {
  grid-row: span 3;
}

.gallery.compact .photo-tile,
.photo-tile.tile-compact {
  grid-column: span 1;
  grid-row: span 1;
}

.photo-tile::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, transparent 55%, rgba(7, 17, 31, 0.34));
  opacity: 0;
  transition: opacity 180ms ease;
}

.photo-tile:hover::after,
.photo-tile:focus-visible::after {
  opacity: 1;
}

.photo-tile img {
  min-height: 0;
}

.photo-meta {
  z-index: 1;
  border-radius: 8px;
  background: rgba(7, 17, 31, 0.56);
}

.empty-state {
  border-radius: 8px;
}

.vpn-dashboard {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: stretch;
}

.vpn-status {
  grid-column: span 5;
  min-height: 320px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(7, 17, 31, 0.96), rgba(13, 37, 55, 0.94) 58%, rgba(20, 46, 37, 0.94)),
    #07111f;
}

.vpn-panel {
  grid-column: span 7;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
}

.vpn-panel:nth-of-type(3) {
  grid-column: span 5;
}

.vpn-panel.wide {
  grid-column: span 6;
}

.country-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.country-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 96px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(7, 17, 31, 0.035), rgba(7, 17, 31, 0.07));
}

.country-code {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: white;
  background: #07111f;
  font-size: 0.8rem;
  font-weight: 900;
}

.country-card > span:last-child {
  min-width: 0;
}

.country-card strong,
.country-card small {
  display: block;
}

.country-card small {
  color: var(--muted);
  line-height: 1.35;
}

.country-card.active .country-code {
  color: #07111f;
  background: white;
}

.country-card.active small {
  color: rgba(255, 255, 255, 0.78);
}

.device-list {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.device-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 17, 31, 0.035);
}

.device-item i {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 6px rgba(255, 159, 10, 0.14);
}

.device-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.login-dialog form {
  display: grid;
  grid-template-columns: minmax(260px, 0.92fr) minmax(320px, 1fr);
  gap: 0;
  width: min(820px, calc(100vw - 32px));
  overflow: hidden;
  padding: 0;
  border-radius: 18px;
}

.login-visual {
  display: grid;
  align-content: end;
  min-height: 520px;
  padding: 28px;
  color: white;
  background:
    linear-gradient(145deg, rgba(7, 17, 31, 0.98), rgba(23, 34, 52, 0.98) 58%, rgba(30, 39, 27, 0.92)),
    #07111f;
}

.login-phone {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  align-self: center;
  width: min(230px, 100%);
  margin: 0 auto 36px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 28px 70px rgba(0, 0, 0, 0.24);
}

.login-phone span {
  min-height: 72px;
  border-radius: 8px;
  background: linear-gradient(135deg, #007aff, #30d158);
}

.login-phone span:nth-child(1),
.login-phone span:nth-child(4) {
  grid-row: span 2;
  min-height: 150px;
}

.login-phone span:nth-child(2) {
  background: linear-gradient(135deg, #ff375f, #ff9f0a);
}

.login-phone span:nth-child(3) {
  background: linear-gradient(135deg, #5856d6, #00a7c8);
}

.login-phone span:nth-child(5) {
  background: linear-gradient(135deg, #30d158, #f4f6f9);
}

.login-phone span:nth-child(6) {
  background: linear-gradient(135deg, #07111f, #8b96a6);
}

.login-visual strong {
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 0.95;
}

.login-visual small {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.68);
  font-weight: 800;
}

.login-panel {
  padding: clamp(26px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.92);
}

.login-dialog h2,
.upload-dialog h2 {
  letter-spacing: 0;
}

.upload-dialog form {
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 248, 252, 0.96)),
    white;
}

.drop-zone {
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(0, 122, 255, 0.09), rgba(48, 209, 88, 0.08)),
    rgba(255, 255, 255, 0.86);
}

.upload-queue li,
.login-dialog input,
.upload-dialog input[type="text"] {
  border-radius: 8px;
}

.lightbox::backdrop {
  background: rgba(3, 7, 14, 0.86);
}

.download-button {
  position: fixed;
  z-index: 2;
  color: white;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(8, 11, 16, 0.56);
  backdrop-filter: blur(16px);
}

@media (max-width: 1180px) {
  .memory-hero {
    grid-template-columns: 1fr;
  }

  .hero-preview {
    min-height: min(72vw, 560px);
  }

  .stats-grid {
    flex-direction: row;
  }

  .vpn-status,
  .vpn-panel,
  .vpn-panel:nth-of-type(3),
  .vpn-panel.wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .memory-hero {
    min-height: 0;
    padding: 14px;
    border-radius: 12px;
  }

  .memory-copy {
    min-height: 420px;
    padding: 6px;
  }

  .memory-copy h2 {
    font-size: clamp(2.45rem, 14vw, 4.8rem);
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .primary-button,
  .hero-actions .ghost-button {
    width: 100%;
  }

  .hero-preview {
    min-height: 460px;
  }

  .hero-rail {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .hero-thumb:nth-child(n + 5) {
    display: none;
  }

  .stats-grid {
    flex-direction: column;
  }

  .gallery,
  .gallery.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 31vw;
    gap: 4px;
  }

  .photo-tile.tile-hero,
  .photo-tile.tile-wide,
  .photo-tile.tile-cinematic {
    grid-column: span 2;
    grid-row: span 2;
  }

  .photo-tile.tile-tall,
  .photo-tile.tile-portrait,
  .photo-tile.tile-square {
    grid-row: span 1;
  }

  .login-dialog form {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .login-panel {
    padding: 28px;
  }

  .vpn-dashboard {
    grid-template-columns: 1fr;
  }
}

.login-dialog,
.upload-dialog {
  width: min(820px, calc(100vw - 32px));
  max-width: none;
  overflow: visible;
}

.upload-dialog {
  width: min(620px, calc(100vw - 32px));
}

.login-dialog form,
.upload-dialog form {
  width: 100%;
  max-width: 100%;
}

.login-panel,
.upload-dialog form > * {
  min-width: 0;
}

@media (max-width: 720px) {
  .login-dialog,
  .upload-dialog {
    width: min(430px, calc(100vw - 28px));
  }
}

/* 2026 VPN + premium polish */
body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(237, 242, 248, 0.96) 38%, rgba(245, 247, 249, 1)),
    var(--bg);
}

.topbar {
  min-height: 72px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(246, 249, 253, 0.72)),
    rgba(250, 251, 253, 0.78);
}

.brand-mark {
  position: relative;
  overflow: hidden;
}

.brand-mark::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.38), transparent 46%);
}

.top-tab,
.pill,
.album-chip,
.primary-button,
.ghost-button,
.icon-button,
.country-card,
.photo-tile,
.hero-thumb {
  touch-action: manipulation;
}

.memory-hero {
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(4, 9, 18, 0.98), rgba(9, 19, 34, 0.98) 48%, rgba(19, 30, 38, 0.96)),
    #050a12;
}

.memory-hero::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(120deg, transparent 0 28%, rgba(255, 255, 255, 0.08) 38%, transparent 52%),
    radial-gradient(ellipse at 50% 100%, rgba(0, 122, 255, 0.16), transparent 48%);
  pointer-events: none;
}

.memory-copy h2 {
  font-size: clamp(2.6rem, 5vw, 6.4rem);
}

.has-photos .memory-copy h2 {
  max-width: 520px;
}

.hero-preview {
  border-radius: 10px;
  transform: translateZ(0);
}

.hero-preview::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 18%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 28%);
  pointer-events: none;
}

.hero-glass {
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
}

.hero-rail {
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(5, 10, 18, 0.36);
  backdrop-filter: blur(14px) saturate(1.25);
}

.stats-grid div {
  min-height: 136px;
  transition: transform 180ms ease, background 180ms ease;
}

.stats-grid div:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.16);
}

.library-tools {
  border-radius: 10px;
}

.gallery {
  perspective: 1200px;
}

.photo-tile {
  border-radius: 6px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.82) inset,
    0 10px 28px rgba(7, 17, 31, 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.photo-tile:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.88) inset,
    0 22px 48px rgba(7, 17, 31, 0.18);
}

.photo-tile.loaded img {
  animation: photoReveal 320ms ease both;
}

@keyframes photoReveal {
  from {
    opacity: 0;
    transform: scale(1.04);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.vpn-dashboard {
  gap: 16px;
}

.vpn-status,
.vpn-panel {
  border-color: rgba(7, 17, 31, 0.08);
  box-shadow: 0 18px 54px rgba(7, 17, 31, 0.1);
}

.vpn-status {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  align-items: flex-end;
  min-height: 390px;
  padding: clamp(22px, 3vw, 34px);
  background:
    linear-gradient(145deg, rgba(4, 9, 18, 0.98), rgba(9, 22, 38, 0.98) 58%, rgba(15, 42, 34, 0.96)),
    #050a12;
}

.vpn-status-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.075) 1px, transparent 1px),
    linear-gradient(125deg, transparent 10%, rgba(34, 197, 94, 0.18) 48%, transparent 78%);
  background-size: 46px 46px, 46px 46px, 100% 100%;
  opacity: 0.72;
}

.vpn-status h2 {
  margin-bottom: 12px;
  font-size: clamp(2.25rem, 4vw, 4.2rem);
  line-height: 0.95;
}

.vpn-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
}

.vpn-metric {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(14px);
}

.vpn-metric span,
.vpn-metric strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vpn-metric span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.vpn-metric strong {
  margin-top: 6px;
  color: white;
  font-size: 0.95rem;
}

.status-ring {
  background: conic-gradient(var(--orange) 0 58%, rgba(255, 255, 255, 0.14) 58%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 24px 54px rgba(0, 0, 0, 0.22);
}

.status-ring[data-state="ready"] {
  background: conic-gradient(var(--green) 0 100%, rgba(255, 255, 255, 0.14) 0);
}

.status-ring[data-state="not_installed"],
.status-ring[data-state="setup"] {
  background: conic-gradient(var(--red) 0 34%, rgba(255, 255, 255, 0.14) 34%);
}

.vpn-panel {
  padding: clamp(18px, 2vw, 26px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(249, 251, 253, 0.84)),
    white;
}

.vpn-map-panel {
  min-height: 390px;
}

.country-grid {
  gap: 12px;
}

.country-card {
  position: relative;
  overflow: hidden;
  align-items: flex-start;
  min-height: 118px;
  padding: 14px;
  border-color: rgba(7, 17, 31, 0.1);
}

.country-card em {
  position: absolute;
  right: 12px;
  top: 12px;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(7, 17, 31, 0.07);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.country-card.locked {
  cursor: not-allowed;
  opacity: 0.64;
}

.country-card.locked .country-code {
  background: #7c8796;
}

.country-card.active:not(.locked) {
  background:
    linear-gradient(135deg, #007aff, #1e3a5f 58%, #22c55e);
}

.country-card.active:not(.locked) em {
  color: #07111f;
  background: white;
}

.details-list div {
  align-items: center;
}

.details-list dd {
  max-width: 62%;
  overflow-wrap: anywhere;
}

.device-item {
  align-items: flex-start;
  padding: 16px;
}

.device-item.ok i {
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(48, 209, 88, 0.14);
}

.device-item.error i {
  background: var(--red);
  box-shadow: 0 0 0 6px rgba(255, 69, 58, 0.14);
}

.vpn-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.vpn-step {
  position: relative;
  display: flex;
  gap: 12px;
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 17, 31, 0.035);
}

.vpn-step > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(7, 17, 31, 0.12);
}

.vpn-step > span::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
}

.vpn-step.done > span::before,
.vpn-step.next > span::before {
  background: var(--green);
}

.vpn-step.locked {
  opacity: 0.62;
}

.vpn-step strong,
.vpn-step small,
.vpn-step a {
  display: block;
}

.vpn-step small {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.vpn-step a {
  width: fit-content;
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 999px;
  color: white;
  background: var(--ink);
  font-size: 0.78rem;
  font-weight: 850;
  text-decoration: none;
}

.login-dialog form {
  border-radius: 10px;
}

.login-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.95)),
    white;
}

@media (max-width: 980px) {
  .vpn-metrics,
  .vpn-steps {
    grid-template-columns: 1fr;
  }

  .vpn-status {
    min-height: 330px;
  }
}

@media (max-width: 620px) {
  :root {
    --topbar: 120px;
  }

  .memory-copy {
    min-height: 330px;
  }

  .hero-preview {
    min-height: 390px;
  }

  .vpn-status {
    min-height: 420px;
  }

  .vpn-status {
    align-items: stretch;
    flex-direction: column;
  }

  .vpn-metrics {
    grid-template-columns: 1fr;
  }

  .country-card {
    min-height: 106px;
  }
}

/* 2026 NAS control center */
:root {
  --nas-deep: #050914;
  --nas-ink: #07111f;
  --nas-panel: rgba(255, 255, 255, 0.86);
  --nas-panel-strong: #ffffff;
  --nas-blue: #0a84ff;
  --nas-violet: #5856d6;
  --nas-mint: #30d158;
  --nas-cyan: #00c7be;
}

body {
  background:
    linear-gradient(180deg, #f7f9fc 0%, #eef3f8 46%, #f8f6f2 100%),
    var(--bg);
}

body::before {
  background-image:
    linear-gradient(rgba(7, 17, 31, 0.038) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7, 17, 31, 0.038) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.38), transparent 68%);
}

.topbar {
  min-height: 74px;
  border-bottom-color: rgba(7, 17, 31, 0.07);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 250, 253, 0.78)),
    rgba(255, 255, 255, 0.72);
}

.brand strong {
  font-weight: 900;
}

.brand-mark {
  border-radius: 8px;
  color: white;
  background:
    linear-gradient(145deg, rgba(10, 132, 255, 0.98), rgba(0, 199, 190, 0.92) 58%, rgba(48, 209, 88, 0.92)),
    var(--nas-blue);
}

.top-tabs {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.top-tab.active {
  color: var(--nas-ink);
  box-shadow: 0 10px 28px rgba(7, 17, 31, 0.12);
}

.primary-button {
  background:
    linear-gradient(135deg, var(--nas-blue), var(--nas-violet) 70%),
    var(--nas-blue);
}

.memory-hero {
  grid-template-columns: minmax(280px, 0.82fr) minmax(340px, 1.12fr) minmax(170px, 0.44fr);
  min-height: 510px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(5, 9, 20, 0.99), rgba(8, 20, 35, 0.99) 48%, rgba(15, 38, 41, 0.97)),
    var(--nas-deep);
}

.memory-hero::before {
  background:
    linear-gradient(120deg, transparent 0 24%, rgba(255, 255, 255, 0.08) 38%, transparent 54%),
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 100% 100%, 44px 44px, 44px 44px;
  opacity: 0.9;
}

.memory-hero::after {
  opacity: 0.18;
}

.live-dot {
  box-shadow:
    0 0 0 7px rgba(48, 209, 88, 0.12),
    0 0 0 14px rgba(48, 209, 88, 0.05);
}

.memory-copy h2 {
  max-width: 600px;
  font-weight: 900;
}

.memory-copy #heroMeta {
  color: rgba(255, 255, 255, 0.76);
}

.hero-preview {
  border-radius: 8px;
  outline: 1px solid rgba(255, 255, 255, 0.16);
  outline-offset: -1px;
}

.hero-fallback {
  grid-template-columns: 1.1fr 0.9fr;
}

.hero-fallback span {
  background:
    linear-gradient(135deg, rgba(10, 132, 255, 0.68), rgba(0, 199, 190, 0.3)),
    rgba(255, 255, 255, 0.12);
}

.hero-glass,
.hero-rail {
  border-radius: 8px;
}

.stats-grid div {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.105);
}

.stats-grid strong {
  font-size: clamp(1.45rem, 2vw, 2.15rem);
}

.nas-console {
  display: grid;
  grid-template-columns: minmax(300px, 1.18fr) repeat(3, minmax(178px, 0.62fr));
  gap: 12px;
  margin: 16px 0 18px;
}

.nas-card {
  min-width: 0;
  min-height: 154px;
  padding: clamp(16px, 2vw, 22px);
  border: 1px solid rgba(7, 17, 31, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 251, 253, 0.88)),
    var(--nas-panel-strong);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.82) inset,
    0 16px 46px rgba(7, 17, 31, 0.08);
}

.nas-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nas-card-head h2 {
  margin: 2px 0 0;
  font-size: clamp(1.1rem, 1.6vw, 1.45rem);
}

.nas-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: white;
  background:
    linear-gradient(145deg, var(--nas-ink), #1e3a5f 62%, #0f766e),
    var(--nas-ink);
}

.nas-icon svg {
  width: 24px;
  height: 24px;
}

.nas-status-dot {
  width: 12px;
  height: 12px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 6px rgba(255, 159, 10, 0.13);
}

.nas-status-dot[data-state="online"] {
  background: var(--nas-mint);
  box-shadow: 0 0 0 6px rgba(48, 209, 88, 0.15);
}

.nas-storage-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.nas-storage-main {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.nas-storage-main strong {
  font-size: clamp(2.1rem, 4vw, 4rem);
  line-height: 0.94;
}

.nas-storage-main span {
  color: var(--muted);
  font-weight: 850;
}

.storage-meter {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(7, 17, 31, 0.08);
}

.storage-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, var(--nas-mint), var(--nas-cyan), var(--nas-blue)),
    var(--nas-mint);
  transition: width 260ms ease, background 180ms ease;
}

.storage-meter span[data-level="warm"] {
  background: linear-gradient(90deg, var(--orange), var(--nas-blue));
}

.storage-meter span[data-level="critical"] {
  background: linear-gradient(90deg, var(--red), var(--orange));
}

.storage-split {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-weight: 780;
}

.storage-split strong {
  color: var(--text);
}

.nas-mini-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.nas-mini-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.nas-mini-card strong {
  font-size: clamp(1.25rem, 1.8vw, 1.9rem);
  line-height: 1;
}

.nas-mini-card small {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-weight: 680;
  line-height: 1.45;
}

.nas-value[data-state="online"],
.nas-value[data-state="ready"],
.nas-value[data-state="private_ready"] {
  color: #087337;
}

.nas-value[data-state="setup"],
.nas-value[data-state="not_installed"],
.nas-value[data-state="login_required"],
.nas-value[data-state="forwarding_required"] {
  color: #a15c00;
}

.library-tools {
  border-radius: 8px;
  border: 1px solid rgba(7, 17, 31, 0.08);
}

.photo-tile {
  border-radius: 8px;
}

.vpn-dashboard {
  gap: 14px;
}

.vpn-status,
.vpn-panel {
  border-radius: 8px;
  border-color: rgba(7, 17, 31, 0.08);
}

.vpn-status {
  background:
    linear-gradient(145deg, rgba(5, 9, 20, 0.99), rgba(9, 22, 38, 0.98) 56%, rgba(8, 53, 43, 0.96)),
    var(--nas-deep);
}

.vpn-status-bg {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(125deg, transparent 10%, rgba(48, 209, 88, 0.16) 50%, transparent 80%);
}

.status-ring[data-state="ready"],
.status-ring[data-state="private_ready"] {
  background: conic-gradient(var(--nas-mint) 0 100%, rgba(255, 255, 255, 0.14) 0);
}

.status-ring[data-state="login_required"],
.status-ring[data-state="forwarding_required"] {
  background: conic-gradient(var(--orange) 0 62%, rgba(255, 255, 255, 0.14) 62%);
}

.vpn-panel h2 {
  margin-top: 0;
}

.country-card.active:not(.locked) {
  background:
    linear-gradient(135deg, var(--nas-blue), #1e3a5f 58%, var(--nas-mint)),
    var(--nas-blue);
}

.country-code {
  border-radius: 8px;
}

.device-item,
.vpn-step,
.vpn-metric {
  border-radius: 8px;
}

.vpn-step a {
  border-radius: 8px;
}

@media (min-width: 1180px) {
  .vpn-dashboard {
    grid-template-columns: minmax(420px, 1.05fr) minmax(320px, 0.84fr) minmax(300px, 0.72fr);
  }

  .vpn-status {
    grid-column: span 2;
  }

  .vpn-map-panel {
    grid-column: 3;
    grid-row: span 2;
  }

  .vpn-dashboard > .vpn-panel:not(.wide):not(.vpn-map-panel) {
    grid-column: span 2;
  }

  .vpn-panel.wide {
    grid-column: span 3;
  }
}

@media (max-width: 1180px) {
  .nas-console {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nas-storage-card {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .memory-hero {
    min-height: auto;
  }

  .nas-console {
    grid-template-columns: 1fr;
  }

  .nas-storage-card {
    grid-column: auto;
  }

  .nas-storage-main {
    align-items: flex-start;
    flex-direction: column;
  }

  .storage-split {
    flex-direction: column;
  }

  .vpn-status h2 {
    font-size: clamp(2rem, 11vw, 3.1rem);
  }
}

@media (max-width: 620px) {
  .topbar {
    grid-template-columns: 1fr auto;
    row-gap: 10px;
  }

  .brand {
    min-width: 0;
  }

  .top-tabs {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .top-tab {
    flex: 1;
    justify-content: center;
  }

  .top-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .nas-card {
    min-height: 136px;
  }
}

/* 2026 mobile app pass */
@media (hover: none) {
  .top-tab:active,
  .pill:active,
  .album-chip:active,
  .primary-button:active,
  .ghost-button:active,
  .icon-button:active,
  .photo-tile:active,
  .country-card:active {
    transform: scale(0.98);
  }
}

@media (max-width: 760px) {
  :root {
    --topbar: 64px;
    --mobile-tabbar: 78px;
  }

  html {
    scroll-padding-top: calc(var(--topbar) + 12px);
  }

  body {
    overflow-x: hidden;
    background:
      linear-gradient(180deg, #f8fafc 0%, #eef3f8 42%, #f7f8fb 100%),
      var(--bg);
  }

  body::before {
    background-size: 34px 34px;
    opacity: 0.75;
  }

  main {
    width: 100%;
    padding: 12px 10px calc(var(--mobile-tabbar) + 26px + env(safe-area-inset-bottom));
  }

  .topbar {
    grid-template-columns: 1fr auto;
    min-height: var(--topbar);
    padding: 8px 12px;
    border-bottom-color: rgba(7, 17, 31, 0.07);
    background: rgba(248, 250, 252, 0.9);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 10px 30px rgba(7, 17, 31, 0.08);
  }

  .brand {
    min-width: 0;
    gap: 10px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .brand strong {
    font-size: 0.98rem;
  }

  .brand small {
    display: none;
  }

  .top-actions {
    grid-column: 2;
    grid-row: 1;
    gap: 7px;
  }

  .top-actions .icon-button {
    width: 44px;
    min-height: 44px;
    background: rgba(255, 255, 255, 0.9);
  }

  .topbar .top-tabs {
    display: none;
  }

  .mobile-tabs {
    position: fixed;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 12px;
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    min-height: 64px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 22px;
    background: rgba(5, 9, 20, 0.92);
    box-shadow: 0 18px 50px rgba(7, 17, 31, 0.34);
    backdrop-filter: blur(22px) saturate(1.25);
  }

  .mobile-tabs .top-tab {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-height: 52px;
    padding: 5px 8px;
    border-radius: 16px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.72rem;
    font-weight: 900;
  }

  .mobile-tabs .top-tab svg {
    width: 22px;
    height: 22px;
  }

  .mobile-tabs .top-tab.active {
    color: var(--nas-ink);
    background: white;
    box-shadow: none;
  }

  .auth-locked .mobile-tabs,
  .auth-locked .top-actions {
    display: none;
  }

  .page-head {
    display: grid;
    gap: 10px;
    margin: 16px 0 10px;
  }

  .page-head .overline {
    font-size: 0.72rem;
  }

  .page-head h1 {
    font-size: clamp(2.15rem, 10.5vw, 3.25rem);
    line-height: 0.96;
  }

  .page-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  .view-switch {
    min-height: 50px;
    padding: 5px;
    border-radius: 8px;
    box-shadow: none;
  }

  .pill {
    min-height: 40px;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 900;
  }

  #openUpload {
    position: fixed;
    right: 18px;
    bottom: calc(var(--mobile-tabbar) + 22px + env(safe-area-inset-bottom));
    z-index: 82;
    width: 58px;
    min-height: 58px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    box-shadow: 0 18px 34px rgba(10, 132, 255, 0.34);
  }

  #openUpload svg {
    width: 25px;
    height: 25px;
  }

  .memory-hero {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border-radius: 8px;
    background: var(--nas-deep);
  }

  .memory-hero::before,
  .memory-hero::after {
    opacity: 0.28;
  }

  .hero-preview {
    order: 1;
    min-height: 0;
    aspect-ratio: 16 / 7.2;
    border-radius: 0;
    box-shadow: none;
    outline: 0;
  }

  .hero-preview::after {
    background:
      linear-gradient(180deg, transparent 38%, rgba(7, 17, 31, 0.2) 68%, rgba(7, 17, 31, 0.52)),
      linear-gradient(90deg, rgba(7, 17, 31, 0.08), transparent 52%);
  }

  .hero-fallback {
    inset: 12px;
  }

  .hero-glass {
    right: 10px;
    bottom: 74px;
    left: 10px;
    min-height: 62px;
    padding: 10px 12px;
  }

  .hero-glass strong {
    font-size: 1rem;
  }

  .hero-rail {
    right: auto;
    bottom: 10px;
    left: 10px;
    grid-template-columns: repeat(4, 58px);
    gap: 6px;
    padding: 6px;
    max-width: calc(100% - 20px);
  }

  .hero-thumb {
    border-radius: 7px;
  }

  .hero-thumb:nth-child(n + 5) {
    display: none;
  }

  .memory-copy {
    order: 2;
    min-height: 0;
    padding: 14px 16px 15px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
      #050914;
  }

  .memory-copy .live-dot {
    margin-bottom: 10px;
  }

  .hero-kicker {
    margin-bottom: 8px !important;
    font-size: 0.72rem !important;
  }

  .memory-copy h2 {
    max-width: 100%;
    font-size: clamp(1.9rem, 9vw, 2.85rem);
    line-height: 0.94;
  }

  .memory-copy #heroMeta {
    display: -webkit-box;
    max-width: 100%;
    margin-top: 7px;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.74);
    font-size: 0.88rem;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 10px;
  }

  #heroUpload {
    display: none;
  }

  .hero-actions .ghost-button {
    width: 100%;
    min-height: 46px;
    border-radius: 8px;
  }

  .stats-grid {
    order: 3;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    width: 100%;
    min-width: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.08);
  }

  .stats-grid div {
    min-height: 64px;
    padding: 10px 12px;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.07);
  }

  .stats-grid strong {
    font-size: 1.28rem;
    line-height: 1;
  }

  .stats-grid span {
    margin-top: 6px;
    font-size: 0.68rem;
  }

  .nas-console {
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 10px 0 12px;
  }

  .nas-card {
    min-height: 0;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.86) inset;
  }

  .nas-storage-card {
    gap: 14px;
    color: white;
    background:
      linear-gradient(145deg, rgba(5, 9, 20, 0.98), rgba(11, 31, 48, 0.98) 62%, rgba(9, 70, 56, 0.96)),
      var(--nas-deep);
  }

  .nas-storage-card .overline,
  .nas-storage-card .nas-storage-main span,
  .nas-storage-card .storage-split {
    color: rgba(255, 255, 255, 0.7);
  }

  .nas-storage-card .storage-split strong {
    color: white;
  }

  .nas-storage-main {
    flex-direction: row;
    align-items: end;
  }

  .nas-storage-main strong {
    font-size: clamp(2rem, 12vw, 3.3rem);
  }

  .nas-mini-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 104px;
  }

  .nas-mini-card strong {
    font-size: 1.45rem;
  }

  .library-tools {
    position: sticky;
    top: calc(var(--topbar) + 8px);
    z-index: 22;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 10px 0 12px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 28px rgba(7, 17, 31, 0.08);
    backdrop-filter: blur(18px) saturate(1.2);
  }

  .search {
    min-height: 48px;
    border-radius: 8px;
  }

  .album-filters {
    display: flex;
    flex: none;
    width: 100%;
    gap: 7px;
  }

  .album-chip {
    min-height: 40px;
    padding: 0 13px;
    border-radius: 999px;
    font-size: 0.82rem;
  }

  .gallery,
  .gallery.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(160px, 43vw);
    gap: 6px;
  }

  .gallery.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 31vw;
  }

  .month-divider {
    min-height: 0;
    padding: 18px 2px 8px;
  }

  .month-divider strong {
    font-size: 1.35rem;
  }

  .month-divider span {
    font-size: 0.76rem;
  }

  .photo-tile,
  .gallery.compact .photo-tile {
    min-height: 0;
    border-radius: 8px;
  }

  .photo-tile.tile-hero,
  .photo-tile.tile-wide,
  .photo-tile.tile-cinematic {
    grid-column: span 2;
    grid-row: span 2;
  }

  .gallery.compact .photo-tile,
  .gallery.compact .photo-tile.tile-compact {
    grid-column: span 1;
    grid-row: span 1;
  }

  .photo-tile.tile-tall,
  .photo-tile.tile-portrait,
  .photo-tile.tile-square {
    grid-row: span 1;
  }

  .photo-tile::after {
    opacity: 1;
    background: linear-gradient(180deg, transparent 54%, rgba(7, 17, 31, 0.58));
  }

  .photo-meta {
    right: 6px;
    bottom: 6px;
    left: 6px;
    display: block;
    padding: 7px 8px;
    opacity: 1;
    transform: none;
    border-radius: 8px;
  }

  .photo-meta strong,
  .photo-meta span {
    display: block;
  }

  .photo-meta strong {
    font-size: 0.76rem;
  }

  .photo-meta span {
    margin-top: 2px;
    font-size: 0.66rem;
  }

  .vpn-dashboard {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .vpn-status,
  .vpn-panel,
  .vpn-panel.wide,
  .vpn-panel:nth-of-type(3) {
    grid-column: 1 / -1;
  }

  .vpn-status {
    flex-direction: column;
    align-items: flex-start;
    min-height: 0;
    padding: 18px;
  }

  .status-ring {
    width: 78px;
    height: 78px;
  }

  .status-ring span {
    width: 56px;
    height: 56px;
  }

  .vpn-status h2 {
    font-size: clamp(2rem, 10vw, 3.1rem);
  }

  .vpn-metrics,
  .vpn-steps,
  .device-list,
  .country-grid {
    grid-template-columns: 1fr;
  }

  .vpn-panel {
    padding: 16px;
  }

  .country-card,
  .device-item,
  .vpn-step {
    min-height: 0;
    padding: 14px;
  }

  .details-list dd {
    max-width: 58%;
  }

  .login-dialog,
  .upload-dialog {
    width: 100%;
    max-width: 100%;
  }

  .login-dialog {
    height: 100dvh;
  }

  .login-dialog form {
    width: 100%;
    min-height: 100dvh;
    border-radius: 0;
  }

  .login-panel {
    align-self: end;
    padding: 28px 22px calc(28px + env(safe-area-inset-bottom));
    border-radius: 8px 8px 0 0;
  }

  .upload-dialog {
    inset: auto 0 0 0;
    margin: 0;
    max-height: calc(100dvh - 16px);
  }

  .upload-dialog form {
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    border-radius: 8px 8px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .drop-zone {
    min-height: 160px;
  }

  .lightbox figure {
    width: 100vw;
    height: 100dvh;
  }

  .close-button,
  .download-button {
    top: calc(14px + env(safe-area-inset-top));
  }
}

@media (max-width: 390px) {
  .hero-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-thumb:nth-child(n + 4) {
    display: none;
  }

  .gallery,
  .gallery.compact {
    grid-auto-rows: 44vw;
  }

  .gallery.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-head h1 {
    font-size: 2.05rem;
  }
}

/* Exact photos logo */
.brand-mark {
  color: inherit;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(7, 17, 31, 0.12);
}

.brand-mark::after {
  display: none;
}

.brand-mark img {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

@media (max-width: 760px) {
  .brand-mark img {
    width: 32px;
    height: 32px;
  }
}

/* Smaller gallery + VPN polish */
.gallery {
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  grid-auto-rows: 68px;
  gap: 6px;
}

.gallery.compact {
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  grid-auto-rows: 96px;
  gap: 5px;
}

.photo-tile.tile-hero {
  grid-column: span 2;
  grid-row: span 3;
}

.photo-tile.tile-wide,
.photo-tile.tile-cinematic {
  grid-column: span 2;
  grid-row: span 2;
}

.photo-tile.tile-tall,
.photo-tile.tile-portrait,
.photo-tile.tile-square {
  grid-row: span 2;
}

.vpn-dashboard {
  gap: 18px;
}

.vpn-status {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background:
    linear-gradient(145deg, rgba(4, 8, 18, 0.99), rgba(8, 22, 41, 0.98) 44%, rgba(7, 55, 43, 0.96) 100%),
    #050914;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 24px 70px rgba(5, 9, 20, 0.22);
}

.vpn-status::after {
  position: absolute;
  inset: 0;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(122deg, transparent 0 32%, rgba(10, 132, 255, 0.16) 45%, rgba(48, 209, 88, 0.12) 58%, transparent 72%);
  background-size: 38px 38px, 38px 38px, 100% 100%;
  pointer-events: none;
}

.vpn-status > * {
  position: relative;
  z-index: 1;
}

.status-ring {
  width: 104px;
  height: 104px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.14),
    0 18px 46px rgba(48, 209, 88, 0.18);
}

.status-ring span {
  width: 74px;
  height: 74px;
  background:
    linear-gradient(145deg, rgba(5, 9, 20, 0.98), rgba(17, 31, 48, 0.98)),
    #07111f;
}

.vpn-status h2 {
  text-wrap: balance;
}

.vpn-status #vpnSummary {
  max-width: 720px;
  color: rgba(255, 255, 255, 0.82);
}

.vpn-metric {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.14) inset;
}

.vpn-panel {
  border: 1px solid rgba(7, 17, 31, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 253, 0.92)),
    #ffffff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.86) inset,
    0 18px 48px rgba(7, 17, 31, 0.08);
}

.vpn-panel h2 {
  letter-spacing: 0;
}

.country-card,
.device-item,
.vpn-step {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 248, 252, 0.9)),
    #ffffff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.88) inset;
}

.country-card.active:not(.locked) {
  border-color: transparent;
  background:
    linear-gradient(135deg, #0a84ff, #5e5ce6 48%, #30d158),
    #0a84ff;
  box-shadow: 0 18px 38px rgba(10, 132, 255, 0.22);
}

.device-item.ok,
.vpn-step.done,
.vpn-step.next {
  border-color: rgba(48, 209, 88, 0.24);
  background:
    linear-gradient(180deg, rgba(240, 255, 247, 0.98), rgba(255, 255, 255, 0.92)),
    #ffffff;
}

@media (max-width: 760px) {
  .gallery,
  .gallery.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: clamp(106px, 28vw, 150px);
    gap: 5px;
  }

  .photo-tile.tile-hero,
  .photo-tile.tile-wide,
  .photo-tile.tile-cinematic,
  .photo-tile.tile-tall,
  .photo-tile.tile-portrait,
  .photo-tile.tile-square,
  .photo-tile.tile-compact,
  .gallery.compact .photo-tile {
    grid-column: span 1;
    grid-row: span 1;
  }

  .photo-meta {
    padding: 6px 7px;
  }

  .photo-meta strong {
    font-size: 0.7rem;
  }

  .photo-meta span {
    font-size: 0.61rem;
  }

  .vpn-status {
    gap: 14px;
    padding: 16px;
    border-radius: 10px;
  }

  .status-ring {
    width: 70px;
    height: 70px;
  }

  .status-ring span {
    width: 50px;
    height: 50px;
  }

  .vpn-status h2 {
    margin-bottom: 8px;
    font-size: clamp(1.82rem, 8.8vw, 2.45rem);
  }

  .vpn-status #vpnSummary {
    font-size: 0.92rem;
    line-height: 1.48;
  }

  .vpn-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .vpn-metric:first-child {
    grid-column: 1 / -1;
  }

  .vpn-panel {
    border-radius: 10px;
  }

  .country-card {
    min-height: 92px;
  }
}

@media (max-width: 390px) {
  .gallery,
  .gallery.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 30vw;
  }
}

/* Mobile swipe library refresh */
.vpn-refresh {
  gap: 8px;
}

.vpn-refresh svg {
  width: 18px;
  height: 18px;
}

.gallery.moments {
  display: block;
}

.month-group {
  margin-bottom: 22px;
}

.month-track {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  grid-auto-rows: 68px;
  grid-auto-flow: dense;
  gap: 6px;
}

.month-track .tile-hero {
  grid-column: span 2;
  grid-row: span 3;
}

.month-track .tile-wide,
.month-track .tile-cinematic {
  grid-column: span 2;
  grid-row: span 2;
}

.month-track .tile-tall,
.month-track .tile-portrait,
.month-track .tile-square {
  grid-row: span 2;
}

@media (max-width: 760px) {
  #photosView.active {
    display: flex;
    flex-direction: column;
  }

  #photosView .page-head {
    order: 1;
  }

  #photosView .library-tools {
    order: 2;
  }

  #photosView .gallery,
  #photosView .empty-state {
    order: 3;
  }

  #photosView .nas-console {
    order: 4;
  }

  #photosView .memory-hero {
    display: none;
  }

  #photosView .page-head {
    margin-bottom: 8px;
  }

  #photosView .page-head h1 {
    font-size: clamp(1.94rem, 9vw, 2.35rem);
  }

  .memory-hero {
    margin-bottom: 8px;
  }

  .hero-preview {
    aspect-ratio: 16 / 6.1;
  }

  .hero-glass,
  .hero-rail {
    display: none;
  }

  .memory-copy {
    padding: 11px 14px 12px;
  }

  .memory-copy > p:first-of-type,
  .hero-actions {
    display: none;
  }

  .memory-copy .live-dot {
    margin: 3px 0 9px;
  }

  .hero-kicker {
    margin-bottom: 5px !important;
  }

  .memory-copy h2 {
    font-size: clamp(1.52rem, 7.7vw, 2rem);
  }

  .memory-copy #heroMeta {
    font-size: 0.8rem;
  }

  .stats-grid div {
    min-height: 54px;
    padding: 8px 10px;
  }

  .stats-grid strong {
    font-size: 1.14rem;
  }

  .stats-grid span {
    margin-top: 4px;
  }

  .nas-console {
    display: flex;
    grid-template-columns: none;
    gap: 8px;
    margin: 9px -10px 10px;
    padding: 0 10px 5px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .nas-console::-webkit-scrollbar,
  .month-track::-webkit-scrollbar,
  .vpn-metrics::-webkit-scrollbar,
  .country-grid::-webkit-scrollbar,
  .device-list::-webkit-scrollbar,
  .vpn-steps::-webkit-scrollbar {
    display: none;
  }

  .nas-card {
    flex: 0 0 150px;
    min-height: 108px;
    padding: 12px;
    scroll-snap-align: start;
  }

  .nas-storage-card {
    flex-basis: 250px;
    gap: 10px;
  }

  .nas-card-head {
    gap: 9px;
  }

  .nas-icon {
    width: 37px;
    height: 37px;
  }

  .nas-icon svg {
    width: 20px;
    height: 20px;
  }

  .nas-card-head h2 {
    font-size: 1.02rem;
  }

  .nas-storage-main strong {
    font-size: 1.86rem;
  }

  .nas-mini-card {
    min-height: 108px;
    gap: 8px;
  }

  .nas-mini-card strong {
    font-size: 1.17rem;
  }

  .library-tools {
    margin: 7px 0 8px;
    padding: 7px;
  }

  .gallery.moments {
    margin: 0 -10px;
  }

  .month-group {
    margin: 0 0 12px;
  }

  .month-divider {
    padding: 11px 14px 7px;
  }

  .month-divider strong {
    font-size: 1.1rem;
  }

  .month-track {
    display: flex;
    gap: 7px;
    padding: 0 14px 7px;
    overflow-x: auto;
    scroll-padding-inline: 14px;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .month-track::after {
    display: block;
    flex: 0 0 7px;
    content: "";
  }

  .month-track .photo-tile,
  .month-track .photo-tile.tile-hero,
  .month-track .photo-tile.tile-wide,
  .month-track .photo-tile.tile-cinematic,
  .month-track .photo-tile.tile-tall,
  .month-track .photo-tile.tile-portrait,
  .month-track .photo-tile.tile-square {
    flex: 0 0 102px;
    width: 102px;
    height: 108px;
    aspect-ratio: 1;
    grid-column: auto;
    grid-row: auto;
    scroll-snap-align: start;
  }

  .month-track .photo-tile::after,
  .gallery.compact .photo-tile::after {
    display: none;
  }

  .month-track .photo-meta,
  .gallery.compact .photo-meta {
    display: none;
  }

  .gallery.compact {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: clamp(78px, 23vw, 108px);
    gap: 4px;
  }

  #vpnView .page-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    margin-bottom: 12px;
  }

  #vpnView .page-head h1 {
    font-size: clamp(1.9rem, 9vw, 2.35rem);
  }

  .vpn-refresh {
    width: 50px;
    min-height: 50px;
    padding: 0;
    border-radius: 8px;
  }

  .vpn-refresh span {
    display: none;
  }

  .vpn-refresh svg {
    width: 22px;
    height: 22px;
  }

  .vpn-status {
    display: block;
    min-height: 228px;
    padding: 15px;
  }

  .vpn-status .status-ring {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 58px;
    height: 58px;
  }

  .vpn-status .status-ring span {
    width: 42px;
    height: 42px;
  }

  .vpn-status h2 {
    max-width: calc(100% - 66px);
    margin: 7px 0 7px;
    font-size: clamp(1.55rem, 8vw, 2.1rem);
  }

  .vpn-status #vpnSummary {
    max-width: calc(100% - 58px);
    font-size: 0.83rem;
    line-height: 1.42;
  }

  .vpn-metrics {
    display: flex;
    grid-template-columns: none;
    gap: 7px;
    margin: 15px -15px 0;
    padding: 0 15px 2px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .vpn-metric,
  .vpn-metric:first-child {
    flex: 0 0 150px;
    grid-column: auto;
    min-height: 68px;
    padding: 10px;
    scroll-snap-align: start;
  }

  .vpn-metric strong {
    overflow-wrap: anywhere;
    white-space: normal;
    line-height: 1.25;
  }

  .vpn-panel {
    padding: 14px;
    overflow: hidden;
  }

  .vpn-map-panel {
    min-height: 0;
  }

  .country-grid,
  .device-list,
  .vpn-steps {
    display: flex;
    grid-template-columns: none;
    gap: 8px;
    margin-right: -14px;
    margin-left: -14px;
    padding: 0 14px 3px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .country-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: start;
    flex: 0 0 260px;
    min-height: 128px;
    scroll-snap-align: start;
  }

  .country-card em {
    position: static;
    grid-column: 2;
    justify-self: start;
  }

  .device-item {
    flex: 0 0 205px;
    scroll-snap-align: start;
  }

  .vpn-step {
    flex: 0 0 210px;
    min-height: 100px;
    scroll-snap-align: start;
  }
}

@media (max-width: 390px) {
  .month-track .photo-tile,
  .month-track .photo-tile.tile-hero,
  .month-track .photo-tile.tile-wide,
  .month-track .photo-tile.tile-cinematic,
  .month-track .photo-tile.tile-tall,
  .month-track .photo-tile.tile-portrait,
  .month-track .photo-tile.tile-square {
    flex-basis: 94px;
    width: 94px;
    height: 99px;
  }

  .gallery.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: 23vw;
  }
}

/* Mobile stacked library: compact top navigation, NAS before photos */
@media (max-width: 760px) {
  :root {
    --topbar: 58px;
    --mobile-tabbar: 0px;
  }

  html {
    scroll-padding-top: calc(var(--topbar) + 56px);
  }

  main {
    padding-top: 8px;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: var(--topbar);
    padding: 7px 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-mark img {
    width: 29px;
    height: 29px;
  }

  .top-actions .icon-button {
    width: 40px;
    min-height: 40px;
  }

  .mobile-tabs {
    position: sticky;
    top: var(--topbar);
    right: auto;
    bottom: auto;
    left: auto;
    z-index: 29;
    display: flex;
    gap: 6px;
    min-height: 51px;
    margin: 0;
    padding: 5px 10px;
    border: 0;
    border-bottom: 1px solid rgba(7, 17, 31, 0.07);
    border-radius: 0;
    background: rgba(248, 250, 252, 0.93);
    box-shadow: 0 8px 22px rgba(7, 17, 31, 0.05);
    backdrop-filter: blur(20px) saturate(1.25);
  }

  .mobile-tabs .top-tab {
    flex: 1 1 0;
    flex-direction: row;
    gap: 7px;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    color: #596678;
    background: #edf1f5;
    font-size: 0.82rem;
  }

  .mobile-tabs .top-tab svg {
    width: 19px;
    height: 19px;
  }

  .mobile-tabs .top-tab.active {
    color: #ffffff;
    background: #07111f;
  }

  #photosView .nas-console {
    order: 1;
  }

  #photosView .page-head {
    order: 2;
  }

  #photosView .library-tools {
    order: 3;
  }

  #photosView .gallery,
  #photosView .empty-state {
    order: 4;
  }

  #photosView .page-head {
    display: block;
    margin: 4px 0 7px;
  }

  #photosView .page-head > div:first-child {
    display: none;
  }

  #photosView .page-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 7px;
  }

  #photosView .view-switch {
    min-height: 46px;
  }

  #photosView .pill {
    min-height: 36px;
  }

  #openUpload {
    position: static;
    width: 48px;
    min-height: 46px;
    border-radius: 8px;
    box-shadow: none;
  }

  #openUpload svg {
    width: 21px;
    height: 21px;
  }

  .nas-console {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 2px 0 8px;
    padding: 0;
    overflow: visible;
    scroll-snap-type: none;
  }

  .nas-card {
    flex: none;
    min-height: 0;
    padding: 10px;
    scroll-snap-align: none;
  }

  .nas-storage-card {
    grid-column: 1 / -1;
    min-height: 144px;
    padding: 12px;
    gap: 9px;
  }

  .nas-storage-main strong {
    font-size: 1.72rem;
  }

  .storage-meter {
    height: 7px;
  }

  .storage-split {
    font-size: 0.78rem;
  }

  .nas-mini-card {
    min-height: 78px;
    gap: 5px;
  }

  .nas-mini-label {
    font-size: 0.61rem;
  }

  .nas-mini-card strong {
    font-size: 0.9rem;
    line-height: 1.16;
    overflow-wrap: anywhere;
  }

  .nas-mini-card small {
    font-size: 0.68rem;
    line-height: 1.25;
  }

  .library-tools {
    position: static;
    margin: 0 0 8px;
    padding: 6px;
    box-shadow: none;
  }

  .search {
    min-height: 43px;
  }

  .album-chip {
    min-height: 37px;
    padding: 0 12px;
  }

  .gallery.moments {
    margin: 0;
  }

  .month-group {
    margin: 0 0 13px;
  }

  .month-divider {
    padding: 9px 2px 7px;
  }

  .month-track {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: auto;
    gap: 5px;
    padding: 0;
    overflow: visible;
    scroll-snap-type: none;
  }

  .month-track::after {
    display: none;
  }

  .month-track .photo-tile,
  .month-track .photo-tile.tile-hero,
  .month-track .photo-tile.tile-wide,
  .month-track .photo-tile.tile-cinematic,
  .month-track .photo-tile.tile-tall,
  .month-track .photo-tile.tile-portrait,
  .month-track .photo-tile.tile-square {
    flex: none;
    width: 100%;
    height: auto;
    aspect-ratio: 0.9;
    grid-column: auto;
    grid-row: auto;
    scroll-snap-align: none;
  }
}

@media (max-width: 390px) {
  .month-track .photo-tile,
  .month-track .photo-tile.tile-hero,
  .month-track .photo-tile.tile-wide,
  .month-track .photo-tile.tile-cinematic,
  .month-track .photo-tile.tile-tall,
  .month-track .photo-tile.tile-portrait,
  .month-track .photo-tile.tile-square {
    width: 100%;
    height: auto;
  }
}

/* Photo viewer and stable mobile grid */
.viewer-open {
  overflow: hidden;
}

.lightbox {
  overflow: hidden;
  background: #000000;
  overscroll-behavior: none;
}

.lightbox::backdrop {
  background: #000000;
  backdrop-filter: none;
}

.lightbox-stage {
  touch-action: pan-x;
  user-select: none;
  -webkit-user-select: none;
}

.lightbox-stage img {
  -webkit-user-drag: none;
}

.lightbox .close-button {
  top: calc(14px + env(safe-area-inset-top));
  right: auto;
  left: 14px;
  width: 48px;
  min-height: 48px;
  border-color: rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(18, 18, 20, 0.56);
}

.lightbox .download-button {
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  width: 48px;
  min-height: 48px;
  border-color: rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(18, 18, 20, 0.56);
}

.lightbox .delete-button {
  position: fixed;
  z-index: 2;
  top: calc(14px + env(safe-area-inset-top));
  right: 72px;
  width: 48px;
  min-height: 48px;
  color: #ffffff;
  border-color: rgba(255, 112, 103, 0.32);
  border-radius: 50%;
  background: rgba(116, 28, 30, 0.6);
  backdrop-filter: blur(16px);
}

.lightbox .delete-button:disabled {
  opacity: 0.45;
}

.lightbox .delete-button:not(:disabled):active {
  background: rgba(167, 34, 37, 0.74);
}

.lightbox img.slide-next {
  animation: lightboxNext 190ms ease-out;
}

.lightbox img.slide-prev {
  animation: lightboxPrev 190ms ease-out;
}

@keyframes lightboxNext {
  from {
    opacity: 0.45;
    transform: translateX(18px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes lightboxPrev {
  from {
    opacity: 0.45;
    transform: translateX(-18px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 760px) {
  .month-track {
    gap: 8px;
  }

  .month-track .photo-tile,
  .month-track .photo-tile.tile-hero,
  .month-track .photo-tile.tile-wide,
  .month-track .photo-tile.tile-cinematic,
  .month-track .photo-tile.tile-tall,
  .month-track .photo-tile.tile-portrait,
  .month-track .photo-tile.tile-square {
    position: relative;
    min-height: 0;
    aspect-ratio: 1 / 1.12;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: none;
    touch-action: manipulation;
  }

  .month-track .photo-tile img {
    position: absolute;
    inset: 0;
    height: 100%;
    min-height: 0;
  }

  .month-track .photo-tile:hover {
    transform: none;
    box-shadow: none;
  }

  .lightbox figure.lightbox-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100dvh;
    padding: 0;
  }

  .lightbox-stage img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    box-shadow: none;
    object-fit: contain;
  }

  .lightbox figcaption,
  .lightbox .nav-button {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox img.slide-next,
  .lightbox img.slide-prev {
    animation: none;
  }
}

/* Lightweight mobile scrolling motion */
@media (max-width: 760px) {
  body::before {
    display: none;
  }

  .topbar,
  .mobile-tabs {
    background: #f8fafc;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .month-track .photo-tile,
  .gallery.compact .photo-tile {
    contain: paint;
    transform: translateZ(0);
  }

  .month-track .photo-tile.loaded img,
  .gallery.compact .photo-tile.loaded img {
    animation: none;
    transition: opacity 180ms ease-out;
  }

  .month-track .photo-tile.reveal-ready,
  .gallery.compact .photo-tile.reveal-ready {
    opacity: 0;
    transform: translate3d(0, 10px, 0) scale(0.985);
  }

  .month-track .photo-tile.reveal-ready.is-visible,
  .gallery.compact .photo-tile.reveal-ready.is-visible {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    transition:
      opacity 260ms cubic-bezier(0.22, 1, 0.36, 1),
      transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: var(--reveal-delay, 0ms);
  }
}

@media (prefers-reduced-motion: reduce) {
  .month-track .photo-tile.reveal-ready,
  .month-track .photo-tile.reveal-ready.is-visible,
  .gallery.compact .photo-tile.reveal-ready,
  .gallery.compact .photo-tile.reveal-ready.is-visible {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Mobile previews appear progressively without animating the scrolling layer. */
@media (max-width: 760px) {
  .month-track .photo-tile img,
  .gallery.compact .photo-tile img {
    opacity: 0;
    transition: opacity 280ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .month-track .photo-tile.loaded img,
  .gallery.compact .photo-tile.loaded img {
    opacity: 1;
    animation: none;
    transition-delay: var(--photo-load-delay, 0ms);
  }
}

@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .month-track .photo-tile img,
  .month-track .photo-tile.loaded img,
  .gallery.compact .photo-tile img,
  .gallery.compact .photo-tile.loaded img {
    opacity: 1;
    transition: none;
  }
}

/* Pinch-controlled mobile gallery density */
@media (max-width: 760px) {
  .gallery,
  .gallery .month-track,
  .gallery .photo-tile {
    touch-action: pan-y;
  }

  .gallery.moments[data-columns="4"] .month-track {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .gallery.moments[data-columns="4"] .photo-tile {
    aspect-ratio: 1;
    border-radius: 6px;
  }

  .gallery.moments .month-track {
    transition: gap 330ms cubic-bezier(0.2, 0.82, 0.25, 1);
  }

  .gallery.moments .photo-tile {
    transition: border-radius 330ms cubic-bezier(0.2, 0.82, 0.25, 1);
  }
}

/* iOS-like fullscreen swipe track */
.lightbox figure.lightbox-stage {
  position: relative;
  display: block;
  overflow: hidden;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

.lightbox-viewport {
  position: absolute;
  inset: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}

.lightbox-viewport::-webkit-scrollbar {
  display: none;
}

.lightbox-track {
  display: flex;
  width: max-content;
  height: 100%;
}

.lightbox.controlled-swipe .lightbox-viewport {
  overflow-x: hidden;
  scroll-snap-type: none;
  touch-action: none;
}

.lightbox.controlled-swipe .lightbox-track {
  will-change: transform;
  transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox.controlled-swipe .lightbox-track.is-dragging,
.lightbox.controlled-swipe .lightbox-track.is-instant {
  transition: none;
}

.lightbox-slide {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  flex: 0 0 100vw;
  width: 100vw;
  height: 100%;
  padding: 72px clamp(16px, 8vw, 98px);
  contain: layout paint;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.lightbox-slide img {
  max-width: 100%;
  max-height: calc(100dvh - 150px);
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.lightbox-stage figcaption {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
}

.video-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: rgba(7, 17, 31, 0.62);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.video-badge svg {
  width: 19px;
  height: 19px;
}

.hero-thumb .video-badge {
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
}

.hero-thumb .video-badge svg {
  width: 13px;
  height: 13px;
}

.lightbox-slide video {
  max-width: 100%;
  max-height: calc(100dvh - 150px);
  background: #000;
  object-fit: contain;
}

.lightbox.shows-video .lightbox-stage figcaption {
  bottom: 62px;
}

@media (max-width: 760px) {
  .lightbox-slide {
    padding: 0 7px;
  }

  .lightbox-slide img,
  .lightbox-slide video {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    box-shadow: none;
    object-fit: contain;
  }

  .lightbox.shows-video .lightbox-stage figcaption {
    bottom: calc(env(safe-area-inset-bottom) + 62px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery.moments .month-track,
  .gallery.moments .photo-tile,
  .lightbox.controlled-swipe .lightbox-track {
    transition: none;
  }

}

/* Private gallery gesture and copy guard */
html,
body {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

input,
textarea,
[contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}

img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Private vault access screen and mobile polish */
.login-dialog {
  width: min(860px, calc(100vw - 32px));
  max-width: none;
  overflow: hidden;
  border-radius: 8px;
  background: transparent;
}

.login-dialog::backdrop {
  background: rgba(4, 10, 18, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.login-dialog form {
  grid-template-columns: minmax(280px, 0.84fr) minmax(350px, 1fr);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 26px 80px rgba(2, 8, 18, 0.42);
}

.login-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: end;
  min-height: 548px;
  padding: 34px 30px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(13, 28, 45, 0.12), rgba(6, 15, 26, 0.78)),
    #07111f;
}

.login-cover {
  position: absolute;
  top: 46px;
  left: 50%;
  display: grid;
  place-items: center;
  width: min(210px, calc(100% - 56px));
  padding: 14px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.login-cover img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
}

.login-visual small {
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-visual strong {
  font-size: clamp(2.2rem, 5vw, 3.35rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  padding: clamp(30px, 5vw, 48px);
  background: #ffffff;
}

.vault-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(34px, 8vh, 58px);
}

.vault-brand img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
}

.vault-brand span,
.vault-brand strong,
.vault-brand small {
  display: block;
}

.vault-brand strong {
  color: #07111f;
  font-size: 1.12rem;
  line-height: 1.1;
}

.vault-brand small {
  margin-top: 4px;
  color: #66778c;
  font-size: 0.78rem;
  font-weight: 650;
}

.vault-heading .overline {
  margin-bottom: 10px;
  color: #16754b;
  letter-spacing: 0;
}

.vault-heading h2 {
  margin-bottom: 25px;
  color: #07111f;
  font-size: clamp(2rem, 4vw, 2.45rem);
  line-height: 1.03;
}

.vault-security {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 20px;
}

.vault-secure,
.attempt-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #dbe5df;
  border-radius: 999px;
  color: #16754b;
  background: #eef8f2;
  font-size: 0.8rem;
  font-weight: 750;
}

.vault-secure {
  gap: 6px;
}

.vault-secure svg {
  width: 16px;
  height: 16px;
}

.attempt-badge[data-state="warning"] {
  border-color: #f0d3a5;
  color: #a35a06;
  background: #fff7eb;
}

.attempt-badge[data-state="blocked"] {
  border-color: #f1c7c2;
  color: #b8322b;
  background: #fff1ef;
}

.passcode-field {
  gap: 8px;
  margin: 0 0 12px !important;
  color: #46576c !important;
  font-size: 0.88rem;
  font-weight: 700;
}

.password-shell {
  position: relative;
  display: block;
}

.login-dialog .password-shell input {
  min-height: 56px;
  padding-right: 58px;
  border-color: #d9e0e8;
  border-radius: 8px;
  color: #07111f;
  background: #f7f9fc;
}

.login-dialog .password-shell input:focus {
  border-color: #007aff;
  background: #ffffff;
}

.password-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: #65758b;
  background: transparent;
}

.password-toggle svg {
  width: 21px;
  height: 21px;
}

.login-notice {
  min-height: 35px;
  margin: 0 0 13px;
  color: #66778c !important;
  font-size: 0.8rem;
  line-height: 1.42;
}

.login-dialog .form-error {
  margin: 0 0 12px;
  padding: 11px 12px;
  border: 1px solid #f1c7c2;
  border-radius: 8px;
  color: #b8322b;
  background: #fff1ef;
  font-size: 0.86rem;
}

.unlock-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  border-radius: 8px;
  color: #ffffff;
  background: #07111f;
}

.unlock-button svg {
  width: 20px;
  height: 20px;
}

.login-dialog form.is-submitting .unlock-button {
  opacity: 0.65;
}

.login-dialog form.is-blocked .password-shell,
.login-dialog form.is-blocked .unlock-button {
  opacity: 0.48;
}

@media (max-width: 760px) {
  body:not(.viewer-open) {
    background: #f2f5f9;
  }

  .topbar {
    min-height: 68px;
    padding: 10px 12px;
    background: #ffffff;
  }

  .mobile-tabs {
    margin: 8px 10px 10px;
    padding: 4px;
    border: 1px solid #e1e7ef;
    border-radius: 8px;
    background: #ffffff;
  }

  .library-tools {
    border-color: #e1e7ef;
    box-shadow: none;
  }

  .month-divider strong {
    color: #07111f;
  }

  .month-track .photo-tile:active {
    transform: scale(0.975);
  }

  .login-dialog {
    inset: 0;
    width: 100%;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border-radius: 0;
    background: #ffffff;
  }

  .login-dialog form {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .login-visual {
    display: flex;
    flex: 0 0 clamp(216px, 31dvh, 254px);
    min-height: 0;
    padding: 24px 22px 22px;
  }

  .login-cover {
    top: 20px;
    left: auto;
    right: 22px;
    width: 96px;
    padding: 7px;
    transform: none;
  }

  .login-visual strong {
    font-size: 2.1rem;
  }

  .login-panel {
    flex: 1;
    justify-content: start;
    padding: 22px 22px calc(24px + env(safe-area-inset-bottom));
    border-radius: 0;
  }

  .vault-brand {
    margin-bottom: 30px;
  }

  .vault-heading h2 {
    margin-bottom: 21px;
    font-size: 2rem;
  }
}

/* Keep mobile chrome on its own inexpensive layer while the photo feed scrolls. */
@media (max-width: 760px) {
  :root {
    --mobile-safe-top: env(safe-area-inset-top, 0px);
    --mobile-fixed-topbar: calc(68px + var(--mobile-safe-top));
    --mobile-fixed-tabs: 60px;
  }

  .topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 31;
    height: var(--mobile-fixed-topbar);
    min-height: var(--mobile-fixed-topbar);
    padding-top: calc(7px + var(--mobile-safe-top));
    border-bottom: 1px solid #e6ebf1;
    background: #ffffff;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    contain: paint;
  }

  .mobile-tabs {
    position: fixed;
    top: var(--mobile-fixed-topbar);
    right: 0;
    left: 0;
    z-index: 30;
    height: var(--mobile-fixed-tabs);
    min-height: var(--mobile-fixed-tabs);
    margin: 0;
    padding: 7px 10px 8px;
    border: 0;
    border-bottom: 1px solid #e6ebf1;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    contain: paint;
  }

  main {
    padding-top: calc(var(--mobile-fixed-topbar) + var(--mobile-fixed-tabs) + 12px);
  }

  .month-group {
    content-visibility: visible;
  }

  .month-track .photo-tile,
  .gallery.compact .photo-tile {
    contain: layout paint;
    transform: none;
    transition: none;
  }

  .month-track .photo-tile.reveal-ready,
  .month-track .photo-tile.reveal-ready.is-visible,
  .gallery.compact .photo-tile.reveal-ready,
  .gallery.compact .photo-tile.reveal-ready.is-visible {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
