@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap');

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

#gameCanvas {
  background: #000;
  display: block;
  /* 幅・高さは main.js が縦横比 16:9 を保ったまま設定する */
}

/* 名前入力用のオーバーレイ入力欄。#gameWrap に対する%位置で
   キャンバスの拡大縮小に自動追従させる */
#gameWrap {
  position: relative;
}

#nameInput {
  position: absolute;
  left: 34.375%;   /* (960-330)/1920 */
  top: 46.3%;      /* 500/1080 */
  width: 31.25%;   /* 600/1920 */
  height: 7.4%;    /* 80/1080 */
  font-size: min(3.4vw, 2.6vh);
  font-family: inherit;
  text-align: center;
  border: none;
  outline: none;
  background: transparent;
  color: #000;
  caret-color: #000;
  display: none;
}

#loading {
  position: fixed;
  inset: 0;
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 20px;
  z-index: 50;
}
#loading .bar {
  width: 60vw;
  max-width: 480px;
  height: 10px;
  border: 2px solid #fff;
}
#loading .bar-fill {
  height: 100%;
  width: 0%;
  background: #ff9ec2;
}

/* 縦持ち時の回転案内オーバーレイ */
#rotateOverlay {
  position: fixed;
  inset: 0;
  background: #000;
  color: #fff;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  z-index: 100;
  padding: 24px;
}
#rotateOverlay .icon {
  font-size: 64px;
  animation: rotateHint 1.6s ease-in-out infinite;
}
#rotateOverlay p {
  font-size: 5vw;
  max-width: 90vw;
  line-height: 1.6;
  margin: 0;
}
#rotateOverlay p.sound-note {
  font-size: 3.6vw;
  color: #ffd1dc;
  border: 1px solid rgba(255,209,220,0.6);
  border-radius: 8px;
  padding: 10px 16px;
}
@keyframes rotateHint {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-90deg); }
}

body.portrait-lock #stage,
body.portrait-lock #loading {
  display: none;
}
body.portrait-lock #rotateOverlay {
  display: flex;
}

/* シェア結果カード画面 */
#shareScreen {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px;
  overflow-y: auto;
}
#shareScreen[hidden] {
  display: none;
}

/* 横持ちスマホなど縦幅が狭い画面でもボタンや閉じるボタンが隠れないよう、
   カード画像の高さをビューポート基準で頭打ちにする */
#shareCard {
  background: #fff;
  border-radius: 16px;
  padding: 12px;
  max-width: min(90vw, 480px);
  text-align: center;
}
#shareCard img {
  display: block;
  width: min(70vw, 42vh, 420px);
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  margin: 0 auto;
  background: #eee;
}
#shareCard p {
  margin: 10px 0 0;
  color: #333;
  font-weight: 700;
  font-size: 16px;
}

#shareButtons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: min(90vw, 480px);
}

.share-btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  background: #fff;
  color: #333;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.share-btn-primary {
  background: #ff6fa5;
  color: #fff;
}

#shareCloseBtn {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.6);
  background: transparent;
  color: #fff;
  border-radius: 999px;
  padding: 8px 26px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

/* 縦幅が狭くてもいつでも閉じられる、常時表示の角ボタン */
#shareCornerCloseBtn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  z-index: 81;
}
