:root {
  color-scheme: light;
  --bg: #f6fbff;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #ffffff;
  --border: rgba(89, 135, 171, 0.16);
  --text: #203246;
  --muted: #647688;
  --accent: #2f8fc8;
  --accent-soft: rgba(47, 143, 200, 0.12);
  --danger: #dd5a68;
  --success: #3f9b75;
  --shadow: 0 24px 60px rgba(52, 98, 136, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
  min-height: 100%;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(126, 214, 255, 0.26), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 213, 237, 0.28), transparent 24%),
    linear-gradient(180deg, #f9fdff 0%, #eef7ff 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  font-family: "Inter", "Helvetica Neue", "Segoe UI", sans-serif;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

video {
  max-width: 100%;
  display: block;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 64px;
}

.content-stack {
  display: grid;
  gap: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 28px;
}

.panel h1,
.panel-head h2 {
  margin: 0;
  line-height: 1.1;
}

.panel-head h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.panel-head h2 {
  font-size: 1.65rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.intro-copy,
.panel-head p,
.gallery-count,
.form-message,
.photo-meta,
.field span,
.lightbox__caption p:last-child {
  color: var(--muted);
}

.intro-copy {
  max-width: 650px;
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.7;
}

.panel-head {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.panel-head--intro {
  margin-bottom: 26px;
}

.panel-head--row {
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 16px;
}

.panel-head--gallery {
  margin-bottom: 18px;
}

.identity-form {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
}

.field {
  display: grid;
  gap: 8px;
  flex: 1 1 280px;
}

.field span {
  font-size: 0.88rem;
}

.field input,
.photo-form input,
.photo-form textarea {
  width: 100%;
  border: 1px solid rgba(89, 135, 171, 0.18);
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  border-radius: 16px;
  padding: 13px 15px;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.photo-form input:focus,
.photo-form textarea:focus {
  border-color: rgba(47, 143, 200, 0.78);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 0 0 4px rgba(47, 143, 200, 0.12);
}

.primary-button,
.ghost-button,
.lightbox__close,
.lightbox__nav,
.photo-download {
  border: 0;
  border-radius: 999px;
  min-height: 48px;
  padding: 12px 18px;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.primary-button {
  background: linear-gradient(135deg, #45b2f0, #2f8fc8);
  color: #ffffff;
  font-weight: 700;
}

.ghost-button,
.lightbox__close,
.lightbox__nav,
.photo-download {
  background: rgba(47, 143, 200, 0.09);
  color: var(--text);
}

.photo-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.primary-button:hover,
.ghost-button:hover,
.lightbox__close:hover,
.lightbox__nav:hover,
.photo-download:hover {
  transform: translateY(-1px);
}

.upload-surface {
  min-height: 260px;
  display: grid;
  place-items: center;
  border: 1.5px dashed rgba(47, 143, 200, 0.28);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(244, 251, 255, 0.96)),
    rgba(255, 255, 255, 0.78);
  padding: 24px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.upload-surface.is-dragging,
.upload-surface:focus-visible {
  border-color: rgba(47, 143, 200, 0.72);
  background: linear-gradient(180deg, rgba(47, 143, 200, 0.08), rgba(255, 255, 255, 0.9));
  transform: translateY(-1px);
}

.upload-surface__inner {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.upload-surface__title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 800;
}

.upload-surface__subtitle {
  margin: 0 0 8px;
  color: var(--muted);
}

.upload-progress {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.upload-progress__bar {
  width: 100%;
  height: 12px;
  background: rgba(47, 143, 200, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.upload-progress__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #65c8ff, #2f8fc8);
  transition: width 0.18s ease;
}

.upload-progress__meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.92rem;
}

.form-message {
  min-height: 1.4em;
  margin: 16px 0 0;
  font-size: 0.95rem;
}

.form-message.is-error {
  color: var(--danger);
}

.form-message.is-success {
  color: var(--success);
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 18px;
}

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

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(47, 143, 200, 0.08);
  border: 1px solid rgba(47, 143, 200, 0.14);
}

.profile-chip__label {
  font-size: 0.85rem;
  color: var(--muted);
}

.photo-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.photo-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  min-width: 0;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid rgba(47, 143, 200, 0.12);
}

.photo-thumb-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
}

.photo-thumb {
  display: block;
  position: relative;
  width: 100%;
  border: 0;
  border-radius: 18px;
  overflow: hidden;
  padding: 0;
  aspect-ratio: 1 / 1;
  background: rgba(47, 143, 200, 0.08);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-play-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(32, 50, 70, 0.72);
  color: #fff;
  font-size: 1.35rem;
  box-shadow: 0 12px 24px rgba(32, 50, 70, 0.22);
  pointer-events: none;
}

.photo-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(221, 90, 104, 0.96);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 20px rgba(125, 51, 59, 0.18);
}

.photo-delete:hover {
  transform: scale(1.04);
}

.photo-delete:disabled {
  opacity: 0.65;
  cursor: wait;
}

.photo-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
  font-size: 0.88rem;
}

.photo-meta strong,
.photo-meta span {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.photo-uploader {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

.photo-form {
  display: grid;
  gap: 10px;
}

.photo-readonly-meta {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(47, 143, 200, 0.06);
}

.photo-readonly-meta p {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
}

.photo-form textarea {
  min-height: 96px;
  resize: vertical;
}

.photo-status {
  min-height: 1.2em;
  font-size: 0.85rem;
  color: var(--muted);
}

.photo-status.is-error {
  color: var(--danger);
}

.photo-status.is-success {
  color: var(--success);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 12px;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(32, 50, 70, 0.48);
}

.lightbox__dialog {
  position: relative;
  z-index: 1;
  width: min(calc(100vw - 24px), 1200px);
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 16px;
  justify-items: center;
  align-content: center;
}

.lightbox__close {
  grid-column: 1;
  justify-self: end;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  align-self: center;
  transform: translateY(-50%);
  font-size: 2rem;
  line-height: 1;
  width: 56px;
  height: 56px;
}

#prevLightboxButton {
  left: 12px;
}

#nextLightboxButton {
  right: 12px;
}

.lightbox__stage {
  grid-column: 1;
  width: fit-content;
  height: fit-content;
  min-height: 0;
  max-width: min(92vw, 1160px);
  max-height: calc(100vh - 190px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 30px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(47, 143, 200, 0.12);
  touch-action: pan-y;
  padding: 12px;
  box-shadow: 0 18px 42px rgba(32, 50, 70, 0.14);
}

.lightbox__stage.is-zoomed {
  touch-action: none;
}

.lightbox__stage img {
  width: auto;
  height: auto;
  max-width: min(88vw, 1136px);
  max-height: calc(100vh - 214px);
  object-fit: contain;
  object-position: center center;
  transform-origin: center center;
  transition: transform 0.18s ease;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox__stage video {
  width: auto;
  height: auto;
  max-width: min(88vw, 1136px);
  max-height: calc(100vh - 214px);
  object-fit: contain;
  object-position: center center;
  background: rgba(255, 255, 255, 0.96);
}

.lightbox__stage img.is-zoomed {
  cursor: grab;
  transition: none;
}

.lightbox__stage.is-zoomed:active img.is-zoomed {
  cursor: grabbing;
}

.lightbox__caption {
  display: none;
}

.lightbox__caption p {
  margin: 0;
}

.lightbox__caption p:first-child {
  font-size: 1rem;
  font-weight: 600;
}

@media (max-width: 900px) {
  .lightbox__dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    margin: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .lightbox__close,
  .lightbox__stage,
  .lightbox__caption {
    grid-column: 1;
  }

  .lightbox__nav {
    width: 48px;
    height: 48px;
  }

  #prevLightboxButton {
    left: 12px;
  }

  #nextLightboxButton {
    right: 12px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100%, calc(100% - 20px));
    padding-top: 26px;
    padding-bottom: 28px;
  }

  .panel {
    border-radius: 22px;
    padding: 20px;
  }

  .lightbox__dialog {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
    margin: 0;
    gap: 12px;
  }

  .lightbox__stage {
    max-width: calc(100vw - 12px);
    max-height: calc(100vh - 170px);
    border-radius: 24px;
    padding: 8px;
  }

  .lightbox__stage img,
  .lightbox__stage video {
    max-width: calc(100vw - 28px);
    max-height: calc(100vh - 190px);
  }

  .panel-head h1 {
    font-size: clamp(1.95rem, 9vw, 2.6rem);
    line-height: 1.14;
  }

  .panel-head h2 {
    font-size: 1.45rem;
  }

  .intro-copy {
    font-size: 0.98rem;
    line-height: 1.62;
  }

  .panel-head--row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .identity-form {
    flex-direction: column;
    align-items: stretch;
  }

  .identity-form .primary-button,
  .upload-surface .primary-button {
    width: 100%;
    justify-content: center;
  }

  .app-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .editor-actions {
    width: 100%;
  }

  .editor-actions .ghost-button {
    flex: 1 1 0;
    justify-content: center;
  }

  .photo-grid {
    grid-template-columns: 1fr;
  }

  .upload-surface {
    min-height: 220px;
    padding: 20px 16px;
  }

  .upload-surface__title {
    font-size: 1.55rem;
  }

  .upload-progress__meta {
    flex-direction: column;
    gap: 4px;
  }

  .photo-card {
    padding: 12px;
  }

  .photo-delete {
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    min-height: 32px;
  }

  .photo-play-badge {
    width: 54px;
    height: 54px;
    font-size: 1.15rem;
  }

  .photo-form textarea {
    min-height: 88px;
  }

  .lightbox__close {
    width: 100%;
    justify-self: stretch;
  }

  .lightbox__nav {
    width: 48px;
    height: 48px;
    min-height: 48px;
  }

  #prevLightboxButton {
    left: 8px;
  }

  #nextLightboxButton {
    right: 8px;
  }
}

@media (max-width: 420px) {
  .page-shell {
    width: min(100%, calc(100% - 16px));
    padding-top: 18px;
  }

  .panel {
    padding: 16px;
    border-radius: 18px;
  }

  .field input,
  .photo-form input,
  .photo-form textarea {
    padding: 12px 14px;
  }

  .profile-chip {
    width: 100%;
    justify-content: center;
  }
}

.duplicate-panel {
  display: grid;
  gap: 16px;
}

.duplicate-results {
  display: grid;
  gap: 18px;
}

.duplicate-group {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--panel-strong);
}

.duplicate-group__head,
.duplicate-group__actions,
.photo-section-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.duplicate-group__head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.duplicate-group__head span {
  color: var(--muted);
  font-size: 0.9rem;
}

.duplicate-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.duplicate-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

.duplicate-card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.duplicate-card input {
  justify-self: start;
}

.duplicate-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
}

.duplicate-card__details {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.duplicate-card__details strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.duplicate-card__details p {
  margin: 0;
  color: var(--text);
  line-height: 1.4;
}

.slideshow-start {
  justify-self: end;
}

body.slideshow-open {
  overflow: hidden;
}

.slideshow {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #050505;
  color: #ffffff;
  overflow: hidden;
}

.slideshow__stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.slideshow__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 1.8s ease, transform 7s ease;
  will-change: opacity, transform;
}

.slideshow__image.is-active {
  opacity: 1;
}

.slideshow__image.is-active.is-zoom-a {
  transform: scale(1.12) translate3d(1.5%, -1.5%, 0);
}

.slideshow__image.is-active.is-zoom-b {
  transform: scale(1.12) translate3d(-1.5%, 1.5%, 0);
}

.slideshow__controls {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(92vw, 760px);
  padding: 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(12px);
}

.slideshow__button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
}

.slideshow__counter {
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.9rem;
}

.slideshow__caption {
  position: absolute;
  left: 50%;
  top: 20px;
  transform: translateX(-50%);
  max-width: min(88vw, 900px);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
  font-size: 0.95rem;
  backdrop-filter: blur(12px);
}

@media (max-width: 700px) {
  .slideshow__controls {
    border-radius: 24px;
  }

  .slideshow__caption {
    border-radius: 18px;
  }
}

