:root {
  color-scheme: light;
  --navy: #143879;
  --blue: #1b75b9;
  --cyan: #14d6ef;
  --yellow: #ffc62e;
  --ink: #073c4d;
  --paper: #ffffff;
  --shadow: 0 16px 44px rgba(4, 31, 82, .28);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: #0b2a64; }
body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 0%, rgba(27, 185, 220, .38), transparent 42%),
    linear-gradient(180deg, #188fc7 0%, #17498f 54%, #092762 100%);
  font-family: Arial, Helvetica, sans-serif;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }

.app {
  width: min(100%, 480px);
  min-height: 100svh;
  margin: 0 auto;
  background: #153e84;
  box-shadow: 0 0 60px rgba(0, 0, 0, .28);
}

.welcome {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #1d80bb;
}

.welcome-background {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.welcome-layer {
  position: absolute;
  z-index: 2;
  display: block;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.welcome-sponsors {
  top: 4.1%;
  left: 14.2%;
  width: 71.6%;
}

.welcome-event-logo {
  top: 22.3%;
  left: 24%;
  width: 52%;
}

.welcome-event-logo > img {
  display: block;
  width: 100%;
  height: auto;
}

.event-logo-sweep {
  position: absolute;
  inset: 0;
  overflow: hidden;
  mix-blend-mode: screen;
  -webkit-mask: url("assets/welcome-event-logo.png") center / 100% 100% no-repeat;
  mask: url("assets/welcome-event-logo.png") center / 100% 100% no-repeat;
}

.event-logo-sweep::before {
  content: "";
  position: absolute;
  top: -55%;
  bottom: -55%;
  left: -28%;
  width: 28%;
  background: linear-gradient(
    108deg,
    transparent 18%,
    rgba(255, 248, 184, .08) 36%,
    rgba(255, 255, 255, .95) 50%,
    rgba(158, 246, 255, .38) 64%,
    transparent 82%
  );
  background-repeat: no-repeat;
  transform: translate3d(0, 0, 0);
  will-change: transform, opacity;
  animation: event-logo-light-sweep 3s linear infinite;
}

@keyframes event-logo-light-sweep {
  0%, 4% { transform: translate3d(0, 0, 0); opacity: 0; }
  6.25% { transform: translate3d(0, 0, 0); opacity: 1; }
  93.75% { transform: translate3d(457%, 0, 0); opacity: 1; }
  96%, 100% { transform: translate3d(457%, 0, 0); opacity: 0; }
}

.welcome-date {
  top: 71.6%;
  left: 23.2%;
  width: 53.6%;
}

.welcome-title {
  top: 77.2%;
  left: 7%;
  width: 86%;
}

.welcome-corners {
  mix-blend-mode: lighten;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
}

.welcome-border {
  z-index: 3;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2.8%;
  object-fit: cover;
}

.welcome-motifs {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.welcome-motif {
  position: absolute;
  width: 33%;
  height: auto;
  opacity: .5;
  mix-blend-mode: screen;
  filter: saturate(1.2) brightness(1.2) drop-shadow(0 10px 20px rgba(6, 48, 119, .2));
  will-change: transform, opacity;
  user-select: none;
  -webkit-user-drag: none;
}

.welcome-motif-left {
  top: 10.2%;
  left: -8%;
  animation: motif-drift-left 4s ease-in-out infinite alternate;
}

.welcome-motif-right {
  top: 11.7%;
  right: -8%;
  animation: motif-drift-right 4.5s ease-in-out infinite alternate;
}

@keyframes motif-drift-left {
  0% { transform: translate3d(-3%, -2%, 0) rotate(-2deg) scale(.98); opacity: .2; }
  55% { opacity: .34; }
  100% { transform: translate3d(10%, 7%, 0) rotate(2deg) scale(1.04); opacity: .25; }
}

@keyframes motif-drift-right {
  0% { transform: translate3d(4%, 5%, 0) rotate(2deg) scale(1.03); opacity: .24; }
  45% { opacity: .36; }
  100% { transform: translate3d(-9%, -4%, 0) rotate(-2deg) scale(.97); opacity: .2; }
}

.welcome-hotspot {
  position: absolute;
  z-index: 4;
  left: 18.4%;
  width: 63.2%;
  height: 7.25%;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: url("assets/welcome-button.png") center / 100% 100% no-repeat;
  cursor: pointer;
  font-size: clamp(22px, 7vw, 36px);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 2px 2px rgba(109, 76, 0, .12);
}

.welcome-hotspot::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  box-shadow: inset 0 0 0 0 rgba(0, 52, 85, 0);
  transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.welcome-hotspot:hover::after,
.welcome-hotspot:focus-visible::after {
  background: rgba(255, 255, 255, .12);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .55);
}

.welcome-hotspot:active::after {
  transform: scale(.985);
  background: rgba(0, 52, 85, .08);
}

.take-photo { top: 42.25%; }
.upload-photo { top: 52.15%; }

.editor {
  min-height: 100svh;
  padding: max(18px, env(safe-area-inset-top)) 14px max(28px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 14%, rgba(47, 215, 240, .34), transparent 38%),
    linear-gradient(180deg, #239bd0 0%, #1b5ba0 48%, #123672 100%);
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #fff;
  padding: 2px 2px 12px;
}

.editor h1 { margin: 0; font-size: 18px; line-height: 1.1; }
.instruction {
  margin: 0 2px 12px;
  color: rgba(255, 255, 255, .92);
  font-size: 13px;
  line-height: 1.45;
}

.photo-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  user-select: none;
  -webkit-user-select: none;
}

#photo-canvas { display: block; width: 100%; height: 100%; }

.photo-touch-zone {
  position: absolute;
  left: 9.72%;
  top: 25.26%;
  width: 80.56%;
  height: 57.66%;
  border-radius: 12% / 9%;
  touch-action: none;
  cursor: grab;
}

.photo-touch-zone:active { cursor: grabbing; }
.photo-touch-zone:focus-visible { outline: 3px solid var(--yellow); outline-offset: -5px; }

.zoom-controls {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  gap: 10px;
  align-items: center;
  margin: 14px 0 12px;
}

.round-button,
.secondary-button,
.primary-button,
.text-button {
  min-height: 48px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
}

.round-button,
.secondary-button {
  color: var(--ink);
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(255, 255, 255, .75);
  box-shadow: 0 8px 22px rgba(4, 31, 82, .16);
}

.round-button { border-radius: 50%; font-size: 27px; line-height: 1; }
.secondary-button { border-radius: 14px; padding: 12px 16px; }
.primary-button {
  color: #083c4b;
  background: linear-gradient(180deg, #ffe56b, #f8b800);
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 10px 24px rgba(76, 49, 0, .24);
  font-size: 17px;
}

.text-button {
  min-height: 44px;
  padding: 8px 4px;
  color: #fff;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.actions { display: grid; gap: 10px; }
.status {
  min-height: 1.5em;
  margin: 13px 4px 0;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.welcome-footer {
  position: absolute;
  z-index: 4;
  right: 8%;
  bottom: 7.2%;
  left: 8%;
  color: rgba(255, 255, 255, .82);
  font-size: clamp(9px, 2.5vw, 12px);
  line-height: 1.3;
  text-align: center;
  text-shadow: 0 2px 5px rgba(4, 24, 70, .65);
  pointer-events: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 700px) {
  body { padding: 24px 0; }
  .app { min-height: auto; border-radius: 20px; overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
  .welcome-motif { animation: none !important; opacity: .24; }
  .event-logo-sweep::before { animation: none !important; opacity: 0; }
}
