:root {
  --bg: #fff1e6;
  --ink: #2c1814;
  --muted: #7a5348;
  --line: #f0d2c2;
  --card: rgba(255, 250, 246, 0.94);
  --accent: #e23d32;
  --accent-dark: #b4231c;
  --fur: #f26b32;
  --cream: #fff6ee;
  --warn: #8a4e12;
  --warn-bg: #fff3df;
  --danger: #9a2430;
  --danger-bg: #ffe8e6;
  --shadow: 0 22px 50px rgba(120, 42, 24, 0.1);
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Outfit, "Segoe UI", sans-serif;
  font-size: 16.5px;
  line-height: 1.45;
  background:
    radial-gradient(820px 460px at 100% -8%, #ffd0b4, transparent 58%),
    radial-gradient(680px 380px at -10% 0%, #ffd0cc, transparent 52%),
    var(--bg);
}

main {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.4rem 0 calc(3rem + env(safe-area-inset-bottom));
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 0.5rem 0.25rem;
  align-items: end;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.8rem;
  color: var(--fur);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.logo {
  width: 1.35rem;
  height: 1.35rem;
}

h1, h2, h3 { font-family: Fraunces, Georgia, serif; font-weight: 560; letter-spacing: -0.03em; }

h1 {
  margin: 0;
  max-width: 14ch;
  font-size: clamp(2.3rem, 5vw, 4.1rem);
  line-height: 0.98;
}

.lede {
  max-width: 38rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.mascot {
  width: 230px;
  justify-self: end;
  margin-bottom: -1.4rem;
  pointer-events: none;
  user-select: none;
}

.mascot img {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 56% 82%;
  filter: drop-shadow(0 16px 14px rgba(90, 28, 16, 0.16));
  animation: floaty 3.4s ease-in-out infinite;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-8px) rotate(2.5deg); }
}

body.is-saving .mascot img {
  animation: cheer 0.55s ease-in-out infinite;
}

@keyframes cheer {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  40% { transform: translateY(-8px) rotate(6deg); }
  70% { transform: translateY(-3px) rotate(-2deg); }
}

body.is-done .mascot img {
  animation: hop 0.7s ease;
}

@keyframes hop {
  0% { transform: translateY(0) rotate(-2deg) scale(1); }
  35% { transform: translateY(-22px) rotate(6deg) scale(1.04); }
  100% { transform: translateY(0) rotate(-2deg) scale(1); }
}

.lookup-card, .panel, .job, .video-head {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}

.lookup-card {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 1.4rem;
}

label {
  display: block;
  margin: 0.15rem 0.4rem 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lookup {
  display: flex;
  gap: 0.6rem;
}

input[type="text"] {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  padding: 0.9rem 1.15rem;
}

input[type="text"]:focus {
  outline: 2px solid rgba(226, 61, 50, 0.28);
  border-color: var(--accent);
}

button { font: inherit; }

button.primary, #lookup-button, #access-button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  padding: 0.9rem 1.25rem;
  cursor: pointer;
}

button.primary {
  width: 100%;
  margin-top: 0.9rem;
  min-height: 3rem;
}

#lookup-button, #access-button { min-height: 3rem; }

button.primary:hover, #lookup-button:hover, #access-button:hover { background: var(--accent-dark); }

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.text {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  padding: 0.35rem 0.2rem;
  min-height: 2.75rem;
}

button.text:hover { color: var(--ink); }

#result { margin-top: 1.2rem; }

.video-head {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  padding: 0.8rem;
  border-radius: 1.3rem;
}

#thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.85rem;
  background: #f0d2c2;
}

h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

#meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.panel {
  padding: 1.1rem 1.1rem 1.15rem;
  border-radius: 1.3rem;
  min-width: 0;
}

.panel h3 {
  margin: 0;
  font-size: 1.55rem;
}

.panel header p {
  margin: 0.25rem 0 0.9rem;
  color: var(--muted);
}

.choices {
  display: grid;
  gap: 0.45rem;
}

.choice {
  display: grid;
  grid-template-columns: 1.05rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.78rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: white;
  cursor: pointer;
  min-height: 2.9rem;
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: #fff0ea;
}

.choice input {
  accent-color: var(--accent);
  margin: 0;
  width: 1.05rem;
  height: 1.05rem;
}

.choice-label {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.choice-size {
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

.empty, .fine {
  margin: 0;
  color: var(--muted);
}

.fine { margin-top: 0.75rem; font-size: 0.92rem; }

.job {
  margin-top: 1rem;
  padding: 1rem 1.1rem 1.05rem;
  border-radius: 1.3rem;
}

.progress {
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: #f6ddd2;
}

#progress-bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--fur), var(--accent));
}

.progress.indeterminate #progress-bar {
  width: 35%;
  animation: slide 1.15s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.job-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.7rem;
}

#job-detail {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.done { margin: 0.7rem 0 0; }

.done a { color: var(--accent-dark); }

.message {
  margin: 0.75rem 0.3rem 0.15rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.8rem;
}

.error { color: var(--danger); background: var(--danger-bg); }
.warn { color: var(--warn); background: var(--warn-bg); }

footer {
  margin-top: 1.6rem;
  color: var(--muted);
  font-size: 0.92rem;
}

footer strong { color: var(--ink); font-weight: 600; }

@media (max-width: 840px) {
  .hero {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .mascot {
    width: min(140px, 36vw);
    order: -1;
    margin: 0.15rem 0 -0.2rem 0.7rem;
  }

  h1 { max-width: 16ch; }
}

@media (max-width: 760px) {
  main {
    width: min(980px, calc(100% - 1.25rem));
    padding-top: 1.35rem;
  }

  .panels,
  .video-head,
  .lookup {
    grid-template-columns: 1fr;
    display: grid;
  }

  .lookup { display: grid; }

  #lookup-button,
  #access-button,
  button.primary { width: 100%; }

  .video-head { align-items: start; }

  .choice {
    grid-template-columns: 1.05rem minmax(0, 1fr);
  }

  .choice-size {
    grid-column: 2;
  }

  .job-row { align-items: flex-start; }

  button.text { min-height: 2.5rem; }
}

.admin-main { width: min(680px, calc(100% - 1.5rem)); }

.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.admin-head .mascot {
  width: 108px;
  margin: 0;
}

.admin-card {
  margin-top: 1.2rem;
  padding: 1.1rem;
  border-radius: 1.3rem;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}

.admin-card h2 {
  font-size: 1.45rem;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.2rem, 1fr));
  gap: 0.5rem;
}

.preset {
  min-height: 2.9rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: white;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.preset.selected,
.preset:hover {
  border-color: var(--accent);
  background: #fff0ea;
}

.custom-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.custom-row input {
  width: 7.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  padding: 0.75rem 1rem;
}

.custom-row button,
.quiet-button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 600;
  min-height: 2.9rem;
  padding: 0.7rem 1.1rem;
  cursor: pointer;
}

.quiet-button {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--line);
  margin-top: 0.9rem;
  margin-right: 0.5rem;
}

.file-list { margin: 0.4rem 0 0; padding: 0; list-style: none; }

.file-row {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.file-row p { margin: 0; overflow-wrap: anywhere; }

.file-meta {
  color: var(--muted);
  font-size: 0.92rem;
  text-align: right;
  white-space: nowrap;
}

.path {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.signed-in {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0.3rem 0.7rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.code-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.7rem;
}

.code-chip {
  font-family: Consolas, "Courier New", monospace;
  letter-spacing: 0.08em;
  font-weight: 600;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.tiny-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  min-height: 2.4rem;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
}

.tiny-button.danger { color: var(--danger); }

@media (max-width: 640px) {
  .admin-head { align-items: flex-start; }
  .admin-head .mascot { width: 84px; }
  .custom-row { display: grid; grid-template-columns: 1fr; }
  .custom-row input { width: 100%; }
  .file-row { display: grid; }
  .file-meta { text-align: left; white-space: normal; }
  .row-actions { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .mascot img,
  body.is-saving .mascot img,
  body.is-done .mascot img,
  .progress.indeterminate #progress-bar {
    animation: none;
  }

  .progress.indeterminate #progress-bar {
    width: 100%;
    opacity: 0.45;
  }
}
