:root {
  --bg: #faf8f5;
  --fg: #2c2825;
  --muted: #7a7268;
  --accent: #5c7a6b;
  --accent-dark: #4a6356;
  --gold: #b8956a;
  --card: #ffffff;
  --shadow: 0 4px 24px rgba(44, 40, 37, 0.08);
  --radius: 14px;
  font-family: "Outfit", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(184, 149, 106, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(92, 122, 107, 0.08), transparent);
}

h1, h2, h3, .brand {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(122, 114, 104, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-panel {
  display: contents;
}

.topbar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid rgba(122, 114, 104, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--fg);
  cursor: pointer;
  flex-shrink: 0;
}

.topbar-toggle:hover {
  border-color: rgba(92, 122, 107, 0.35);
  background: #fff;
}

.topbar-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topbar-toggle-bars,
.topbar-toggle-bars::before,
.topbar-toggle-bars::after {
  display: block;
  width: 1.1rem;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.topbar-toggle-bars {
  position: relative;
}

.topbar-toggle-bars::before,
.topbar-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
}

.topbar-toggle-bars::before {
  top: -6px;
}

.topbar-toggle-bars::after {
  top: 6px;
}

.topbar.is-open .topbar-toggle-bars {
  background: transparent;
}

.topbar.is-open .topbar-toggle-bars::before {
  top: 0;
  transform: rotate(45deg);
}

.topbar.is-open .topbar-toggle-bars::after {
  top: 0;
  transform: rotate(-45deg);
}

.brand {
  font-size: 1.35rem;
  color: var(--fg);
  text-decoration: none;
  flex-shrink: 1;
  min-width: 0;
  grid-column: 1;
  justify-self: start;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: 0.65rem 1rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  grid-column: 3;
  justify-self: end;
}

.nav-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: rgba(122, 114, 104, 0.1);
  grid-column: 2;
  justify-self: center;
}

.wedding-tab {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.wedding-tab:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.55);
}

.wedding-tab.is-active {
  color: var(--fg);
  background: var(--card);
  box-shadow: 0 1px 4px rgba(20, 18, 16, 0.1);
}

.nav a:not(.wedding-tab):not(.btn-nav) {
  color: var(--fg);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 400;
  white-space: nowrap;
}

.nav a:not(.wedding-tab):not(.btn-nav):hover {
  color: var(--accent);
}

.nav:empty {
  display: none;
}

.account-menu {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.account-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.account-link {
  display: block;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(122, 114, 104, 0.15);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.account-link:last-child {
  border-bottom: none;
}

.account-link:hover {
  background: rgba(92, 122, 107, 0.06);
  margin: 0 -1rem;
  padding-left: 1rem;
  padding-right: 1rem;
  border-radius: 8px;
}

.account-link-label {
  display: block;
  font-weight: 500;
}

.account-link-hint {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.account-link-danger .account-link-label {
  color: #8b3a3a;
}

.account-logout-form {
  margin: 0;
  padding: 0;
}

.account-logout-form .account-link {
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
}

.account-back {
  text-align: center;
  margin-top: 1.5rem;
}

.bug-report-card {
  max-width: 520px;
  margin: 1.25rem auto 0;
}

.nav .btn-nav {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff !important;
}

.nav .btn-nav:hover {
  background: var(--accent-dark);
  color: #fff !important;
}

.page {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.hero {
  text-align: center;
  padding: 2rem 0 2.5rem;
}

.hero-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  color: var(--gold);
  margin: 0 0 0.75rem;
  font-weight: 500;
}

.hero h1 {
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  margin: 0 0 0.75rem;
  line-height: 1.15;
}

.lede {
  margin: 0 auto;
  max-width: 32rem;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 300;
}

.home-hero {
  padding-bottom: 1.5rem;
}

.home-actions {
  display: grid;
  gap: 0.85rem;
  max-width: 640px;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .home-actions {
    grid-template-columns: 1fr 1fr;
  }
}

.home-action {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid rgba(122, 114, 104, 0.12);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.home-action:hover {
  transform: translateY(-2px);
  border-color: rgba(92, 122, 107, 0.28);
  box-shadow: 0 8px 28px rgba(44, 40, 37, 0.1);
}

.home-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.home-action-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  border-radius: 999px;
  background: rgba(92, 122, 107, 0.1);
}

.home-action-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.home-action-text strong {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.2;
}

.home-action-text span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin: 1.75rem 0 0;
}

.btn {
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  border: 1px solid rgba(122, 114, 104, 0.35);
  background: var(--card);
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.card.narrow {
  max-width: 420px;
  margin: 1rem auto;
}

.card.wide-register {
  max-width: 480px;
}

.landing-cards {
  display: grid;
  gap: 1.25rem;
  margin-top: 2rem;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 640px) {
  .landing-cards {
    grid-template-columns: 1fr 1fr;
  }
}

.landing-card {
  text-align: left;
}

.landing-card h2 {
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
}

.landing-card p {
  color: var(--muted);
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

.wedding-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2.5rem 0 3rem;
}

.wedding-tiles--single {
  display: flex;
  justify-content: center;
}

.wedding-tiles--single .wedding-tile {
  width: 100%;
  max-width: 380px;
}

.wedding-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: calc(var(--radius) + 2px);
  background: var(--card);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    var(--shadow);
  border: 1px solid rgba(122, 114, 104, 0.12);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.wedding-tile:hover {
  transform: translateY(-4px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 12px 40px rgba(44, 40, 37, 0.12);
  border-color: rgba(92, 122, 107, 0.25);
}

.wedding-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.wedding-tile-accent {
  height: 5px;
  background: linear-gradient(
    90deg,
    rgba(92, 122, 107, 0.55) 0%,
    rgba(184, 149, 106, 0.75) 50%,
    rgba(92, 122, 107, 0.55) 100%
  );
}

.wedding-tile--host .wedding-tile-accent {
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--gold) 45%,
    var(--accent-dark) 100%
  );
}

.wedding-tile-body {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.75rem 1.65rem 1.65rem;
  background:
    radial-gradient(ellipse 120% 80% at 100% 0%, rgba(184, 149, 106, 0.08), transparent 55%),
    radial-gradient(ellipse 80% 60% at 0% 100%, rgba(92, 122, 107, 0.06), transparent 50%);
}

.wedding-tile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.wedding-tile-title {
  font-size: 1.85rem;
  line-height: 1.2;
  margin: 0;
  flex: 1;
  min-width: 0;
}

.wedding-tile-badge {
  flex-shrink: 0;
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding: 0.32rem 0.6rem;
  border-radius: 999px;
  background: rgba(184, 149, 106, 0.18);
  color: var(--fg);
  border: 1px solid rgba(184, 149, 106, 0.35);
}

.wedding-tile-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 300;
  line-height: 1.55;
}

.landing-hint {
  margin-top: 2rem;
}

.join-code {
  font-family: ui-monospace, monospace;
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  background: rgba(92, 122, 107, 0.12);
  border-radius: 6px;
}

.join-code-banner {
  text-align: center;
  margin-bottom: 1.5rem;
}

.join-code-host {
  margin-top: 0.75rem;
  color: var(--muted);
}

.join-code-input {
  font-family: ui-monospace, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.form-divider {
  border: none;
  border-top: 1px solid rgba(122, 114, 104, 0.2);
  margin: 0.5rem 0;
}

.form-section-label {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.label-text {
  font-weight: 500;
  font-size: 0.9rem;
}

.optional {
  font-weight: 300;
  color: var(--muted);
}

label.field.invalid input,
label.field.invalid select,
label.field.invalid textarea {
  border-color: #c45c5c;
}

.field-error {
  color: #c45c5c;
  font-size: 0.85rem;
}

.field-hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.password-rules {
  margin: 0.25rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
select,
textarea {
  font: inherit;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(122, 114, 104, 0.3);
  background: var(--bg);
  color: var(--fg);
}

textarea {
  min-height: 7.5rem;
  resize: vertical;
}

.security-question-display {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: var(--bg);
  font-style: italic;
  color: var(--fg);
}

.error {
  color: #c45c5c;
  margin: 0 0 0.75rem;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 1rem 0 0;
  text-align: center;
}

.banner {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.banner.ok {
  border: 1px solid rgba(92, 122, 107, 0.4);
  background: rgba(92, 122, 107, 0.1);
}

.people-section {
  margin-bottom: 1.5rem;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.people-note {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.people-note a {
  color: var(--accent);
}

.people-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.person-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(122, 114, 104, 0.15);
}

.person-row:last-child {
  border-bottom: none;
}

.person-row.empty {
  color: var(--muted);
  justify-content: center;
}

.person-row.is-you {
  background: rgba(92, 122, 107, 0.06);
  margin: 0 -0.75rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  border-radius: 8px;
}

.person-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
}

.person-ident {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.person-name {
  font-weight: 500;
}

.person-email {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.person-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.person-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: rgba(184, 149, 106, 0.2);
  color: var(--fg);
  font-weight: 600;
}

.person-badge.you {
  background: rgba(92, 122, 107, 0.2);
}

.join-mode-field {
  border: none;
  margin: 0;
  padding: 0;
}

.join-mode-field .label-text,
.join-mode-field legend {
  display: block;
  margin-bottom: 0.35rem;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.35rem 0;
  cursor: pointer;
}

.radio-option input {
  margin-top: 0.2rem;
}

.person-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
}

.inline-form {
  display: inline;
  margin: 0;
}

.btn.small {
  font-size: 0.8rem;
  padding: 0.25rem 0.55rem;
}

.btn.danger {
  background: rgba(160, 70, 70, 0.12);
  border-color: rgba(160, 70, 70, 0.35);
  color: #8b3a3a;
}

.btn.danger:hover {
  background: rgba(160, 70, 70, 0.2);
}

.person-row.is-disabled {
  opacity: 0.65;
}

.person-badge.disabled {
  background: rgba(122, 114, 104, 0.12);
  color: var(--muted);
}

.person-toggle-form {
  margin-left: 0.5rem;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  user-select: none;
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: relative;
  flex-shrink: 0;
  width: 2.5rem;
  height: 1.4rem;
  background: rgba(122, 114, 104, 0.35);
  border-radius: 999px;
  transition: background 0.15s ease;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.1rem;
  height: 1.1rem;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease;
}

.toggle-input:checked + .toggle-slider {
  background: var(--accent, #5c7a6b);
}

.toggle-input:checked + .toggle-slider::after {
  transform: translateX(1.1rem);
}

.toggle-input:focus-visible + .toggle-slider {
  outline: 2px solid var(--accent, #5c7a6b);
  outline-offset: 2px;
}

.toggle-label {
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 4.5rem;
}

.person-remove-form {
  margin-left: 0.25rem;
}

.pending-row {
  background: rgba(184, 149, 106, 0.08);
  margin: 0 -0.75rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  border-radius: 8px;
}

.gallery-section {
  margin-top: 1rem;
}

.gallery-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.gallery-header h2 {
  font-size: 1.75rem;
  margin: 0;
}

.gallery-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.gallery-count {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

#gallery-download-all {
  font-size: 0.85rem;
  padding: 0.45rem 0.85rem;
}

.download-modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(20, 18, 16, 0.55);
  backdrop-filter: blur(4px);
}

.download-modal[hidden] {
  display: none !important;
}

.download-modal-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 2.25rem;
  text-align: center;
  max-width: 22rem;
  width: 100%;
}

.download-spinner {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 1.25rem;
  border: 3px solid rgba(92, 122, 107, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: download-spin 0.75s linear infinite;
}

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

.download-modal-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 500;
}

.download-modal-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.gallery-loading,
.gallery-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.gallery-empty .btn {
  margin-top: 1rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.gallery-sentinel {
  height: 1px;
  margin-top: -1px;
}

.gallery-load-more {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #eee;
  aspect-ratio: 1;
  cursor: pointer;
  border: none;
  padding: 0;
  display: block;
  width: 100%;
  box-shadow: 0 2px 12px rgba(44, 40, 37, 0.06);
  transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

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

.gallery-item-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  padding-left: 0.2rem;
  pointer-events: none;
}

.gallery-item-delete {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  padding: 0;
}

.gallery-item:hover .gallery-item-delete,
.gallery-item:focus-within .gallery-item-delete {
  opacity: 1;
}

.gallery-item-delete:hover {
  background: rgba(180, 40, 40, 0.85);
}

.gallery-item-delete:focus-visible {
  opacity: 1;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (pointer: coarse) {
  .gallery-item-delete {
    opacity: 0.85;
  }
}

.gallery-item-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 0.75rem 0.65rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  color: #fff;
  font-size: 0.8rem;
  text-align: left;
}

.gallery-item-caption {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-item-uploader {
  opacity: 0.85;
  font-size: 0.75rem;
}

.lightbox-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1rem;
}

.lightbox-action {
  min-width: 7rem;
}

.lightbox-actions .btn {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
}

.lightbox-actions .btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.lightbox-actions .btn.danger {
  background: rgba(160, 70, 70, 0.35);
  border-color: rgba(255, 180, 180, 0.45);
  color: #fff;
}

.lightbox-actions .btn.danger:hover {
  background: rgba(160, 70, 70, 0.5);
  color: #fff;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(20, 18, 16, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox-figure {
  margin: 0;
  max-width: min(92vw, 1100px);
  max-height: 90vh;
  text-align: center;
}

.lightbox-figure img,
.lightbox-figure video {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-figure figcaption {
  color: rgba(255, 255, 255, 0.85);
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  font-size: 2.5rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  cursor: pointer;
}

.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

.upload-hero {
  text-align: center;
  margin-bottom: 1.5rem;
}

.upload-hero h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

.settings-back {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.settings-card {
  max-width: 480px;
  margin: 0 auto 1.25rem;
}

.settings-card .stack {
  margin-top: 0.75rem;
}

.settings-heading {
  font-size: 1.2rem;
  margin: 0 0 0.35rem;
}

.settings-hero {
  text-align: center;
  margin-bottom: 1.5rem;
}

.settings-hero h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

.manage-hero {
  text-align: center;
  margin-bottom: 1.5rem;
}

.manage-hero h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

.page-hero {
  text-align: center;
  margin-bottom: 1.5rem;
}

.page-hero h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

.manage-actions-card,
.page-actions-card {
  max-width: 640px;
  margin: 0 auto 1.5rem;
}

.manage-heading,
.page-actions-heading {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}

.share-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 960px;
  margin: 0 auto 1.5rem;
}

@media (min-width: 640px) {
  .share-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

.share-card {
  margin: 0;
}

.share-heading {
  font-size: 1.1rem;
  margin: 0 0 0.35rem;
}

.share-code-row,
.share-link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.join-code-large {
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  padding: 0.5rem 0.85rem;
}

.share-url {
  flex: 1 1 12rem;
  word-break: break-all;
  color: var(--accent);
}

.share-qr-card {
  text-align: center;
}

.share-artifacts-card .artifacts-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.share-artifacts-card .artifact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.share-artifacts-card .artifact-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.share-artifacts-card .artifact-desc {
  font-size: 0.82rem;
  color: var(--muted);
}

.share-artifacts-card .btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  white-space: nowrap;
}

.share-qr {
  display: block;
  margin: 1rem auto 0;
  border-radius: 8px;
}

.copy-status {
  text-align: center;
  color: var(--accent);
  font-size: 0.9rem;
  margin: 0;
}

.upload-card {
  max-width: 640px;
  margin: 0 auto;
}

.drop-zone {
  border: 2px dashed rgba(92, 122, 107, 0.45);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: rgba(92, 122, 107, 0.04);
  margin-bottom: 1.25rem;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(92, 122, 107, 0.1);
  outline: none;
}

.drop-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.drop-title {
  font-weight: 500;
  margin: 0 0 0.25rem;
}

.drop-hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

.preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.preview-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem;
  border-radius: 10px;
  background: rgba(122, 114, 104, 0.06);
  border: 1px solid rgba(122, 114, 104, 0.12);
}

.preview-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  padding-right: 1.8rem;
}

.preview-name {
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-size {
  font-size: 0.7rem;
  color: var(--muted);
}

.preview-status {
  font-size: 0.68rem;
  font-weight: 600;
  margin-top: 0.1rem;
}

.preview-status-queued {
  color: var(--muted);
}

.preview-status-busy {
  color: var(--accent);
}

.preview-status-ok {
  color: #4a8f6a;
}

.preview-status-err {
  color: #c45c5c;
}

.preview-progress {
  height: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.preview-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.15s ease;
}

.preview-item-busy {
  border-color: rgba(122, 114, 104, 0.28);
}

.preview-item-done {
  opacity: 0.85;
}

.preview-item-failed {
  border-color: rgba(196, 92, 92, 0.35);
}

.preview-remove {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.preview-remove:hover {
  background: rgba(0, 0, 0, 0.75);
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.msg {
  min-height: 1.25rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.msg.ok { color: var(--accent); }
.msg.err { color: #c45c5c; }

.activity-card {
  max-width: 640px;
  margin: 1.5rem auto 0;
}

.activity-heading {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(122, 114, 104, 0.1);
  font-size: 0.85rem;
  line-height: 1.4;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  flex-shrink: 0;
  font-size: 0.9rem;
}

.activity-body {
  flex: 1 1 auto;
  min-width: 0;
}

.activity-who {
  font-weight: 600;
}

.activity-file {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14rem;
  display: inline-block;
  vertical-align: bottom;
}

.activity-when {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.activity-empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.5rem 0;
}

@media (max-width: 767px) {
  .topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    overflow-x: hidden;
  }

  .topbar-toggle {
    display: inline-flex;
    order: 2;
  }

  .brand {
    order: 1;
    flex: 1 1 auto;
    max-width: calc(100% - 3rem);
    font-size: 1.2rem;
    grid-column: unset;
  }

  .topbar-panel {
    display: none;
    order: 3;
    flex: 1 1 100%;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(122, 114, 104, 0.12);
    min-width: 0;
    max-width: 100%;
  }

  .topbar.is-open .topbar-panel {
    display: flex;
  }

  .nav-tabs {
    display: flex;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    grid-column: unset;
    justify-self: stretch;
    min-width: 0;
    gap: 0.1rem;
    padding: 0.2rem;
  }

  .nav-tabs .wedding-tab {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    padding: 0.35rem 0.35rem;
    font-size: 0.78rem;
  }

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

  .nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    grid-column: unset;
    justify-self: stretch;
  }

  .nav a:not(.wedding-tab):not(.btn-nav),
  .nav .btn-nav {
    display: block;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    text-align: center;
  }

  .nav a:not(.wedding-tab):not(.btn-nav):hover {
    background: rgba(122, 114, 104, 0.08);
  }
}

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

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .lightbox-nav {
    display: none;
  }
}

.site-footer {
  margin-top: auto;
  padding: 1.5rem 1.5rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.site-footer-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer-nav a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.site-footer-sep {
  opacity: 0.5;
}

.legal-page h2 {
  font-size: 1.35rem;
  margin: 2rem 0 0.75rem;
}

.legal-page section:first-of-type h2 {
  margin-top: 1.25rem;
}

.legal-page ul {
  padding-left: 1.25rem;
}

.legal-page li + li {
  margin-top: 0.35rem;
}

.legal-updated {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: -0.5rem;
}

.legal-links {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(122, 114, 104, 0.15);
}

.legal-agreement {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.legal-agreement a {
  color: var(--accent-dark);
}
