*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Hiragino Kaku Gothic ProN","Yu Gothic",Meiryo,sans-serif;
  color:#111827;background:#fff;
}
button{font:inherit}
.screen{display:none}
.screen.active{display:block}

.home-wrap{
  width:min(1180px,calc(100% - 40px));
  min-height:100vh;margin:0 auto;
  display:grid;grid-template-columns:1.08fr .92fr;
  align-items:center;gap:72px;padding:38px 0;
}
.hero-collage{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.hero-tile{
  width:100%;aspect-ratio:1;overflow:hidden;
  border-radius:16px;background:#f1f3f6;
}
.hero-tile img{
  width:100%;height:100%;display:block;
  object-fit:cover;object-position:center top;
}
.fallback{
  width:100%;height:100%;display:flex;align-items:center;justify-content:center;
  font-size:2rem;font-weight:800;color:#9aa1ad;background:#f1f3f6;
}
.small-title{font-size:1.15rem;font-weight:800;margin:0 0 12px}
.hero-copy h1{margin:0;font-size:clamp(3rem,6vw,5.7rem);line-height:.98;letter-spacing:-.055em}
.hero-copy h1 span{
  background:linear-gradient(90deg,#6a5ce7,#ee2f9e);
  -webkit-background-clip:text;background-clip:text;color:transparent
}
.description{margin:30px 0 22px;color:#4d5564;font-size:1.07rem;line-height:1.8}
.count{font-size:1rem;color:#5b6270;margin:0 0 22px}
.start-btn,.share-btn{
  border:0;border-radius:14px;padding:18px 24px;color:#fff;font-weight:800;
  font-size:1.05rem;cursor:pointer;background:linear-gradient(90deg,#7060ea,#ec2f9c)
}
.start-btn{width:min(450px,100%)}

.quiz-wrap{width:min(1120px,calc(100% - 32px));margin:0 auto;padding:38px 0 80px}
.progress-row{margin-bottom:24px}
#percent{text-align:right;font-weight:800;color:#3b4250;margin-bottom:10px}
.progress{height:10px;border-radius:99px;background:#edf0f4;overflow:hidden}
#bar{height:100%;width:0;background:linear-gradient(90deg,#7060ea,#ec2f9c);border-radius:99px}
.quiz-wrap h2{text-align:center;font-size:clamp(1.45rem,3vw,2rem);margin:22px 0 26px}

.choices{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;align-items:start}
.choice{
  border:1px solid #dfe3e8;border-radius:14px;background:#f8f9fb;
  overflow:hidden;cursor:pointer;transition:.15s ease;min-width:0
}
.choice:hover{transform:translateY(-2px);box-shadow:0 6px 18px rgba(0,0,0,.07)}
.choice-media{
  width:100%;aspect-ratio:1;overflow:hidden;background:#eef0f3;
}
.choice-media img{
  width:100%;height:100%;display:block;
  object-fit:cover;object-position:center top;
}
.choice-media .fallback{aspect-ratio:1}
.choice-body{padding:13px 14px 15px}
.choice-name{font-size:1.05rem;font-weight:800;line-height:1.35}
.choice-work{margin-top:4px;font-size:.82rem;color:#646c79;min-height:1.2em}

.result-wrap{width:min(880px,calc(100% - 32px));margin:0 auto;padding:50px 0 80px;text-align:center}
.result-wrap h2{font-size:clamp(2rem,5vw,3.4rem);margin:0 0 28px}
.ranking{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;text-align:left}
.rank{
  position:relative;border:1px solid #e1e4e8;border-radius:14px;
  overflow:hidden;background:#fafbfc;
}
.rank-badge{
  position:absolute;top:8px;left:8px;z-index:2;background:#fff;border:1px solid #d9dde3;
  min-width:34px;height:34px;padding:0 8px;border-radius:8px;
  display:flex;align-items:center;justify-content:center;font-weight:800
}
.rank-media{
  width:100%;aspect-ratio:1;overflow:hidden;background:#eef0f3;
}
.rank-media img{
  width:100%;height:100%;display:block;
  object-fit:cover;object-position:center top;
}
.rank-media .fallback{aspect-ratio:1}
.rank-body{padding:11px 12px 13px}
.rank-name{font-weight:800}
.rank-work{font-size:.78rem;color:#747b87;margin-top:3px}

.share-panel{
  margin:30px auto 0;padding:20px;border:1px solid #e2e5ea;
  border-radius:16px;background:#fafbfc;display:flex;flex-wrap:wrap;
  justify-content:center;gap:10px;align-items:center
}
.share-btn{padding:13px 22px}
.secondary-btn{
  border:1px solid #ccd1d8;background:#fff;border-radius:10px;
  padding:12px 18px;cursor:pointer
}
.share-note{width:100%;font-size:.78rem;color:#7a818c;margin:4px 0 0}
.result-actions{margin-top:18px}

@media(max-width:820px){
  .home-wrap{grid-template-columns:1fr;gap:34px;padding:22px 0 44px}
  .hero-copy{order:-1}
  .hero-copy h1{font-size:3.8rem}
  .hero-collage{gap:7px}
  .hero-tile{border-radius:10px}
  .choices{grid-template-columns:repeat(2,1fr);gap:10px}
  .choice-name{font-size:.95rem}
  .choice-work{font-size:.75rem}
}
@media(max-width:420px){
  .quiz-wrap{width:min(100% - 18px,1120px);padding-top:22px}
  .choices{gap:8px}
  .choice-body{padding:10px}
  .choice-name{font-size:.84rem}
  .choice-work{font-size:.68rem}
  .ranking{gap:7px}
  .rank-name{font-size:.78rem}
  .rank-work{font-size:.64rem}
}


/* 結果順位：4・5・6 / 2・1・3 / 7・8・9 の表彰台風配置 */
.ranking .rank-badge{
  top:10px;
  left:10px;
  min-width:auto;
  height:auto;
  padding:5px 10px;
  border:0;
  border-radius:999px;
  background:#fff;
  box-shadow:0 1px 4px rgba(0,0,0,.08);
  color:#111827;
  font-size:.82rem;
  line-height:1;
}
.ranking .rank-1 .rank-badge{
  color:#fff;
  background:linear-gradient(90deg,#8b5cf6,#ec4899);
}
.ranking .rank-2 .rank-badge{
  color:#fff;
  background:#5f82d9;
}
.ranking .rank-body{
  text-align:center;
}
.ranking .rank-name{
  font-weight:800;
}


/* 4人組を作れない端数が2〜3人なら、その人数で比較する */
.choices[data-count="2"]{
  grid-template-columns:repeat(2,minmax(0,280px));
  justify-content:center;
}
.choices[data-count="3"]{
  grid-template-columns:repeat(3,minmax(0,1fr));
  max-width:850px;
  margin-left:auto;
  margin-right:auto;
}
@media(max-width:820px){
  .choices[data-count="2"]{
    grid-template-columns:repeat(2,1fr);
    max-width:none;
  }
  .choices[data-count="3"]{
    grid-template-columns:repeat(2,1fr);
    max-width:none;
  }
}
