:root {
  --violet-deep: #10163f;
  --violet: #25205f;
  --violet-bright: #40358b;
  --violet-soft: #eeefff;
  --orange: #f45112;
  --orange-light: #ff7a1a;
  --white: #ffffff;
  --ink: #171a3f;
  --muted: #62647a;
  --shadow: 0 24px 65px rgba(23, 26, 74, .18);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--violet-deep); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 6% 14%, rgba(64, 53, 139, .16), transparent 31rem),
    radial-gradient(circle at 94% 22%, rgba(244, 81, 18, .13), transparent 28rem),
    linear-gradient(180deg, #f8f9ff 0%, #fff 68%, #eef0ff 100%);
}

.topbar {
  position: relative;
  overflow: hidden;
  min-height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: linear-gradient(105deg, var(--violet-deep), var(--violet) 68%, var(--violet-bright));
  border-bottom: 7px solid var(--orange);
}

.topbar::before,
.topbar::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 180px;
  background: var(--orange);
  transform: rotate(25deg);
  opacity: .95;
}

.topbar::before { left: -170px; top: -75px; }
.topbar::after { right: -180px; bottom: -96px; }

.topbar img {
  position: relative;
  z-index: 1;
  width: min(205px, 55vw);
  max-height: 82px;
  object-fit: contain;
}

main { width: min(1050px, calc(100% - 32px)); margin: 0 auto; padding: 46px 0 40px; }

.intro { max-width: 730px; margin: 0 auto 28px; text-align: center; }
.eyebrow { margin: 0 0 8px; color: var(--orange); font-weight: 900; letter-spacing: .13em; text-transform: uppercase; font-size: .83rem; }
h1 { margin: 0; color: var(--violet); font-size: clamp(2rem, 6vw, 3.7rem); line-height: .98; letter-spacing: -.045em; font-weight: 950; }
.intro > p:last-child { margin: 18px auto 0; max-width: 650px; color: var(--muted); font-size: 1.06rem; line-height: 1.55; }

.maker {
  display: grid;
  grid-template-columns: minmax(300px, 540px) minmax(250px, 330px);
  gap: 38px;
  align-items: center;
  justify-content: center;
  padding: 30px;
  border: 1px solid rgba(37, 32, 95, .11);
  border-top: 5px solid var(--orange);
  border-radius: 30px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border: 4px solid var(--violet);
  border-radius: 50%;
  background: linear-gradient(145deg, #dce2ff, #fff0e8);
  box-shadow: 0 18px 45px rgba(23, 26, 74, .22), 0 0 0 8px rgba(244, 81, 18, .14);
  touch-action: none;
  user-select: none;
}

canvas { display: block; width: 100%; height: 100%; }

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 7px;
  padding: 24px;
  text-align: center;
  color: var(--violet);
  pointer-events: none;
}

.empty-state::before {
  content: "";
  position: absolute;
  inset: 8%;
  border: 3px dashed rgba(37,32,95,.24);
  border-radius: 50%;
}

.camera-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 5px;
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, var(--orange), var(--orange-light));
  font-size: 2rem;
  font-weight: 300;
  box-shadow: 0 10px 22px rgba(74,35,152,.25);
}
.empty-state strong { font-size: 1.06rem; }
.empty-state small { color: var(--muted); }
.drag-tip { margin: 13px 0 0; text-align: center; color: var(--muted); font-size: .88rem; }

.controls { display: flex; flex-direction: column; gap: 18px; }
.upload-button, .download-button {
  width: 100%;
  min-height: 57px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 16px;
  padding: 14px 20px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.upload-button {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(105deg, var(--orange), var(--orange-light));
  box-shadow: 0 10px 24px rgba(244,81,18,.24);
}
.upload-button span { pointer-events: none; }
.upload-button input {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .001;
  cursor: pointer;
}
.download-button { color: #fff; background: linear-gradient(105deg, var(--violet-deep), var(--violet-bright)); box-shadow: 0 10px 24px rgba(37,32,95,.24); }
.upload-button:hover, .download-button:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(36,22,105,.24); }
.upload-button:focus-within, button:focus-visible, input:focus-visible { outline: 3px solid rgba(243,83,18,.32); outline-offset: 3px; }
.download-button:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }

.adjustments { padding: 18px; border-left: 4px solid var(--orange); border-radius: 16px; background: var(--violet-soft); }
.adjustments > label { display: block; margin-bottom: 12px; color: var(--violet); font-weight: 800; }
.range-row { display: flex; align-items: center; gap: 10px; color: var(--violet); font-weight: 800; }
input[type="range"] { width: 100%; accent-color: var(--orange); }
.text-button { display: block; margin: 11px auto 0; padding: 4px 8px; border: 0; color: var(--violet); background: transparent; font: inherit; font-size: .9rem; font-weight: 750; cursor: pointer; }
.status { min-height: 1.35em; margin: -7px 0 0; color: var(--violet); text-align: center; font-size: .9rem; font-weight: 700; }
.privacy { max-width: 720px; margin: 24px auto 0; color: var(--muted); text-align: center; font-size: .9rem; line-height: 1.5; }

footer {
  display: flex;
  gap: .4rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 22px 24px calc(22px + env(safe-area-inset-bottom));
  color: #fff;
  text-align: center;
  border-top: 6px solid var(--orange);
  background: linear-gradient(105deg, var(--violet-deep), var(--violet));
}
footer strong { color: var(--orange-light); }

@media (max-width: 760px) {
  .topbar { min-height: 92px; }
  .topbar img { width: min(180px, 53vw); max-height: 70px; }
  main { padding-top: 32px; }
  .maker { grid-template-columns: 1fr; gap: 25px; padding: 18px; border-radius: 24px; }
  .controls { max-width: 540px; width: 100%; margin: 0 auto; }
}

@media (max-width: 420px) {
  main { width: min(100% - 20px, 1050px); }
  .intro { margin-bottom: 20px; }
  .intro > p:last-child { font-size: 1rem; }
  .maker { padding: 12px; }
  .canvas-wrap { border-radius: 50%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
