body { font-family: sans-serif; margin: 0; padding: 0; }

#topbar {
  padding: 10px 12px;
  background: #eee;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 44px;
  box-sizing: border-box;
}

#playerSlots {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  width: 100%;
  margin-bottom: 8px;
  padding: 4px 0;
}
.player-slot {
  height: 40px;
  border-radius: 8px;
  background: #ddd;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 15px;
  transition: background-color 0.2s;
  box-shadow: 0 1px 3px #0001;
  position: relative;
  overflow: hidden;
}
.player-slot.empty {
  background: #ececec;
  color: #aaa;
}
.player-slot.turn {
  border: 3px solid #333 !important;
  box-shadow: 0 0 10px #333, 0 0 0 4px #ffd600;
}
.player-slot .slot-timer {
  display: inline-block;
  margin-left: 0.5em;
  color: #222;
  font-weight: bold;
  background: #ffd600;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.95em;
  vertical-align: middle;
}
.slot-main {
  display: flex;
  align-items: center;
  gap: 6px;
}
.slot-name { color: #222; }
.slot-victory {
  position: absolute;
  top: 2px;
  right: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #444;
}
.slot-score {
  position: absolute;
  bottom: 2px;
  right: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #444;
}
.slot-stun {
  background: #e55;
  color: #fff;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
  margin-left: 4px;
}
.slot-empty { color: #bbb; font-size: 13px; }

#turn { font-weight: bold; display: flex; align-items: center; gap: 4px; }
#timer { font-weight: bold; margin-left: 8px; }
#roomCode { margin-left: 12px; font-weight: bold; }

#container {
  display: flex;
  height: calc(100vh - 60px);
}
#boardWrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  min-height: calc(100vh - 60px);
}

/* 상태바 꾸미기 */
#statusBar {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 420px;
}
#statusBar .badge {
  align-self: flex-start;
  background: #333;
  color: #fff;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
}
#statusBar .badge.hidden { display: none; }
.scores {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.pstat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--c) 25%, #fff 75%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 45%, #000 0%) inset;
  font-size: 14px;
}
.pstat .score { margin-left: auto; font-weight: 700; }
.stunTag {
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0,0,0,.25);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

#board {
  --w: 16;
  display: grid;
  grid-template-columns: repeat(var(--w), 24px);
  gap: 2px;
  padding: 10px;
  user-select: none;
  margin: 0 auto;
}
#startBtnWrap { margin: 14px auto 0; }
#result {
  padding: 12px 16px;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  background: #222;
  color: #fff;
  margin: 10px auto 0;
  border-radius: 6px;
}

/* 스턴 메시지 고정 영역 */
#stunSlot {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px auto 0;
}
#stunMsg {
  padding: 6px 12px;
  background: #f55;
  color: #fff;
  font-weight: bold;
  width: max-content;
  border-radius: 16px;
  box-shadow: 0 0 0 2px rgba(255,255,255,.3) inset;
}
#stunMsg.hidden { visibility: hidden; display: block; }

/* 랜덤 지뢰 옵션 */
.rangeRow {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.miniLabel { font-size: 12px; color: #555; margin-top: 2px; }
.rangeHint { font-size: 12px; color: #777; margin-top: 4px; display: block; }

#options {
  width: 220px;
  background: #fafafa;
  border-left: 1px solid #ddd;
  padding: 12px;
  box-sizing: border-box;
  overflow: auto;
}
#options h3 { margin-top: 0; }
.opt-row { margin-bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
.realtime-only { display: none; }
.turn-only { display: flex; flex-direction: column; gap: 4px; }

.hidden { display: none; }

.cell {
  width: 24px;
  height: 24px;
  background: #bbb;
  text-align: center;
  line-height: 24px;
  cursor: pointer;
  font-weight: bold;
  box-sizing: border-box;
}
.cell.rev { background: #e0e0e0; cursor: default; }
.cell.boom { color: #000; }
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

#board.my-turn {
  box-shadow: 0 0 24px 8px rgba(80,255,120,0.18);
  border: 3px solid rgba(80,255,120,0.37);
  border-radius: 10px;
  transition: box-shadow 0.3s, border 0.3s;
}