/* main.css - Core styles, resets, and layout */

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

body {
  margin: 0;
  background: #c0c0c0;
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Game Window */
.game-window {
  background: #c0c0c0;
  border-top: 3px solid #fff;
  border-left: 3px solid #fff;
  border-bottom: 3px solid #808080;
  border-right: 3px solid #808080;
  padding: 6px;
  display: inline-block;
}

/* Menu Bar */
.menu-bar {
  display: flex;
  margin-bottom: 4px;
  position: relative;
}

.menu-btn {
  background: #c0c0c0;
  border: none;
  padding: 2px 8px;
  font-size: 12px;
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
  cursor: pointer;
}

.menu-btn:hover {
  border-top: 1px solid #fff;
  border-left: 1px solid #fff;
  border-bottom: 1px solid #808080;
  border-right: 1px solid #808080;
}

.menu-btn:active {
  border-top: 1px solid #808080;
  border-left: 1px solid #808080;
  border-bottom: 1px solid #fff;
  border-right: 1px solid #fff;
}

/* Menu Dropdown */
.menu-dropdown {
  position: absolute;
  background: #c0c0c0;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #808080;
  border-right: 2px solid #808080;
  z-index: 100;
  min-width: 160px;
  display: none;
  padding: 2px 0;
}

.menu-dropdown.visible,
.menu-dropdown.open {
  display: block;
}

.menu-item {
  padding: 4px 20px 4px 24px;
  cursor: pointer;
  font-size: 12px;
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
  position: relative;
  white-space: nowrap;
}

.menu-item:hover {
  background: #000080;
  color: #fff;
}

.menu-item.checked::before {
  content: '✓';
  position: absolute;
  left: 8px;
}

.menu-separator {
  height: 1px;
  background: #808080;
  border-bottom: 1px solid #fff;
  margin: 2px 0;
}

/* Game Container */
.game-container {
  border-top: 3px solid #808080;
  border-left: 3px solid #808080;
  border-bottom: 3px solid #fff;
  border-right: 3px solid #fff;
  padding: 6px;
  background: #c0c0c0;
}

/* Status Bar */
.status-bar {
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-bottom: 2px solid #fff;
  border-right: 2px solid #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  margin-bottom: 8px;
  min-height: 42px;
}

/* LED Display */
.led-display {
  background: #300;
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-bottom: 2px solid #fff;
  border-right: 2px solid #fff;
  padding: 1px 2px;
  display: flex;
}

/* Digits */
.digit {
  color: #f00;
  font-family: 'Digital-7', 'Courier New', monospace;
  font-size: 28px;
  font-weight: bold;
  width: 16px;
  text-align: center;
  line-height: 1;
  text-shadow: 0 0 4px rgba(255, 0, 0, 0.4);
  background: #200;
}

/* Smiley Button */
.smiley-btn {
  width: 34px;
  height: 34px;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #808080;
  border-right: 2px solid #808080;
  background: #c0c0c0;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.smiley-btn:active {
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-bottom: 2px solid #fff;
  border-right: 2px solid #fff;
  padding-top: 1px;
  padding-left: 1px;
}

/* Board Container */
.board-container {
  border-top: 3px solid #808080;
  border-left: 3px solid #808080;
  border-bottom: 3px solid #fff;
  border-right: 3px solid #fff;
  overflow: hidden;
  display: inline-block;
}

/* Flag Mode Button */
.flag-mode-btn {
  width: 34px;
  height: 34px;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #808080;
  border-right: 2px solid #808080;
  background: #c0c0c0;
  font-size: 18px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.flag-mode-btn.active {
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-bottom: 2px solid #fff;
  border-right: 2px solid #fff;
  background: #a0a0a0;
}

/* Dialog System */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: none;
}

.dialog-overlay.visible {
  display: flex;
  justify-content: center;
  align-items: center;
}

.dialog {
  background: #c0c0c0;
  border-top: 3px solid #fff;
  border-left: 3px solid #fff;
  border-bottom: 3px solid #808080;
  border-right: 3px solid #808080;
  min-width: 250px;
}

.dialog-title {
  background: #000080;
  color: #fff;
  padding: 3px 6px;
  font-weight: bold;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-close {
  width: 16px;
  height: 14px;
  background: #c0c0c0;
  border-top: 1px solid #fff;
  border-left: 1px solid #fff;
  border-bottom: 1px solid #808080;
  border-right: 1px solid #808080;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.dialog-close:active {
  border-top: 1px solid #808080;
  border-left: 1px solid #808080;
  border-bottom: 1px solid #fff;
  border-right: 1px solid #fff;
}

.dialog-body {
  padding: 12px 16px;
}

.dialog-btn,
.win-btn {
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #808080;
  border-right: 2px solid #808080;
  background: #c0c0c0;
  padding: 4px 16px;
  min-width: 75px;
  font-size: 12px;
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
  cursor: pointer;
}

.dialog-btn:active,
.win-btn:active {
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-bottom: 2px solid #fff;
  border-right: 2px solid #fff;
}

/* Form Elements */
input[type="number"],
.win-input {
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-bottom: 2px solid #fff;
  border-right: 2px solid #fff;
  background: #fff;
  width: 60px;
  padding: 2px 4px;
  font-size: 12px;
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #808080;
  border-right: 2px solid #808080;
  background: #c0c0c0;
  padding: 8px 12px;
  font-size: 12px;
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
  z-index: 2000;
  display: none;
}

.toast.visible {
  display: block;
}
