/***********************************
 * File: wp-content/plugins/math-shooter-leaderboard/assets/math-shooter.css
 * Purpose: Math Shooter UI styles (layout / buttons / cards / overlay modal)
 ***********************************/

/* =========================
   Layout (outer)
   ========================= */

.math_shooter_app {
  max-width: 980px;
  margin: 0 auto;
}

.math_shooter_topbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin: 10px 0;
}

.math_shooter_meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 15px;
  opacity: 0.9;
  font-weight: bold;
}

.math_shooter_meta div{
  border-right: solid 1px #000000;
  padding-right: 15px;
}

.math_shooter_btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* =========================
   Buttons
   ========================= */

.math_shooter_btns button,
.ms_actions button,
.ms_choice {
  background: #1f2a37;
  color: #e6edf3;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
}

.math_shooter_btns button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* =========================
   Main grid (canvas + side)
   ========================= */

.math_shooter_layout {
  display: grid;
  grid-template-columns: minmax(0, 720px) minmax(0, 240px);
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .math_shooter_layout {
    grid-template-columns: 1fr;
  }
}

/* =========================
   Canvas
   ========================= */

.math_shooter_canvasBox {
  position: relative; /* HUDを重ねる */
  border: 1px solid #223042;
  border-radius: 14px;
  overflow: hidden;
  background: #070a0f;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.math_shooter_canvasBox canvas {
  width: 100%;
  height: auto;
  display: block;
}

/* =========================
   Side cards
   ========================= */

.math_shooter_card {
  border: 1px solid #223042;
  border-radius: 14px;
  padding: 12px;
  background-color: #000000;
  color: #ffffff;
  margin: 0 0 20px;
}

.math_shooter_card_title {
  font-weight: 700;
  margin-bottom: 8px;
}

.math_shooter_leaderboard {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.6;
}

#mathShooterLeaderboard {
  list-style-type: none;
  padding: 0;
}

#mathShooterLeaderboard li{
  margin: 0 0 10px;
}

.math_shooter_note {
  font-size: 12px;
  opacity: 0.85;
  line-height: 1.6;
  margin-top: 8px;
}

/* =========================
   Overlay modal (quiz / send score)
   ========================= */

.ms_overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  z-index: 99999;
  padding: 16px;
}

.ms_modal {
  background: #0b0f14;
  color: #e6edf3;
  border: 1px solid #223042;
  border-radius: 16px;
  padding: 16px;
  margin: 0 15px;
  font-size: 110%;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55);
}

.ms_modal h3 {
  margin: 0 0 10px;
  font-size: 18px;
	color: #ffffff;
}

.ms_row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.ms_input {
  flex: 1;
  min-width: 180px;
  background: #111827;
  color: #e6edf3;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px;
}

.ms_actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.ms_err {
  color: #fca5a5;
  font-size: 12px;
  margin-top: 8px;
  min-height: 16px;
}

.ms_note {
  margin: 10px 0 0;
  font-size: 14px;
}

/* =========================
   UI tweaks (hearts)
   ========================= */

#uiLives {
  font-weight: 700;
  letter-spacing: 2px;
}

/* =========================
   Leaderboard: Top3 colors + medal icons
   ========================= */

.math_shooter_leaderboard li:nth-child(1) b { color: #d4af37; }
.math_shooter_leaderboard li:nth-child(2) b { color: #c0c0c0; }
.math_shooter_leaderboard li:nth-child(3) b { color: #cd7f32; }

.math_shooter_leaderboard li {
  position: relative;
  padding-left: 1.6em;
}
.math_shooter_leaderboard li:nth-child(1)::before { content: "🥇"; position: absolute; left: 0; top: 0; }
.math_shooter_leaderboard li:nth-child(2)::before { content: "🥈"; position: absolute; left: 0; top: 0; }
.math_shooter_leaderboard li:nth-child(3)::before { content: "🥉"; position: absolute; left: 0; top: 0; }

/* =========================
   HUD (bottom center on canvas)
   ========================= */

.math_shooter_hud {
  position: absolute;
  left: 50%;
  bottom: 16px; /* HUDの位置。船と被るなら、JS設定のplayerBottomPaddingを増やすのが確実 */
  transform: translateX(-50%);
  width: calc(100% - 24px);
  pointer-events: none;
  display: grid;
  place-items: center;
}

.math_shooter_hud_inner {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;

  color: #ffffff;
  font-size: 14px;
  line-height: 1.2;

  padding: 8px 10px;
  border-radius: 12px;

  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.math_shooter_hud_item b {
  font-weight: 700;
}

.rank-name {
	display: block;
}

/* =========================
   Mobile controls
   ========================= */

/* デフォルトは非表示（PC） */
.math_shooter_controls {
  display: none;
}

@media (max-width: 1023px) {

  #math_shooter_app {
    margin: 0 ;
  }
	
	.math_shooter_canvasBox {
  border-radius: 0px;
	}
	
	.math_shooter_topbar {
  margin: 10px 20px;
}
	
	.math_shooter_card {
  margin: 0 20px 20px;
}
	
	.rank-name {
	display: inline;
}


  .math_shooter_controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    padding: 12px;
    margin-top: 10px;
  }

  .ms_btn {
    appearance: none;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(15, 23, 42, 0.92);
    color: #fff;

    border-radius: 14px;
    width: 72px;
    height: 56px;

    font-size: 20px;
    font-weight: 700;

    /* スマホ長押し/選択系の抑制 */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;

    /* 押下時の挙動を安定 */
    touch-action: manipulation;
  }

  .ms_btn:active {
    transform: scale(0.98);
  }

  .ms_btn_shoot {
    width: 92px;
  }

  /* ===== 三角形ボタン（画像なし） ===== */
  .ms_btn_arrow {
    position: relative;
  }

  .ms_btn_arrow::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    transform: translate(-50%, -50%);
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
  }

  /* 右向き ▶ */
  .ms_btn_right::before {
    border-left: 18px solid #fff;
    transform: translate(-45%, -50%);
  }

  /* 左向き ◀ */
  .ms_btn_left::before {
    border-right: 18px solid #fff;
    transform: translate(-55%, -50%);
  }
}

