/* ==========================================================================
   Node Sequence 节点序列记忆挑战游戏样式
   纯原生 CSS，移动端优先，触控热区友好，无障碍反馈，3D 叠层瓷砖质感
   ========================================================================== */

.game-section {
  padding: 80px 0;
  position: relative;
  background-color: var(--bg-sand-light);
}

.game-console-wrapper {
  max-width: 860px;
  margin: 0 auto;
  background: var(--bg-white);
  border: 2px solid var(--text-forest-dark);
  border-radius: var(--radius-md);
  box-shadow: 6px 6px 0 var(--text-forest-dark);
  padding: 32px;
  position: relative;
}

/* 控制台顶部信息条 */
.game-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--bg-sand-border);
  margin-bottom: 24px;
}

.game-scoreboard {
  display: flex;
  align-items: center;
  gap: 20px;
  font-family: monospace;
}

.score-pill {
  display: flex;
  flex-direction: column;
}

.score-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-forest-muted);
}

.score-num {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-forest-dark);
  line-height: 1.1;
}

.score-num.coral {
  color: var(--color-coral);
}

.game-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sound-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-forest-dark);
  background-color: var(--bg-sand-warm);
  border: 1px solid var(--bg-sand-border);
  border-radius: var(--radius-xs);
  box-shadow: 2px 2px 0 var(--bg-sand-border);
  transition: var(--transition);
}

.sound-toggle-btn:hover {
  background-color: #FFFFFF;
  border-color: var(--text-forest-dark);
}

.sound-toggle-btn.muted {
  color: var(--text-forest-muted);
  opacity: 0.8;
}

/* 状态与文本提示条 (具有 aria-live) */
.game-status-box {
  padding: 14px 18px;
  border-radius: var(--radius-xs);
  background-color: var(--bg-sand-warm);
  border: 1px solid var(--bg-sand-border);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-forest-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  min-height: 52px;
}

.game-status-box.error {
  background-color: var(--color-coral-subtle);
  border-color: var(--color-coral);
  color: var(--color-coral);
}

.game-status-box.success {
  background-color: rgba(27, 127, 82, 0.1);
  border-color: var(--color-emerald);
  color: var(--color-emerald);
}

/* 6 个节点瓷砖的网格布局 */
.node-tiles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.node-tile {
  background: var(--bg-sand-card);
  border: 2px solid var(--bg-sand-border);
  border-radius: var(--radius-sm);
  box-shadow: 4px 4px 0 var(--bg-sand-border);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 96px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
  position: relative;
  touch-action: manipulation;
}

.node-tile:hover:not(:disabled) {
  border-color: var(--text-forest-dark);
  transform: translateY(-2px);
  box-shadow: 6px 6px 0 var(--text-forest-dark);
}

.node-tile:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--text-forest-dark);
}

.node-tile:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

/* 各节点的特定主题与点亮色彩 */
.node-tile[data-node="1"] {
  border-left: 5px solid #E76247;
}
.node-tile[data-node="1"].active-flash {
  background-color: #E76247 !important;
  color: #FFFFFF !important;
  border-color: #CF4E34 !important;
  box-shadow: 0 0 20px rgba(231, 98, 71, 0.6) !important;
  transform: scale(0.98);
}

.node-tile[data-node="2"] {
  border-left: 5px solid #C28B38;
}
.node-tile[data-node="2"].active-flash {
  background-color: #C28B38 !important;
  color: #FFFFFF !important;
  border-color: #A37125 !important;
  box-shadow: 0 0 20px rgba(194, 139, 56, 0.6) !important;
  transform: scale(0.98);
}

.node-tile[data-node="3"] {
  border-left: 5px solid #1B7F52;
}
.node-tile[data-node="3"].active-flash {
  background-color: #1B7F52 !important;
  color: #FFFFFF !important;
  border-color: #13623E !important;
  box-shadow: 0 0 20px rgba(27, 127, 82, 0.6) !important;
  transform: scale(0.98);
}

.node-tile[data-node="4"] {
  border-left: 5px solid #2B6CB0;
}
.node-tile[data-node="4"].active-flash {
  background-color: #2B6CB0 !important;
  color: #FFFFFF !important;
  border-color: #1E5389 !important;
  box-shadow: 0 0 20px rgba(43, 108, 176, 0.6) !important;
  transform: scale(0.98);
}

.node-tile[data-node="5"] {
  border-left: 5px solid #8E4A68;
}
.node-tile[data-node="5"].active-flash {
  background-color: #8E4A68 !important;
  color: #FFFFFF !important;
  border-color: #71354F !important;
  box-shadow: 0 0 20px rgba(142, 74, 104, 0.6) !important;
  transform: scale(0.98);
}

.node-tile[data-node="6"] {
  border-left: 5px solid #163323;
}
.node-tile[data-node="6"].active-flash {
  background-color: #163323 !important;
  color: #FFFFFF !important;
  border-color: #0F2418 !important;
  box-shadow: 0 0 20px rgba(22, 51, 35, 0.6) !important;
  transform: scale(0.98);
}

/* 瓷砖内部排版 */
.tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tile-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tile-key-badge {
  font-family: monospace;
  font-size: 0.72rem;
  font-weight: 700;
  background-color: var(--bg-sand-warm);
  border: 1px solid var(--bg-sand-border);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  color: var(--text-forest-dark);
}

.active-flash .tile-key-badge {
  background: rgba(255, 255, 255, 0.3);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.5);
}

.tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-family: monospace;
  color: inherit;
  opacity: 0.85;
}

/* 错误抖动动画 */
.tile-error-shake {
  animation: shake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(3px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

/* 底部操作说明 */
.game-instructions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px dashed var(--bg-sand-border);
  font-size: 0.82rem;
  color: var(--text-forest-muted);
}

.instruction-keys {
  display: flex;
  align-items: center;
  gap: 6px;
}

.key-pill {
  padding: 2px 6px;
  background-color: var(--bg-sand-warm);
  border: 1px solid var(--bg-sand-border);
  border-radius: 3px;
  font-family: monospace;
  font-weight: 700;
  color: var(--text-forest-dark);
}

/* 移动端适配 */
@media (max-width: 768px) {
  .game-console-wrapper {
    padding: 20px 16px;
  }

  .node-tiles-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .node-tile {
    min-height: 80px;
    padding: 14px 12px;
  }

  .game-top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .game-controls {
    width: 100%;
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile-error-shake {
    animation: none;
    border-color: var(--color-coral) !important;
  }
  .node-tile {
    transition: none;
  }
}
