:root {
  --bg: #ffffff;
  --ink: #0a0a0a;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --fill: #f5f5f5;
  --ok: #111111;
  --err: #c1121f;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  color: var(--ink);
  font-family: "SF Pro Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.app {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: calc(18px + var(--safe-top)) clamp(16px, 4vw, 40px) calc(40px + var(--safe-bottom));
}

.top {
  display: block;
  margin-bottom: 22px;
  text-align: center;
}
.top h1 {
  margin: 5px 0 0;
  font-weight: 750;
  font-family: Georgia, "Times New Roman", serif;
}
.title-main, .title-names { display: block; }
.title-main {
  font-family: "SF Pro Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: clamp(1.35rem, 3.5vw, 2.1rem);
  font-weight: 720;
  letter-spacing: -.045em;
}
.title-names {
  margin-top: 3px;
  font-size: clamp(2.15rem, 6vw, 3.7rem);
  font-weight: 650;
  letter-spacing: -.055em;
  line-height: .98;
}
.top .eyebrow {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.tabs {
  position: sticky;
  top: calc(8px + var(--safe-top));
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  background: rgba(245,245,245,.96);
  border-radius: 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.tab {
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .92rem;
  font-weight: 650;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.ui-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.tab .ui-icon { margin-right: 7px; }
.tab.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.tab:active { transform: scale(.98); }
.tab-panel[hidden] { display: none !important; }
.tab-panel { animation: panel-in .2s ease-out; }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.upload-card {
  background: transparent;
  border: 0;
  padding: 0;
}

#fileInput { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.dropzone {
  width: 100%;
  min-height: clamp(280px, 42vh, 400px);
  border: 2px dashed #111;
  border-radius: 24px;
  background: #fff;
  color: #0a0a0a;
  padding: 36px 20px;
  display: grid;
  align-content: center;
  gap: 10px;
  justify-items: center;
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s ease, transform .15s ease;
}
.dropzone:hover { background: #fafafa; }
.dropzone:active { background: #f0f0f0; transform: scale(.995); }
.dz-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 999px;
  background: #0a0a0a;
  color: #fff;
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
  margin-bottom: 4px;
}
.dz-title {
  font-weight: 750;
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  letter-spacing: -0.035em;
}
.dz-sub {
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
}
.dz-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.dz-actions button {
  border: 1px solid #111;
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 14px 10px;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.dz-actions button:active { background: var(--fill); }

.hint {
  margin: 10px 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}
.privacy-note {
  max-width: 480px;
  margin: 12px auto 0;
  color: var(--muted);
  text-align: center;
  font-size: .78rem;
  line-height: 1.45;
}

.queue { margin-top: 12px; display: grid; gap: 8px; }
.q-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  font-size: 0.82rem;
  padding: 8px 10px;
  background: var(--fill);
  border-radius: 10px;
}
.q-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-bar {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 999px;
  background: #ddd;
  overflow: hidden;
}
.q-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  background: #0a0a0a;
  transition: width 0.15s linear;
}
.q-item.ok .q-bar > span { background: #0a0a0a; width: 100% !important; }
.q-item.err .q-bar > span { background: var(--err); width: 100% !important; }
.q-status { color: var(--muted); font-variant-numeric: tabular-nums; }

.gallery-wrap { margin-top: 4px; }
.gallery-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.section-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: .75rem;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.gallery-head h2 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  line-height: 1;
  letter-spacing: -.04em;
  font-weight: 750;
}
.count { font-size: 0.8rem; color: var(--muted); }

.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}
.tile {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border-radius: 7px;
  background: transparent;
  z-index: 0;
}
.tile:focus-within { z-index: 4; }
.tile-open {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  border-radius: 7px;
  padding: 0;
  overflow: hidden;
  background: var(--fill);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile .badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(0,0,0,0.82);
  color: #fff;
  font-size: 0.65rem;
  padding: 3px 6px;
  border-radius: 4px;
}
.reaction-bar {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
  z-index: 2;
}
.reaction-summary {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 0;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  color: #111;
  font: inherit;
  font-size: .88rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.reaction-trigger {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: rgba(255,255,255,.96);
  color: #111;
  font-size: 1.55rem;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.reaction-picker {
  position: absolute;
  right: 0;
  bottom: 35px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 8px;
  border: 1px solid #e5e5e5;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(0,0,0,.2);
  transform-origin: bottom right;
  animation: reaction-pop .15s ease-out;
}
.reaction-picker[hidden] { display: none; }
.reaction-choice {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: transparent;
  font-size: 1.85rem;
  cursor: pointer;
  line-height: 1;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,.1));
  animation: reaction-rise .28s cubic-bezier(.2,1.5,.45,1) both;
  transition: transform .16s cubic-bezier(.2,1.5,.45,1), filter .16s ease;
}
.reaction-choice:hover, .reaction-choice:focus {
  background: transparent;
  transform: translateY(-10px) scale(1.3);
  filter: drop-shadow(0 7px 4px rgba(0,0,0,.18));
  outline: none;
}
.reaction-choice:active { transform: translateY(-4px) scale(1.12); }
.reaction-choice:nth-child(1) { animation-delay: .015s; }
.reaction-choice:nth-child(2) { animation-delay: .045s; }
.reaction-choice:nth-child(3) { animation-delay: .075s; }
.reaction-choice:nth-child(4) { animation-delay: .105s; }
.reaction-choice:nth-child(5) { animation-delay: .135s; }
.reaction-choice:nth-child(6) { animation-delay: .165s; }
@keyframes reaction-pop {
  from { opacity: 0; transform: scale(.78); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes reaction-rise {
  from { opacity: 0; transform: translateY(14px) scale(.5); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .reaction-picker, .reaction-choice { animation: none; transition: none; }
}

.empty {
  text-align: center;
  color: var(--muted);
  margin: 36px 0;
  font-size: 0.92rem;
}
.more {
  display: block;
  width: 100%;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
}
.site-footer {
  margin-top: 42px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: .76rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: grid;
  place-items: center;
  padding: var(--safe-top) 12px var(--safe-bottom);
}
.lightbox[hidden] { display: none !important; }
.lb-body {
  width: min(100%, 900px);
  max-height: 85vh;
  display: grid;
  place-items: center;
}
.lb-body img, .lb-body video {
  max-width: 100%;
  max-height: 85vh;
}
.lb-close, .lb-nav {
  position: absolute;
  border: 0;
  background: rgba(255,255,255,0.14);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  font-size: 1.5rem;
  line-height: 1;
}
.lb-close { top: calc(12px + var(--safe-top)); right: 12px; }
.lb-nav.prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb-nav.next { right: 8px; top: 50%; transform: translateY(-50%); }

@media (min-width: 640px) {
  .gallery { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .dz-actions { width: min(420px, 100%); margin-left: auto; margin-right: auto; }
}

@media (min-width: 960px) {
  .gallery { grid-template-columns: repeat(4, 1fr); gap: 7px; }
}

@media (max-width: 420px) {
  .tabs {
    margin-left: -2px;
    margin-right: -2px;
    border-radius: 12px;
  }
  .tab {
    min-height: 50px;
    font-size: .9rem;
  }
  .reaction-picker { gap: 2px; padding: 5px; }
  .reaction-choice { width: 40px; height: 40px; font-size: 1.58rem; }
}
