*{box-sizing:border-box}
:root{
  --bg:#071021;--panel:#111827;--panel2:#1f2937;--line:#334155;
  --text:#f8fafc;--muted:#94a3b8;--yellow:#facc15;--white:#fff;
}
html,body{margin:0;min-height:100%;background:linear-gradient(180deg,#182338 0,#071021 45%,#020617 100%);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Hiragino Kaku Gothic ProN","Yu Gothic",Meiryo,sans-serif}
body{padding:16px}
button{font:inherit}
.app{width:min(1180px,100%);margin:0 auto}
.hero{padding:14px 0 24px}
.eyebrow{margin:0 0 10px;color:var(--yellow);font-weight:800;letter-spacing:.06em}
.hero-row{display:flex;align-items:flex-start;justify-content:space-between;gap:18px}
h1{margin:0;font-size:clamp(42px,7vw,76px);line-height:1.08}
.score{min-width:90px;padding:10px 14px;border:2px solid var(--yellow);border-radius:18px;background:#111827;text-align:center}
.score span{display:block;color:var(--muted);font-size:12px}
.score strong{font-size:30px}
.panel{margin-bottom:16px;padding:clamp(16px,3vw,24px);border:1px solid rgba(148,163,184,.25);border-radius:26px;background:rgba(17,24,39,.96);box-shadow:0 18px 50px rgba(0,0,0,.25)}
.hidden{display:none!important}
.loading-panel{text-align:center;min-height:220px;display:grid;place-content:center}
.spinner{width:58px;height:58px;margin:0 auto 18px;border:6px solid #334155;border-top-color:var(--yellow);border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.primary,.secondary,.slot{border:0;border-radius:14px;font-weight:800;cursor:pointer}
.primary{padding:13px 22px;background:var(--yellow);color:#111827}
.secondary{padding:12px 20px;background:#334155;color:#fff}
.question-card{overflow:hidden;border-radius:22px;background:#fff;color:#111827}
.question-front{display:grid;grid-template-columns:minmax(0,7fr) minmax(132px,3fr);align-items:start}
.question-copy{grid-column:1;grid-row:1;padding:24px}
.question-image-wrap{grid-column:2;grid-row:1;width:100%;aspect-ratio:1/1;margin:18px 18px 0 0;border-radius:16px;overflow:hidden;background:#e2e8f0}
.question-image{width:100%;height:100%;object-fit:cover;display:block}
.kana{margin:0 0 4px;color:#64748b;font-size:13px}
.person-name{margin:0 0 12px;font-size:clamp(25px,4vw,40px);line-height:1.25}
.short{margin:0;color:#334155;line-height:1.7}
.next-area{text-align:center;margin-top:16px}
.rule-note{text-align:center;margin:14px 0 0;color:var(--muted);font-size:14px}
.timeline-heading{margin:0 0 16px}
.timeline{display:flex;align-items:stretch;gap:8px;overflow-x:auto;padding:6px 2px 14px}
.slot{flex:0 0 56px;min-height:170px;padding:8px 4px;background:rgba(250,204,21,.12);color:var(--yellow);border:2px dashed rgba(250,204,21,.75);writing-mode:vertical-rl;text-orientation:upright}
.slot:hover,.slot:focus-visible{background:var(--yellow);color:#111827}
.timeline-card{flex:0 0 170px;min-height:170px;padding:14px;border:1px solid var(--line);border-radius:18px;background:var(--panel2);cursor:pointer}
.timeline-card img{width:100%;aspect-ratio:1/1;object-fit:cover;border-radius:12px;background:#cbd5e1}
.timeline-card h3{margin:10px 0 4px;font-size:17px}
.timeline-card .year{color:var(--yellow);font-size:14px;font-weight:800}
.restart-wrap{text-align:center;padding:4px 0 24px}
.game-over{text-align:center}
.final-score{margin:8px 0 16px;color:var(--yellow);font-size:clamp(64px,15vw,110px);font-weight:900;line-height:1}

/* 詳細表示。画像は出題時と同じ右上30%。文章は回り込み、下は全幅。 */
.detail-view{display:flow-root;padding:24px;background:#fff;color:#111827}
.detail-image-wrap{float:right;width:30%;min-width:132px;max-width:220px;aspect-ratio:1/1;margin:0 0 14px 20px;border-radius:16px;overflow:hidden;background:#e2e8f0}
.detail-image{width:100%;height:100%;object-fit:cover;display:block}
.detail-title{margin:0 0 14px;font-size:clamp(25px,4vw,40px);line-height:1.3}
.detail-years{font-size:.5em;font-weight:700;white-space:nowrap}
.detail-description{line-height:1.8}
.detail-description p:first-child{margin-top:0}
.detail-link{display:inline-block;margin-top:10px;color:#2563eb}

.modal{position:fixed;inset:0;z-index:9999;display:grid;place-items:center;padding:16px}
.modal-backdrop{position:absolute;inset:0;border:0;background:rgba(2,6,23,.8);cursor:pointer}
.modal-card{position:relative;z-index:1;width:min(760px,100%);max-height:88vh;overflow:auto;border-radius:24px;background:#fff;color:#111827;box-shadow:0 30px 80px rgba(0,0,0,.5)}
.modal-close{position:sticky;top:10px;float:right;z-index:2;width:42px;height:42px;margin:10px 10px 0 0;border:0;border-radius:50%;background:#111827;color:#fff;font-size:28px;line-height:1;cursor:pointer}

@media(max-width:640px){
  body{padding:10px}
  .hero-row{align-items:flex-start}
  h1{font-size:44px}
  .question-front{grid-template-columns:minmax(0,7fr) minmax(106px,3fr)}
  .question-copy{padding:16px}
  .question-image-wrap{margin:12px 12px 0 0}
  .detail-view{padding:16px}
  .detail-image-wrap{width:30%;min-width:106px;max-width:150px;margin:0 0 12px 14px}
  .timeline-card{flex-basis:145px}
}


/* 最終調整 */
h1 {
  font-size: clamp(28px, 5vw, 48px);
}

.question-panel {
  border: 0;
  box-shadow: none;
}

/* 問題画像と詳細画像を同じ小型サムネイルに固定 */
.question-front {
  display: flow-root;
}

.question-copy {
  display: block;
  padding: 24px;
}

.question-image-wrap {
  float: right;
  width: 120px;
  height: 120px;
  margin: 18px 18px 14px 20px;
  border-radius: 14px;
  overflow: hidden;
  background: #e2e8f0;
}

.question-image {
  width: 120px;
  height: 120px;
  object-fit: cover;
  display: block;
}

.detail-image-wrap {
  float: right;
  width: 120px;
  min-width: 120px;
  max-width: 120px;
  height: 120px;
  margin: 0 0 14px 20px;
  border-radius: 14px;
  overflow: hidden;
  background: #e2e8f0;
}

.detail-image {
  width: 120px;
  height: 120px;
  object-fit: cover;
  display: block;
}

@media (max-width: 640px) {
  h1 {
    font-size: 32px;
  }

  .question-copy {
    padding: 16px;
  }

  .question-image-wrap,
  .detail-image-wrap {
    width: 96px;
    min-width: 96px;
    max-width: 96px;
    height: 96px;
    margin: 12px 12px 12px 14px;
  }

  .question-image,
  .detail-image {
    width: 96px;
    height: 96px;
  }
}


/* ×ボタンは内容上に重ね、余白を作らない */
.modal-card {
  position: relative;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  float: none;
  margin: 0;
  z-index: 10;
}


/* 出題エリア外側の枠線を削除 */
.question-panel {
  border: none !important;
  box-shadow: none !important;
}
