/* Phase 3: ダイアログ・通知・規約・作成の演出・操作性の調整 */

/* ---- 操作性 ---- */
html { -webkit-text-size-adjust: 100%; }
button, .dropzone, .card-item { touch-action: manipulation; -webkit-touch-callout: none; user-select: none; }
button { min-height: 2.2rem; cursor: pointer; }
button:focus-visible, input:focus-visible, .card-item:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}
#toolbar { padding-top: env(safe-area-inset-top); }
.screen { animation: fadein 0.25s ease; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
@keyframes fadein { from { opacity: 0; transform: translateY(0.4rem); } to { opacity: 1; transform: none; } }
button.big { transition: transform 0.08s, filter 0.15s; }
button.big:hover:not(:disabled) { filter: brightness(1.08); }
.link { font: inherit; font-size: 0.8rem; color: #e8d9a8; background: none; border: none; text-decoration: underline; min-height: 0; }

/* スライダーのつまみを、指でつかみやすい大きさに */
input[type=range] { height: 2rem; }
input[type=range]::-webkit-slider-thumb { width: 1.4rem; height: 1.4rem; }
input[type=range]::-moz-range-thumb { width: 1.4rem; height: 1.4rem; }
.agree input { width: 1.4rem; height: 1.4rem; }

/* ---- マイめんこの詳細・通報 ---- */
.detail { display: flex; gap: 0.8rem; align-items: center; width: 100%; background: rgba(255,255,255,0.07); border-radius: 0.6rem; padding: 0.6rem; text-align: left; }
#detail-card { width: 3rem; height: auto; border-radius: 0.3rem; }
.detail-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; }
.row { display: flex; gap: 0.5rem; }
button.small { font: inherit; font-size: 0.72rem; font-weight: 700; padding: 0.3rem 0.7rem; min-height: 0; border-radius: 0.4rem; color: #fff; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.4); }
button.small.danger { background: #b03a2e; border-color: #b03a2e; }
button.small:disabled { opacity: 0.35; }
.flag { font-size: 0.62rem; background: #ffb347; color: #3a1d05; border-radius: 0.8rem; padding: 0.05rem 0.5rem; font-weight: 800; }
.flag[hidden] { display: none; }
.card-item .mark { position: absolute; left: 0.2rem; top: 0.2rem; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: #ffb347; }

/* ---- ダイアログ ---- */
.modal { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.65); padding: 1rem; }
.modal[hidden] { display: none; }
.modal-box { width: 100%; max-height: 92%; overflow-y: auto; background: #3a2a1c; border: 2px solid #ffd34d; border-radius: 0.8rem; padding: 1rem; text-align: left; animation: fadein 0.2s ease; }
.modal-box h3 { font-size: 1.1rem; margin: 0 0 0.6rem; color: #ffd34d; }
#modal-body { font-size: 0.85rem; line-height: 1.7; }
#modal-body p { margin: 0 0 0.5rem; }
#modal-body ol { margin: 0 0 0.5rem; padding-left: 1.3rem; }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 0.8rem; }
.modal-actions button { font: inherit; font-weight: 800; font-size: 0.9rem; padding: 0.5rem 1.1rem; border-radius: 0.6rem; border: none; color: #3a1d05; background: linear-gradient(#ffd34d, #f0a020); }
.modal-actions button.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.5); }
.modal-actions button.danger { background: #b03a2e; color: #fff; }
.modal-actions button:disabled { opacity: 0.4; }
.reason { display: block; padding: 0.4rem 0.5rem; border-radius: 0.5rem; margin-bottom: 0.3rem; background: rgba(255,255,255,0.07); }
.reason input { margin-right: 0.4rem; }
.reason small { display: block; margin-left: 1.4rem; color: #e8d9a8; font-size: 0.72rem; line-height: 1.4; }
.modal-box textarea { width: 100%; font: inherit; font-size: 0.85rem; border-radius: 0.5rem; border: 1px solid rgba(255,255,255,0.4); background: rgba(255,255,255,0.1); color: #fff; padding: 0.4rem; resize: none; }

.toast { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); z-index: 20; max-width: 90%; background: rgba(0,0,0,0.85); color: #fff; font-size: 0.85rem; padding: 0.6rem 1rem; border-radius: 1rem; text-align: center; animation: fadein 0.2s ease; }
.toast[hidden] { display: none; }

/* ---- 作成画面 ---- */
.steps { list-style: none; display: flex; gap: 0.3rem; margin: 0; padding: 0; width: 100%; font-size: 0.65rem; }
.steps li { flex: 1; text-align: center; padding: 0.3rem 0; border-radius: 0.4rem; background: rgba(255,255,255,0.08); color: #a99a7a; }
.steps li.cur { background: #ffd34d; color: #3a1d05; font-weight: 800; }
.steps li.done { background: rgba(111,191,115,0.35); color: #fff; }
.steps li.done::before { content: "済 "; }

.dropzone { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 5rem; border: 2px dashed rgba(255,255,255,0.5); border-radius: 0.8rem; padding: 0.8rem; font-weight: 800; font-size: 0.95rem; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.dropzone small { font-weight: 400; color: #e8d9a8; font-size: 0.7rem; }
.dropzone.over, .dropzone:hover { background: rgba(255,211,77,0.15); border-color: #ffd34d; }
.dropzone input { display: none; }
.dropzone.compact { min-height: 2.4rem; font-size: 0.8rem; }

.editor-stage { perspective: 40rem; }
#editor-canvas { transition: transform 0.25s cubic-bezier(.2,1.6,.4,1); transform: rotate(var(--tilt, 0deg)) scale(var(--pop, 1)); }
.type-label { margin: 0; font-weight: 800; font-size: 1rem; color: #ffd34d; }
.type-label:empty { display: none; }

.terms h4 { font-size: 0.8rem; margin: 0 0 0.3rem; }
.ok-ng { display: flex; gap: 0.5rem; margin: 0.4rem 0; }
.ok-ng > div { flex: 1; border-radius: 0.5rem; padding: 0.5rem; font-size: 0.7rem; line-height: 1.5; }
.ok-ng ul { margin: 0; padding-left: 1rem; }
.ok-ng li { margin-bottom: 0.2rem; }
.ok-ng small { display: block; color: #e8d9a8; font-size: 0.62rem; }
.ok { background: rgba(111,191,115,0.18); border: 1px solid rgba(111,191,115,0.6); }
.ng { background: rgba(214,69,65,0.18); border: 1px solid rgba(214,69,65,0.6); }
.ok h4 { color: #9fe3a3; }
.ng h4 { color: #ff9a8a; }

.checklist { list-style: none; margin: 0; padding: 0; width: 100%; font-size: 0.8rem; display: flex; flex-direction: column; gap: 0.2rem; text-align: left; }
.checklist li::before { content: "未"; display: inline-block; width: 1.6rem; margin-right: 0.4rem; text-align: center; border-radius: 0.3rem; background: rgba(255,255,255,0.15); font-size: 0.65rem; }
.checklist li.met::before { content: "済"; background: #4caf50; }

/* ---- 完了画面 ---- */
#confetti { position: absolute; inset: 0; z-index: 5; width: 100%; height: 100%; pointer-events: none; }
.done-stage #done-card { animation: bounce-in 0.7s cubic-bezier(.2,1.6,.4,1); box-shadow: 0 0.6rem 1.4rem rgba(0,0,0,0.5); }
@keyframes bounce-in { from { transform: scale(0.3) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .screen, .modal-box, .toast, .done-stage #done-card { animation: none; }
  #editor-canvas { transition: none; }
}

button.big.dim { opacity: 0.55; }

/* 著作権の注意書き。画像を選ぶ前に目に入るよう、目立つ色の枠にする */
.copyright-note { width: 100%; text-align: left; background: rgba(255,179,71,0.16); border: 2px solid #ffb347; border-radius: 0.6rem; padding: 0.5rem 0.7rem; font-size: 0.78rem; line-height: 1.6; }
.copyright-note b { color: #ffb347; }
.copyright-note p { margin: 0.2rem 0 0; }

/* 画面の下の土俵が透けて読みにくくならないよう、通常の画面はほぼ不透明にする */
.screen { background: rgba(24, 14, 8, 0.95); }
.screen.overlay { background: rgba(24, 14, 8, 0.72); }

/* 中央寄せのままだと、背の低い画面で上が切れて届かなくなる。autoマージンなら、あふれたらスクロールできる */
.screen { justify-content: flex-start; }
.screen > :first-child { margin-top: auto; }
.screen > :last-child { margin-bottom: auto; }
