:root {
  color-scheme: dark;
  --ink: #fff8eb;
  --muted: #d7c9b0;
  --bg: #17120f;
  --panel: #241b16;
  --line: rgba(255, 248, 235, 0.18);
  --gold: #f2c14e;
  --pink: #ff5a8a;
  --mint: #55d6be;
  --danger: #ff7b5f;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 16% 8%, rgba(255, 90, 138, 0.18), transparent 28rem),
    radial-gradient(circle at 88% 22%, rgba(85, 214, 190, 0.15), transparent 24rem),
    linear-gradient(145deg, #17120f 0%, #22140f 46%, #111111 100%);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

.party-shell,
.admin-shell {
  width: min(980px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero-band,
.admin-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(2.7rem, 9vw, 6.8rem);
  line-height: 0.9;
}

.admin-header h1 {
  font-size: clamp(2.2rem, 7vw, 5.2rem);
}

.intro {
  max-width: 640px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.6vw, 1.35rem);
}

.badge {
  width: 150px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 16px;
  border: 3px solid var(--gold);
  border-radius: 50%;
  background: #2d2017;
  box-shadow: var(--shadow);
  transform: rotate(8deg);
  text-align: center;
}

.badge span {
  display: block;
  color: var(--pink);
  font-size: 4rem;
  font-weight: 950;
  line-height: 0.82;
}

.badge small {
  color: var(--ink);
  font-weight: 850;
  line-height: 1;
}

.greeting-form {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--gold);
  font-weight: 850;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 235, 0.07);
  color: var(--ink);
  outline: none;
}

input {
  min-height: 54px;
  padding: 0 16px;
}

textarea {
  min-height: 150px;
  resize: vertical;
  padding: 16px;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(85, 214, 190, 0.14);
}

.camera-panel {
  display: grid;
  gap: 14px;
}

.camera-stage {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(242, 193, 78, 0.16), rgba(255, 90, 138, 0.1)),
    #130f0d;
}

video,
.camera-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

video {
  transform: scaleX(-1);
}

video.is-live,
.camera-stage img.is-visible {
  opacity: 1;
}

.camera-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
}

.camera-fallback.is-hidden {
  display: none !important;
}

.camera-fallback strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: #14110f;
  cursor: pointer;
  font-weight: 950;
}

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

.primary {
  min-height: 60px;
  background: linear-gradient(90deg, var(--gold), var(--pink), var(--mint));
  box-shadow: var(--shadow);
}

.secondary {
  background: var(--gold);
}

.delete-button {
  justify-self: start;
  min-height: 40px;
  background: var(--danger);
}

.status {
  min-height: 1.4em;
  margin: 0;
  color: var(--muted);
  font-weight: 750;
}

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

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

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.greeting-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 235, 0.07);
  box-shadow: var(--shadow);
}

.greeting-card img,
.photo-empty {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #130f0d;
}

.photo-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 850;
}

.greeting-content {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.greeting-meta {
  margin: 0;
  color: var(--gold);
  font-size: 0.86rem;
  font-weight: 900;
}

.greeting-message {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
  white-space: pre-wrap;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
}

@media (max-width: 680px) {
  .party-shell,
  .admin-shell {
    width: min(100% - 20px, 980px);
    padding-top: 12px;
  }

  .hero-band,
  .admin-header {
    grid-template-columns: 1fr;
    padding: 18px 0;
  }

  .badge {
    width: 112px;
    justify-self: start;
  }

  .badge span {
    font-size: 3rem;
  }

  button {
    width: 100%;
  }
}
