:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --surface-3: #f8fafc;
  --text: #172033;
  --muted: #64748b;
  --line: #d7e0ea;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --mint: #14b8a6;
  --coral: #f97316;
  --amber: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 18px 50px rgba(23, 32, 51, 0.12);
  --soft-shadow: 0 10px 28px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #f8fbff 0%, #eef4f8 48%, #f8fafc 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans KR", sans-serif;
  letter-spacing: 0;
  overscroll-behavior-y: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.mobile-action-bar {
  display: none;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  background:
    linear-gradient(120deg, rgba(37, 99, 235, 0.92), rgba(20, 184, 166, 0.78)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='700' viewBox='0 0 900 700'%3E%3Crect width='900' height='700' fill='%23dbeafe'/%3E%3Cg opacity='.55'%3E%3Crect x='70' y='80' width='220' height='160' rx='8' fill='%23ffffff'/%3E%3Crect x='330' y='120' width='260' height='200' rx='8' fill='%23ffffff'/%3E%3Crect x='620' y='70' width='190' height='145' rx='8' fill='%23ffffff'/%3E%3Crect x='120' y='310' width='250' height='190' rx='8' fill='%23ffffff'/%3E%3Crect x='420' y='370' width='330' height='230' rx='8' fill='%23ffffff'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
}

.auth-visual {
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  padding: 64px;
  color: white;
}

.auth-title {
  max-width: 680px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: white;
  color: var(--primary);
  border-radius: 8px;
  margin-bottom: 22px;
}

.auth-title h1 {
  margin: 0 0 16px;
  font-size: clamp(44px, 7vw, 88px);
  line-height: 0.95;
  letter-spacing: 0;
}

.auth-title p {
  margin: 0;
  max-width: 520px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 18px;
  line-height: 1.7;
}

.auth-panel {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 28px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
}

.auth-box {
  width: 100%;
  background: var(--surface);
  border: 1px solid rgba(216, 224, 234, 0.8);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.auth-box h2,
.panel-title,
.modal-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.auth-switch button,
.segmented button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.auth-switch button.active,
.segmented button.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 8px rgba(23, 32, 51, 0.08);
}

.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
  outline: none;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.primary-btn,
.secondary-btn,
.danger-btn,
.text-btn,
.icon-btn,
.fab {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease,
    box-shadow 0.16s ease;
}

.primary-btn {
  background: var(--primary);
  color: white;
}

.primary-btn:hover {
  background: var(--primary-strong);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.secondary-btn {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.secondary-btn:hover {
  border-color: rgba(37, 99, 235, 0.28);
  background: #f8fbff;
}

.danger-btn {
  background: #fff5f5;
  border-color: #fecaca;
  color: var(--danger);
}

.text-btn {
  background: transparent;
  color: var(--primary);
  padding-inline: 6px;
}

.text-btn:hover {
  background: rgba(37, 99, 235, 0.08);
}

.sync-chip {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.sync-chip.loading svg,
.icon-btn.active svg {
  animation: spin 0.9s linear infinite;
}

.sync-chip.live {
  color: var(--primary-strong);
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.08);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

.sync-dot.is-live {
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.55);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.55);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(20, 184, 166, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0);
  }
}

.search-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  min-height: 36px;
}

.search-field input {
  border: none;
  background: transparent;
  outline: none;
  color: var(--text);
  font-size: 14px;
  width: 160px;
}

.search-field .icon-btn {
  width: 24px;
  height: 24px;
  min-height: 24px;
  border: none;
  background: transparent;
  color: var(--muted);
}

.selection-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 12px;
}

.selection-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.selection-info strong {
  color: var(--primary-strong);
  font-size: 16px;
}

.selection-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.media-tile.is-selectable {
  cursor: pointer;
}

.media-tile.is-selected {
  outline: 3px solid var(--primary);
  outline-offset: -3px;
}

.select-marker {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  z-index: 2;
}

.select-marker.is-on {
  background: var(--primary);
  border-color: #fff;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-btn {
  width: 40px;
  padding: 0;
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.icon-btn.active {
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.35);
  background: #eff6ff;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  min-width: 0;
}

.sidebar {
  min-height: 100vh;
  min-width: 0;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: 10px 0 34px rgba(23, 32, 51, 0.05);
}

.brand-row,
.user-row,
.topbar,
.album-header,
.toolbar,
.modal-head,
.media-actions,
.member-row,
.comment-row,
.invite-row {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 12px;
  font-weight: 800;
  font-size: 19px;
}

.brand-row .brand-mark {
  width: 38px;
  height: 38px;
  margin: 0;
  background: var(--primary);
  color: white;
}

.user-row {
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface), var(--surface-3));
  box-shadow: 0 8px 20px rgba(23, 32, 51, 0.05);
}

.avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: hsl(var(--hue, 205) 78% 45%);
  color: white;
  font-weight: 700;
}

.user-meta,
.album-card-meta,
.member-meta {
  min-width: 0;
}

.user-meta strong,
.member-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-meta span,
.album-card-meta span,
.member-meta span,
.subtle {
  color: var(--muted);
  font-size: 13px;
}

.album-nav {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.album-nav button {
  width: 100%;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 62px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px;
  background: transparent;
  color: var(--text);
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.album-nav button.active,
.album-nav button:hover {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 8px 20px rgba(23, 32, 51, 0.06);
}

.album-nav button:hover {
  transform: translateX(2px);
}

.mini-cover,
.album-cover,
.media-tile {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
}

.mini-cover {
  width: 48px;
  height: 48px;
  border-radius: 8px;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(215, 224, 234, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 30px rgba(23, 32, 51, 0.07);
}

.topbar h2 {
  margin: 0;
  font-size: 24px;
}

.topbar-compact {
  min-height: 46px;
  padding: 8px 12px;
}

.topbar-back {
  flex: 0 0 auto;
}

.top-actions,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.media-subnav {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.media-subnav button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.media-subnav button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 8px rgba(23, 32, 51, 0.08);
}

.media-subnav span {
  min-width: 20px;
  min-height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary-strong);
  font-size: 12px;
}

.empty-state {
  min-height: 58vh;
  display: grid;
  place-items: center;
  padding: 40px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  text-align: center;
}

.empty-state svg {
  color: var(--primary);
}

.empty-state h3 {
  margin: 14px 0 8px;
}

.panel .empty-state {
  min-height: 300px;
  margin: 12px;
  background: var(--surface-3);
}

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

.home-stack {
  display: grid;
  gap: 16px;
  width: min(100%, 1040px);
  margin-inline: auto;
}

.home-hero {
  min-height: 188px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  color: white;
  background:
    linear-gradient(115deg, rgba(16, 24, 39, 0.96), rgba(37, 99, 235, 0.72) 54%, rgba(20, 184, 166, 0.78)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0 1px, transparent 1px 24px);
  box-shadow: var(--soft-shadow);
}

.home-hero h1 {
  margin: 8px 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.05;
}

.home-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 800;
}

.home-hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.home-hero .primary-btn {
  background: white;
  color: #172033;
}

.home-hero .primary-btn:hover {
  background: #f8fafc;
}

.home-hero .secondary-btn {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
  color: white;
}

.home-hero .secondary-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.05);
}

.summary-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.summary-item:last-child {
  border-right: 0;
}

.summary-item span {
  color: var(--muted);
  font-size: 13px;
}

.summary-item strong {
  overflow: hidden;
  color: var(--text);
  font-size: 24px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.section-head h3 {
  margin: 0 0 3px;
  font-size: 18px;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  justify-content: stretch;
  gap: 16px;
}

.album-card {
  position: relative;
  display: grid;
  gap: 12px;
  contain: layout paint;
  content-visibility: auto;
  contain-intrinsic-size: 320px 330px;
  overflow: hidden;
  border: 1px solid rgba(215, 224, 234, 0.78);
  border-radius: 8px;
  padding: 10px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  color: var(--text);
  text-align: left;
  box-shadow: 0 10px 26px rgba(23, 32, 51, 0.07);
  transition:
    border-color 0.16s ease,
    transform 0.16s ease,
    box-shadow 0.16s ease;
}

.album-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.74);
  pointer-events: none;
}

.album-card:hover {
  border-color: rgba(37, 99, 235, 0.32);
  transform: translateY(-1px);
  box-shadow: 0 18px 38px rgba(23, 32, 51, 0.12);
}

.album-card:active {
  transform: translateY(0) scale(0.99);
}

.album-cover {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.album-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent 44%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.08), transparent 38%);
}

.album-cover-shade {
  position: absolute;
  inset: auto 0 0;
  z-index: 1;
  height: 62%;
  background: linear-gradient(180deg, transparent, rgba(15, 23, 42, 0.68));
}

.album-chip,
.album-count {
  position: absolute;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.album-chip {
  left: 10px;
  top: 10px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(10px);
}

.album-count {
  right: 10px;
  bottom: 10px;
  background: var(--album-accent, var(--primary));
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.album-card .album-card-meta {
  display: grid;
  gap: 4px;
  padding: 0 2px 1px;
}

.album-card .album-card-meta strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-cover img,
.mini-cover img,
.media-tile img,
.media-tile video,
.viewer-media img,
.viewer-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.album-cover img {
  transition: transform 0.42s ease;
}

.album-card:hover .album-cover img {
  transform: scale(1.035);
}

.album-detail {
  --album-accent: var(--primary);
  display: grid;
  gap: 16px;
  width: min(100%, 1180px);
  margin-inline: auto;
}

.album-hero {
  position: relative;
  min-height: 232px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: white;
  overflow: hidden;
  box-shadow: 0 22px 52px rgba(15, 23, 42, 0.16);
  background:
    radial-gradient(circle at 86% 18%, rgba(255, 255, 255, 0.22), transparent 30%),
    linear-gradient(90deg, rgba(3, 7, 18, 0.76), rgba(3, 7, 18, 0.28)),
    var(--cover, #2563eb);
}

.album-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 42%),
    radial-gradient(circle at 20% 100%, rgba(37, 99, 235, 0.18), transparent 44%);
  pointer-events: none;
}

.album-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--album-accent), rgba(20, 184, 166, 0.92), transparent);
}

.album-hero > * {
  position: relative;
  z-index: 1;
}

.album-hero.has-cover {
  background-size: cover;
  background-position: center;
}

.album-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
  max-width: 900px;
}

.album-hero p {
  margin: 0;
  max-width: 680px;
  color: rgba(255, 255, 255, 0.88);
}

.stat-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.stat-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  backdrop-filter: blur(12px);
}

.album-hero .secondary-btn,
.album-hero .icon-btn {
  color: white;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(15, 23, 42, 0.34);
  box-shadow: none;
  backdrop-filter: blur(12px);
}

.album-hero .secondary-btn:hover,
.album-hero .icon-btn:hover {
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(15, 23, 42, 0.5);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.05);
  overflow: hidden;
}

.panel-media {
  border-color: rgba(215, 224, 234, 0.76);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.toolbar {
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.segmented button {
  padding: 0 12px;
  white-space: nowrap;
}

.upload-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 12px;
  padding: 12px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.08), rgba(20, 184, 166, 0.07)),
    var(--surface-3);
}

.upload-dock-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dock-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: white;
  color: var(--primary);
  box-shadow: 0 8px 18px rgba(23, 32, 51, 0.08);
}

.upload-dock-main strong,
.upload-dock-main span {
  display: block;
}

.upload-dock-main span {
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-dock-main span svg {
  vertical-align: -2px;
}

.upload-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.media-grid,
.date-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  grid-auto-flow: dense;
  gap: 8px;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.42), rgba(255, 255, 255, 0.86));
}

.media-load-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px 26px;
}

.media-load-more .secondary-btn {
  min-width: min(220px, 100%);
  justify-content: center;
}

.media-tile {
  aspect-ratio: 1;
  contain: layout paint;
  content-visibility: auto;
  contain-intrinsic-size: 160px 160px;
  border: 0;
  border-radius: 5px;
  padding: 0;
  color: white;
  background: #080d18;
  box-shadow: none;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    filter 0.16s ease;
}

.media-tile:hover {
  transform: scale(1.012);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.18);
  filter: saturate(1.05) contrast(1.01);
}

@media (hover: none) {
  .album-card:hover {
    transform: none;
    box-shadow: 0 10px 26px rgba(23, 32, 51, 0.07);
  }

  .media-tile:hover {
    transform: none;
    box-shadow: none;
    filter: none;
  }
}

.media-grid .media-tile.is-large {
  grid-column: span 2;
  grid-row: span 2;
  contain-intrinsic-size: 320px 320px;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
}

.media-tile.is-new {
  outline: 3px solid rgba(20, 184, 166, 0.9);
  outline-offset: -3px;
  animation: newTile 1.2s ease both;
}

@keyframes newTile {
  0% {
    transform: scale(0.96);
    filter: saturate(1.25);
  }

  100% {
    transform: scale(1);
    filter: saturate(1);
  }
}

.media-tile::after {
  display: none;
}

.media-tile:hover::after,
.media-tile:focus-visible::after {
  opacity: 0.82;
}

.media-grid .media-tile.is-large::after {
  opacity: 0.66;
}

.media-like-chip {
  position: absolute;
  right: 7px;
  bottom: 7px;
  z-index: 1;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.42);
  color: white;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  backdrop-filter: blur(10px);
}

.media-like-chip.is-liked {
  background: rgba(220, 38, 38, 0.78);
  border-color: rgba(255, 255, 255, 0.2);
}

.media-like-chip.is-liked svg {
  fill: currentColor;
}

.media-type-chip {
  position: absolute;
  left: 7px;
  bottom: 7px;
  z-index: 1;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.48);
  color: white;
  backdrop-filter: blur(10px);
}

.media-meta {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 6px;
  color: white;
  font-size: 12px;
}

.media-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(10px);
}

.media-chip:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-grid .media-tile.is-large .media-chip:first-child {
  min-height: 28px;
  padding: 0 9px;
  font-size: 13px;
}

.date-section {
  display: grid;
  gap: 4px;
  padding-top: 4px;
}

.date-section h3 {
  margin: 0;
  padding: 14px 12px 4px;
  font-size: 15px;
}

.members-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.member-row {
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-3);
}

.member-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  background: #ecfeff;
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
}

.modal-backdrop,
.media-backdrop,
.upload-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.58);
}

.media-backdrop {
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(16px);
}

.modal,
.media-viewer,
.upload-box {
  width: min(100%, 520px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-head {
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.modal-body {
  padding: 18px;
}

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

.media-viewer {
  width: min(100%, 1080px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #060a12;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.36);
}

.media-backdrop.immersive {
  padding: 0;
  background: #000;
}

.media-viewer.is-immersive {
  width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  display: block;
  border-radius: 0;
  background: #000;
}

.viewer-media {
  position: relative;
  min-height: 68vh;
  background:
    radial-gradient(circle at 50% 40%, rgba(30, 41, 59, 0.72), transparent 48%),
    linear-gradient(180deg, #020617, #070b14);
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}

.viewer-media img,
.viewer-media video {
  object-fit: contain;
}

.media-tile img[data-src],
.media-tile video[data-src],
.filmstrip-item img[data-src],
.filmstrip-item video[data-src] {
  background:
    linear-gradient(90deg, rgba(226, 232, 240, 0.65), rgba(248, 250, 252, 0.92), rgba(226, 232, 240, 0.65));
  background-size: 220% 100%;
  animation: media-loading-sheen 1.2s ease-in-out infinite;
}

@keyframes media-loading-sheen {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

.media-viewer.is-immersive .viewer-media {
  width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  background: #000;
  touch-action: none;
}

.media-viewer.is-immersive .viewer-panel,
.media-viewer.is-immersive .viewer-nav {
  display: none;
}

.viewer-close-floating {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  width: 42px;
  height: 42px;
  display: none;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.38);
  color: white;
  backdrop-filter: blur(12px);
}

.media-viewer.is-immersive .viewer-close-floating {
  display: grid;
  opacity: 0.42;
}

.media-viewer.is-immersive .viewer-close-floating:hover {
  opacity: 0.9;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 60px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.42);
  color: white;
  transform: translateY(-50%);
  backdrop-filter: blur(10px);
}

.viewer-nav:hover {
  background: rgba(15, 23, 42, 0.72);
}

.viewer-prev {
  left: 14px;
}

.viewer-next {
  right: 14px;
}

.viewer-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid rgba(215, 224, 234, 0.76);
  background: #fbfdff;
}

.viewer-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 14px;
  border-bottom: 1px solid var(--line);
}

.media-actions {
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.74);
}

.filmstrip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 58px;
  gap: 7px;
  overflow-x: auto;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fafc, #eef3f8);
}

.filmstrip-item {
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 0;
  background: #0f172a;
  opacity: 0.72;
  transition:
    border-color 0.16s ease,
    opacity 0.16s ease,
    transform 0.16s ease;
}

.filmstrip-item.active {
  border-color: var(--primary);
  opacity: 1;
  transform: translateY(-1px);
}

.filmstrip-item img,
.filmstrip-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.viewer-neighbors {
  display: none;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}

.comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 8px;
  border-bottom: 1px solid rgba(215, 224, 234, 0.72);
}

.comments-head strong {
  font-size: 14px;
}

.comments-head span {
  min-width: 24px;
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #eef3f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.comments {
  flex: 1;
  min-height: 180px;
  overflow: auto;
  padding: 10px 14px 12px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.empty-comment {
  margin: 0;
  padding: 16px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.comment-row {
  gap: 9px;
  align-items: flex-start;
}

.comment-row .avatar {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  font-size: 12px;
}

.comment-bubble {
  min-width: 0;
  flex: 1;
  padding: 10px 11px;
  border-radius: 8px;
  background: #f3f6fa;
}

.comment-bubble p {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.comment-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.comment-form input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.upload-box {
  padding: 18px;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.progress span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: linear-gradient(90deg, var(--primary), var(--mint));
}

.invite-row {
  gap: 8px;
}

.invite-row input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #101827;
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

.hidden-input {
  display: none;
}

/* user-row works both as div (legacy) and as button (account entry) */
button.user-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  text-align: left;
}

button.user-row:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: #f5f8ff;
}

button.user-row svg {
  color: var(--muted);
}

/* Pull-to-refresh indicator */
#ptr-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 0;
  height: 0;
  overflow: hidden;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0));
  transition: height 0.18s ease;
  pointer-events: none;
}

#ptr-indicator.is-active {
  height: calc(56px + env(safe-area-inset-top));
  padding-top: calc(8px + env(safe-area-inset-top));
}

#ptr-indicator.is-refreshing .ptr-spinner {
  animation: spin 0.8s linear infinite;
}

.ptr-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(37, 99, 235, 0.25);
  border-top-color: var(--primary);
  display: inline-block;
}

/* Account modal */
.account-modal {
  width: min(520px, 96vw);
}

.account-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 0 16px 8px;
  border-bottom: 1px solid var(--line);
}

.account-tabs button {
  min-height: 40px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  border-radius: 10px;
}

.account-tabs button.active {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary-strong);
}

.account-body {
  padding-top: 14px;
}

.session-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.session-row.is-current {
  border-color: rgba(37, 99, 235, 0.32);
  background: #eff6ff;
}

.session-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.session-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Viewer progressive image loading */
.viewer-blur-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: blur(14px) saturate(0.75);
  transform: scale(1.06);
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.viewer-media.full-loaded .viewer-blur-thumb {
  opacity: 0;
}

.viewer-media .viewer-zoom-wrap img:not(.is-loaded) {
  opacity: 0;
}

/* Viewer pinch/zoom transform */
.viewer-media .viewer-zoom-wrap {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  touch-action: none;
}

.viewer-media .viewer-zoom-wrap img,
.viewer-media .viewer-zoom-wrap video {
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
  transform: translate3d(var(--zoom-tx, 0px), var(--zoom-ty, 0px), 0) scale(var(--zoom-scale, 1));
  transition: transform 0.18s ease, opacity 0.35s ease;
  will-change: transform;
}

.viewer-media.is-zooming .viewer-zoom-wrap img,
.viewer-media.is-zooming .viewer-zoom-wrap video {
  transition: none;
}

/* Safe-area for app shell on iOS notch */
@supports (padding: max(0px)) {
  body {
    padding-top: env(safe-area-inset-top);
  }
  .mobile-action-bar {
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
}

/* Mobile-only: bottom-sheet viewer */
@media (max-width: 560px) {
  .media-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .media-viewer {
    grid-template-rows: auto minmax(0, 56dvh) minmax(0, 44dvh);
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    overflow: hidden;
    transform: translateY(var(--sheet-drag, 0px));
    transition: transform 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .media-viewer.is-dragging {
    transition: none;
  }

  .media-viewer::before {
    content: "";
    display: block;
    width: 44px;
    height: 4px;
    margin: 8px auto 4px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.18);
  }

  .viewer-close-floating {
    top: max(12px, env(safe-area-inset-top));
  }

  .viewer-panel {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .mobile-action-bar {
    bottom: max(8px, env(safe-area-inset-bottom));
  }

  .selection-bar {
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .selection-actions .text-btn {
    padding: 0 8px;
  }

  .search-field input {
    width: 100%;
  }

  .account-modal {
    width: 100vw;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
  }

  .account-tabs {
    padding-bottom: 6px;
  }
}

@media (max-width: 900px) {
  .auth-page,
  .app-shell,
  .media-viewer {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    min-height: 42vh;
    padding: 32px;
  }

  .auth-panel {
    min-height: auto;
  }

  .sidebar {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
  }

  .album-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 72vw);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
  }

  .album-nav button {
    width: auto;
  }

  .home-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-hero-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .viewer-panel {
    border-left: 0;
  }

  .viewer-media {
    min-height: 52vh;
  }

  .viewer-nav {
    display: none;
  }

  .viewer-close-floating {
    display: grid;
  }
}

@media (max-width: 720px) {
  body {
    background: #f6f8fb;
  }

  .app-shell {
    display: block;
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .workspace,
  .sidebar {
    padding: 12px;
  }

  .workspace {
    padding-top: 10px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 18;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: auto;
    border-bottom: 1px solid rgba(215, 224, 234, 0.9);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(18px);
  }

  .brand-row {
    gap: 9px;
    font-size: 17px;
  }

  .brand-row .brand-mark {
    width: 34px;
    height: 34px;
  }

  .sidebar > .secondary-btn,
  .sidebar > .text-btn {
    display: none;
  }

  .sidebar > button.user-row {
    grid-column: 2;
    width: 44px;
    height: 44px;
    min-height: 44px;
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    padding: 4px;
    border-radius: 50%;
  }

  .sidebar > button.user-row .user-meta,
  .sidebar > button.user-row > svg {
    display: none;
  }

  .sidebar > button.user-row .avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .album-nav {
    grid-column: 1 / -1;
    grid-auto-columns: minmax(122px, max-content);
    gap: 7px;
    margin-inline: -12px;
    padding: 0 12px 2px;
    scrollbar-width: none;
  }

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

  .app-shell.is-home .album-nav {
    display: none;
  }

  .album-nav button {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    min-height: 48px;
    padding: 6px 10px 6px 6px;
    border-color: var(--line);
    background: rgba(248, 250, 252, 0.92);
    box-shadow: none;
  }

  .album-nav button:hover {
    transform: none;
  }

  .album-nav button.active {
    border-color: rgba(37, 99, 235, 0.35);
    background: #eff6ff;
  }

  .album-nav .mini-cover {
    width: 34px;
    height: 34px;
  }

  .album-nav .album-card-meta strong {
    display: block;
    max-width: 116px;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .album-nav .album-card-meta span {
    display: none;
  }

  .topbar {
    display: none;
  }

  .primary-btn,
  .secondary-btn,
  .danger-btn,
  .text-btn,
  .icon-btn {
    min-height: 48px;
  }

  .album-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .album-card {
    gap: 9px;
    padding: 7px;
  }

  .album-cover {
    aspect-ratio: 16 / 10;
    max-height: 260px;
  }

  .album-detail {
    gap: 12px;
  }

  .album-hero {
    min-height: 176px;
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .album-hero h1 {
    font-size: 30px;
  }

  .album-hero p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .album-hero .top-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px 48px;
    width: 100%;
  }

  .stat-row {
    margin-top: 12px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
  }

  .toolbar > .segmented {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .media-subnav {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .toolbar-actions .search-field {
    grid-column: 1 / 2;
    width: 100%;
  }

  .search-field input {
    width: 100%;
  }

  .toolbar-actions .icon-btn {
    grid-column: 2;
    width: 48px;
  }

  .toolbar-actions [data-action="upload-folder"],
  .toolbar-actions [data-action="upload-click"] {
    display: none;
  }

  .mobile-action-bar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 35;
    display: grid;
    grid-template-columns: 1fr 1fr 1.25fr;
    gap: 6px;
    padding: 6px;
    border: 1px solid rgba(215, 224, 234, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(18px);
  }

  .mobile-action-bar button {
    min-width: 0;
    min-height: 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .mobile-action-bar button.active {
    background: #eff6ff;
    color: var(--primary);
  }

  .mobile-action-bar .mobile-upload {
    flex-direction: row;
    gap: 7px;
    background: var(--primary);
    color: white;
    font-size: 14px;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
  }

  .mobile-action-bar.is-single {
    left: 50%;
    right: auto;
    width: min(260px, calc(100vw - 32px));
    grid-template-columns: 1fr;
    transform: translateX(-50%);
  }

  .mobile-action-bar.is-single .mobile-upload {
    min-height: 56px;
    justify-content: center;
  }

  .media-grid,
  .date-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
  }

  .media-grid .media-tile.is-large {
    grid-column: span 2;
    grid-row: span 2;
  }

  .media-like-chip {
    right: 5px;
    bottom: 5px;
    min-height: 21px;
    padding: 0 6px;
    font-size: 11px;
  }
}

@media (max-width: 560px) {
  body {
    background: #f6f8fb;
  }

  .app-shell {
    display: block;
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .workspace,
  .sidebar {
    padding: 12px;
  }

  .workspace {
    padding-top: 10px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 18;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    border-bottom: 1px solid rgba(215, 224, 234, 0.9);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(18px);
  }

  .brand-row {
    gap: 9px;
    font-size: 17px;
  }

  .brand-row .brand-mark {
    width: 34px;
    height: 34px;
  }

  .sidebar > .secondary-btn,
  .sidebar > .text-btn {
    display: none;
  }

  .sidebar > button.user-row {
    grid-column: 2;
    width: 44px;
    height: 44px;
    min-height: 44px;
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    padding: 4px;
    border-radius: 50%;
  }

  .sidebar > button.user-row .user-meta,
  .sidebar > button.user-row > svg {
    display: none;
  }

  .sidebar > button.user-row .avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .album-nav {
    grid-column: 1 / -1;
    grid-auto-columns: minmax(118px, max-content);
    gap: 7px;
    margin-inline: -12px;
    padding: 0 12px 2px;
    scrollbar-width: none;
  }

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

  .app-shell.is-home .album-nav {
    display: none;
  }

  .album-nav button {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    min-height: 48px;
    padding: 6px 10px 6px 6px;
    border-color: var(--line);
    background: rgba(248, 250, 252, 0.9);
    box-shadow: none;
  }

  .album-nav button:hover {
    transform: none;
  }

  .album-nav button.active {
    border-color: rgba(37, 99, 235, 0.35);
    background: #eff6ff;
  }

  .album-nav .mini-cover {
    width: 34px;
    height: 34px;
  }

  .album-nav .album-card-meta strong {
    display: block;
    max-width: 106px;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .album-nav .album-card-meta span {
    display: none;
  }

  .topbar,
  .album-hero,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    display: none;
  }

  .toolbar-actions,
  .top-actions,
  .empty-actions,
  .upload-actions,
  .home-hero-actions {
    width: 100%;
  }

  .primary-btn,
  .secondary-btn,
  .danger-btn,
  .text-btn,
  .icon-btn {
    min-height: 48px;
  }

  .primary-btn,
  .secondary-btn,
  .danger-btn {
    flex: 1;
  }

  .home-hero {
    min-height: 150px;
    padding: 16px;
  }

  .home-hero h1 {
    font-size: 30px;
  }

  .home-hero-actions .secondary-btn {
    display: none;
  }

  .summary-item {
    padding: 13px 14px;
  }

  .summary-item strong {
    font-size: 21px;
  }

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

  .summary-item:nth-child(2n) {
    border-right: 0;
  }

  .summary-item:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .album-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .album-card {
    gap: 9px;
    padding: 7px;
  }

  .album-cover {
    aspect-ratio: 16 / 10;
  }

  .album-detail {
    gap: 12px;
  }

  .album-hero {
    min-height: 164px;
    padding: 16px;
  }

  .album-hero h1 {
    font-size: 30px;
  }

  .album-hero p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .album-hero .top-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px 48px;
  }

  .stat-row {
    margin-top: 12px;
  }

  .upload-dock {
    align-items: stretch;
    flex-direction: column;
    margin: 8px;
    padding: 10px;
  }

  .dock-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .upload-dock-main span {
    max-width: 248px;
  }

  .toolbar > .segmented {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
  }

  .media-subnav {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .toolbar-actions .search-field {
    grid-column: 1 / -1;
    width: 100%;
  }

  .toolbar-actions .icon-btn {
    width: 48px;
  }

  .toolbar-actions [data-action="upload-folder"],
  .toolbar-actions [data-action="upload-click"] {
    display: none;
  }

  .toolbar-actions .primary-btn,
  .toolbar-actions .secondary-btn {
    min-width: 0;
    padding: 0 8px;
  }

  .mobile-action-bar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 35;
    display: grid;
    grid-template-columns: 1fr 1fr 1.25fr;
    gap: 6px;
    padding: 6px;
    border: 1px solid rgba(215, 224, 234, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(18px);
  }

  .mobile-action-bar button {
    min-width: 0;
    min-height: 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .mobile-action-bar button.active {
    background: #eff6ff;
    color: var(--primary);
  }

  .mobile-action-bar .mobile-upload {
    flex-direction: row;
    gap: 7px;
    background: var(--primary);
    color: white;
    font-size: 14px;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
  }

  .mobile-action-bar.is-single {
    left: 50%;
    right: auto;
    width: min(260px, calc(100vw - 32px));
    grid-template-columns: 1fr;
    transform: translateX(-50%);
  }

  .mobile-action-bar.is-single .mobile-upload {
    min-height: 56px;
    justify-content: center;
  }

  .viewer-nav {
    width: 40px;
    height: 54px;
  }

  .media-backdrop {
    padding: 0;
  }

  .media-viewer {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    display: grid;
    grid-template-rows: 18px minmax(0, 54dvh) minmax(0, 1fr);
    border: 0;
    border-radius: 0;
  }

  .media-viewer::before {
    grid-row: 1;
    align-self: center;
  }

  .viewer-media {
    grid-row: 2;
    min-height: 0;
    height: auto;
  }

  .viewer-panel {
    grid-row: 3;
    min-height: 0;
    overflow: hidden;
  }

  .viewer-head {
    padding: 12px;
  }

  .viewer-head strong {
    display: block;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .media-actions {
    padding: 10px 12px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .media-actions .secondary-btn,
  .media-actions .danger-btn {
    flex: 0 0 auto;
  }

  .filmstrip {
    grid-auto-columns: 52px;
    padding: 8px 12px;
  }

  .filmstrip-item {
    width: 52px;
    height: 52px;
  }

  .viewer-neighbors {
    display: none;
  }

  .comments {
    min-height: 0;
    padding: 10px 12px;
  }

  .comment-form {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  .media-viewer.is-immersive .viewer-media {
    grid-row: 1 / -1;
    height: 100dvh;
  }

  .media-viewer.is-immersive::before {
    display: none;
  }

  .media-grid,
  .date-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
  }

  .media-grid .media-tile.is-large {
    grid-column: span 2;
    grid-row: span 2;
  }

  .media-meta {
    left: 5px;
    right: 5px;
    bottom: 5px;
    gap: 4px;
    font-size: 11px;
  }

  .media-grid .media-tile:not(.is-large) .media-meta {
    display: none;
  }

  .media-chip {
    min-height: 21px;
    padding: 0 5px;
  }

  .media-like-chip {
    right: 5px;
    bottom: 5px;
    min-height: 21px;
    padding: 0 6px;
    font-size: 11px;
  }

  .auth-title h1 {
    font-size: 44px;
  }
}
