:root {
  --purple: #6c45e8;
  --purple-dark: #4420b2;
  --yellow: #ffd84f;
  --pink: #ff6ca8;
  --cyan: #52e0df;
  --ink: #24184d;
  --paper: #fffaf0;
  --white: #fff;
  font-family: "Arial Rounded MT Bold", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: #26195d;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

button { font: inherit; }

.mirror-app {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 216, 79, .5), transparent 21rem),
    radial-gradient(circle at 89% 78%, rgba(82, 224, 223, .42), transparent 22rem),
    linear-gradient(145deg, #6843dc, #352079);
}

#camera {
  position: fixed;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
}

#mirror {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: linear-gradient(145deg, #6b49df, #2d1b69);
}

.color-wash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(30, 15, 76, .1), transparent 38%, rgba(20, 10, 55, .45));
  z-index: 1;
}

.topbar {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--white);
  font-size: clamp(1rem, 3.8vw, 1.25rem);
  font-weight: 900;
  letter-spacing: .04em;
  text-shadow: 0 2px 12px rgba(25, 10, 72, .35);
}

.brand__spark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  color: var(--purple-dark);
  background: var(--yellow);
  transform: rotate(-7deg);
  box-shadow: 0 5px 0 rgba(62, 26, 143, .35);
}

.topbar__actions { display: flex; gap: 9px; }

.icon-button {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, .68);
  border-radius: 16px;
  color: var(--white);
  background: rgba(31, 18, 81, .34);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 6px 20px rgba(20, 8, 58, .2);
  cursor: pointer;
}

.icon-button span { font-size: 1.55rem; line-height: 1; }
.icon-button:active { transform: scale(.94); }

.welcome {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 86px 24px 40px;
  background:
    radial-gradient(circle at 15% 14%, rgba(255, 216, 79, .85) 0 5px, transparent 6px),
    radial-gradient(circle at 88% 22%, rgba(82, 224, 223, .95) 0 7px, transparent 8px),
    radial-gradient(circle at 16% 83%, rgba(255, 108, 168, .9) 0 8px, transparent 9px),
    linear-gradient(145deg, #7954ed, #4326a2);
  transition: opacity .45s ease, visibility .45s ease;
}

.welcome.is-hidden { opacity: 0; visibility: hidden; }

.welcome::before,
.welcome::after {
  content: "";
  position: absolute;
  width: 62px;
  height: 62px;
  border: 12px solid var(--yellow);
  border-radius: 50%;
  opacity: .85;
}
.welcome::before { left: -26px; top: 33%; }
.welcome::after { right: -34px; bottom: 24%; border-color: var(--cyan); }

.welcome__blob {
  position: absolute;
  filter: blur(2px);
  opacity: .4;
}
.welcome__blob--one {
  width: 180px; height: 180px; right: -65px; top: 10%;
  border-radius: 44% 56% 66% 34%; background: var(--pink); transform: rotate(22deg);
}
.welcome__blob--two {
  width: 210px; height: 140px; left: -80px; bottom: 7%;
  border-radius: 60% 40% 47% 53%; background: var(--cyan); transform: rotate(-15deg);
}

.welcome__content {
  position: relative;
  width: min(100%, 540px);
  text-align: center;
  color: var(--white);
}

.welcome__face {
  position: relative;
  width: clamp(116px, 31vw, 154px);
  aspect-ratio: 1;
  margin: 0 auto 22px;
  border: 7px solid var(--ink);
  border-radius: 45% 55% 48% 52%;
  background: var(--yellow);
  box-shadow: 11px 12px 0 var(--pink), -8px -8px 0 var(--cyan);
  transform: rotate(-4deg);
  animation: float 3.4s ease-in-out infinite;
}

.eye {
  position: absolute;
  top: 37%;
  width: 14px;
  height: 19px;
  border-radius: 50%;
  background: var(--ink);
}
.eye:first-child { left: 28%; }
.eye:nth-child(2) { right: 28%; }
.smile {
  position: absolute;
  left: 50%; bottom: 20%; width: 48px; height: 25px;
  border-bottom: 8px solid var(--ink); border-radius: 0 0 50% 50%; transform: translateX(-50%);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--yellow);
  font-size: .88rem;
  font-weight: 900;
  letter-spacing: .18em;
}

h1 {
  margin: 0;
  font-size: clamp(2.75rem, 12vw, 5.8rem);
  line-height: .98;
  letter-spacing: -.055em;
  text-shadow: 0 7px 0 rgba(49, 20, 120, .42);
}
h1 em { color: var(--yellow); font-style: normal; }

.welcome__copy {
  max-width: 410px;
  margin: 20px auto 24px;
  font-size: clamp(1rem, 4vw, 1.2rem);
  line-height: 1.65;
}

.start-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: min(100%, 310px);
  padding: 17px 26px;
  border: 3px solid var(--ink);
  border-radius: 22px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 8px 0 var(--ink), 0 15px 30px rgba(23, 10, 61, .35);
  font-size: 1.15rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.start-button:active { transform: translateY(5px); box-shadow: 0 3px 0 var(--ink); }
.start-button__icon { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 50%; color: var(--white); background: var(--purple); font-size: .8rem; }

.privacy-note { margin: 23px 0 0; font-size: .78rem; opacity: .82; }
.privacy-note span { color: #69f4c2; font-size: .65rem; }

.controls {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 0 calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(25, 10, 64, .5) 18%, rgba(25, 10, 64, .78));
}

.controls__hint {
  width: fit-content;
  margin: 0 auto 11px;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 4px 14px rgba(22, 9, 59, .2);
  font-size: .76rem;
  font-weight: 900;
}

.effect-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 3px max(16px, env(safe-area-inset-left));
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.effect-list::-webkit-scrollbar { display: none; }

.effect-button {
  flex: 0 0 auto;
  display: grid;
  min-width: 86px;
  gap: 4px;
  place-items: center;
  padding: 10px 11px;
  border: 2px solid rgba(255, 255, 255, .6);
  border-radius: 19px;
  color: var(--white);
  background: rgba(34, 18, 83, .58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 7px 20px rgba(22, 9, 60, .2);
  font-size: .72rem;
  font-weight: 800;
  scroll-snap-align: center;
  cursor: pointer;
}
.effect-button__emoji { font-size: 1.65rem; line-height: 1; }
.effect-button.is-active {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 5px 0 var(--ink);
  transform: translateY(-4px);
}

.status-pill {
  position: absolute;
  z-index: 3;
  top: calc(74px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 7px 12px;
  border-radius: 999px;
  color: #fff;
  background: rgba(25, 10, 64, .42);
  backdrop-filter: blur(10px);
  font-size: .69rem;
  font-weight: 700;
}
.status-pill__dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #69f4c2; box-shadow: 0 0 0 4px rgba(105,244,194,.18); }

.message-card {
  position: absolute;
  z-index: 8;
  top: 50%; left: 50%;
  width: min(calc(100% - 40px), 420px);
  padding: 28px 24px;
  transform: translate(-50%, -50%);
  text-align: center;
  border: 4px solid var(--ink);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 12px 14px 0 rgba(31, 15, 78, .5);
}
.message-card__icon { display: grid; width: 55px; height: 55px; margin: 0 auto 15px; place-items: center; border: 3px solid var(--ink); border-radius: 50%; color: var(--white); background: var(--pink); font-size: 1.8rem; font-weight: 900; }
.message-card h2 { margin: 0 0 10px; font-size: 1.4rem; }
.message-card p { margin: 0 0 20px; color: #5e5379; line-height: 1.6; }
.message-card button { padding: 12px 22px; border: 2px solid var(--ink); border-radius: 15px; color: var(--white); background: var(--purple); box-shadow: 0 4px 0 var(--ink); font-weight: 900; cursor: pointer; }

[hidden] { display: none !important; }
button:focus-visible { outline: 4px solid var(--cyan); outline-offset: 3px; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-10px) rotate(3deg); }
}

@media (min-width: 760px) {
  .topbar { padding-left: 30px; padding-right: 30px; }
  .effect-list { justify-content: center; }
  .effect-button { min-width: 105px; }
}

@media (max-height: 650px) {
  .welcome { padding-top: 72px; }
  .welcome__face { width: 82px; margin-bottom: 12px; border-width: 5px; }
  .welcome__copy { margin: 10px auto 14px; }
  .privacy-note { margin-top: 14px; }
  .start-button { padding-top: 12px; padding-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
