﻿* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

body {
  background: #000;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: 100svh;
  min-height: -webkit-fill-available;
}

#game-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  height: 100svh;
  min-height: -webkit-fill-available;
  overflow: hidden;
}

/* Three.js Canvas */
#three-container {
  position: absolute;
  inset: 0;
  background: #000;
}

/* HUD 共通 */
#hud-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  z-index: 10;
  pointer-events: none; /* ボタンなどは個別に pointer-events: auto */
}

/* CURRENT / NEXT パネル */
#piece-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
}

.piece-block {
  background: rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.piece-label {
  font-size: 10px;
  color: #fff;
  opacity: 0.7;
  margin-bottom: 4px;
}

#piece-icon,
#next-piece-icon {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}

/* ステータス＋ミニマップ側 */
#status-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  margin-left: auto;
  pointer-events: auto;
}

#minimap-wrapper {
  background: rgba(0, 0, 0, 0.75);
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#minimap-columns {
  display: flex;
  gap: 6px;
}

.mini-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mini-title {
  font-size: 10px;
  color: #fff;
  opacity: 0.7;
  margin-bottom: 2px;
}

#minimap-1f,
#minimap-2f {
  width: 64px;
  height: 64px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  image-rendering: pixelated;
}

/* スコア表示 */
#score-panel {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 4px;
  margin-top: 2px;
}

.score-label {
  font-size: 11px;
  color: cyan;
  text-shadow: 0 0 4px rgba(0, 255, 255, 0.7);
}

#score-value {
  font-size: 12px;
  color: #fff;
}

/* Desktop UI scaling */
body.desktop-ui #minimap-1f,
body.desktop-ui #minimap-2f {
  width: 96px;
  height: 96px;
}
body.desktop-ui #score-panel {
  gap: 6px;
}
body.desktop-ui .score-label {
  font-size: 14px;
}
body.desktop-ui #score-value {
  font-size: 18px;
}

/* Desktop fallback based on pointer (for browsers where class is missing) */
@media (hover: hover) and (pointer: fine) {
  #minimap-1f,
  #minimap-2f {
    width: 96px;
    height: 96px;
  }
  #score-panel {
    gap: 6px;
  }
  .score-label {
    font-size: 14px;
  }
  #score-value {
    font-size: 18px;
  }
}
/* メニューボタン（ハンバーガー）右下固定 */
#menu-btn { display: none; }

#menu-btn div {
  width: 55%;
  height: 55%;
  border-top: 0.32vh solid #fff;
  border-bottom: 0.32vh solid #fff;
}

/* 左下：移動スティック */
#left-stick-area {
  position: absolute;
  left: 16px;
  bottom: 24px;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

#left-stick-base {
  width: 110px;
  height: 110px;
  border-radius: 55px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

#left-stick {
  width: 64px;
  height: 64px;
  border-radius: 32px;
  background: radial-gradient(circle at 30% 30%, #aaa, #333);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

/* 右側：回転＆DROP ボタン */
#right-controls {
  position: absolute;
  right: 24px;
  bottom: 32px;
  width: 200px;
  height: 220px;
  display: block;
  position: absolute;
  pointer-events: auto;
  z-index: 20; /* Keep above look-area overlay so buttons stay clickable */
}

.rotate-btn {
  width: 56px;
  height: 56px;
  border-radius: 28px;
  border: none;
  font-size: 26px;
  background: #222;
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
}

.main-btn {
  width: 86px;
  height: 86px;
  border-radius: 43px;
  border: none;
  font-size: 18px;
  background: #e74c3c;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.9);
}

/* Layout inside right controls */
#btn-place {
  position: absolute;
  right: 0;
  bottom: 0;
}

#btn-rotate-right {
  position: absolute;
  right: 15px;       /* align with DROP center */
  bottom: 98px;      /* above DROP with small gap */
}

#btn-rotate-left {
  position: absolute;
  right: 98px;       /* to the left of DROP with gap */
  bottom: 15px;      /* vertically centered with DROP */
}

/* 照準 */
#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 0.2vh solid rgba(0, 0, 0, 0.9);
  box-shadow: 0 0 0.6vh rgba(255, 255, 255, 0.8);
  pointer-events: none;
}

/* 視点移動用エリア：画面右半分 */
#look-area {
  position: absolute;
  right: 0;
  bottom: 0;
  top: 0;
  width: 50%;
  pointer-events: auto;
}



