
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&family=Noto+Sans+SC:wght@400;500;600;700;800&display=swap');

:root {
  --lavender: #eee6ff;
  --purple: #8e72e8;
  --purple-dark: #7054ca;
  --pink: #ffb9d8;
  --mint: #c8f4e8;
  --ink: #39334e;
  --muted: #8e899e;
  --white: #ffffff;
  --border: #eee8f8;
  --shadow: 0 14px 45px rgba(104, 79, 159, 0.09);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 0% 0%, #f0e8ff 0, transparent 34%),
    radial-gradient(ellipse at 100% 12%, #ffeaf4 0, transparent 28%),
    #fbfaff;
  font-family: "Nunito", "Noto Sans SC", sans-serif;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid #b7a2ff;
  outline-offset: 3px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

.page-shell {
  width: min(1180px, calc(100% - 44px));
  margin: 0 auto;
}

.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(142, 114, 232, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 900;
  font-size: 19px;
  letter-spacing: 1px;
  text-decoration: none;
}

.brand-icon {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--purple);
  color: white;
  font-size: 23px;
  box-shadow: 0 5px 12px #8e72e844;
}

.brand-accent {
  color: var(--purple);
}

.top-tag,
.section-kicker {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.7px;
}

.top-tag {
  padding: 9px 13px;
  border: 1px solid #eee6ff;
  border-radius: 999px;
  background: #ffffffa8;
}

.intro {
  text-align: center;
  padding: 44px 12px 34px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--purple-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.7px;
}

.eyebrow span,
.live-status .status-dot,
.camera-badge span {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: #7ad8b9;
}

.intro h1 {
  margin: 12px 0 9px;
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 900;
  letter-spacing: -1.8px;
  line-height: 1.18;
}

.intro h1 span {
  color: var(--purple);
}

.intro p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.studio {
  padding: 25px;
  border: 1px solid #ffffff;
  border-radius: 25px;
  background: #ffffffd9;
  box-shadow: var(--shadow);
}

.studio-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.studio-heading h2,
.bottom-actions h2 {
  margin: 5px 0 0;
  font-size: 21px;
  font-weight: 900;
}

.live-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid #eee8f8;
  border-radius: 999px;
  color: var(--muted);
  background: #fbfaff;
  font-size: 11px;
  font-weight: 800;
}

.live-status .status-dot {
  background: #c3b8da;
}

.live-status.is-live .status-dot {
  background: #61cda7;
  box-shadow: 0 0 0 4px #61cda722;
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(285px, 0.85fr);
  gap: 23px;
  align-items: start;
}

.camera-panel {
  min-width: 0;
}

.camera-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  isolation: isolate;
  border-radius: 19px;
  background:
    radial-gradient(circle at 25% 25%, #e7dcff 0, transparent 40%),
    radial-gradient(circle at 75% 75%, #d5f6ed 0, transparent 40%),
    #eee8fa;
}

#cameraVideo,
.captured-image,
.stage-tint,
.sticker-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#cameraVideo {
  display: none;
  object-fit: cover;
  transform: scaleX(-1);
}

.captured-image {
  display: none;
  object-fit: cover;
}

.camera-stage.has-camera #cameraVideo {
  display: block;
}

.camera-stage.has-capture #cameraVideo {
  display: none;
}

.camera-stage.has-capture .captured-image {
  display: block;
}

.stage-tint {
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, #29223c12, transparent 40%, #29223c0a);
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

.placeholder-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border: 1px solid #ffffff;
  border-radius: 25px;
  background: #ffffffa8;
  box-shadow: 0 10px 28px #9b82d51c;
  font-size: 35px;
}

.camera-placeholder h3 {
  margin: 0 0 7px;
  font-size: 18px;
  font-weight: 900;
}

.camera-placeholder p {
  margin: 0 0 17px;
  color: #817993;
  font-size: 12px;
}

.camera-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid #ffffff5c;
  border-radius: 999px;
  color: white;
  background: #352d4c65;
  backdrop-filter: blur(10px);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1px;
}

.camera-badge span {
  background: #ffb9d8;
}

.gesture-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 24px);
  padding: 9px 12px;
  border: 1px solid #ffffff8c;
  border-radius: 13px;
  color: #514565;
  background: #ffffffdf;
  backdrop-filter: blur(12px);
  font-size: 10px;
  font-weight: 800;
}

.hint-icon {
  font-size: 18px;
}

.sticker-layer {
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
}

.sticker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 20px;
  background: #ffffffdb;
  box-shadow: 0 7px 18px #3d2b5a26;
  font-size: 43px;
  line-height: 1;
  cursor: grab;
  user-select: none;
  touch-action: none;
  pointer-events: auto;
  transform-origin: center;
}

.sticker:active {
  cursor: grabbing;
}

.sticker.selected {
  border-color: #9a7af0;
  box-shadow: 0 0 0 4px #9a7af033, 0 8px 22px #3d2b5a2b;
}

.camera-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-top: 15px;
}

.button {
  min-height: 41px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.button-primary {
  color: white;
  background: linear-gradient(135deg, #a58aef, #8669df);
  box-shadow: 0 7px 16px #9276e637;
}

.button-primary:hover:not(:disabled) {
  box-shadow: 0 10px 20px #9276e64a;
}

.button-soft {
  color: #776b99;
  border-color: #e9e1fa;
  background: #f7f3ff;
}

.shutter-icon {
  font-size: 15px;
}

.privacy-note {
  margin: 13px 0 0;
  color: #a09aaf;
  text-align: center;
  font-size: 10px;
}

.tool-panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid #f0eafa;
  border-radius: 19px;
  background: linear-gradient(160deg, #fcfaff, #fff9fc);
}

.panel-title h3 {
  margin: 7px 0 5px;
  font-size: 16px;
  font-weight: 900;
}

.panel-title h3 span {
  color: #f39ac6;
}

.panel-title p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin: 18px 0 13px;
}

.sticker-option {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 9px 2px 8px;
  border: 1px solid #eee8f8;
  border-radius: 13px;
  color: var(--ink);
  background: white;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.sticker-option:hover {
  transform: translateY(-3px);
  border-color: #cbbafa;
  background: #f9f5ff;
}

.sticker-option > span {
  font-size: 29px;
  line-height: 1.3;
}

.sticker-option small {
  width: 100%;
  overflow: hidden;
  color: #8b839d;
  font-size: 9px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button-random {
  width: 100%;
  color: #7054ca;
  border-color: #e7ddff;
  background: #eee7ff;
}

.button-random > span {
  font-size: 17px;
}

.panel-divider {
  height: 1px;
  margin: 21px 0;
  background: #eee8f5;
}

.edit-heading {
  margin-bottom: 13px;
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.edit-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 61px;
  border: 1px solid #eee8f8;
  border-radius: 12px;
  color: #786b9c;
  background: white;
  font-size: 22px;
  cursor: pointer;
}

.edit-button span {
  font-size: 10px;
  font-weight: 800;
}

.edit-button:hover:not(:disabled) {
  border-color: #cbbafa;
  background: #f8f4ff;
}

.button-undo {
  width: 100%;
  margin-top: 10px;
  color: #8d6a82;
  border-color: #f5dce9;
  background: #fff0f7;
}

.tip-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 17px;
  padding: 12px;
  border: 1px solid #dff4ed;
  border-radius: 13px;
  background: #f0fcf8;
}

.tip-card > span {
  font-size: 19px;
}

.tip-card strong {
  font-size: 11px;
}

.tip-card p {
  margin: 4px 0 0;
  color: #7b958e;
  font-size: 10px;
  line-height: 1.7;
}

.bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 23px;
  padding: 25px 29px;
  border: 1px solid #ffffff;
  border-radius: 21px;
  background: linear-gradient(105deg, #eee7ff, #fff0f7 65%, #e9faf5);
}

.bottom-actions h2 {
  font-size: 19px;
}

.bottom-actions p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.download-button {
  flex-shrink: 0;
  min-height: 47px;
  padding: 12px 19px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 25px 3px 30px;
  color: #aaa3b8;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(360px, calc(100% - 44px));
  padding: 13px 17px;
  border: 1px solid #ffffff;
  border-radius: 14px;
  color: #514565;
  background: #ffffffed;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 850px) {
  .studio {
    padding: 18px;
  }

  .studio-layout {
    grid-template-columns: 1fr;
  }

  .tool-panel {
    padding: 18px;
  }

  .sticker-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: calc(100% - 24px);
  }

  .topbar {
    height: 65px;
  }

  .brand {
    font-size: 16px;
  }

  .top-tag {
    max-width: 145px;
    padding: 7px 9px;
    font-size: 8px;
    letter-spacing: 0.7px;
  }

  .intro {
    padding: 34px 5px 25px;
  }

  .intro h1 {
    letter-spacing: -1px;
  }

  .intro p {
    font-size: 12px;
  }

  .studio {
    padding: 13px;
    border-radius: 19px;
  }

  .studio-heading {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 15px;
  }

  .studio-heading h2 {
    font-size: 18px;
  }

  .camera-stage {
    aspect-ratio: 3 / 4;
  }

  .camera-placeholder h3 {
    font-size: 16px;
  }

  .camera-placeholder p {
    max-width: 240px;
    line-height: 1.7;
  }

  .camera-controls {
    gap: 7px;
  }

  .camera-controls .button {
    padding: 9px 11px;
    font-size: 11px;
  }

  .tool-panel {
    padding: 14px;
  }

  .sticker-option > span {
    font-size: 26px;
  }

  .bottom-actions {
    align-items: flex-start;
    flex-direction: column;
    padding: 21px;
  }

  footer {
    flex-direction: column;
    line-height: 1.7;
  }
}

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