:root {
  color-scheme: light;
  --paper: #fffdf8;
  --ink: #242615;
  --olive: #405128;
  --olive-soft: #eef2e7;
  --gold: #c99f3b;
  --muted: #6d705e;
  --line: #e6dcc8;
  --danger: #9b2525;
  --shadow: 0 18px 50px rgba(64, 81, 40, 0.14);
  --title-font: "Great Vibes", "Brush Script MT", "Segoe Script", cursive;
  --body-font: "Poppins", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(238, 242, 231, 0.38), rgba(255, 253, 248, 0.48)),
    var(--paper);
  color: var(--ink);
  font-family: var(--body-font);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.guest-page {
  overflow-x: hidden;
}

.corner-florals {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.corner-floral {
  position: absolute;
  width: min(42vw, 430px);
  height: min(27vw, 260px);
  opacity: 0.92;
  filter: drop-shadow(0 14px 20px rgba(64, 81, 40, 0.1));
}

.corner-floral::before,
.corner-floral::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  display: block;
  width: 100%;
  aspect-ratio: 454 / 135;
  background-image: url("/assets/floral-corner.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.corner-floral::after {
  width: 72%;
  transform: rotate(-90deg);
  transform-origin: left bottom;
}

.corner-floral.top-left {
  top: 12px;
  left: -8px;
  transform: scaleY(-1);
}

.corner-floral.top-right {
  top: 12px;
  right: -8px;
  transform: scale(-1);
}

.corner-floral.bottom-left {
  bottom: 22px;
  left: -8px;
}

.corner-floral.bottom-right {
  right: -8px;
  bottom: 22px;
  transform: scaleX(-1);
}

.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: 26px;
  background:
    radial-gradient(circle at 50% 38%, rgba(238, 242, 231, 0.98), rgba(255, 253, 248, 0.96) 36%, #fffdf8 70%),
    var(--paper);
  color: var(--olive);
  text-align: center;
  opacity: 1;
  transition: opacity 950ms ease, visibility 950ms ease;
}

.intro-screen > :not(.intro-florals) {
  position: relative;
  z-index: 2;
}

.intro-florals {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.intro-floral {
  position: absolute;
  left: 50%;
  width: min(72vw, 560px);
  aspect-ratio: 454 / 135;
  background-image: url("/assets/floral-corner.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0;
  filter: drop-shadow(0 14px 22px rgba(64, 81, 40, 0.1));
  animation: introFloralReveal 1800ms 450ms ease-out forwards;
}

.intro-floral-top {
  top: clamp(22px, 6vh, 58px);
  transform: translateX(-50%) translateY(-18px);
}

.intro-floral-bottom {
  bottom: clamp(28px, 7vh, 70px);
  transform: translateX(-50%) translateY(18px) scaleY(-1);
  animation-delay: 850ms;
}

.guest-page.intro-complete .intro-screen {
  visibility: hidden;
  opacity: 0;
}

.intro-bloom {
  position: relative;
  width: 170px;
  height: 90px;
  animation: bloomRise 1700ms ease-out both;
}

.leaf,
.flower {
  position: absolute;
  display: block;
  opacity: 0;
  transform: scale(0.35) rotate(var(--angle));
  animation: bloomIn 1300ms ease-out forwards;
}

.leaf {
  width: 58px;
  height: 22px;
  border-radius: 58px 0;
  background: linear-gradient(135deg, #9daf7a, #405128);
  transform-origin: 8px 18px;
}

.leaf::after {
  content: "";
  position: absolute;
  inset: 10px 7px auto;
  height: 1px;
  background: rgba(255, 255, 255, 0.55);
}

.flower {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #c99f3b 0 15%, transparent 16%),
    radial-gradient(circle at 50% 18%, #fff 0 25%, transparent 26%),
    radial-gradient(circle at 84% 50%, #fff 0 25%, transparent 26%),
    radial-gradient(circle at 50% 84%, #fff 0 25%, transparent 26%),
    radial-gradient(circle at 16% 50%, #fff 0 25%, transparent 26%);
  box-shadow: 0 5px 18px rgba(64, 81, 40, 0.14);
}

.leaf-one {
  --angle: -28deg;
  left: 20px;
  top: 42px;
  animation-delay: 380ms;
}

.leaf-two {
  --angle: 28deg;
  right: 20px;
  top: 42px;
  animation-delay: 680ms;
}

.leaf-three {
  --angle: -6deg;
  left: 58px;
  top: 20px;
  animation-delay: 980ms;
}

.flower-one {
  --angle: 0deg;
  left: 71px;
  top: 34px;
  animation-delay: 1280ms;
}

.flower-two {
  --angle: 0deg;
  left: 98px;
  top: 44px;
  width: 21px;
  height: 21px;
  animation-delay: 1580ms;
}

.intro-kicker,
.intro-names {
  margin: 0;
}

.intro-kicker {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
}

.intro-screen h1 {
  margin: 0;
  animation: titleFloat 1500ms 1700ms ease-out both;
}

.intro-names {
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 500;
  animation: fadeUp 1200ms 2500ms ease-out both;
}

.intro-line {
  width: min(260px, 68vw);
  height: 2px;
  overflow: hidden;
  background: rgba(201, 159, 59, 0.22);
}

.intro-line span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--gold);
  transform: translateX(-100%);
  animation: lineSweep 2300ms 3000ms ease-in-out forwards;
}

.intro-skip {
  position: absolute;
  right: 22px;
  bottom: 22px;
  min-height: 40px;
  border: 1px solid rgba(64, 81, 40, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--olive);
  padding: 8px 15px;
  font-size: 0.92rem;
  font-weight: 600;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.intro-skip:hover {
  transform: translateY(-2px);
  border-color: rgba(64, 81, 40, 0.45);
  background: #fff;
}

.intro-skip:active {
  transform: translateY(0) scale(0.98);
}

.guest-shell {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 28px 16px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 650ms ease, transform 650ms ease;
}

.guest-page.intro-complete .guest-shell {
  opacity: 1;
  transform: translateY(0);
}

.upload-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(100%, 660px);
  padding: clamp(28px, 5vw, 72px);
  margin: 0 auto;
  text-align: center;
}

.brand-mark {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  color: var(--olive);
  text-align: center;
}

.brand-mark span {
  height: 1px;
  background: var(--gold);
}

.brand-mark p,
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.74rem;
}

h1 {
  margin: 22px 0 10px;
  color: var(--olive);
  font-family: var(--title-font);
  font-size: 6.2rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

.intro {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 1.18rem;
  line-height: 1.55;
}

.upload-form,
.login-card,
.qr-panel,
.toolbar,
.empty-state {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.upload-form {
  display: grid;
  gap: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
}

.field {
  display: grid;
  gap: 8px;
  text-align: center;
}

.field span {
  color: var(--olive);
  font-weight: 700;
}

.field small {
  color: var(--muted);
  font-weight: 400;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-align: center;
}

textarea {
  resize: vertical;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 430px);
  margin: 0 auto;
}

.action-tile {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 4px;
  min-height: 86px;
  align-content: center;
  padding: 12px 14px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: rgba(238, 242, 231, 0.72);
  color: var(--olive);
  text-align: center;
  animation: choiceGlow 3600ms ease-in-out infinite;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease, background 220ms ease;
}

.action-tile:nth-child(2) {
  animation-delay: 900ms;
}

.action-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0 34%, rgba(255, 255, 255, 0.82) 48%, transparent 62% 100%);
  pointer-events: none;
  transform: translateX(-120%);
  animation: choiceSweep 4200ms ease-in-out infinite;
}

.action-tile:nth-child(2)::before {
  animation-delay: 900ms;
}

.action-tile:hover {
  transform: translateY(-3px);
  border-color: #d8ad42;
  background: rgba(245, 248, 239, 0.88);
  box-shadow: 0 12px 28px rgba(64, 81, 40, 0.14);
}

.action-tile:hover::before {
  animation-duration: 1500ms;
}

.action-tile:active {
  transform: translateY(-1px) scale(0.99);
}

.action-tile input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.action-tile strong {
  font-size: 1rem;
}

.action-tile span {
  color: var(--muted);
  font-size: 0.86rem;
}

.selected-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  backdrop-filter: blur(14px);
}

.selected-heading,
.selected-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.selected-heading {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

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

.selected-list li {
  padding: 10px 14px;
  background: rgba(255, 253, 248, 0.58);
}

.selected-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-button,
.selected-list button,
.delete-button {
  border: 0;
  background: transparent;
  color: var(--danger);
  text-decoration: underline;
}

.primary-button,
.secondary-button,
.qr-download {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 46px;
  border-radius: 999px;
  border: 1px solid var(--olive);
  padding: 12px 20px;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(64, 81, 40, 0.12);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.primary-button::before,
.secondary-button::before,
.qr-download::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0 32%, rgba(255, 255, 255, 0.28) 48%, transparent 64% 100%);
  transform: translateX(-120%);
  transition: transform 620ms ease;
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.qr-download:focus-visible,
.intro-skip:focus-visible,
.action-tile:focus-within {
  outline: 3px solid rgba(201, 159, 59, 0.42);
  outline-offset: 3px;
}

.primary-button {
  background: linear-gradient(135deg, #405128, #61723b);
  color: #fff;
}

.secondary-button,
.qr-download {
  background: #fff;
  color: var(--olive);
}

.primary-button:not(:disabled):hover,
.secondary-button:not(:disabled):hover,
.qr-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(64, 81, 40, 0.18);
}

.primary-button:not(:disabled):hover::before,
.secondary-button:not(:disabled):hover::before,
.qr-download:hover::before {
  transform: translateX(120%);
}

.secondary-button:not(:disabled):hover,
.qr-download:hover {
  border-color: var(--gold);
  background: var(--olive-soft);
}

.primary-button:not(:disabled):active,
.secondary-button:not(:disabled):active,
.qr-download:active {
  transform: translateY(0) scale(0.98);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

.status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
}

.status[data-type="success"] {
  color: var(--olive);
}

.status[data-type="error"] {
  color: var(--danger);
}

.admin-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.login-view {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(430px, 100%);
  padding: 22px;
}

.login-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--line);
}

.login-card h1,
.admin-header h1 {
  font-size: 4.2rem;
}

.album-view {
  display: grid;
  gap: 18px;
}

.admin-header,
.toolbar,
.qr-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.admin-header h1 {
  margin: 6px 0 0;
}

.admin-actions,
.toolbar-actions,
.qr-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar,
.qr-panel,
.empty-state {
  padding: 16px;
  border-radius: 8px;
}

.toolbar span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.qr-panel {
  flex-wrap: wrap;
}

.qr-panel h2,
.empty-state h2 {
  margin: 0 0 6px;
  color: var(--olive);
}

.qr-panel p,
.empty-state p {
  margin: 0;
  color: var(--muted);
}

.qr-form {
  flex: 1 1 380px;
}

.qr-preview {
  width: 110px;
  height: 110px;
  border: 1px solid var(--line);
  background: #fff;
}

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

.photo-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(64, 81, 40, 0.09);
}

.photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #f5f0e8;
}

.photo-select {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--olive);
  font-size: 0.9rem;
}

.photo-select input {
  width: auto;
}

.photo-meta {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.photo-meta span,
.photo-meta p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.delete-button {
  padding: 0 12px 12px;
}

.empty-state {
  text-align: center;
}

@media (max-width: 820px) {
  .corner-floral {
    width: 196px;
    height: 132px;
    opacity: 0.58;
  }

  .corner-floral.top-left,
  .corner-floral.top-right {
    top: 8px;
  }

  .corner-floral.bottom-left,
  .corner-floral.bottom-right {
    bottom: 10px;
  }

  .intro-floral {
    width: min(86vw, 390px);
    opacity: 0;
  }

  .guest-shell {
    align-items: flex-start;
  }

  .upload-panel {
    justify-content: start;
  }

  .admin-header,
  .toolbar,
  .qr-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-actions,
  .toolbar-actions,
  .qr-form {
    width: 100%;
  }

  .admin-actions > *,
  .toolbar-actions > *,
  .qr-form > * {
    flex: 1;
  }
}

@keyframes bloomRise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bloomIn {
  to {
    opacity: 1;
    transform: scale(1) rotate(var(--angle));
  }
}

@keyframes titleFloat {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes lineSweep {
  55% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(100%);
  }
}

@keyframes introFloralReveal {
  from {
    opacity: 0;
  }

  to {
    opacity: 0.58;
  }
}

@keyframes choiceGlow {
  0%,
  100% {
    box-shadow: 0 8px 18px rgba(64, 81, 40, 0.08);
    border-color: rgba(201, 159, 59, 0.68);
  }

  45% {
    box-shadow: 0 12px 30px rgba(201, 159, 59, 0.26);
    border-color: rgba(201, 159, 59, 0.96);
  }
}

@keyframes choiceSweep {
  0%,
  42% {
    transform: translateX(-120%);
  }

  68%,
  100% {
    transform: translateX(120%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 520px) {
  .actions-grid,
  .toolbar-actions,
  .admin-actions,
  .qr-form {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .qr-download {
    width: 100%;
  }

  h1 {
    font-size: 3.2rem;
  }

  .login-card h1,
  .admin-header h1 {
    font-size: 3rem;
  }
}
