/* ================= 照片跑酷 PhotoRunner ================= */

:root {
  --bg: #10142a;
  --bg-soft: #1a1f3d;
  --card: #232a52;
  --card-edge: #343d75;
  --text: #eef1ff;
  --text-dim: #9aa3cf;
  --accent: #ff8a3d;
  --accent-2: #4f8cff;
  --ok: #3ddc84;
  --danger: #ff5d5d;
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* hidden 属性必须永远生效(否则会被下面 .overlay 的 display:flex 覆盖) */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(1200px 700px at 70% -10%, #2a3468 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

#app {
  width: min(960px, 100%);
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: fadein .35s ease;
}
.screen.active { display: flex; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ================= 上传屏 ================= */

.hero { text-align: center; margin: 28px 0 30px; }
.logo { font-size: 56px; filter: drop-shadow(0 6px 18px rgba(255,138,61,.35)); }
.hero h1 {
  font-size: 40px;
  margin-top: 8px;
  background: linear-gradient(90deg, #ffd166, #ff8a3d 45%, #ff6b9d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 2px;
}
.subtitle { color: var(--text-dim); margin-top: 10px; line-height: 1.8; }

.dropzone {
  width: min(560px, 100%);
  padding: 44px 24px;
  border: 2.5px dashed #4a5596;
  border-radius: var(--radius);
  background: rgba(35, 42, 82, .45);
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
  outline: none;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragover {
  border-color: var(--accent);
  background: rgba(255, 138, 61, .08);
  transform: translateY(-2px);
}
.dz-icon { font-size: 44px; }
.dz-text { font-size: 18px; margin-top: 12px; }
.dz-hint { font-size: 13px; color: var(--text-dim); margin-top: 8px; }

.samples { margin-top: 22px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
.samples-label { color: var(--text-dim); font-size: 14px; }
.sample-chips { display: flex; gap: 10px; }
.sample-chip {
  width: 64px; height: 64px;
  border-radius: 14px;
  border: 2px solid var(--card-edge);
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  background: #fff;
  padding: 0;
}
.sample-chip:hover { transform: scale(1.08); border-color: var(--accent); }
.sample-chip img { width: 100%; height: 100%; object-fit: cover; display: block; }

.privacy { margin-top: 26px; color: var(--text-dim); font-size: 13px; }

/* ================= 处理屏 ================= */

.cutting-box { text-align: center; margin-top: 60px; width: min(420px, 100%); }
.scan-frame {
  position: relative;
  width: 240px; height: 240px;
  margin: 0 auto 24px;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--card-edge);
  background: #fff;
}
.scan-frame img { width: 100%; height: 100%; object-fit: contain; }
.scan-line {
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 14px 3px rgba(255,138,61,.55);
  animation: scan 1.6s ease-in-out infinite alternate;
}
@keyframes scan {
  from { top: 4%; } to { top: 94%; }
}
.cutting-status { font-size: 16px; }
.cutting-tips { color: var(--text-dim); font-size: 13px; margin-top: 14px; }

.cutting-error { margin-top: 24px; padding: 18px; border-radius: 14px; background: rgba(255, 93, 93, .1); border: 1px solid rgba(255,93,93,.4); }
.cutting-error p { margin-bottom: 14px; }

/* ================= 预览屏 ================= */

.preview-title { font-size: 26px; margin-top: 44px; }
.preview-wrap {
  margin: 22px 0;
  padding: 14px;
  border-radius: var(--radius);
  background:
    repeating-conic-gradient(#e8eaf2 0% 25%, #ffffff 0% 50%) 0 0 / 26px 26px;
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
}
#preview-canvas { display: block; max-width: 100%; }
.preview-tip { color: var(--text-dim); font-size: 14px; margin-bottom: 22px; }
.link-btn {
  margin-top: 16px;
  background: none; border: none;
  color: var(--text-dim);
  text-decoration: underline;
  cursor: pointer; font-size: 13px;
}
.link-btn:hover { color: var(--accent); }

/* ================= 按钮 ================= */

.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 26px;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s, box-shadow .2s, background .2s;
}
.btn:active { transform: scale(.96); }
.btn-primary {
  background: linear-gradient(135deg, #ffb36b, var(--accent));
  color: #3a1c00;
  font-weight: 700;
  box-shadow: 0 6px 22px rgba(255,138,61,.4);
}
.btn-primary:hover { box-shadow: 0 8px 28px rgba(255,138,61,.6); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--card-edge);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-big { padding: 15px 40px; font-size: 19px; border-radius: 14px; }
.btn-small { padding: 7px 14px; font-size: 14px; }
.btn-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ================= 游戏屏 ================= */

#screen-game { gap: 12px; }

.game-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hud { display: flex; gap: 22px; }
.hud-item { color: var(--text-dim); font-size: 14px; }
.hud-item b { color: var(--text); font-size: 19px; font-variant-numeric: tabular-nums; margin-left: 4px; }

.game-canvas-wrap {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--card-edge);
  box-shadow: 0 18px 60px rgba(0,0,0,.5);
  background: #87ceeb;
  /* 手机上禁止滚动/双击缩放干扰跳跃 */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
#game-canvas { display: block; width: 100%; height: auto; }

.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 14, 34, .45);
  backdrop-filter: blur(2px);
}
/* 起跑提示不拦截点击:手机上点屏幕任何位置都能起跑 */
#overlay-start { pointer-events: none; }
.overlay-card {
  text-align: center;
  background: rgba(20, 25, 55, .92);
  border: 1px solid var(--card-edge);
  padding: 28px 42px;
  border-radius: 16px;
}
.overlay-emoji { font-size: 40px; }
.overlay-card p { font-size: 20px; margin-top: 10px; }
.overlay-sub { color: var(--text-dim); font-size: 14px !important; margin-top: 6px !important; }
.overlay-score b { color: var(--accent); font-size: 30px; }
.new-record { color: #ffd166; font-weight: 700; margin-left: 6px; }
.overlay-card .btn-row { margin-top: 18px; }

.game-hint { color: var(--text-dim); font-size: 13px; }

/* 游戏结束时的震屏 */
.game-canvas-wrap.shake { animation: shake .4s; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 3px); }
  40% { transform: translate(5px, -4px); }
  60% { transform: translate(-4px, -2px); }
  80% { transform: translate(3px, 3px); }
}

/* ================= 移动端 ================= */
@media (max-width: 600px) {
  .hero h1 { font-size: 30px; }
  .hero { margin-top: 10px; }
  .dropzone { padding: 32px 16px; }
  .overlay-card { padding: 20px 24px; }
  .hud { gap: 12px; }
}
