/* ============================================================
   星空シミュレーター  seiza-planetarium
   修正: 全天円形ビュー → 天球（一人称）ビューに変更
   ============================================================ */
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
html,body{margin:0;padding:0;height:100%;overflow:hidden;}
body{
  font-family:"BIZ UDPGothic","Hiragino Sans","Yu Gothic",-apple-system,sans-serif;
  background:#0b1020;
}

.sp-root{
  position:relative;
  display:flex;
  flex-direction:column;
  width:100%;
  height:100dvh;
  overflow:hidden;
  background:#0b1020;
  color:#fff;
  user-select:none;
}

/* ---------- ヘッダー ---------- */
/* 修正: 行を明確に分けて、幅が狭くても要素が重ならないようにする */
.sp-root .sp-header{
  flex:0 0 auto;
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:6px 10px;
  background:#1e3a5f;
  border-bottom:2px solid #d4af37;
}
.sp-root .sp-hdr-row{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:5px;
}
.sp-root .sp-title{
  font-size:17px;
  flex:0 0 auto;
}
.sp-root .sp-hbtn{
  flex:0 0 auto;
  border:1px solid rgba(212,175,55,.7);
  background:#16294a;
  color:#fff;
  border-radius:999px;
  width:24px; height:24px;
  font-size:12px;
  cursor:pointer;
}
.sp-root .sp-hbtn:active{background:#d4af37;color:#1e3a5f;}
.sp-root .sp-hdr-row input[type="date"]{
  flex:1 1 104px;
  min-width:98px;
  max-width:130px;
  padding:4px 5px;
  font-size:12px;
}
.sp-root .sp-hdr-row select{
  flex:1 1 88px;
  min-width:76px;
  max-width:130px;
  padding:4px 5px;
  font-size:12px;
}
.sp-root .sp-status{
  font-size:11.5px;
  color:#ffe9a8;
  line-height:1.3;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* ---------- 星空キャンバス ---------- */
.sp-root .sp-stage{
  flex:1 1 auto;
  position:relative;
  min-height:0;
  overflow:hidden;
}
.sp-root .sp-canvas{
  display:block;
  width:100%;
  height:100%;
  /* 修正: 画面ドラッグで視点を回すのでブラウザのスクロールを止める */
  touch-action:none;
  cursor:grab;
}
.sp-root .sp-canvas.sp-grabbing{cursor:grabbing;}

/* 修正: 視点の方角を常に出すコンパス表示 */
.sp-root .sp-compass{
  position:absolute;
  left:50%;
  top:8px;
  transform:translateX(-50%);
  z-index:6;
  background:rgba(30,58,95,.72);
  border:1px solid rgba(212,175,55,.55);
  border-radius:999px;
  padding:3px 14px;
  font-size:clamp(11px,1.8vw,14px);
  color:#ffe9a8;
  pointer-events:none;
  white-space:nowrap;
}

/* 修正: さがしている星座を表示するバー */
.sp-root .sp-find{
  position:absolute;
  left:50%;
  top:40px;
  transform:translateX(-50%);
  z-index:7;
  display:flex;
  align-items:center;
  gap:10px;
  background:rgba(212,175,55,.92);
  color:#1e3a5f;
  border-radius:999px;
  padding:5px 8px 5px 16px;
  font-size:clamp(12px,1.9vw,15px);
  font-weight:700;
  white-space:nowrap;
  max-width:92%;
  overflow:hidden;
}
.sp-root .sp-find-x{
  flex:0 0 auto;
  width:24px;height:24px;
  border:none;border-radius:50%;
  background:rgba(30,58,95,.85);
  color:#fff;font-size:14px;line-height:1;
  cursor:pointer;
}

/* 修正: 導入画面を、せっていモーダルと同じ「中央のコンパクトなカード」にする */
.sp-root .sp-intro{
  position:absolute; inset:0; z-index:40;
  background:rgba(5,8,16,.85);
  display:flex; align-items:center; justify-content:center;
  padding:16px;
}
.sp-root .sp-intro.hidden{display:none !important;}
.sp-root .sp-intro-card{
  background:#fff;
  color:#1e3a5f;
  border:3px solid #d4af37;
  border-radius:16px;
  width:min(380px,92vw);
  max-height:88dvh;
  overflow-y:auto;
  padding:16px 18px;
}
.sp-root .sp-intro-step{display:none; flex-direction:column;}
.sp-root .sp-intro-step.active{display:flex;}
.sp-root .sp-intro-dots{display:flex; gap:8px; justify-content:center; margin-bottom:14px;}
.sp-root .sp-intro-dot{width:9px;height:9px;border-radius:50%;background:#d3d9e4;}
.sp-root .sp-intro-dot.on{background:#d4af37;}
.sp-root .sp-intro h2{
  color:#1e3a5f; font-size:17px; font-weight:700; text-align:center; margin:0 0 14px;
  border-bottom:2px solid #d4af37; padding-bottom:8px;
}
.sp-root .sp-intro label{color:#5a6b85; font-size:13px; display:block; margin:0 0 6px;}
.sp-root .sp-intro input[type="date"], .sp-root .sp-intro select{
  width:100%; padding:11px; border-radius:10px; border:2px solid #cfd8e3; font-size:15px; margin-bottom:16px; color:#1e3a5f;
}
.sp-root .sp-intro-pick{
  display:grid; gap:8px; margin-bottom:16px;
}
.sp-root .sp-intro-pick.sp-ip2{grid-template-columns:1fr 1fr;}
.sp-root .sp-ipbtn{
  padding:13px 8px; border-radius:12px; border:2px solid #1e3a5f; background:#fff;
  color:#1e3a5f; font-size:13px; font-family:inherit; cursor:pointer; line-height:1.5; font-weight:700;
}
.sp-root .sp-ipbtn.sp-on{background:#1e3a5f; color:#fff; border-color:#1e3a5f;}
.sp-root .sp-intro-next{
  width:100%; border:none; border-radius:999px; background:#d4af37; color:#1e3a5f;
  padding:14px; font-size:15px; font-weight:700; font-family:inherit; cursor:pointer; margin-top:4px;
}
.sp-root .sp-intro-back{
  background:none; border:none; color:#5a6b85; font-size:13px; padding:0 0 12px;
  align-self:flex-start; cursor:pointer; font-family:inherit;
}
/* 修正: センサーが無いときの一言バナー */
.sp-root .sp-sensor-note{
  position:absolute; left:50%; bottom:10px; transform:translateX(-50%);
  z-index:6; background:rgba(30,58,95,.9); color:#ffe9a8; font-size:12px;
  padding:6px 14px; border-radius:999px; white-space:nowrap;
}
.sp-root .sp-sensor-note.hidden{display:none !important;}

/* ---------- 右下 縦並びツールバー ---------- */
.sp-root .sp-toolbar{
  position:absolute;
  right:10px;
  bottom:10px;
  display:flex;
  flex-direction:column;
  gap:8px;
  z-index:5;
}
.sp-root .sp-tool{
  width:46px;height:46px;
  border-radius:50%;
  background:rgba(30,58,95,.86);
  border:1px solid rgba(212,175,55,.6);
  color:#fff;
  font-size:20px;
  cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  backdrop-filter:blur(4px);
}
.sp-root .sp-tool:active{background:#d4af37;color:#1e3a5f;}

/* ---------- 下部コントロール ---------- */
.sp-root .sp-controls{
  flex:0 0 auto;
  background:#16294a;
  border-top:2px solid #d4af37;
  padding:6px 10px 8px;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.sp-root .sp-row{display:flex;align-items:center;gap:6px;}
.sp-root .sp-row.sp-wrap{flex-wrap:wrap;}

.sp-root .sp-btn{
  border:1px solid rgba(212,175,55,.7);
  background:#1e3a5f;
  color:#fff;
  border-radius:999px;
  padding:6px 12px;
  font-size:clamp(11px,1.7vw,14px);
  font-family:inherit;
  cursor:pointer;
  white-space:nowrap;
}
.sp-root .sp-btn:active{background:#d4af37;color:#1e3a5f;}
.sp-root .sp-btn.sp-on{background:#d4af37;color:#1e3a5f;font-weight:700;}
.sp-root .sp-btn.sp-play{min-width:62px;font-weight:700;}

.sp-root input[type="date"],
.sp-root select{
  font-family:inherit;
  font-size:clamp(11px,1.7vw,14px);
  padding:5px 8px;
  border-radius:8px;
  border:1px solid rgba(212,175,55,.7);
  background:#fff;
  color:#1e3a5f;
  max-width:46vw;
}
.sp-root .sp-time{
  font-variant-numeric:tabular-nums;
  font-size:clamp(14px,2.6vw,20px);
  font-weight:700;
  color:#ffe9a8;
  min-width:64px;
  text-align:center;
}
.sp-root input[type="range"]{
  flex:1 1 auto;
  min-width:80px;
  accent-color:#d4af37;
  height:26px;
}

/* ---------- モーダル ---------- */
.sp-root .sp-modal{
  position:absolute;
  inset:0;
  background:rgba(5,8,16,.72);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:20;
  padding:16px;
}
.sp-root .sp-modal.hidden{display:none !important;}
.sp-root .sp-panel{
  background:#fff;
  color:#1e3a5f;
  border-radius:16px;
  border:3px solid #d4af37;
  padding:12px 14px;
  width:min(400px,90vw);
  max-height:76dvh;
  overflow-y:auto;
}
.sp-root .sp-panel h2{
  margin:0 0 8px;
  font-size:16px;
  border-bottom:2px solid #d4af37;
  padding-bottom:5px;
}
.sp-root .sp-panel h3{margin:12px 0 5px;font-size:13px;color:#2d5580;}
.sp-root .sp-panel p,.sp-root .sp-panel li{font-size:12.5px;line-height:1.55;}
.sp-root .sp-check{
  display:flex;align-items:center;gap:8px;
  padding:7px 4px;font-size:14px;cursor:pointer;
  border-bottom:1px dashed #cfd8e3;
}
.sp-root .sp-check input{width:20px;height:20px;accent-color:#1e3a5f;}
.sp-root .sp-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(140px,1fr));
  gap:8px;
}
.sp-root .sp-grid.sp-g5{grid-template-columns:repeat(auto-fill,minmax(84px,1fr));}
.sp-root .sp-gbtn{
  border:2px solid #1e3a5f;
  background:#fff;color:#1e3a5f;
  border-radius:10px;padding:9px 6px;
  font-family:inherit;font-size:13px;font-weight:700;
  cursor:pointer;
}
.sp-root .sp-gbtn.sp-on{background:#1e3a5f;color:#fff;}
/* 修正: 星座をさがすリスト（見える/見えないが分かる行レイアウト） */
.sp-root .sp-find-list{display:flex;flex-direction:column;gap:6px;}
.sp-root .sp-find-row{
  display:flex;align-items:center;gap:6px;
  border:2px solid #1e3a5f;border-radius:12px;overflow:hidden;
}
.sp-root .sp-find-row.sp-find-row-off{border-color:#cfd8e3;}
.sp-root .sp-find-name{
  flex:1 1 auto;text-align:left;
  border:none;background:#fff;color:#1e3a5f;
  padding:9px 12px;font-family:inherit;font-size:13px;font-weight:700;cursor:pointer;
}
.sp-root .sp-find-row-off .sp-find-name{color:#8a94a6;font-weight:400;}
.sp-root .sp-find-jump{
  flex:0 0 auto;border:none;border-left:2px solid #cfd8e3;background:#f3f6fa;color:#2d5580;
  padding:9px 10px;font-family:inherit;font-size:12px;font-weight:700;cursor:pointer;white-space:nowrap;
}
.sp-root .sp-find-jump:disabled{color:#b6bfcc;cursor:default;}
.sp-root .sp-close{
  display:block;width:100%;margin-top:14px;
  border:none;border-radius:999px;
  background:#1e3a5f;color:#fff;
  padding:11px;font-family:inherit;font-size:15px;font-weight:700;
  cursor:pointer;
}

/* ---------- 星タップ時の情報 ---------- */
.sp-root .sp-tip{
  position:absolute;
  z-index:8;
  background:rgba(30,58,95,.94);
  border:1px solid #d4af37;
  border-radius:10px;
  padding:7px 11px;
  font-size:13px;
  line-height:1.5;
  pointer-events:none;
  white-space:nowrap;
}
.sp-root .hidden{display:none !important;}

@media (max-width:520px){
  .sp-root .sp-tool{width:40px;height:40px;font-size:17px;}
}
