@font-face {
  font-family: "EOY Noto Sans TC";
  src: url("./素材/landing-noto-tc-400.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "EOY Noto Sans TC";
  src: url("./素材/landing-noto-tc-700.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: Arial, "Helvetica Neue", sans-serif;
  background: #f7f4ef;
  color: #0b0b0b;
  font-synthesis: none;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

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

button {
  border: 0;
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.screen {
  display: none;
  position: fixed;
  inset: 0;
  min-height: 100dvh;
}

.screen.is-active {
  display: flex;
}

.landing-screen {
  font-family: "EOY Noto Sans TC", Arial, sans-serif;
  flex-direction: column;
  justify-content: space-between;
  overflow: auto;
  padding: calc(44px + var(--safe-top)) max(28px, var(--safe-right)) calc(24px + var(--safe-bottom)) max(28px, var(--safe-left));
  background: #fbfaf8;
  isolation: isolate;
}

.landing-content {
  position: absolute;
  top: 37.1%;
  left: max(28px, var(--safe-left));
  right: max(28px, var(--safe-right));
  z-index: 2;
  margin: 0;
  text-align: center;
}

.eyebrow {
  margin: 0 0 15px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.28em;
}

.landing-logo-heading {
  margin: 0;
  height: 40px;
  overflow: hidden;
}

.landing-brand {
  display: block;
  width: 260.516px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.landing-copy {
  margin: 30px 0 0;
  color: #897342;
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.36em;
}

.landing-actions {
  position: relative;
  z-index: 3;
  width: min(100%, 420px);
  margin: auto auto 0;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 56px;
  padding: 16px 24px;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.primary-button {
  background: #0b0b0b;
  color: #fff;
}

.primary-button:active {
  background: #2a2a2a;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.secondary-button {
  border: 1px solid #0b0b0b;
  background: transparent;
}

.privacy-note {
  margin: 12px 0 0;
  color: #68645f;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-align: center;
}

.landing-art {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(100%, 390px);
  transform: translateX(-50%);
  container-type: inline-size;
  z-index: 0;
  pointer-events: none;
}

.landing-rose {
  position: absolute;
  top: 51.6866%;
  left: 27.3127cqw;
  width: 90.1336cqw;
  height: 147.4885cqw;
  transform: rotate(33.49deg);
  opacity: 0.65;
  overflow: hidden;
}

.landing-rose img {
  position: absolute;
  left: -38.52%;
  top: -1.54%;
  width: 175.11%;
  height: 102.31%;
  max-width: none;
  opacity: 0.6;
}

.landing-rule {
  display: block;
  width: 32px;
  height: 1px;
  margin: 30px auto 0;
  background: #c4a65e;
}

.landing-screen .primary-button {
  border: 1px solid #b89b56;
  background: #b89b56;
  color: #fff;
}

.landing-screen .primary-button:active {
  background: #9f8343;
}

.landing-screen .privacy-note {
  line-height: 1.8;
  color: #817969;
}

@media (max-height: 500px) {
  .landing-screen { padding-top: calc(20px + var(--safe-top)); }
  .landing-content { top: 15%; margin: 0; }
  .landing-brand { width: 220px; }
  .landing-copy { margin-top: 12px; }
  .landing-rule { margin-top: 14px; }
}

.camera-screen {
  flex-direction: column;
  background: #090909;
  color: #fff;
}

.camera-header,
.result-header {
  flex: 0 0 auto;
}

.camera-header {
  display: grid;
  min-height: calc(58px + var(--safe-top));
  grid-template-columns: 72px 1fr 88px;
  align-items: center;
  padding: var(--safe-top) max(8px, var(--safe-right)) 0 max(8px, var(--safe-left));
}

.icon-button,
.control-button {
  cursor: pointer;
  background: transparent;
  color: #fff;
}

.plain-icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  justify-self: start;
}

.plain-icon-button svg {
  width: 27px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.beauty-toggle {
  display: flex;
  min-width: 84px;
  min-height: 44px;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  padding: 0;
  cursor: pointer;
  background: transparent;
  color: #fff;
}

.beauty-toggle-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.beauty-toggle-track {
  position: relative;
  width: 40px;
  height: 24px;
  border: 1px solid #777;
  border-radius: 999px;
  background: #262626;
  transition: border-color 160ms ease, background 160ms ease;
}

.beauty-toggle-track span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

.beauty-toggle[aria-pressed="true"] .beauty-toggle-track {
  border-color: #fff;
  background: #fff;
}

.beauty-toggle[aria-pressed="true"] .beauty-toggle-track span {
  background: #090909;
  transform: translateX(16px);
}

.beauty-toggle:disabled {
  cursor: default;
  opacity: 0.35;
}

.camera-stage-wrap {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  padding: 0 max(8px, var(--safe-right)) 4px max(8px, var(--safe-left));
}

.camera-stage {
  position: relative;
  width: min(100%, calc((100dvh - 178px - var(--safe-top) - var(--safe-bottom)) * 8 / 9));
  max-height: calc(100dvh - 178px - var(--safe-top) - var(--safe-bottom));
  aspect-ratio: 8 / 9;
  overflow: hidden;
  background: #161616;
}

#cameraVideo {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#previewCanvas,
#frameOverlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#previewCanvas {
  display: block;
}

#frameOverlay {
  z-index: 2;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

.camera-message {
  display: flex;
  position: absolute;
  inset: 0;
  z-index: 3;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #151515;
  text-align: center;
}

.camera-message p {
  width: min(80%, 280px);
  margin: 16px auto;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  line-height: 1.7;
}

.camera-message[hidden] {
  display: none;
}

.loading-ring {
  width: 30px;
  height: 30px;
  border: 1px solid #555;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.text-button {
  border-bottom: 1px solid currentColor;
  padding: 7px 2px;
  cursor: pointer;
  background: transparent;
  color: #fff;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
}

.capture-flash {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.capture-flash.is-flashing {
  animation: flash 220ms ease-out;
}

@keyframes flash {
  0% { opacity: 0; }
  35% { opacity: 0.88; }
  100% { opacity: 0; }
}

.camera-controls {
  display: grid;
  min-height: calc(116px + var(--safe-bottom));
  flex: 0 0 auto;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  padding: 8px max(20px, var(--safe-right)) calc(14px + var(--safe-bottom)) max(20px, var(--safe-left));
}

.camera-controls .capture-button {
  grid-column: 2;
}

.control-button {
  display: flex;
  width: 68px;
  min-height: 64px;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  justify-content: center;
  justify-self: center;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
}

.control-button svg {
  width: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.control-button:disabled,
.capture-button:disabled {
  cursor: default;
  opacity: 0.35;
}

.frame-icon {
  display: block;
  width: 22px;
  height: 27px;
  border: 1px solid currentColor;
  box-shadow: inset 0 0 0 4px #090909, inset 0 0 0 5px currentColor;
}

.capture-button {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  justify-self: center;
  border: 2px solid #fff;
  border-radius: 50%;
  padding: 5px;
  cursor: pointer;
  background: transparent;
}

.capture-button span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #fff;
  transition: transform 120ms ease;
}

.capture-button:active span {
  transform: scale(0.9);
}

.result-screen {
  flex-direction: column;
  overflow-y: auto;
  padding: calc(34px + var(--safe-top)) max(24px, var(--safe-right)) calc(24px + var(--safe-bottom)) max(24px, var(--safe-left));
  background: #f7f4ef;
}

.result-header {
  text-align: center;
}

.result-header .eyebrow {
  margin-bottom: 7px;
}

.result-header h2 {
  margin: 0;
  font-family: inherit;
  font-size: 1.8rem;
  font-weight: 700;
}

.result-image-wrap {
  display: flex;
  min-height: 0;
  flex: 1 0 auto;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}

#resultImage {
  display: block;
  width: min(100%, 390px, calc((100dvh - 268px - var(--safe-top) - var(--safe-bottom)) * 8 / 9));
  max-height: calc(100dvh - 268px - var(--safe-top) - var(--safe-bottom));
  aspect-ratio: 8 / 9;
  background: #ddd;
  box-shadow: 0 16px 38px rgba(20, 17, 12, 0.15);
  object-fit: contain;
}

.result-actions {
  width: min(100%, 420px);
  flex: 0 0 auto;
  margin: 0 auto;
}

.result-actions .secondary-button {
  margin-top: 10px;
}

.download-hint {
  white-space: pre-line;
  min-height: 1.2em;
  margin: 10px 0 0;
  color: #5e5a55;
  font-size: 0.68rem;
  line-height: 1.5;
  text-align: center;
}

.download-fallback {
  display: block;
  min-height: 44px;
  margin: 6px auto 0;
  padding: 8px 16px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
}

.download-fallback[hidden] {
  display: none;
}

.orientation-notice {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  background: #090909;
  color: #fff;
  text-align: center;
}

.orientation-notice span {
  font-size: 2.4rem;
}

.orientation-notice p {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
  .orientation-notice {
    display: flex;
  }
}

@media (min-width: 760px) {


  .camera-stage {
    width: min(100%, calc((100dvh - 188px - var(--safe-top) - var(--safe-bottom)) * 8 / 9));
    max-height: calc(100dvh - 188px - var(--safe-top) - var(--safe-bottom));
  }
}

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