body {
  margin: 0;
  padding: 0;
  overflow: hidden;
}


.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}


/* タイトル画面 */
#title-screen {
  display: flex; /* 最初に表示する画面 */
}


/* ゲーム画面 */
#game-screen {
  display: none;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}
 

.hand {
  display: flex;
  gap: 4px;
}

.tile {
  width: 40px;
  height: 60px;
  border: none;
  background: transparent;
  
  display: flex;
  justify-content: center;
  align-items: center;
  background: white;
  cursor: pointer;
  font-size: 20px;
}

.discards {
  display: flex;
  flex-wrap: wrap;
  width: 200px;
  gap: 2px;
}

.tile.cpu {
  background: #ddd;
  cursor: default;
}


#left-info {
  widthj: 220px;
  background: transparent;
  padding: 10px;
}


#top-left-info {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 180px;
  padding: 10px;
  background: rgba(30, 30, 30, 0.75);
  border-radius: 8px;
  color: white;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ドラ表示 */
.dora-area {
  background: rgba(50, 50, 50, 0.6);
  padding: 6px;
  border-radius: 6px;
}

.dora-title {
  font-size: 13px;
  margin-bottom: 4px;
  opacity: 0.8;
}

.dora-tiles {
  display: flex;
  gap: 4px;
}

.dora-tiles img {
  width: 32px;
  height: 48px;
  border-radius: 3px;
}

/* 積み棒・供託 */
.counter-area {
  background: rgba(50, 50, 50, 0.6);
  height: 60px;
  padding: 6px;
  border-radius: 6px;
  justify-content: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.counter-area img {
  height: 45px;
}

.counter-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.counter-icon {
  width: 28px;
  height: 28px;
}

.counter-text {
  font-size: 15px;
  font-weight: bold;
}

/* プレイモード */
.mode-info {
  text-align: center;
  font-weight: bold;
}




/* 雀卓 */
#table {
  flex: 1;
  position: relative;
  top: 0;
  left: 0;
  width: 95vw;
  height: 80vh;
  overflow: hidden;
}


/* 山 */
#table-info {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 300px;
  height: 300px;
  pointer-events: none;
  transform: translate(-50%, -50%);

  background: rgba(0, 0, 0, 0.15);
  padding: 12px;
  border-radius: 6px;
  display: inline-flex;
}

.center-info {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #000;
  font-size: 40px;
  font-weight: bold;
  
}

#wall-count {
  padding-top: 10px; 
  font-size: 35px;
  margin-top: 4px;
}

.side-info {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  color: white;
  font-size: 20px;
  font-weight: bold;
}

.side-info.top {
  top: 0;
  left: 50%;
  transform: translate(-50%, 0) rotate(180deg);
}

.side-info.bottom {
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 0);
}

.side-info.left {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-35px, -50%) rotate(90deg);
}

.side-info.right {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translate(35px, -50%) rotate(-90deg);
}

.wind-box {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  line-height: 40px;
}

.wind-box.east-wind {
  background: #b30000; /* 自分の風は赤背景 */
}

.score-box {
  font-size: 22px;
  color: #000;
}

/*  */
.turn-highlight {
  box-shadow: 0 0 12px 4px rgba(255, 220, 0, 0.9);
  background: rgba(255, 230, 120, 0.6);
  transition: 0.2s;
}

/* ターンインジケーター */
@keyframes blink-border {
  0%   { opacity: 0; }
  50%  { opacity: 1; }
  100% { opacity: 0; }
}

/* 山の縁（4方向） */
.wall-edge {
  position: absolute;
  background: rgba(255, 220, 0, 0.9);
  animation: blink-border 1s infinite;
  pointer-events: none;
}

/* 上 */
.wall-edge-top {
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
}

/* 下 */
.wall-edge-bottom {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 6px;
}

/* 左 */
.wall-edge-left {
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
}

/* 右 */
.wall-edge-right {
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
}


/* 手牌：捨て牌共通 */
.hand-area, .discard-area {
  position: absolute;
  display: flex;
  transform-origin: center center; /* 基準を要素の中心にする */
}


.hand-area.opponent .tile{
  width: calc(40px * 0.7); /* 相手の手牌は元のサイズの70% */
  height: calc(60px * 0.7);
}



/* 下側 */
.hand-bottom {
  transform: rotate(0deg);
}

/* 右側 */
.hand-right {
  transform: rotate(-90deg);
}

/* 上側 */
.hand-top {
  transform:rotate(180deg);
}

/* 左側 */
.hand-left {
  transform: rotate(90deg);
}






/* 捨て牌の表示 */
.discard-area {
  position: absolute;
  display: grid;
  grid-template-columns: repeat(6, 1fr); /* 横6枚 */
  gap: 4px;
  width: 240px; /* 40px × 6枚 = 240px */
}

.discard-area .tile {
  width: calc(40px * 0.9); /* 捨て牌は元のサイズの90% */
  height: calc(60px * 0.9);
}



.discard-bottom {
  transform: rotate(0deg);
}


.discard-right {
  flex-direction: column;
  transform: rotate(-90deg);
}


.discard-top {
  transform: rotate(180deg);
}


.discard-left {
  flex-direction: column;
  transform: rotate(90deg);
}
  





 /* 河（捨て牌） */
#player-discards {
  position: absolute;
  bottom: 120px;     
  left: 50%;

  width: 300px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#cpu1-discards {
  position: absolute;

  width: 300px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#cpu2-discards {
  position: absolute;
  
  width: 300px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}



/* --- 山（中央） --- */
#wall {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 160px;
  height: 80px;
  background: #ccc;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  z-index: 500;
}



#next-btn {
  position: fixed;
  bottom: 20px; 
  right: 20px;
  z-index: 2000;
  background: white;
  padding: 8px 12px;
  border: 1px solid #333;
  border-radius: 4px;
}

#auto-sort-btn {
  position: fixed;
  bottom: 70px; 
  right: 20px;
  z-index: 2000;
  background: white;
  padding: 8px 12px;
  border: 1px solid #333;
  border-radius: 4px;
}


