* { box-sizing: border-box; }
html { height: 100dvh; background: #6eb5df; }
body { margin: 0; height: 100dvh; background: #6eb5df url("images/background.webp") top center no-repeat; background-size: auto 100%; }
.text-center { text-align: center !important; }
.text-white { color: #ffffff !important; }
.hidden { display: none; }
#app {
  max-width: 480px;
  min-height: 780px;
  height: 100dvh;
  margin: 0 auto;
  /* background: url("images/main.webp") center/cover no-repeat; */
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
}
.page-heading {
  font-family: "Barlow Semi Condensed", sans-serif;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-align: center;
  color: #ffffff;
  font-size: 18px;
}
.hero-heading {
  margin-top: 10px;
  margin-bottom: 22px;
  color: #ffffff;
  font-size: 38px;
  line-height: 0.98;
  text-align: center;
  text-transform: uppercase;
}
.screen1-inner {
  padding: 18px 22px 22px;
  gap: 11px;
}
.screen1-inner .input {
  min-height: 46px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  background: rgba(207, 235, 249, 0.92);
  border-color: transparent;
  color: #102840;
}
.screen1-inner .input::placeholder {
  color: #102840;
  opacity: 1;
}
.screen1-inner .terms-box {
  min-height: 175px;
  border-radius: 18px;
  padding: 13px 11px;
  background: rgba(207, 235, 249, 0.92);
  border-color: transparent;
  font-size: 14px;
  line-height: 1.35;
  text-align: left;
  color: #102840;
}
.screen1-inner .agree {
  justify-content: center;
  font-size: 15px;
  color: #FFF;
}
.screen1-inner .agree a {
  color: #2646d5;
  text-decoration: underline;
  font-weight: bold;
}
.field-error {
  min-height: 18px;
  margin: -6px 2px 0;
  text-align: center;
  color: #b42318;
  font-size: 13px;
  font-weight: 600;
}
.input.is-invalid,
.screen1-inner #agree.is-invalid {
  border-color: #b42318 !important;
  box-shadow: 0 0 0 2px rgba(180, 35, 24, 0.12);
}
.screen1-inner #agree {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #9cbdd4;
  border-radius: 4px;
  background: #ffffff;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
}
.screen1-inner #agree::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: transform 0.12s ease-in-out;
  clip-path: polygon(14% 44%, 0 65%, 45% 100%, 100% 16%, 80% 0%, 43% 62%);
  background-color: #1e78d2;
}
.screen1-inner #agree:checked {
  border-color: #1e78d2;
  background: #ffffff;
}
.screen1-inner #agree:checked::before {
  transform: scale(1);
}
.screen1-inner #btn-join {
  margin-top: 6px;
  min-height: 53px;
  border-radius: 14px;
  font-size: 26px;
  font-weight: 700;
  font-family: "Barlow Semi Condensed", sans-serif;
  letter-spacing: 0.2px;
}
.btn-dark-teal,
.btn.btn-dark-teal {
  background: #114a5a;
  border-color: #114a5a;
  color: #ffffff;
}
.btn-dark-teal:hover,
.btn.btn-dark-teal:hover {
  background: #0d3f4d;
  border-color: #0d3f4d;
}
#btn-pick,
#btn-capture,
#btn-back,
#btn-finish,
#btn-download,
#btn-share,
#btn-replay {
  background: #114a5a !important;
  border-color: #114a5a !important;
  color: #ffffff !important;
  font-family: "Barlow Semi Condensed", sans-serif;
  font-weight: 600;
  letter-spacing: 0.2px;
}
#btn-pick:hover,
#btn-capture:hover,
#btn-back:hover,
#btn-finish:hover,
#btn-download:hover,
#btn-share:hover,
#btn-replay:hover {
  background: #0d3f4d !important;
  border-color: #0d3f4d !important;
}
.screen {
  position: absolute;
  top: calc(min(100vw, 480px) * 395 / 840);
  right: 0;
  bottom: calc(min(100vw, 480px) * 350 / 840);
  left: 0;
  display: block;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;

}
.screen.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  z-index: 20;
}
.inner {
  padding: 18px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}
.terms-box {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  height: 140px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.45;
}
.agree { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.dropzone {
  border: 2px dashed #8ea8cc;
  border-radius: 12px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.dropzone.dragover {
  border-color: #2563eb;
  background: #eaf2ff;
}
.status { min-height: 20px; font-size: 13px; color: #333; }
.capture-section {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.35);
  display: grid;
  gap: 8px;
  justify-items: center;
}
.capture-hint {
  margin: 0;
  color: #ffffff;
  font-size: 13px;
  text-align: center;
  line-height: 1.35;
}
.editor-wrap {
  width: 90%;
  display: flex;
  justify-content: center;
  transform-origin: top center;
  margin: 0 auto;
}
.editor-canvas {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 762 / 1356;
  height: auto;
  position: relative;
  overflow: hidden;
  background: #eee;
  touch-action: none;
  cursor: grab;
}
.editor-canvas:active {
  cursor: grabbing;
}
.editor-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  /* border-radius: 12px; */
  background: rgba(11, 36, 68, 0.22);
  color: #ffffff;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.editor-hint.is-hidden {
  opacity: 0;
}
.editor-hint-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
}
.editor-hint-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.editor-hint-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 500;
}
#editor-image {
  position: absolute;
  max-width: none;
  max-height: none;
  user-select: none;
  -webkit-user-drag: none;
  cursor: inherit;
}
#editor-image.dragging { cursor: grabbing; }
.frame-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.ratio-options {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.ratio-option {
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.ratio-option.is-active {
  background: #ffffff;
  color: #114a5a;
  border-color: #ffffff;
}
.actions {
  margin-top: 0;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.actions .btn {
  min-width: 150px;
  min-height: 40px;
  border-radius: 14px;
  font-size: 15px;
  /* font-weight: 700;
  font-family: "Barlow Semi Condensed", sans-serif; */
  padding: 0 14px;
  white-space: nowrap;
}
#btn-pick, #btn-capture {
  min-width: 150px;
  padding: 0 14px;
}
#btn-replay {
  min-width: 200px;
  margin: 0 auto;
  background: #FFF !important;
  color: #114a5a !important;
}
.result-image {
  max-width: 90%;
  width: auto;
  height: auto;
  max-height: 340px;
  margin: 0 auto;
  display: block;
}
@media (max-height: 799px) {
  .result-image {
    max-height: 280px;
  }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(2px);
}
.deco-header-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  display: block;
}
.deco-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  aspect-ratio: 840 / 395;
  z-index: 10;
  pointer-events: auto;
  display: block;
  transform: translateZ(0);
}
.deco-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  aspect-ratio: 840 / 350;
  z-index: 10;
  pointer-events: none;
  display: block;
  transform: translateZ(0);
}
.app-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(12px);
  background: rgba(8, 29, 57, 0.92);
  color: #fff;
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  z-index: 120;
  transition: all 0.22s ease;
}
.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#screen-3 .inner, #screen-4 .inner {
  margin-top: -10px;
}

.m-hidden { display: none; }

@media (max-width: 480px) {
  .hero-heading {
    font-size: 32px;
  }
  .screen1-inner #btn-join {
    font-size: 22px;
  }
}

@media (max-height: 799px) {
  .screen1-inner #btn-join {
      font-size: 18px;
  }
  .ratio-options {
    margin-top: 0px;
    padding: 4px 20px;
  }
  .btn {
    height: 2.6rem;
  }
  #btn-pick, #btn-capture, .actions .btn {
    min-width: 120px;
    padding: 0 14px;
  }
  .inner {
    gap: 10px;
  }
  #btn-replay {
    min-width: 140px;
    height: 2.4rem;
    min-height: 2.4rem;
  }
}

@media (min-height: 800px) {
  .dropzone {
    min-height: 220px;
  }
  .actions {
    margin-top: 10px;
  }
  .actions .btn {
    min-width: 150px;
    min-height: 46px;
    font-size: 17px;
  }
  .page-heading {
    font-size: 22px;
  }
  #screen-3 .inner, #screen-4 .inner {
    margin-top: -20px;
  }
  .m-hidden { display: block; }
}
