:root {
  --or1: #ff7e5f;
  --or2: #feb47b;
  --ink: #3c3333;
  --muted: #7a7373;
  --bg: #f0f4f8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: 'M PLUS Rounded 1c', system-ui, sans-serif;
  padding: 16px;
}
.app {
  max-width: 960px;
  margin: 0 auto;
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);
  padding: 20px 28px 16px;
}
.app-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(45deg, var(--or1), var(--or2));
  display: grid; place-items: center; box-shadow: 0 4px 10px rgba(255,126,95,.35);
}
.logo-text { font-weight: 800; font-size: 1.5rem; letter-spacing: .02em; }
.grad {
  background: linear-gradient(to right, var(--or1), var(--or2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.badge-demo { font-size: .8rem; background: #fff3ec; color: #d9603f; border-radius: 999px; padding: 4px 12px; font-weight: 700; }

.step { padding: 12px 0 8px; }
.lead-small { color: var(--muted); font-weight: 700; margin: 4px 0 10px; word-break: keep-all; text-align: center; }
.hero { font-weight: 800; font-size: clamp(1.8rem, 5vw, 2.8rem); line-height: 1.3; margin: 0 0 12px; }
.muted { color: var(--muted); line-height: 1.8; }
.start-card { display: block; width: min(420px, 100%); margin: 20px auto 0; border-radius: 12px; box-shadow: 0 10px 24px rgba(0,0,0,.14); }
.btn-xl { font-size: clamp(1.2rem, 4vw, 1.6rem); padding: .8rem 2.4rem; }

/* 進み方 */
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 4px 0 12px; }
.steps li { flex: 1; text-align: center; font-weight: 800; font-size: clamp(.72rem, 2.6vw, .95rem); color: #b9b2b2; background: #f6f6f8; border-radius: 999px; padding: 6px 4px; }
.steps li.now { color: #fff; background: linear-gradient(to right, var(--or1), var(--or2)); }
.steps li.done { color: #d9603f; background: #fff3ec; }

.btn-meishot {
  background: linear-gradient(to right, var(--or1), var(--or2));
  border: 0; color: #fff; font-weight: 800; border-radius: 999px;
  box-shadow: 0 6px 14px rgba(255,126,95,.35);
}
.btn-meishot:hover, .btn-meishot:focus { color: #fff; filter: brightness(1.04); }
.btn-outline-meishot { border: 2px solid var(--or1); color: #e0603e; font-weight: 800; border-radius: 999px; background: #fff; }
.btn-outline-meishot:hover { background: #fff3ec; color: #e0603e; }
.btn-light { border-radius: 999px; font-weight: 700; }

/* 撮影 */
.topic { text-align: center; margin: 4px auto 14px; }
.topic-label { font-size: .8rem; color: var(--muted); font-weight: 700; }
.topic-text {
  display: inline-block; min-width: min(420px, 100%); margin-top: 4px;
  background: #f6f6f8; border-radius: 999px; padding: 8px 24px;
  font-size: clamp(1.2rem, 3.6vw, 1.7rem); font-weight: 800;
}
.topic-text.decided { background: #fff3ec; color: #d9603f; }
.topic-pose { margin-top: 6px; color: var(--muted); font-weight: 700; min-height: 1.5em; }
.cam-wrap {
  position: relative; width: 100%; aspect-ratio: 275 / 173;
  background: #1d1d22; border-radius: 20px; overflow: hidden;
}
.cam-wrap video, .cam-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-wrap video { transform: scaleX(-1); }
.lock {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: linear-gradient(135deg, #fff7f2, #ffe9dd); text-align: center; padding: 16px;
}
.lock-text { margin: 0; font-weight: 800; color: #b5674e; }
.cam-msg { position: absolute; inset: 0; display: grid; place-items: center; color: #ddd; font-weight: 700; text-align: center; padding: 16px; }
.cam-hint {
  position: absolute; left: 12px; bottom: 12px; background: rgba(255,255,255,.88);
  border-radius: 999px; padding: 4px 12px; font-size: .85rem; font-weight: 700;
}
.countdown {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: clamp(5rem, 22vw, 12rem); font-weight: 800; color: #fff;
  text-shadow: 0 6px 24px rgba(0,0,0,.45); background: rgba(0,0,0,.12);
}
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .25s ease-out; }
.flash.on { opacity: 1; transition: none; }
.shoot-actions { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 16px; flex-wrap: wrap; }
.shutter {
  width: 76px; height: 76px; border-radius: 50%; border: 6px solid #ffe2d6;
  background: linear-gradient(45deg, var(--or1), var(--or2));
  box-shadow: 0 6px 16px rgba(255,126,95,.45); transition: transform .15s;
}
.shutter:active { transform: scale(.94); }
.shutter:disabled { filter: grayscale(1); opacity: .45; box-shadow: none; }
.file-btn { cursor: pointer; }

/* 生成中 */
.gen { text-align: center; padding: 48px 8px; }
.gen-icon { font-size: 3rem; animation: spin 2.4s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.gen-title { font-weight: 800; font-size: 1.4rem; margin: 16px 0 20px; }
.gen-progress { height: 14px; border-radius: 999px; max-width: 520px; margin: 0 auto; background: #f1f1f4; }
.gen-progress .progress-bar { background: linear-gradient(to right, var(--or1), var(--or2)); transition: width .25s; }
.gen-log { margin-top: 14px; color: var(--muted); font-weight: 700; min-height: 1.5em; }

/* 名刺 */
.card-stage { perspective: 1400px; display: flex; justify-content: center; padding: 8px 0 4px; }
.mcard {
  position: relative; width: min(560px, 100%); aspect-ratio: 275 / 173;
  transform-style: preserve-3d; transition: transform .9s cubic-bezier(.3,.7,.2,1);
  cursor: pointer; outline: none;
}
.mcard.flipped { transform: rotateY(180deg); }
.mcard:focus-visible { box-shadow: 0 0 0 4px #ffd3c2; border-radius: 16px; }
.mcard-face {
  position: absolute; inset: 0; border-radius: 16px; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 14px 30px rgba(0,0,0,.18);
}
.mcard-front { background: #fff; border: 1px solid #eee; }
.mcard-front img { width: 100%; height: 100%; display: block; }
.mcard-back { transform: rotateY(180deg); background: #222; }
.mcard-back img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-actions { display: flex; justify-content: center; gap: 14px; margin-top: 22px; flex-wrap: wrap; }

.app-foot { margin-top: 18px; padding-top: 12px; border-top: 1px solid #f0f0f0; color: #9a9393; font-size: .78rem; text-align: center; }

@media (max-width: 480px) {
  body { padding: 10px; }
  .app { padding: 16px 16px 12px; border-radius: 22px; }
  .shutter { width: 68px; height: 68px; }
  .shoot-actions .btn { font-size: 1rem; padding: .5rem 1rem; }
}
