:root {
  --red: #de2910;
  --red-deep: #b51f0b;
  --gold: #ffde00;
  --bg: #fff6f2;
  --card: #ffffff;
  --text: #2a1a17;
  --muted: #8a6f69;
  --line: #f1d9d2;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1211;
    --card: #251a18;
    --text: #f6ebe8;
    --muted: #b39a94;
    --line: #3a2a27;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}
header { text-align: center; }
h1 { margin: 4px 0 6px; font-size: 26px; color: var(--red); letter-spacing: 2px; }
.sub { margin: 0; color: var(--muted); font-size: 14px; }

.stage { text-align: center; }
#preview {
  margin: 0 auto;
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 8px 30px rgba(222, 41, 16, .18);
  display: block;
  width: 100%;
  aspect-ratio: 1;
  cursor: pointer;
}
.pick[hidden] { display: none; }

.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 46px; padding: 0 18px;
  border-radius: 12px;
  border: 1.5px solid var(--red);
  background: var(--card);
  color: var(--red);
  font-size: 16px; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}
.btn.primary { background: var(--red); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.98); }

.btn.ghost { background: transparent; border-color: rgba(255,255,255,.5); color: #fff; }

.editor {
  position: fixed; inset: 0;
  z-index: 5;
  background: #000;
  display: flex; flex-direction: column;
  touch-action: none;
  overscroll-behavior: contain;
}
.editor[hidden] { display: none; }
.editor-hint {
  margin: 0;
  padding: calc(14px + env(safe-area-inset-top)) 16px 10px;
  text-align: center;
  color: rgba(255,255,255,.75);
  font-size: 14px;
}
#crop { flex: 1; min-height: 0; width: 100%; display: block; touch-action: none; }
.editor-bar {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
}
body.locked { overflow: hidden; }

.privacy { text-align: center; font-size: 12px; color: var(--muted); margin: 0; }

.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .7);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  z-index: 10;
}
.modal[hidden] { display: none; }
.sheet {
  width: 100%; max-width: 420px;
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  text-align: center;
}
.sheet img { width: 100%; border-radius: 12px; display: block; }
.tip { color: var(--muted); font-size: 13px; margin: 10px 0 12px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
