:root {
  --bg: #f6f1e7;
  --bg-soft: #efe7d8;
  --card: #fffdf8;
  --ink: #3e3427;
  --ink-soft: #7a6b56;
  --accent: #a9853f;
  --accent-dark: #8c6d42;
  --line: #e3d8c3;
  --ok: #5d7d4b;
  --err: #b3552f;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(62, 52, 39, .07), 0 12px 32px rgba(62, 52, 39, .08);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  background-image: radial-gradient(circle at 15% 0%, #fbf7ee 0%, rgba(251, 247, 238, 0) 42%),
                    radial-gradient(circle at 85% 100%, #efe3cc 0%, rgba(239, 227, 204, 0) 45%);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px 40px; flex: 1; }

.site-header { text-align: center; padding: 40px 16px 8px; }

.monogram {
  width: 74px; height: 74px; margin: 0 auto 14px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px; letter-spacing: 1px;
  color: var(--accent-dark);
  background: var(--card);
  box-shadow: var(--shadow);
}

.names {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(34px, 8vw, 46px);
  letter-spacing: .5px;
}

.amp { color: var(--accent); font-style: italic; padding: 0 .1em; }

.date {
  margin: 6px 0 0;
  font-family: Georgia, serif;
  font-size: 17px;
  color: var(--accent-dark);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.date::before, .date::after { content: "—"; color: var(--line); margin: 0 10px; }

.lead { margin: 16px auto 0; max-width: 460px; color: var(--ink-soft); }

.tabs {
  display: flex; gap: 6px;
  width: max-content; max-width: calc(100% - 32px);
  margin: 26px auto 22px;
  padding: 5px;
  background: var(--bg-soft);
  border-radius: 999px;
  border: 1px solid var(--line);
}

.tab {
  border: 0; background: transparent; color: var(--ink-soft);
  font: inherit; font-weight: 600;
  padding: 9px 20px; border-radius: 999px;
  cursor: pointer;
  display: flex; align-items: center; gap: 7px;
  transition: background .18s, color .18s;
}

.tab.is-active { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(62,52,39,.12); }

.badge {
  background: var(--accent); color: #fff;
  border-radius: 999px; font-size: 12px; line-height: 1;
  padding: 4px 8px; font-weight: 700;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.field { display: block; margin-bottom: 18px; }

.field-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--ink); }

.field-hint { display: block; font-size: 13px; color: var(--ink-soft); margin-top: 5px; }

input[type="text"] {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s;
}

input[type="text"]:focus { outline: none; border-color: var(--accent); }

.quality { display: flex; gap: 6px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }

.q-btn {
  flex: 1; border: 0; background: transparent; color: var(--ink-soft);
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 9px 10px; border-radius: 9px; cursor: pointer;
  transition: background .15s, color .15s;
}

.q-btn.is-active { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(62,52,39,.12); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font: inherit; font-weight: 600;
  border-radius: 999px; padding: 12px 22px;
  cursor: pointer; text-decoration: none; color: var(--ink);
  transition: transform .12s, box-shadow .15s, background .15s;
  border: 1.5px solid transparent;
}

.btn:active { transform: scale(.97); }

.btn svg { width: 19px; height: 19px; }

.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(169, 133, 63, .35); }
.btn-primary:hover { background: var(--accent-dark); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--bg-soft); }

.btn-small { padding: 8px 15px; font-size: 14px; }
.btn-small svg { width: 16px; height: 16px; }

.btn[disabled] { opacity: .55; cursor: default; }

.dropzone {
  margin-top: 16px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
  transition: border-color .15s, background .15s;
}

.dropzone.is-over { border-color: var(--accent); background: #faf4e7; }

.queue-summary { margin: 20px 2px 10px; font-weight: 600; font-size: 14px; color: var(--ink-soft); }

.summary-bar { height: 7px; background: var(--bg-soft); border-radius: 99px; margin-top: 8px; overflow: hidden; }

.summary-bar > div { height: 100%; width: 0%; background: var(--accent); border-radius: 99px; transition: width .25s; }

.queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }

.queue-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 12px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
}

.queue-item.is-error { border-color: #dcb9a4; background: #fdf6f0; }

.qi-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.qi-meta { grid-row: 2; font-size: 12.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; min-width: 0; }

.qi-bar { flex: 1; height: 5px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; }
.qi-bar > div { height: 100%; width: 0%; background: var(--accent); transition: width .2s; }

.qi-status { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.qi-status.is-wait { color: var(--ink-soft); }
.qi-status.is-work { color: var(--accent-dark); }
.qi-status.is-ok { color: var(--ok); }
.qi-status.is-err { color: var(--err); }

.qi-retry {
  grid-row: 2; border: 1.5px solid var(--err); color: var(--err);
  background: transparent; font: inherit; font-size: 12.5px; font-weight: 700;
  border-radius: 99px; padding: 3px 12px; cursor: pointer;
}

.done-banner {
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 22px;
  margin-top: 22px;
}

.done-heart { width: 44px; height: 44px; fill: var(--accent); }

.done-banner h2 { font-family: Georgia, serif; font-weight: 400; margin: 10px 0 4px; }

.done-banner p { color: var(--ink-soft); margin: 0 0 18px; }

.gallery-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

.gallery-head h2 { font-family: Georgia, serif; font-weight: 400; font-size: 24px; margin: 0; }

.muted { color: var(--ink-soft); font-weight: 400; font-size: .72em; }

.gallery-error {
  background: #fdf6f0; border: 1px solid #dcb9a4; color: var(--err);
  border-radius: 12px; padding: 14px 16px; font-size: 14px; margin-bottom: 14px;
}

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

.tile {
  position: relative; border: 0; padding: 0; margin: 0;
  aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  background: var(--bg-soft); cursor: pointer;
  display: block; width: 100%;
}

.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }

.tile:hover img { transform: scale(1.05); }

.tile .play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}

.tile .play svg {
  width: 34px; height: 34px;
  padding: 8px;
  background: rgba(30, 25, 18, .45);
  border-radius: 50%;
  fill: #fff;
}

.empty-state { text-align: center; color: var(--ink-soft); padding: 48px 16px; }

.site-footer {
  text-align: center; padding: 22px 16px 30px;
  color: var(--ink-soft); font-size: 13.5px;
}

.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(28, 23, 16, .94);
  display: flex; flex-direction: column;
}

.lb-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 52px 8px 8px; min-height: 0; }

.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; border-radius: 8px; }

.lb-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
}

.lb-counter { color: rgba(255, 253, 248, .85); font-size: 14px; font-weight: 600; padding-left: 8px; }

.lb-btn {
  border: 0; cursor: pointer;
  background: rgba(255, 253, 248, .14);
  border-radius: 50%;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  color: #fffdf8;
  transition: background .15s;
}

.lb-btn:hover { background: rgba(255, 253, 248, .28); }
.lb-btn svg { width: 22px; height: 22px; }

.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); }

.lb-prev { left: 10px; }
.lb-next { right: 10px; }

.lb-caption {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  color: #fffdf8;
}

.lb-caption-text { display: flex; flex-direction: column; font-size: 13.5px; min-width: 0; }
.lb-caption-text #lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-caption-text .muted { color: rgba(255, 253, 248, .6); }

.lightbox .btn-ghost { border-color: rgba(255, 253, 248, .35); color: #fffdf8; background: rgba(255, 253, 248, .08); }

@media (max-width: 480px) {
  .card { padding: 16px; }
  .actions .btn { flex: 1; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 5px; }
  .lb-prev { left: 4px; }
  .lb-next { right: 4px; }
}
