/* ===== 基础重置 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", "Microsoft YaHei", -apple-system, sans-serif;
  background: #0a0e14;
  color: #e6e6e6;
  /* 移动端安全区域 */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ===== 主界面容器 ===== */
.menu-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 30%, rgba(60, 20, 20, 0.55), transparent 60%),
    linear-gradient(160deg, #0a0e14 0%, #131a24 60%, #0a0e14 100%);
}

.game-title {
  font-size: 64px;
  letter-spacing: 12px;
  font-weight: 800;
  color: #d9f2e6;
  text-shadow:
    0 0 12px rgba(120, 255, 180, 0.45),
    0 0 32px rgba(60, 200, 120, 0.25);
  margin-bottom: 8px;
  text-align: center;
}

.game-sub {
  font-size: 14px;
  letter-spacing: 4px;
  color: #6b8a7a;
  margin-bottom: 48px;
  text-transform: uppercase;
  text-align: center;
}

/* ===== 按钮组 ===== */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 260px;
  max-width: 80vw;
}

.menu-btn {
  padding: 14px 0;
  font-size: 18px;
  letter-spacing: 4px;
  border: 1px solid rgba(120, 200, 160, 0.35);
  background: rgba(20, 40, 30, 0.5);
  color: #c9f2dd;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-user-select: none;
  user-select: none;
}

.menu-btn:hover {
  background: rgba(40, 90, 65, 0.7);
  border-color: rgba(120, 255, 180, 0.7);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(80, 220, 140, 0.35);
}

.menu-btn:active {
  transform: scale(0.97);
}

.menu-btn.small {
  padding: 10px 16px;
  font-size: 15px;
  letter-spacing: 2px;
}

.menu-btn.full-width {
  width: 100%;
}

.start-btn {
  border-color: rgba(120, 255, 180, 0.6);
  background: rgba(30, 70, 50, 0.65);
}

/* ===== 存档提示 ===== */
.save-hint {
  margin-top: 32px;
  font-size: 13px;
  color: #5c7a6a;
  letter-spacing: 1px;
  text-align: center;
}

/* ===== 通用面板 ===== */
.panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(16, 24, 20, 0.96);
  border: 1px solid rgba(120, 200, 160, 0.35);
  border-radius: 10px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
  z-index: 100;
  backdrop-filter: blur(8px);
}

.hidden {
  display: none !important;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(120, 200, 160, 0.2);
  position: sticky;
  top: 0;
  background: rgba(16, 24, 20, 0.98);
  z-index: 1;
}

.panel-header h2 {
  font-size: 18px;
  letter-spacing: 3px;
  color: #c9f2dd;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: #7aa08c;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 8px 12px;
  border-radius: 4px;
  transition: all 0.15s;
}

.close-btn:active {
  background: rgba(120, 200, 160, 0.15);
}

.panel-body {
  padding: 20px;
}

.panel-footer {
  padding: 0 20px 20px;
}

/* ===== 选项面板 ===== */
.option-row {
  display: flex;
  align-items: center;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.option-row label {
  width: 72px;
  font-size: 14px;
  color: #a8c8b8;
  flex-shrink: 0;
}

.option-desc {
  font-size: 12px;
  color: #5c7a6a;
}

.option-row input[type="range"] {
  flex: 1;
  min-width: 120px;
  accent-color: #4ac888;
}

.option-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #4ac888;
  cursor: pointer;
}

#opt-volume-val {
  width: 32px;
  text-align: right;
  font-size: 13px;
  color: #7aa08c;
}

/* ===== 读取存档面板 ===== */

.save-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(10, 20, 15, 0.6);
  border: 1px solid rgba(120, 200, 160, 0.2);
  border-radius: 6px;
  margin-bottom: 20px;
  gap: 10px;
}

.save-status-label {
  font-size: 14px;
  color: #a8c8b8;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.save-status-value {
  font-size: 13px;
  color: #6ee7a0;
  text-align: right;
}

.save-status-value.empty {
  color: #7a8a80;
}

/* 导入区 */
.import-section {
  margin-top: 4px;
}

.import-title {
  font-size: 14px;
  color: #a8c8b8;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

/* 拖拽区（桌面） */
.drop-zone {
  border: 2px dashed rgba(120, 200, 160, 0.4);
  border-radius: 8px;
  padding: 24px 16px;
  text-align: center;
  transition: all 0.2s ease;
  background: rgba(10, 20, 15, 0.4);
}

.drop-zone.dragover {
  border-color: rgba(120, 255, 180, 0.9);
  background: rgba(40, 90, 65, 0.4);
  box-shadow: 0 0 20px rgba(80, 220, 140, 0.3) inset;
}

.drop-zone-text {
  font-size: 14px;
  color: #c9f2dd;
  margin-bottom: 6px;
}

.drop-zone-sub {
  font-size: 12px;
  color: #5c7a6a;
  margin: 8px 0;
}

/* 移动端导入区 */
.mobile-import {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-tip {
  font-size: 12px;
  color: #5c7a6a;
  line-height: 1.5;
}

/* 存档码区 */
.save-code-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(120, 200, 160, 0.15);
}

.save-code-title {
  font-size: 14px;
  color: #a8c8b8;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.save-code-input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(10, 20, 15, 0.8);
  border: 1px solid rgba(120, 200, 160, 0.3);
  border-radius: 6px;
  color: #c9f2dd;
  font-size: 13px;
  font-family: monospace;
  resize: vertical;
  margin-bottom: 10px;
  outline: none;
}

.save-code-input:focus {
  border-color: rgba(120, 255, 180, 0.7);
}

.load-message {
  margin-top: 12px;
  font-size: 13px;
  min-height: 18px;
  text-align: center;
}

.load-message.success {
  color: #6ee7a0;
}

.load-message.error {
  color: #f28b8b;
}

/* ============================================================
 * 移动端适配
 * ============================================================ */
@media (max-width: 600px) {
  .game-title {
    font-size: 40px;
    letter-spacing: 6px;
  }

  .game-sub {
    font-size: 12px;
    letter-spacing: 2px;
    margin-bottom: 32px;
  }

  .button-group {
    width: 240px;
    gap: 14px;
  }

  .menu-btn {
    font-size: 16px;
    padding: 14px 0;
    letter-spacing: 2px;
  }

  .panel {
    width: 94vw;
    max-height: 90vh;
  }

  .panel-body {
    padding: 16px;
  }

  .panel-footer {
    padding: 0 16px 16px;
  }

  .option-row label {
    width: 64px;
    font-size: 13px;
  }
}

/* 触屏设备：隐藏拖拽交互区（打开文件按钮仍在，通过 mobile-import 显示） */
@media (hover: none) and (pointer: coarse) {
  .drop-zone {
    display: none;
  }
}