/* ═══════════════════════════════════════════════════════════
   キャラソート・推しソートメーカー — style.css
   ═══════════════════════════════════════════════════════════ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #fff7ed;
  color: #1c1917;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
header {
  background: #ea580c;
  color: #fff;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.header-inner {
  max-width: 960px; margin: 0 auto; padding: 0 1rem;
  height: 52px; display: flex; align-items: center;
}
.logo { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: .02em; }

/* ── Main ── */
main { max-width: 960px; margin: 0 auto; padding: 1.4rem 1rem 3rem; }

.hero { text-align: center; margin-bottom: 1.3rem; }
.hero-icon { font-size: 2.6rem; line-height: 1; margin-bottom: .4rem; }
.hero h1 { font-size: 1.75rem; font-weight: 800; color: #ea580c; line-height: 1.3; margin-bottom: .5rem; }
.description { font-size: .95rem; color: #57534e; max-width: 640px; margin: 0 auto .8rem; }
.hero-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.badge {
  font-size: .75rem; font-weight: 600; padding: .22rem .7rem; border-radius: 999px;
  background: #ffedd5; color: #9a3412; border: 1px solid #fdba74;
}

.card {
  background: #fff; border-radius: 14px; padding: 1.4rem;
  border: 1.5px solid #fed7aa; margin-bottom: 1.2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card h2 { font-size: 1.15rem; font-weight: 700; color: #ea580c; margin-bottom: .9rem; }

/* ── Screen switching ── */
.screen { display: none; }
.screen.active { display: block; }

/* ── Fields ── */
.field { margin-bottom: 1rem; }
.field-label { display: block; font-size: .88rem; font-weight: 700; color: #292524; margin-bottom: .35rem; }
.field-hint { font-size: .76rem; color: #78716c; margin-top: .3rem; }
.field input[type="text"], .field textarea, .field input[type="url"] {
  width: 100%; padding: .6rem .75rem; font-size: .95rem; font-family: inherit;
  border: 1.5px solid #e7e5e4; border-radius: 8px; background: #fafaf9; color: #1c1917;
  transition: border-color .15s;
}
.field input:focus, .field textarea:focus { outline: none; border-color: #ea580c; background: #fff; }
.field textarea { min-height: 200px; resize: vertical; line-height: 1.6; }
.check-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; font-size: .88rem; }
.check-row label { display: flex; align-items: center; gap: .35rem; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: #ea580c; }

.count-badge { font-size: .8rem; color: #ea580c; font-weight: 700; margin-left: .4rem; }

/* ── Image rows (A+B) ── */
.img-toggle { font-size: .85rem; color: #ea580c; font-weight: 700; cursor: pointer; background: none; border: none; font-family: inherit; padding: .2rem 0; }
.img-toggle:hover { text-decoration: underline; }
.img-rows { display: none; margin-top: .6rem; border-top: 1px dashed #fed7aa; padding-top: .6rem; max-height: 420px; overflow-y: auto; }
.img-rows.open { display: block; }
.img-row { display: grid; grid-template-columns: 44px 1fr auto; gap: .5rem; align-items: center; padding: .35rem 0; border-bottom: 1px solid #f5f5f4; }
.img-row:last-child { border-bottom: none; }
.img-thumb { width: 44px; height: 44px; border-radius: 8px; background: #f5f5f4; border: 1px solid #e7e5e4; display: flex; align-items: center; justify-content: center; font-size: 1rem; color: #a8a29e; overflow: hidden; }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-row-body { min-width: 0; }
.img-row-name { font-size: .85rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.img-row-url { width: 100%; font-size: .78rem; padding: .3rem .5rem; border: 1px solid #e7e5e4; border-radius: 6px; font-family: inherit; background: #fafaf9; margin-top: .2rem; }
.img-row-url:focus { outline: none; border-color: #ea580c; background: #fff; }
.img-row-acts { display: flex; flex-direction: column; gap: .25rem; }
.mini-btn { font-size: .72rem; padding: .25rem .55rem; border: 1px solid #d6d3d1; border-radius: 6px; background: #fff; cursor: pointer; font-family: inherit; color: #44403c; white-space: nowrap; }
.mini-btn:hover { border-color: #ea580c; color: #ea580c; }
.mini-btn.file { position: relative; overflow: hidden; }
.mini-btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.img-note { font-size: .76rem; color: #78716c; background: #fff7ed; padding: .5rem .7rem; border-radius: 8px; margin-top: .6rem; line-height: 1.6; }

/* ── Buttons ── */
.btn-primary {
  width: 100%; padding: .85rem; font-size: 1.05rem; font-weight: 700; font-family: inherit;
  background: #ea580c; color: #fff; border: none; border-radius: 10px; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: #c2410c; }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { background: #d6d3d1; cursor: not-allowed; }
.btn-secondary {
  padding: .6rem 1rem; font-size: .88rem; font-weight: 600; font-family: inherit;
  background: #fff; color: #ea580c; border: 1.5px solid #ea580c; border-radius: 8px; cursor: pointer;
}
.btn-secondary:hover { background: #fff7ed; }
.btn-secondary:disabled { color: #a8a29e; border-color: #d6d3d1; cursor: not-allowed; background: #fff; }
.btn-dark {
  padding: .6rem 1rem; font-size: .88rem; font-weight: 600; font-family: inherit;
  background: #1c1917; color: #fff; border: none; border-radius: 8px; cursor: pointer;
}
.btn-dark:hover { background: #292524; }
.btn-x { background: #000; }
.btn-x:hover { background: #333; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; }
.btn-row > * { flex: 1 1 auto; text-align: center; }

/* ── Share URL box ── */
.share-box { background: #fff7ed; border: 1.5px solid #fed7aa; border-radius: 10px; padding: 1rem; margin-top: 1rem; }
.share-box h3 { font-size: .95rem; color: #9a3412; margin-bottom: .5rem; }
.share-url { display: flex; gap: .5rem; }
.share-url input { flex: 1; min-width: 0; padding: .55rem .7rem; font-size: .85rem; border: 1.5px solid #e7e5e4; border-radius: 8px; background: #fff; font-family: inherit; }
.share-len { font-size: .74rem; color: #78716c; margin-top: .35rem; }
.share-warn { font-size: .78rem; color: #b91c1c; margin-top: .35rem; font-weight: 600; }

/* ── Recent list ── */
.recent-list { list-style: none; }
.recent-list li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid #f5f5f4; font-size: .88rem; }
.recent-list li:last-child { border-bottom: none; }
.recent-list a { color: #ea580c; font-weight: 700; text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-list a:hover { text-decoration: underline; }
.recent-list small { color: #78716c; white-space: nowrap; }

/* ── Play screen ── */
.play-head { text-align: center; margin-bottom: 1rem; }
.play-title { font-size: 1.3rem; font-weight: 800; color: #1c1917; }
.play-author { font-size: .82rem; color: #78716c; margin-top: .2rem; }
.progress-wrap { margin: .8rem auto 1.2rem; max-width: 520px; }
.progress-bar { height: 12px; background: #ffedd5; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #fb923c, #ea580c); border-radius: 999px; transition: width .25s; }
.progress-text { font-size: .8rem; color: #78716c; text-align: center; margin-top: .35rem; }
.vs-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: .8rem; align-items: stretch; }
.vs-mark { display: flex; align-items: center; justify-content: center; font-weight: 900; color: #ea580c; font-size: 1.3rem; }
.choice {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem;
  min-height: 180px; padding: 1.2rem .8rem; font-size: 1.25rem; font-weight: 800; font-family: inherit;
  background: #fff; color: #1c1917; border: 2.5px solid #fdba74; border-radius: 16px; cursor: pointer;
  transition: transform .12s, border-color .12s, box-shadow .12s; word-break: break-word; text-align: center;
}
.choice:hover { border-color: #ea580c; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(234,88,12,.18); }
.choice:active { transform: scale(.97); }
.choice img { width: 140px; height: 140px; object-fit: cover; border-radius: 12px; background: #f5f5f4; }
.choice .key-hint { font-size: .72rem; color: #a8a29e; font-weight: 500; }
.play-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 1rem; }
.play-actions button { min-width: 120px; }
.play-note { font-size: .78rem; color: #78716c; text-align: center; margin-top: .6rem; }

/* ── Result screen ── */
.result-grid { display: grid; grid-template-columns: 1fr 360px; gap: 1.2rem; align-items: start; }
.rank-list { list-style: none; }
.rank-list li { display: flex; align-items: center; gap: .7rem; padding: .5rem .3rem; border-bottom: 1px solid #f5f5f4; font-size: .95rem; }
.rank-list li:last-child { border-bottom: none; }
.rank-no { flex: 0 0 2.4rem; font-weight: 900; color: #ea580c; text-align: right; font-size: 1.05rem; }
.rank-list li.top1 .rank-no { color: #d97706; font-size: 1.25rem; }
.rank-list li.top2 .rank-no { color: #6b7280; }
.rank-list li.top3 .rank-no { color: #b45309; }
.rank-img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; background: #f5f5f4; flex: 0 0 36px; }
.rank-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.rank-list li.top1 .rank-name { font-size: 1.1rem; font-weight: 800; }
.preview-card { position: sticky; top: 62px; }
.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .45rem; margin-bottom: .8rem; }
.theme-btn {
  padding: .5rem .4rem; font-size: .8rem; font-weight: 600; font-family: inherit;
  border: 1.5px solid #e7e5e4; border-radius: 8px; background: #fff; cursor: pointer; color: #44403c;
}
.theme-btn.active { border-color: #ea580c; background: #fff7ed; color: #ea580c; }
.preview-img-wrap { background: #f5f5f4; border-radius: 10px; overflow: hidden; margin-bottom: .8rem; min-height: 120px; display: flex; align-items: center; justify-content: center; }
.preview-img-wrap img { width: 100%; display: block; }
.preview-actions { display: flex; flex-direction: column; gap: .5rem; }
.preview-actions button { width: 100%; padding: .7rem; font-size: .92rem; }

/* ── Amazon ── */
.amazon-card h2 { font-size: 1.05rem; }
.amazon-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.amazon-item {
  display: flex; gap: .7rem; align-items: flex-start; padding: .8rem; border-radius: 10px;
  border: 1px solid #f5f5f4; background: #fafaf9; text-decoration: none; color: inherit; transition: border-color .15s;
}
.amazon-item:hover { border-color: #ea580c; }
.amazon-item-icon { font-size: 1.6rem; line-height: 1; }
.amazon-item-name { font-size: .88rem; font-weight: 700; color: #1c1917; }
.amazon-item-desc { font-size: .76rem; color: #78716c; margin-top: .15rem; }
.amazon-item-link { font-size: .76rem; color: #ea580c; font-weight: 600; margin-top: .3rem; }

/* ── Scene grid ── */
.scene-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.scene-item { background: #fff7ed; border-radius: 10px; padding: .9rem; }
.scene-item strong { display: block; font-size: .92rem; color: #9a3412; margin-bottom: .3rem; }
.scene-item p { font-size: .84rem; color: #57534e; }

/* ── Guide ── */
.guide-card h3 { font-size: 1rem; font-weight: 700; color: #292524; margin: 1.1rem 0 .4rem; padding-left: .6rem; border-left: 4px solid #ea580c; }
.guide-card h3:first-of-type { margin-top: 0; }
.guide-card p { font-size: .9rem; color: #44403c; margin-bottom: .5rem; }
.guide-card p strong { color: #c2410c; }
.guide-card ol, .guide-card ul { font-size: .9rem; color: #44403c; padding-left: 1.4rem; margin-bottom: .6rem; }
.guide-card li { margin-bottom: .25rem; }
.x-example { background: #f5f5f4; border-radius: 8px; padding: .8rem .9rem; font-size: .86rem; white-space: pre-wrap; line-height: 1.7; color: #292524; margin: .4rem 0 .8rem; }

/* ── Maker note ── */
.maker-note { background: #fffdf5; border: 1.5px solid #f2e6c4; }
.maker-note h2 { color: #7a5c00; }
.mn-item { padding: .85rem 0; border-bottom: 1px dashed #eadfb8; }
.mn-item:last-of-type { border-bottom: none; }
.mn-head { font-size: .92rem; font-weight: 700; color: #8a6a00; margin-bottom: .4rem; }
.mn-item p { font-size: .88rem; line-height: 1.85; color: #5c534a; }
.mn-sign { text-align: right; font-size: .8rem; color: #b09a5e; margin-top: .9rem; font-style: italic; }

/* ── FAQ ── */
.faq-list { display: flex; flex-direction: column; gap: .9rem; }
.faq-item { border-bottom: 1px solid #f5f5f4; padding-bottom: .9rem; }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-q { font-size: .92rem; font-weight: 700; color: #ea580c; margin-bottom: .3rem; }
.faq-a { font-size: .86rem; color: #44403c; }

/* ── Related ── */
.related-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.related-tool-item {
  display: flex; flex-direction: column; gap: .15rem; padding: .8rem; border-radius: 10px;
  border: 1px solid #f5f5f4; background: #fafaf9; text-decoration: none; color: #1c1917; font-size: .88rem; font-weight: 700;
}
.related-tool-item:hover { border-color: #ea580c; }
.related-tool-item span { font-size: 1.4rem; }
.related-tool-item small { font-size: .74rem; color: #78716c; font-weight: 400; }

/* ── Footer ── */
footer { text-align: center; padding: 1.6rem 1rem 2.2rem; font-size: .8rem; color: #78716c; border-top: 1px solid #fed7aa; }
footer a { color: #ea580c; text-decoration: none; }
footer a:hover { text-decoration: underline; }
.amazon-notice { font-size: .72rem; color: #a8a29e; margin-top: .5rem; }

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #1c1917; color: #fff; padding: .6rem 1.1rem; border-radius: 999px; font-size: .85rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 780px) {
  .result-grid { grid-template-columns: 1fr; }
  .preview-card { position: static; }
  .related-tools { grid-template-columns: 1fr; }
  .scene-grid, .amazon-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .hero h1 { font-size: 1.35rem; }
  .card { padding: 1rem; }
  .vs-grid { grid-template-columns: 1fr; }
  .vs-mark { padding: .2rem 0; }
  .choice { min-height: 110px; font-size: 1.1rem; padding: .9rem .6rem; }
  .choice img { width: 96px; height: 96px; }
  .choice .key-hint { display: none; }
  .img-row { grid-template-columns: 40px 1fr; }
  .img-row-acts { grid-column: 2; flex-direction: row; }
}
