:root {
  --ink: #f0f5fa;
  --muted: #9faebd;
  --deep: #0a1622;
  --deep-soft: #132435;
  --teal: #64b4e8;
  --teal-dark: #0f4c78;
  --vermilion: #006faa;
  --gold: #d2ae68;
  --paper: #f2f6fa;
  --paper-deep: #dce6ef;
  --line: rgba(240, 245, 250, .22);
  --line-dark: rgba(10, 22, 34, .18);
  --shadow: 0 24px 60px rgba(0, 0, 0, .28);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--deep);
  color: var(--ink);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
a {
  font: inherit;
  cursor: pointer;
}

button {
  border: 0;
  color: inherit;
}

a {
  text-decoration: none;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.hidden {
  display: none !important;
}

.app-shell,
.screen {
  width: 100%;
  height: 100%;
  min-height: 100svh;
}

.app-shell {
  background: var(--deep);
}

.screen {
  position: relative;
  overflow: hidden;
}

.kicker,
.step-count {
  color: var(--teal);
  font: 600 10px/1.3 "DM Mono", "SFMono-Regular", monospace;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.brand-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 13px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(100, 180, 232, .7);
  background: linear-gradient(110deg, rgba(10, 22, 34, .62), rgba(0, 111, 170, .28), rgba(10, 22, 34, .62));
  background-size: 220% 100%;
  background-position: 0 0;
  color: #eaf4fc;
  background-clip: padding-box;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(100, 180, 232, .58), 0 1px 1px rgba(0, 0, 0, .5);
  -webkit-text-fill-color: #eaf4fc;
  animation: brandBreath 3.8s ease-in-out infinite;
}

.brand-mark::before {
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: -45%;
  width: 42%;
  background: linear-gradient(90deg, transparent, rgba(240, 245, 250, .32), transparent);
  content: "";
  transform: skewX(-18deg);
  animation: brandSweep 5.6s ease-in-out infinite;
}

.result-screen {
  display: flex;
  flex-direction: column;
  padding: 30px clamp(22px, 7vw, 100px) 28px;
  background: var(--paper);
  color: var(--deep);
}

.result-screen::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 7px;
  background: var(--vermilion);
  content: "";
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.result-head .kicker {
  color: var(--teal-dark);
}

.result-head strong {
  color: rgba(10, 22, 34, .62);
  font-size: 13px;
  font-weight: 600;
}

.result-photo-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 760px);
  height: min(66vh, 680px);
  margin: clamp(24px, 6vh, 66px) auto 22px;
  overflow: hidden;
  border: 1px solid rgba(10, 22, 34, .24);
  background: var(--paper-deep);
  box-shadow: var(--shadow);
}

.result-photo-wrap::before,
.result-photo-wrap::after {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: var(--gold);
  border-style: solid;
  content: "";
  pointer-events: none;
}

.result-photo-wrap::before {
  top: 14px;
  left: 14px;
  border-width: 1px 0 0 1px;
}

.result-photo-wrap::after {
  right: 14px;
  bottom: 14px;
  border-width: 0 1px 1px 0;
}

.result-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-loading {
  position: absolute;
  color: rgba(10, 22, 34, .58);
  font-size: 13px;
}

.result-copy {
  width: min(100%, 760px);
  margin: 0 auto 22px;
}

.result-copy p {
  margin: 0 0 7px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.result-copy small {
  color: rgba(10, 22, 34, .58);
  font-size: 12px;
}

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

.save-action,
.again-action {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-radius: 2px;
  font-size: 13px;
  font-weight: 700;
  transition: transform .2s ease, background-color .2s ease, border-color .2s ease;
}

.save-action:hover,
.again-action:hover,
.primary-action:hover,
.shutter-action:hover {
  transform: translateY(-2px);
}

.save-action {
  flex: 1;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  background: var(--deep);
  color: var(--teal);
}

.save-action span {
  color: var(--gold);
  font-size: 20px;
  font-weight: 400;
}

.again-action {
  border: 1px solid rgba(10, 22, 34, .28);
  background: transparent;
  color: var(--deep);
}

.toast {
  position: fixed;
  z-index: 20;
  bottom: 28px;
  left: 50%;
  max-width: calc(100% - 40px);
  padding: 12px 17px;
  transform: translate(-50%, 20px);
  background: var(--deep);
  color: var(--ink);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (min-width: 800px) {
  .result-screen {
    align-items: center;
  }

  .result-photo-wrap {
    height: min(64vh, 680px);
  }
}

@media (max-width: 500px) {
  .result-screen {
    padding: calc(24px + env(safe-area-inset-top, 0px)) 20px calc(22px + env(safe-area-inset-bottom, 0px));
  }

  .result-photo-wrap {
    height: 58vh;
    margin-top: 28px;
  }

  .result-copy p {
    font-size: 24px;
  }

  .result-actions {
    flex-direction: column;
  }

  .again-action {
    justify-content: center;
  }
}

@keyframes brandBreath {
  0%, 100% {
    border-color: rgba(100, 180, 232, .58);
    box-shadow: 0 0 0 rgba(100, 180, 232, 0), inset 0 0 0 rgba(100, 180, 232, 0);
    filter: drop-shadow(0 0 0 rgba(100, 180, 232, 0));
  }
  50% {
    border-color: rgba(100, 180, 232, .98);
    box-shadow: 0 0 24px rgba(100, 180, 232, .18), inset 0 0 18px rgba(100, 180, 232, .08);
    filter: drop-shadow(0 0 7px rgba(100, 180, 232, .34));
  }
}

@keyframes brandSweep {
  0%, 48% { left: -45%; opacity: 0; }
  62% { opacity: .9; }
  82%, 100% { left: 120%; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark,
  .brand-mark::before {
    animation: none;
  }
}

/* 全云端方案：结果页保存提示 */
.save-hint {
  margin: 6px 0 0;
  font-size: 12px;
  letter-spacing: 0.02em;
  opacity: 0.62;
}

/* 全云端方案：照片过期提示 */
.expiry-hint {
  display: block;
  margin-top: 4px;
  color: rgba(10, 22, 34, .58);
  font-size: 12px;
}

/* ===== 我的照片 ===== */
.my-photos-link {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(100, 180, 232, .55);
  border-radius: 2px;
  background: rgba(10, 19, 30, .36);
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  transition: background-color .2s ease, color .2s ease;
}

.my-photos-link:hover {
  background: rgba(100, 180, 232, .18);
  color: var(--ink);
}

.photos-screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 20px calc(22px + env(safe-area-inset-bottom, 0px));
  background: var(--deep);
}

.photos-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.photos-top .back-button {
  align-self: flex-start;
}

.photos-top div {
  display: grid;
  gap: 6px;
}

.photos-top strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.photos-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.photos-scroll {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.photos-grid {
  display: grid;
  flex: 1;
  align-content: start;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 0;
  overflow-y: auto;
}

.photo-card {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--deep-soft);
}

.photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.photo-card figcaption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 16px 8px 6px;
  background: linear-gradient(rgba(10, 22, 34, 0), rgba(10, 22, 34, .86));
  color: var(--ink);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photos-empty {
  padding: 40px 0;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.photos-more {
  flex: none;
  min-height: 44px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  transition: background-color .2s ease;
}

.photos-more:hover {
  background: rgba(100, 180, 232, .14);
}

@media (max-width: 500px) {
  .photos-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
