:root {
  --bg: #0c0a08;
  --gold: #c9a227;
  --cream: #f7edd4;
  --muted: rgba(247, 237, 212, 0.72);
  --btn: #e7c56a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--cream);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  user-select: none;
  overflow: hidden;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: #000;
  overflow: hidden;
}

.poster,
#shot,
#preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster {
  background-size: cover;
  background-position: center;
  z-index: 0;
}

#camera,
#person {
  position: absolute;
  object-fit: cover;
  z-index: 1;
  background: transparent;
  pointer-events: none;
}

#person {
  z-index: 2;
}

.overlay-cutout #camera {
  opacity: 0;
}

#preview {
  pointer-events: none;
  z-index: 0;
}

#sign {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  touch-action: none;
}

video.mirror,
canvas.mirror {
  transform: scaleX(-1);
}

.layer {
  position: absolute;
  inset: 0;
}

.top-bar,
.bottom-bar {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 22px 22px calc(18px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-bar {
  top: 0;
  padding-top: calc(18px + env(safe-area-inset-top));
}

.bottom-bar {
  bottom: 0;
  flex-direction: column;
  gap: 16px;
}

.brand {
  letter-spacing: 0.42em;
  font-size: 15px;
  padding-left: 0.42em;
}

.hole {
  position: absolute;
  border: 1px dashed var(--accent, var(--gold));
  background: transparent;
  pointer-events: auto;
  z-index: 3;
  cursor: move;
}

.hole span {
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--accent, var(--gold));
  border-radius: 3px;
  z-index: 3;
}

.hole [data-dir="nw"] { left: -8px; top: -8px; cursor: nwse-resize; }
.hole [data-dir="ne"] { right: -8px; top: -8px; cursor: nesw-resize; }
.hole [data-dir="sw"] { left: -8px; bottom: -8px; cursor: nesw-resize; }
.hole [data-dir="se"] { right: -8px; bottom: -8px; cursor: nwse-resize; }

.hole-mode #camera {
  background: #111;
}

.hole-mode .hole {
  border-style: solid;
  border-width: 3px;
  box-shadow: 0 0 0 9999px rgba(8, 6, 4, 0.55);
}

.picker {
  width: 100%;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: none;
}

.picker::-webkit-scrollbar {
  display: none;
}

.thumb {
  flex: 0 0 70px;
  height: 92px;
  border: 2px solid transparent;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.08em;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.thumb.active {
  border-color: var(--btn);
  box-shadow: 0 0 0 2px rgba(231, 197, 106, 0.35);
}

.stamp {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(14% + 52% + 3.5%);
  text-align: center;
  z-index: 3;
  color: rgba(244, 216, 140, 0.92);
  letter-spacing: 0.14em;
  font-size: 14px;
}

.count {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  font-size: 120px;
  font-weight: 600;
  color: var(--cream);
  text-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}

.hint {
  color: var(--muted);
  font-size: 14px;
}

.shutter,
.primary,
.ghost {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.shutter {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--btn);
  color: #1a1408;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
  box-shadow: 0 0 0 8px rgba(201, 162, 39, 0.28);
}

.shutter:disabled {
  opacity: 0.45;
}

.ghost,
.primary,
.wide {
  border-radius: 999px;
  padding: 12px 18px;
}

.ghost {
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(247, 237, 212, 0.35) !important;
}

.primary {
  background: var(--btn);
  color: #1a1408;
  font-weight: 700;
}

.wide {
  min-width: 42%;
  text-align: center;
}

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 24px 20px calc(28px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent 42%, rgba(12, 10, 8, 0.92) 68%);
  z-index: 5;
}

#confirm-ui {
  justify-content: flex-end;
  background: linear-gradient(180deg, transparent 35%, rgba(12, 10, 8, 0.94) 62%);
}

#confirm-ui .qr-title,
#confirm-ui .actions {
  position: relative;
  z-index: 7;
}

.actions {
  width: 100%;
  display: flex;
  gap: 12px;
  justify-content: center;
  position: relative;
  z-index: 6;
}

.qr-title {
  letter-spacing: 0.28em;
  margin-bottom: 16px;
}

#qr-img {
  width: 220px;
  height: 220px;
  background: #fff8e8;
  border-radius: 16px;
  padding: 10px;
}

.code-label {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

.take-code {
  font-size: 42px;
  letter-spacing: 0.28em;
  font-weight: 700;
  margin: 4px 0 10px;
}

.error-text {
  padding: 0 24px 20px;
  text-align: center;
  line-height: 1.6;
}

#origin-hint {
  margin-top: 16px;
  padding: 0 20px;
  text-align: center;
}

#origin-hint a {
  color: var(--btn);
}

.demo-hole {
  background: transparent;
}

.hidden {
  display: none !important;
}
