/* 扫雷游戏 - 样式表 */
/* 设计师：心心 | 开发：滢滢 */

/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: #F5F5F5;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  min-height: 100vh;
  user-select: none;
  -webkit-user-select: none;
}

/* ========== Game Container ========== */
.game-container {
  background: #FFFFFF;
  border: 2px solid #808080;
  border-top-color: #FFFFFF;
  border-left-color: #FFFFFF;
  display: inline-block;
}

/* ========== Menu Bar ========== */
.menu-bar {
  display: flex;
  align-items: stretch;
  background: #F0F0F0;
  border-bottom: 1px solid #B0B0B0;
  height: 28px;
  font-size: 13px;
}

.menu-item {
  position: relative;
  padding: 0 12px;
  display: flex;
  align-items: center;
  cursor: pointer;
  line-height: 28px;
}

.menu-item:hover { background: #E0E0E0; }

.dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #FFFFFF;
  border: 1px solid #B0B0B0;
  min-width: 130px;
  z-index: 1000;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.15);
  padding: 2px 0;
}

.menu-item:hover > .dropdown { display: block; }

.dropdown-item {
  padding: 4px 16px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
}

.dropdown-item:hover { background: #E8E8E8; }

.dropdown-separator {
  height: 1px;
  background: #D0D0D0;
  margin: 2px 8px;
}

.dropdown-item.checked::before {
  content: '\2713 ';
  margin-left: -12px;
  padding-right: 4px;
}

/* ========== Info Panel ========== */
.info-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid #B0B0B0;
}

.led-box {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 20px;
  background: #1a1a1a;
  color: #FF0000;
  padding: 2px 6px;
  border: 2px solid;
  border-top-color: #808080;
  border-left-color: #808080;
  border-right-color: #FFFFFF;
  border-bottom-color: #FFFFFF;
  min-width: 52px;
  text-align: center;
  letter-spacing: 2px;
}

.face-btn {
  font-size: 28px;
  background: #C0C0C0;
  border: 2px solid;
  border-top-color: #FFFFFF;
  border-left-color: #FFFFFF;
  border-right-color: #808080;
  border-bottom-color: #808080;
  cursor: pointer;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.face-btn:active {
  border-top-color: #808080;
  border-left-color: #808080;
  border-right-color: #FFFFFF;
  border-bottom-color: #FFFFFF;
}

/* ========== Board ========== */
.board-wrapper {
  padding: 16px;
}

.board {
  display: grid;
  gap: 1px;
  background: #808080;
  border: 2px solid;
  border-top-color: #808080;
  border-left-color: #808080;
  border-right-color: #FFFFFF;
  border-bottom-color: #FFFFFF;
}

/* ========== Cells ========== */
.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Consolas, 'Courier New', monospace;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.05s;
}

/* Unrevealed (3D raised) */
.cell-unrevealed {
  background: #C0C0C0;
  border-top: 2px solid #FFFFFF;
  border-left: 2px solid #FFFFFF;
  border-right: 2px solid #808080;
  border-bottom: 2px solid #808080;
}

.cell-unrevealed:hover { background: #D0D0D0; }

/* Revealed (flat) */
.cell-revealed {
  background: #E0E0E0;
  border: 1px solid #B0B0B0;
  cursor: default;
}

/* Exploded (mine hit) */
.cell-exploded {
  background: #FFCDD2;
  border: 1px solid #B0B0B0;
  cursor: default;
}

/* Wrong flag (game over reveal) */
.cell-wrong-flag {
  background: #E0E0E0;
  border: 1px solid #B0B0B0;
  cursor: default;
}

/* Flagged (same 3D as unrevealed) */
.cell-flagged {
  background: #C0C0C0;
  border-top: 2px solid #FFFFFF;
  border-left: 2px solid #FFFFFF;
  border-right: 2px solid #808080;
  border-bottom: 2px solid #808080;
}

/* Question (same 3D as unrevealed) */
.cell-question {
  background: #C0C0C0;
  border-top: 2px solid #FFFFFF;
  border-left: 2px solid #FFFFFF;
  border-right: 2px solid #808080;
  border-bottom: 2px solid #808080;
}

/* ========== Number Colors ========== */
.cell-n1 { color: #0000FF; }
.cell-n2 { color: #008000; }
.cell-n3 { color: #FF0000; }
.cell-n4 { color: #000080; }
.cell-n5 { color: #800000; }
.cell-n6 { color: #008080; }
.cell-n7 { color: #000000; }
.cell-n8 { color: #808080; }

/* ========== Bottom Bar ========== */
.bottom-bar {
  border-top: 1px solid #B0B0B0;
  padding: 8px 16px;
  text-align: right;
}

.new-game-btn {
  font-size: 13px;
  padding: 4px 16px;
  background: #E0E0E0;
  border: 2px solid;
  border-top-color: #FFFFFF;
  border-left-color: #FFFFFF;
  border-right-color: #808080;
  border-bottom-color: #808080;
  cursor: pointer;
  font-family: inherit;
}

.new-game-btn:hover { background: #D0D0D0; }
.new-game-btn:active {
  border-top-color: #808080;
  border-left-color: #808080;
  border-right-color: #FFFFFF;
  border-bottom-color: #FFFFFF;
}

/* ========== Help / About Overlay ========== */
.overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.35);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.overlay.show { display: flex; }

.overlay-box {
  background: #FFFFFF;
  border: 2px solid #808080;
  border-top-color: #FFFFFF;
  border-left-color: #FFFFFF;
  padding: 24px;
  max-width: 420px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.6;
}

.overlay-close {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 20px;
  cursor: pointer;
  color: #666;
  background: none;
  border: none;
  font-family: inherit;
}

.overlay-close:hover { color: #000; }

.overlay-title {
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 12px;
}

/* ========== Responsive Fine-Tuning ========== */
/* Center the game container on wider screens */
@media (min-width: 800px) {
  body { align-items: center; }
}