* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: #f8f9fa;
  color: #222;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 120px; }

header.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0; border-bottom: 2px solid #4CAF50; margin-bottom: 16px;
}
.brand .logo {
  width: 40px; height: 40px; border-radius: 9px; background: #4CAF50;
  color: #fff; font-size: 22px; display: flex; align-items: center; justify-content: center;
}
.brand .title { font-size: 22px; font-weight: 700; }
.brand .sub { font-size: 13px; color: #888; }

.section { margin: 18px 0; }
.label { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.hint { font-size: 13px; color: #888; margin-top: 4px; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pick {
  border: 2px solid #ddd; background: #fff; border-radius: 12px;
  padding: 18px 10px; text-align: center; font-size: 18px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.pick.active { border-color: #4CAF50; background: #e8f5e9; color: #2e7d32; }

.tpls { display: grid; grid-template-columns: 1fr; gap: 10px; }
.tpl {
  border: 2px solid #ddd; background: #fff; border-radius: 12px; padding: 14px;
  cursor: pointer; display: flex; align-items: center; gap: 12px;
}
.tpl.active { border-color: #4CAF50; background: #e8f5e9; }
.tpl .emoji { font-size: 26px; }
.tpl .tname { font-weight: 700; font-size: 17px; }
.tpl .tdesc { font-size: 13px; color: #777; }

input[type=text] {
  width: 100%; padding: 12px 14px; font-size: 16px;
  border: 2px solid #ddd; border-radius: 10px; background: #fff;
}
input[type=text]:focus { border-color: #4CAF50; outline: none; }

.shot {
  background: #fff; border: 2px solid #eee; border-radius: 12px;
  padding: 14px; margin-bottom: 12px;
}
.shot.ok { border-color: #4CAF50; }
.shot.bad { border-color: #e53935; }
.shot .head { display: flex; align-items: baseline; gap: 8px; }
.shot .num {
  background: #4CAF50; color: #fff; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: 0 0 auto;
}
.shot .desc { font-size: 14px; color: #555; }
.shot .tip { font-size: 12px; color: #4CAF50; background:#f1f8e9; padding:8px 10px; border-radius:8px; margin-top:8px; }
.shot .status { margin-top: 10px; font-size: 14px; }
.shot .status.good { color: #2e7d32; }
.shot .status.err { color: #c62828; }

.btn {
  display: block; width: 100%; padding: 14px; font-size: 17px; font-weight: 700;
  border: none; border-radius: 12px; cursor: pointer; min-height: 50px;
}
.btn-file { background: #eef4ff; color: #2962ff; border: 2px dashed #90b4ff; }
.btn-primary { background: #4CAF50; color: #fff; }
.btn-primary:disabled { background: #bdbdbd; cursor: not-allowed; }
.btn-ghost { background: #fff; color: #444; border: 2px solid #ddd; }

.submit-bar {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px;
  background: rgba(248,249,250,.96); border-top: 1px solid #e0e0e0;
}
.submit-bar .inner { max-width: 560px; margin: 0 auto; }

input[type=file] { display: none; }

/* loading overlay */
.overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,.95);
  display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 50; padding: 24px;
}
.overlay.show { display: flex; }
.spinner {
  width: 56px; height: 56px; border: 6px solid #e0e0e0; border-top-color: #4CAF50;
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.overlay .msg { margin-top: 18px; font-size: 18px; font-weight: 600; }
.overlay .pct { margin-top: 8px; font-size: 28px; font-weight: 800; color: #4CAF50; }

/* status page */
.ring-wrap { text-align: center; margin: 30px 0; }
.ring { width: 160px; height: 160px; margin: 0 auto; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 36px; font-weight: 800; color: #4CAF50; }
.statusmsg { text-align: center; font-size: 18px; font-weight: 600; margin: 12px 0; }
video { width: 100%; border-radius: 12px; background: #000; }
.copybox { background: #fff; border: 2px solid #eee; border-radius: 12px; padding: 12px; margin: 12px 0; }
.copybox .ttl { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 6px; }
.copybox .body { white-space: pre-wrap; font-size: 14px; color: #333; }
.copybtn { background: #e8f5e9; color: #2e7d32; border: none; border-radius: 8px; padding: 6px 12px; font-size: 13px; font-weight: 700; cursor: pointer; }
.errbox { background: #ffebee; color: #c62828; padding: 16px; border-radius: 12px; text-align: center; }
.stack > * { margin-bottom: 12px; }
