* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  max-width: 1100px;
  margin: 20px auto;
  padding: 20px;
  background:
    radial-gradient(ellipse at top, #2c1810 0%, #0a0606 100%);
  color: #f5f0e8;
  min-height: 100vh;
  /* iOS の自動文字拡大を止める。カードは px 指定で組んでおり、
     勝手に拡大されるとレイアウトも canvas 出力も崩れる。 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
h1 {
  margin: 0 0 8px 0;
  font-size: 28px;
  text-align: center;
  color: #ffd700;
  text-shadow: 2px 2px 0 #8b0000, 4px 4px 12px rgba(0,0,0,0.5);
  letter-spacing: 2px;
}
.lead { text-align: center; color: #d4b896; margin-bottom: 20px; font-size: 14px; }
.badge {
  display: inline-block; padding: 3px 10px;
  background: #ffd700; color: #1a0a0a;
  border-radius: 12px; font-size: 11px; vertical-align: middle; margin-left: 8px;
}
.card-ui {
  background: rgba(255, 250, 240, 0.97);
  color: #1d1d1f;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.1), 0 0 0 1px rgba(255,215,0,0.2);
}
.section-title {
  font-weight: 900; margin-bottom: 12px; font-size: 16px;
  color: #8b0000;
  border-bottom: 2px solid #ffd700;
  padding-bottom: 6px;
}
label { display: block; font-size: 13px; color: #424245; margin: 14px 0 6px 0; font-weight: 600; }
.question-label {
  display: block; font-size: 14px; color: #1a1a2e;
  margin: 16px 0 4px 0; font-weight: 700;
}
.question-label .level {
  display: inline-block; background: #8b0000; color: white;
  padding: 2px 8px; border-radius: 10px; font-size: 11px;
  margin-right: 8px;
}
.question-label .level-final { background: #ffd700; color: #1a0a0a; }
.question-hint { font-size: 11px; color: #888; margin-bottom: 6px; font-style: italic; }
input, textarea, select, button {
  font-size: 14px; padding: 10px 12px;
  border: 1px solid #d2d2d7; border-radius: 8px; width: 100%;
  font-family: inherit; background: white;
}
textarea { resize: vertical; min-height: 60px; }
button {
  background: #8b0000; color: white; border: none; cursor: pointer;
  font-weight: 700; transition: background 0.2s;
}
button:hover:not(:disabled) { background: #6b0000; }
button:disabled { background: #c7c7cc; cursor: not-allowed; }
button.secondary { background: #f5f5f7; color: #1d1d1f; border: 1px solid #d2d2d7; }
button.secondary:hover:not(:disabled) { background: #e8e8ed; }
button.gold {
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  color: #1a0a0a;
  font-size: 17px; padding: 16px; font-weight: 900;
  letter-spacing: 1px;
}
/* 参加者番号の入力 */
.member-no {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 3px;
  text-align: center;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  max-width: 260px;
}
.member-no.invalid { border-color: #d32f2f; background: #fff6f6; }

.media-wrap {
  display: flex; justify-content: center;
  background: #000; border-radius: 10px; overflow: hidden;
  margin-bottom: 12px; min-height: 200px;
}
video, .preview-img {
  width: 100%; max-width: 420px; max-height: 560px;
  object-fit: contain; background: #000; display: block;
}
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row button { flex: 1; min-width: 120px; }
.small { font-size: 12px; color: #6e6e73; margin-top: 6px; }
.hidden { display: none !important; }
.status {
  font-size: 13px; padding: 10px 14px; border-radius: 8px; margin: 12px 0;
}
.status.info { background: #fff3cd; color: #8b5a00; }
.status.error { background: #ffeaea; color: #d32f2f; white-space: pre-wrap; }
.status.success { background: #e8f8e8; color: #2e7d32; }
.loading {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid #ffe5a0; border-top-color: #8b5a00;
  border-radius: 50%; animation: spin 0.8s linear infinite;
  vertical-align: -2px; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* カード本体のスタイルは card.css（管理画面と共用）にある */


/* ───── 自動保存が使えない環境向けの長押し保存エリア ───── */
.save-fallback { margin-top: 14px; }
.save-fallback .note {
  font-size: 13px; line-height: 1.6;
  background: #fff3cd; color: #8b5a00;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 10px;
}
.save-fallback img {
  display: block; width: 100%; max-width: 380px; margin: 0 auto;
  border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

/* ───── 狭い画面（iPhone SE など）───── */
@media (max-width: 640px) {
  body { margin: 12px auto; padding: 12px; }
  h1 { font-size: 22px; letter-spacing: 1px; }
  .card-ui { padding: 14px; }
  .card-stage { padding: 20px 10px; }
}
