/* MyHome — mobile-first family memories */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --accent: #f97316;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.05);
  --radius: 12px;
  --gap: 12px;
  --tabbar-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #334155;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.4);
  }
}

html[data-theme="dark"] {
  --bg: #0f172a; --surface: #1e293b; --text: #f1f5f9; --muted: #94a3b8;
  --border: #334155; --primary: #3b82f6; --primary-hover: #60a5fa;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.4);
}
html[data-theme="light"] {
  --bg: #f8fafc; --surface: #ffffff; --text: #0f172a; --muted: #64748b;
  --border: #e2e8f0; --primary: #2563eb; --primary-hover: #1d4ed8;
  --shadow: 0 1px 2px rgba(15,23,42,0.06), 0 4px 12px rgba(15,23,42,0.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.5rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.15rem; margin: 1.25rem 0 0.5rem; }
p  { margin: 0.5em 0; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }

/* Top bar (mobile) */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); font-size: 1.1rem; }
.brand-upload {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 999px;
  background: var(--accent, #f97316); color: #fff;
  text-decoration: none; font-size: 1.05rem; line-height: 1;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.brand-upload:hover, .brand-upload.active { filter: brightness(1.05); }
.menu-toggle {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; color: var(--text); font-size: 1.05rem; line-height: 1;
}
.search { flex: 1; }
.search input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--bg); color: var(--text);
}
.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 10px; color: var(--text);
}

/* Sidebar (desktop) */
/* Sidebar as slide-in overlay on mobile */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: min(78vw, 320px);
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 12px;
  transform: translateX(-100%); transition: transform 0.2s ease;
  z-index: 60; overflow-y: auto;
  display: flex; flex-direction: column; justify-content: space-between;
  padding-top: calc(20px + env(safe-area-inset-top));
}
.sidebar.open { transform: translateX(0); }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.sidebar nav a,
.sidebar-foot a,
.sidebar-foot form button {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; color: var(--text); text-decoration: none;
  background: none; border: none; text-align: left; width: 100%;
}
.sidebar nav a:hover, .sidebar-foot a:hover { background: var(--bg); }
.sidebar nav a.active, .sidebar-foot a.active { background: var(--primary); color: white; }
.sidebar nav a.upload { background: var(--accent); color: white; margin-top: 8px; }
.sidebar-foot { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 55; opacity: 0; transition: opacity 0.2s ease;
}
.sidebar-backdrop.on { opacity: 1; }
.ic { font-size: 1.2rem; }

/* Bottom tab bar (mobile) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  height: var(--tabbar-h);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); text-decoration: none; font-size: 1.4rem; gap: 2px;
}
.tabbar a small { font-size: 0.7rem; }
.tabbar a.active { color: var(--primary); }
.tabbar-plus span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary); color: white; margin-top: -18px;
  box-shadow: var(--shadow); font-weight: 700;
}
.tabbar-plus small { margin-top: 2px; }

.content { padding: 12px; max-width: 1200px; margin: 0 auto; }
.flash { padding: 10px 14px; background: var(--primary); color: white; border-radius: var(--radius); margin-bottom: 12px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

.hero { padding: 16px 0; }
.hero h1 { font-size: 1.6rem; }
.hero .sub { color: var(--muted); }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); text-decoration: none;
  min-height: 44px; gap: 6px;
}
.btn.primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); text-decoration: none; }
.btn.danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn.big { width: 100%; padding: 14px; font-size: 1.05rem; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 0.9rem; }
.link { background: none; border: none; color: var(--muted); text-decoration: underline; }
.link.danger { color: var(--danger); }

/* Grid of photos */
.photo-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
}
@media (min-width: 500px) { .photo-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 800px) { .photo-grid { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 1200px) { .photo-grid { grid-template-columns: repeat(8, 1fr); } }
.photo-cell {
  position: relative; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 6px;
  background: var(--border); display: block;
}
.photo-cell img { width: 100%; height: 100%; object-fit: cover; }
.photo-cell input[type="checkbox"] {
  position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; z-index: 2;
  accent-color: var(--primary);
}
.photo-grid.selectable .photo-cell input:checked ~ img { opacity: 0.7; }
.photo-grid.selectable .photo-cell input:checked ~ .check { display: flex; }
.photo-grid.selectable .photo-cell .check {
  display: none; position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary); color: white; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; z-index: 2;
}

.month-header { color: var(--muted); font-weight: 600; margin-top: 20px; }

/* Cards */
.album-grid, .member-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .album-grid, .member-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .album-grid, .member-grid { grid-template-columns: repeat(4, 1fr); } }

.album-card, .member-card, .post-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--text);
  display: block;
}
.album-cover { aspect-ratio: 4 / 3; background: var(--border); }
.album-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--muted); }
.album-info { padding: 10px 12px; }
.album-title { font-weight: 600; }
.album-sub { color: var(--muted); font-size: 0.85rem; }

.member-card { padding: 14px 10px; text-align: center; }
.avatar {
  width: 72px; height: 72px; margin: 0 auto 8px; border-radius: 50%;
  background: var(--border); overflow: hidden; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; color: var(--muted);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 120px; height: 120px; font-size: 2.5rem; }
.member-name { font-weight: 600; }
.member-sub, .member-birth { color: var(--muted); font-size: 0.85rem; }

.member-head { display: flex; align-items: center; gap: 16px; }

.member-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; }
.member-chip {
  display: inline-flex; flex-direction: column; padding: 8px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); white-space: nowrap;
}
.member-chip .date { color: var(--muted); font-size: 0.8rem; }

.post-list { display: flex; flex-direction: column; gap: 12px; }
.post-card { padding: 14px; }
.post-title { font-weight: 700; font-size: 1.1rem; }
.post-sub { color: var(--muted); font-size: 0.85rem; }
.post-excerpt { color: var(--muted); margin-top: 6px; }
.post-view h1 { margin-top: 12px; }
.post-body { line-height: 1.7; margin: 16px 0; }
.post-body img { max-width: 100%; border-radius: 8px; }
.post-body h1, .post-body h2, .post-body h3 { margin-top: 1.5em; }
.post-body p { margin: 1em 0; }

/* Instagram-style feed */
.feed { display: flex; flex-direction: column; gap: 24px; max-width: 560px; margin: 0 auto; }
.feed-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.feed-media {
  position: relative; display: block; aspect-ratio: 1 / 1;
  background: var(--border); overflow: hidden;
}
.feed-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.feed-empty {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: var(--muted); background: var(--bg);
}
.feed-count {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,0.6); color: white; padding: 4px 10px;
  border-radius: 999px; font-size: 0.75rem; font-weight: 600;
}
.feed-body { padding: 12px 14px 14px; }
.feed-title {
  display: block; font-weight: 700; font-size: 1.05rem; color: var(--text);
  text-decoration: none; margin-bottom: 4px;
}
.feed-title:hover { text-decoration: underline; }
.feed-caption { color: var(--text); margin: 4px 0 6px; line-height: 1.45; }
.feed-date { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* Instagram-style post detail: carousel */
.post-view.insta { max-width: 640px; margin: 0 auto; }
.post-carousel {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  gap: 0; margin: 12px -12px 0; background: black;
  scrollbar-width: none;
}
.post-carousel::-webkit-scrollbar { display: none; }
.carousel-slide {
  flex: 0 0 100%; scroll-snap-align: center;
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1; background: black;
}
.carousel-slide img { width: 100%; height: 100%; object-fit: contain; display: block; }
.carousel-dots {
  display: flex; justify-content: center; gap: 6px; padding: 10px 0;
}
.carousel-dots .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted); opacity: 0.4;
}
.carousel-dots .dot.active { opacity: 1; background: var(--primary); }
.insta-head { padding: 12px 0 4px; }
.insta-title { font-size: 1.4rem; margin: 0 0 6px; }
.insta-date { color: var(--muted); font-size: 0.85rem; margin: 0; }

@media (min-width: 900px) {
  .post-carousel { margin-left: 0; margin-right: 0; border-radius: var(--radius); }
}

/* Family tree */
.tree-wrap {
  overflow-x: auto; overflow-y: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; margin: 12px 0;
  -webkit-overflow-scrolling: touch;
}
.tree-svg { display: block; min-width: 100%; }
.tree-svg .gen-label {
  fill: var(--muted); font-size: 14px; font-weight: 700;
  font-family: inherit; letter-spacing: 0.05em;
}
.tree-svg .node-rect {
  fill: var(--surface); stroke: var(--border); stroke-width: 1.5;
  transition: stroke 0.15s, fill 0.15s;
}
.tree-svg .node-rect.deceased {
  fill: var(--bg); stroke-dasharray: 4 3;
}
.tree-svg a:hover .node-rect { stroke: var(--primary); fill: var(--bg); }
.tree-svg .node-avatar { fill: var(--primary); }
.tree-svg .node-avatar.deceased { fill: var(--muted); }
.tree-svg .node-init {
  fill: white; font-size: 22px; font-weight: 700;
  font-family: inherit;
}
.tree-svg .node-name {
  fill: var(--text); font-size: 15px; font-weight: 700;
  font-family: inherit;
}
.tree-svg .node-role {
  fill: var(--muted); font-size: 12px;
  font-family: inherit;
}
.tree-svg .node-dates {
  fill: var(--muted); font-size: 11px; font-style: italic;
  font-family: inherit;
}
.tree-svg .edge-spouse {
  stroke: var(--accent); stroke-width: 3; stroke-linecap: round;
}
.tree-svg .edge-parent {
  stroke: var(--muted); stroke-width: 1.5;
}

.tag { display: inline-block; padding: 4px 10px; margin: 2px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 0.9rem; }
.tag small { color: var(--muted); margin-left: 4px; }
.tag-cloud { padding: 8px 0; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 10px; max-width: 620px; }
.stack > label { display: block; }
.stack input[type="text"], .stack input[type="date"], .stack input[type="password"],
.stack textarea, .stack select, form.upload input, form.upload select, form.upload textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
label { color: var(--muted); font-size: 0.9rem; }
label > input, label > textarea, label > select { color: var(--text); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
legend { padding: 0 6px; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Upload */
.upload-album {
  display: block; margin-bottom: 12px; font-weight: 600; color: var(--text);
}
.upload-album select { margin-top: 6px; width: 100%; }
.upload .drop {
  display: block; border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px 16px; text-align: center; cursor: pointer; background: var(--surface);
  transition: border-color 0.2s;
}
.upload .drop:hover { border-color: var(--primary); }
.upload .drop input[type="file"] { position: absolute; left: -9999px; }
.drop-icon { font-size: 2.5rem; }
.drop-title { font-weight: 600; margin-top: 8px; }
.drop-sub { color: var(--muted); font-size: 0.9rem; }
.camera-row { margin-top: 8px; display: flex; justify-content: center; }
.upload-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px; margin-top: 12px;
}
.upload-item {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; display: flex; flex-direction: column;
}
.upload-item .thumb {
  aspect-ratio: 1 / 1; background: var(--bg); display: flex;
  align-items: center; justify-content: center; overflow: hidden;
}
.upload-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-item .thumb .placeholder { font-size: 2rem; color: var(--muted); }
.upload-item .meta { padding: 6px 8px; font-size: 0.75rem; }
.upload-item .name {
  color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.upload-item .status { color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.upload-item[data-status="done"] .status { color: #16a34a; }
.upload-item[data-status="failed"] .status { color: var(--danger); }
.upload-item .bar { height: 3px; background: var(--border); }
.upload-item .bar > i { display: block; height: 100%; width: 0; background: var(--primary); transition: width 0.15s; }
.upload-item .retry { margin-top: 4px; }
.upload-summary { margin-top: 14px; }
.upload-progress-bar { width: 100%; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.upload-progress-bar #upload-progress-fill { height: 100%; width: 0; background: var(--primary); transition: width 0.2s; }
.upload-extra { margin-top: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.upload-extra summary { cursor: pointer; font-weight: 600; }
.upload-extra label { display: block; margin-top: 10px; color: var(--text); font-size: 1rem; }
.upload-status { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }
progress { width: 100%; height: 8px; }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.sm { padding: 4px 10px; font-size: 0.85rem; }
.ok { color: #15803d; padding: 10px; background: rgba(22,163,74,0.1); border-radius: 8px; margin-bottom: 12px; }
.hint { color: var(--muted); font-size: 0.9rem; }
.small { font-size: 0.85rem; }
.stack { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.stack > * { margin: 0; }
.tbl { width: 100%; border-collapse: collapse; margin-bottom: 12px; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; font-size: 0.9rem; }
.tbl th { background: var(--bg); color: var(--muted); font-weight: 600; }
.tbl tr:last-child td { border-bottom: none; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.card .url { width: 100%; padding: 6px 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-family: monospace; font-size: 0.85rem; }
.invite-url-row { display: flex; gap: 6px; align-items: center; }
.invite-url-row .url { flex: 1; }
.lbl { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.lbl > input, .lbl > select { padding: 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; }
.me { margin-left: auto; padding: 0 8px; color: var(--muted); font-size: 0.9rem; }
.logout-inline button { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 0.9rem; padding: 4px 8px; }
.logout-inline button:hover { color: var(--danger); }

/* Photo detail */
.photo-view .back { color: var(--muted); }
.photo-full { margin: 12px 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.photo-full img { width: 100%; height: auto; }
.photo-meta { color: var(--muted); font-size: 0.9rem; display: flex; flex-direction: column; gap: 4px; }
.photo-meta a { color: var(--muted); text-decoration: underline; }
.photo-edit { margin-top: 20px; }

/* Login */
.login {
  max-width: 400px; margin: 40px auto; padding: 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  text-align: center;
}
.login h1 { font-size: 1.8rem; }
.login .sub { color: var(--muted); margin-bottom: 20px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form input {
  padding: 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
.setup { color: var(--accent); font-weight: 500; }
.err { color: var(--danger); padding: 10px; background: rgba(220,38,38,0.1); border-radius: 8px; margin-bottom: 12px; }

.empty { color: var(--muted); text-align: center; padding: 32px 12px; grid-column: 1 / -1; }
.desc { color: var(--muted); margin: 8px 0 16px; }
.sub { color: var(--muted); font-size: 0.9rem; }

/* Menu (details as dropdown) */
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] > *:not(summary) {
  position: absolute; right: 0; top: calc(100% + 4px); min-width: 160px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px; box-shadow: var(--shadow); z-index: 5;
}
.menu[open] a, .menu[open] form { display: block; padding: 8px 10px; }

/* Sticky actions for pickers */
.sticky-actions {
  position: sticky; bottom: calc(var(--tabbar-h) + 8px); background: linear-gradient(transparent, var(--bg) 30%);
  padding-top: 20px; margin-top: 12px;
}

/* Timeline */
.timeline-group { margin-bottom: 24px; }
.events { list-style: none; padding: 0; margin: 8px 0; }
.events li { padding: 6px 0; color: var(--muted); }
.events li a { color: var(--text); }

/* Search */
.search-hits { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.search-hits li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.search-hits .kind { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--primary); color: white; font-size: 0.75rem; margin-right: 8px; }
.search-hits .excerpt { color: var(--muted); margin-top: 4px; }

/* Member picker (checkboxes) */
.member-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.member-picker .chk {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg); color: var(--text); font-size: 0.9rem;
  display: inline-flex; align-items: center; gap: 4px;
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.95);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; touch-action: pan-y;
}
.lightbox[hidden] { display: none; }
.lb-img { max-width: 100%; max-height: 90vh; object-fit: contain; }
.lb-close, .lb-prev, .lb-next {
  position: absolute; background: rgba(255,255,255,0.15); color: white;
  border: none; border-radius: 50%; width: 44px; height: 44px; font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
}
.lb-close { top: 20px; right: 20px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lb-caption { position: absolute; bottom: 20px; left: 20px; right: 20px; color: white; text-align: center; font-size: 0.9rem; }

/* Filter row */
.filter select { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }

/* Photo picker large button (bottom) */
.photo-picker .sticky-actions { z-index: 25; }

/* Desktop layout */
@media (min-width: 900px) {
  body { padding-left: 220px; padding-bottom: 0; }
  .tabbar { display: none; }
  .topbar { display: none; }
  .menu-toggle { display: none; }
  .sidebar-backdrop { display: none !important; }
  .sidebar {
    width: 220px; transform: none;
    padding-top: 20px;
  }
  .content { padding: 24px; }
  .hero h1 { font-size: 2rem; }
}

/* Video cells (badge overlay on gallery/videos grid) */
.photo-cell.is-video { position: relative; }
.photo-cell .video-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 12px;
  line-height: 28px;
  text-align: center;
  padding-left: 2px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.35);
  pointer-events: none;
}
