:root {
  --bg: #fff7f9;
  --surface: #ffffff;
  --ink: #240815;
  --muted: #78495c;
  --line: #f5d5df;
  --accent: #e61c5d;
  --accent-dark: #b80c44;
  --accent-ink: #ffffff;
  --gold: #ffd700;
  --gold-dark: #d4a000;
  --focus: #e61c5d;
  --danger: #c0392b;
  --shadow: 0 10px 30px rgba(230, 28, 93, 0.18), 0 2px 10px rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14050b;
    --surface: #220814;
    --ink: #fcf2f6;
    --muted: #b88a9d;
    --line: #421626;
    --accent: #ff2b70;
    --accent-dark: #e61c5d;
    --accent-ink: #ffffff;
    --gold: #ffd700;
    --gold-dark: #ffea70;
    --focus: #ff4d88;
    --danger: #ff7675;
    --shadow: 0 10px 32px rgba(0, 0, 0, 0.5), 0 2px 12px rgba(230, 28, 93, 0.2);
  }
}

html {
  scroll-padding-top: env(safe-area-inset-top, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Hind Vadodara', 'Poppins', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 18px 48px;
}

.page-header {
  margin-bottom: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}

h1 {
  font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2.1rem);
  line-height: 1.25;
  margin: 0 0 4px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.sub-title {
  font-size: clamp(1.05rem, 0.95rem + 0.6vw, 1.35rem);
  color: var(--accent);
  margin: 0 0 8px;
  font-weight: 600;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  max-width: 60ch;
}

.event-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 12px;
}

.detail-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--ink);
  font-weight: 500;
  font-size: 0.86rem;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.detail-item strong {
  color: var(--accent);
  font-weight: 700;
}

.grid {
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@media (min-width: 880px) {
  .grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 1fr);
    gap: 36px;
  }
  .stage {
    position: sticky;
    top: 24px;
  }
}

/* Poster Preview Canvas */
.poster-wrap {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: transparent;
  aspect-ratio: 604 / 603;
}

@media (min-width: 880px) {
  .poster-wrap {
    max-width: min(440px, calc(100vh - 180px));
  }
}

canvas#poster {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Interactive Hit Ellipse */
.frame-hit {
  position: absolute;
  touch-action: none;
  cursor: grab;
  outline-offset: -3px;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.frame-hit:not(.has-photo) {
  cursor: pointer;
}

.frame-hit:not(.has-photo):hover {
  background: rgba(230, 28, 93, 0.12);
}

.frame-hit.dragging {
  cursor: grabbing;
}

.frame-hit:focus-visible {
  outline: 3px solid var(--focus);
}

.stage-hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin: 12px 0 0;
  font-weight: 500;
}

/* Controls Panel */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  display: grid;
  gap: 22px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

.field {
  display: grid;
  gap: 8px;
}

.field > label, .field > .label {
  font-weight: 600;
  font-size: 0.96rem;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.sub-label {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--muted);
}

.field-hint {
  font-size: 0.82rem;
  color: var(--muted);
}

input[type="text"] {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 90%, var(--bg));
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  min-height: 46px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus {
  border-color: var(--focus);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent);
}

input[type="text"]::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

/* Buttons */
button {
  font: inherit;
  cursor: pointer;
}

button:focus-visible, input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 10px;
  font-weight: 600;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--ink);
  transition: all 0.15s ease;
}

.btn:hover:not(:disabled) {
  border-color: var(--ink);
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  transform: translateY(-1px);
}

.btn.primary-outline {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.btn.primary-outline:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn.small {
  min-height: 40px;
  min-width: 40px;
  padding: 0 12px;
}

/* Drag & Drop */
.drop {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 18px;
  display: grid;
  gap: 10px;
  justify-items: start;
  transition: border-color 0.15s, background-color 0.15s;
  background: color-mix(in srgb, var(--surface) 95%, var(--bg));
}

.drop.over {
  border-color: var(--focus);
  background: color-mix(in srgb, var(--focus) 10%, transparent);
}

.drop .file-name {
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Zoom Slider */
.zoom-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  min-height: 28px;
  cursor: pointer;
}

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

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

/* Exports */
.exports {
  display: grid;
  gap: 12px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.exports .row > .btn {
  flex: 1 1 auto;
  white-space: nowrap;
}

#status {
  min-height: 1.4em;
  font-size: 0.92rem;
  margin: 0;
  font-weight: 500;
}

#status.error {
  color: var(--danger);
}
