:root {
  color-scheme: light;
  --ink: #1d4e89;
  --muted: #5d87b5;
  --line: #d5e9fb;
  --blue: #7eb6ef;
  --blue-deep: #3d8fe8;
  --card: rgba(255, 255, 255, 0.88);
  --shadow: 0 18px 40px rgba(90, 150, 210, 0.16);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, #ffffff 0%, transparent 42%),
    linear-gradient(180deg, #ffffff 0%, #eef6ff 48%, #f7fbff 100%);
  color: var(--ink);
  font-family: "Playpen Sans Thai", "Segoe UI", sans-serif;
  line-height: 1.5;
}

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

button, input { font: inherit; color: inherit; }

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 48px 20px 64px;
}

.floaters { position: absolute; inset: 0; }

.floater {
  position: absolute;
  max-width: 150px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 28px;
  opacity: 0;
  transform: translateY(12px) scale(0.94);
  transition: opacity 1.3s ease, transform 1.3s ease;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.floater.is-on {
  opacity: 0.9;
  transform: translateY(0) scale(1);
  animation: drift 8s ease-in-out infinite alternate;
}

.hero-veil {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.97) 0%, rgba(255, 255, 255, 0.86) 30%, rgba(255, 255, 255, 0.2) 70%);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  display: grid;
  justify-items: center;
  text-align: center;
  animation: rise 0.9s ease both;
}

h1 {
  margin: 0;
  font-size: clamp(2.7rem, 8vw, 5.4rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.subtitle {
  max-width: 34rem;
  margin: 14px 0 28px;
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.25rem);
}

.plus {
  width: 88px;
  height: 88px;
  border: 1.5px dashed var(--blue);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--blue-deep);
  font-size: 3rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, background 0.25s ease;
}

.plus:hover { transform: translateY(-3px) scale(1.04); background: #fff; }

.hint { margin: 14px 0 0; color: var(--muted); }

.hint.warn { color: #c45b4a; }

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

#queue {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  width: min(640px, 100%);
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

#queue:not(:empty) {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.pick { width: 180px; animation: rise 0.45s ease both; }

.pick-frame { position: relative; }

.pick img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 22px;
  background: #e7f2ff;
  box-shadow: var(--shadow);
}

.icon-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--blue-deep);
  cursor: pointer;
}

.icon-remove svg { width: 16px; height: 16px; }

.pick input {
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: center;
}

@media (max-width: 699px) {
  #queue:not(:empty) {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(18px);
  }

  .pick { width: min(240px, 100%); }
}

.pick-status {
  position: absolute;
  inset: auto 8px 8px;
  margin: 0;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 0.75rem;
}

.pick-status.error, .pick-status.failed { color: #c45b4a; }

.batch-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.upload, .ghost {
  min-height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.upload {
  background: var(--blue-deep);
  color: #fff;
  box-shadow: var(--shadow);
}

.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

button:disabled { opacity: 0.5; cursor: not-allowed; }

.gallery {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 0 80px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  animation: rise 0.6s ease both;
}

.card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 20px;
  background: #e7f2ff;
}

.card-caption { margin: 0; overflow-wrap: anywhere; }

.card-actions { display: flex; gap: 8px; }

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--blue-deep);
  text-decoration: none;
  cursor: pointer;
}

.icon-button svg { width: 18px; height: 18px; }

.heart svg { fill: none; stroke: currentColor; stroke-width: 1.7; }

.heart[aria-pressed="true"] svg { fill: #ff7b9c; stroke: #ff7b9c; }

.heart.pop { animation: pop 0.35s ease; }

.empty { text-align: center; color: var(--muted); }

dialog {
  width: min(440px, calc(100vw - 24px));
  padding: 0;
  border: 0;
  background: transparent;
}

dialog::backdrop { background: rgba(90, 140, 190, 0.28); }

.sheet {
  padding: 24px;
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}

.sheet h2 { margin: 0 0 8px; }

.modal-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }

#modal-failures { margin: 12px 0 0; padding-left: 18px; text-align: left; }

.noscript { margin: 16px; text-align: center; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--blue-deep);
  outline-offset: 3px;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes drift {
  from { translate: 0 0; }
  to { translate: 0 -12px; }
}

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

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

@media (min-width: 1100px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
