:root {
  --page-bg: oklch(93% 0.004 250);
  --card-bg: oklch(99% 0.003 250);
  --yellow: oklch(80% 0.15 85);
  --yellow-soft: oklch(92% 0.09 90);
  --text: oklch(20% 0 0);
  --text-2: oklch(45% 0.01 250);
  --text-3: oklch(55% 0.01 250);
  --text-4: oklch(58% 0.01 250);
  --red: oklch(55% 0.18 25);
  --border: oklch(85% 0.005 250);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
h1, .drop-label { font-family: 'Baloo 2', sans-serif; }
button { font: inherit; }
a { color: var(--text); text-decoration: underline; }
a:hover { color: oklch(35% 0.02 90); }
[hidden] { display: none !important; }
#file-input { display: none; }

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

/* Layout shell */
.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: max(28px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}
.card {
  width: 100%;
  max-width: 460px;
  background: var(--card-bg);
  border-radius: 28px;
  box-shadow: 0 8px 30px oklch(0% 0 0 / 0.08);
  overflow: hidden;
}

/* Header */
.intro { padding: 30px 24px 4px; }
.intro h1 { margin: 0; font-size: 32px; font-weight: 700; line-height: 1.1; color: var(--text); }
.intro p { margin: 6px 0 0; font-size: 16px; line-height: 1.5; color: var(--text-2); }

.body { padding: 20px 24px 28px; display: flex; flex-direction: column; gap: 18px; }

/* Drop zone */
.drop {
  border: 2.5px dashed oklch(88% 0.02 90);
  border-radius: 20px;
  background: oklch(98% 0.006 90);
  padding: 34px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.drop.is-over { border-color: var(--yellow); background: oklch(95% 0.06 90); }
.drop:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.drop-icon {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--yellow-soft); color: oklch(25% 0.02 90);
  display: flex; align-items: center; justify-content: center;
}
.drop-label { font-size: 17px; font-weight: 600; color: oklch(25% 0 0); }
.drop-help { font-size: 12px; color: var(--text-3); }

/* Buttons */
.btn {
  min-height: 50px;
  padding: 0 26px;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.btn-lg { min-height: 54px; font-size: 16px; }
.btn-primary { background: var(--yellow); color: oklch(15% 0 0); }
.btn-danger { background: var(--red); color: white; }
.btn-outline { border: 1px solid var(--border); background: oklch(96% 0.006 250); color: oklch(25% 0 0); font-size: 14px; }
.btn:active { transform: scale(0.98); }

/* Files + states */
.files { display: flex; flex-direction: column; gap: 14px; }

.banner {
  background: var(--yellow-soft);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  color: oklch(25% 0.02 90);
}

.progress-row {
  display: flex; justify-content: space-between;
  font-size: 13px; font-weight: 700; color: var(--text-2);
  margin-bottom: 6px;
}
.progress-track { height: 9px; border-radius: 999px; background: oklch(90% 0.005 250); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--yellow); border-radius: 999px; transition: width 0.25s; }

.done-badge {
  display: flex; align-items: center; gap: 10px;
  width: fit-content;
  background: var(--yellow-soft);
  border: 1px solid var(--yellow);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px; font-weight: 700; color: var(--text);
}
.done-check {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--text); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
}

/* Thumbnail grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-layer { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.tile-shade { background: linear-gradient(oklch(0% 0 0 / 0), oklch(0% 0 0 / 0.12)); transition: background 0.2s; }
.tile.is-active .tile-shade { background: linear-gradient(oklch(0% 0 0 / 0), oklch(0% 0 0 / 0.35)); }
.tile-play {
  width: 0; height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 14px solid oklch(97% 0.005 60 / 0.9);
}
.tile.is-video.is-active .tile-play { display: none; }
.tile-status { display: none; }
.tile.is-uploading .tile-status, .tile.is-done .tile-status, .tile.is-failed .tile-status { display: flex; }
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid oklch(100% 0 0 / 0.35);
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}
.badge {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
}
.badge-ok { background: var(--yellow); color: oklch(15% 0 0); }
.badge-fail { background: var(--red); color: white; }
.tile-remove {
  position: absolute; top: 5px; right: 5px;
  width: 22px; height: 22px; padding: 0;
  border: none; border-radius: 50%;
  background: oklch(15% 0 0 / 0.55); color: white;
  font-size: 13px; line-height: 1;
  cursor: pointer;
}
/* Bigger invisible tap target for the × on phones */
.tile-remove::after { content: ''; position: absolute; inset: -8px; }

.note { margin: 0; font-size: 12px; line-height: 1.5; text-align: center; color: var(--text-4); }

/* Footer */
.footer {
  padding: 60px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
}
.footer-by { font-size: 14px; font-weight: 600; color: oklch(35% 0.01 250); }
.footer-logo { height: 42px; width: auto; }
.footer-contact { font-size: 14px; line-height: 1.7; color: oklch(30% 0.01 250); margin-top: 4px; }
.footer-contact a { color: inherit; text-decoration: none; }
.footer-contact a:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  .progress-fill, .drop { transition: none; }
}
