/* Global reset */
* { list-style: none; box-sizing: border-box; }

body {
  font-family: Arial, sans-serif;
  display: flex; justify-content: center; align-items: center;
  height: 100vh; margin: 0; background: #5c4a36;
}

/* Wooden frame with inner bevel and bottom step */
#frame {
  width: min(1200px, 96vw); min-width: 860px;
  height: 100vh;
  padding: 16px 18px 22px; border-radius: 14px;
  background: url('../img/wood.jpg') ;
  position: relative;
  box-shadow: inset 0 0 3px white, 0 0 10px black;
}
#frame::after{
  content:''; position:absolute; left:8px; right:8px; bottom:6px; height:10px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.35), rgba(0,0,0,0.2));
  border-radius: 0 0 8px 8px; box-shadow: 0 6px 14px rgba(0,0,0,0.35);
}

#frame-header { text-align: center; padding: 6px 0 10px; }
#game-title {
  font-family: 'Noto Sans SC', Arial, sans-serif;
  font-weight: 900; letter-spacing: 2px; margin: 0;
  color: #8b572a;
  /* 凹陷效果：顶部/左侧高光 + 底部/右侧暗影 + 轻微描边和柔和投影 */
  /* text-shadow:
    0 1px 0 rgba(255,255,255,0.75),
    0 -1px 0 rgba(0,0,0,0.35),
    1px 1px 0 rgba(255,255,255,0.35),
    -1px -1px 0 rgba(0,0,0,0.10),
    0 2px 3px rgba(0,0,0,0.25);
  -webkit-text-stroke: 0.4px rgba(0,0,0,0.08);
  mix-blend-mode: multiply; */
  text-shadow: 
    0 1px 1px rgba(255, 255, 255, 0.5),
    0 -1px 1px rgba(0,0,0,0.5);
  font-family: Helvetica, Arial, sans-serif;
}

#frame-main { display: grid; grid-template-columns: minmax(320px, 1fr) 260px; gap: 16px; align-items: start; }

/* Board wrap */
#board-wrap { position: relative; display: flex; justify-content: center; align-items: center; width: 100%; margin-bottom: 10px;}
#board { border: 2px solid #5a3c1b; margin: 0 auto; box-shadow: 0 0 15px rgba(0,0,0,0.25); background: transparent;
  width: min(90vmin, 95vh); aspect-ratio: 1 / 1; height: auto; max-width: 100%;
}

/* 最后一手棋光晕 */
#last-move-glow {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: inset 0 -2px 15px rgba(255,255,255,0.3),
              inset -2px -1px 40px rgba(10,10,10,0.4),
              0 0 2px rgba(0,0,0,0.5),
              0 0 10px 3px rgba(255, 249, 232, 0.5) !important;
  transition: opacity 0.2s ease;
  opacity: 1;
}


/* Right side panel */
#right-panel { display: flex; flex-direction: column; gap: 14px; }
.panel-group { display: flex; justify-content: space-between; background: rgba(255,255,255,0.15); border: 1px solid rgba(0,0,0,0.15); border-radius: 10px; padding: 10px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.15); }
.panel-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.panel-row label { color: #442d1a; font-weight: 600; }
.panel-row select { padding: 6px 10px; border-radius: 6px; border: 1px solid #9c6a34; background: #f6e7d1; color: #503516; }

/* Wooden buttons */
button, .mode-btn {
  font-size: 15px; padding: 10px 18px; cursor: pointer; color: #fff;
  background: linear-gradient(#c98a4a, #b47837); border: 1px solid #8e5e2a; border-radius: 8px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.15), inset 0 0 0 1px rgba(255,255,255,0.12);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
button:hover, .mode-btn:hover { transform: translateY(-1px); filter: brightness(1.02); box-shadow: 0 5px 12px rgba(0,0,0,0.18); }
button:active, .mode-btn:active { transform: translateY(0); box-shadow: inset 0 2px 4px rgba(0,0,0,0.18); }
button:disabled { background: #c9c9c9; border-color: #bdbdbd; cursor: not-allowed; box-shadow: none; }
.mode-btn.active { background: linear-gradient(#a86f33, #8d5a26); }

/* Footer timers */
#frame-footer { margin-top: 12px; }
#timer-container { width: min(90vmin, 95vh); }
.timer { 
    display: flex;
    text-align: center; 
    font-size: 18px; 
    background: transparent; 
}
.chess {
    width: 80px;
    background: transparent;
    color: #fff;
    font-size: 16px;
    text-align: center;
    padding: 10px 18px;
    border-radius: 8px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
#black-time{
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    background: transparent;
    padding: 10px 16px;
}
#white-time{
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    background: transparent;
    padding: 10px 16px;
}

/* Victory overlay (centered) */
#victory-layer {
  position: fixed; inset: 0; display: flex; /* use .hidden to hide */
  justify-content: center; align-items: center; z-index: 2000;
  background: rgba(0,0,0,0.6);
  flex-direction: column; gap: 12px;
}
#victory-message {
  color: #FFD700; text-align: center; font-size: clamp(28px, 4vw, 48px);
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
  background: rgba(255,255,255,0.15);
  padding: 24px 34px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.25);
}

/* 当前走子高亮样式 */
.timer.active {
  outline: 2px solid #f1c27d;
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.35) inset,
    0 0 16px rgba(241, 194, 125, 0.65),
    0 4px 10px rgba(0,0,0,0.15);
  transform: translateY(-1px);
  transition: outline .15s ease, box-shadow .15s ease, transform .15s ease;
}
.timer.active > div:first-child { color: #8b5a2b; }

/* Message box reuse */
#message { font-size: 16px; color: #333; background: rgba(255,255,255,0.85); padding: 10px 12px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.12); }
.hidden { display: none !important; }

/* Debug panel (keep previous style minimal) */
#debug-panel { margin-top: 10px; border: 1px dashed #aaa; padding: 8px; border-radius: 6px; background:rgba(255,255,255,0.15); }
#debug-panel.hidden { display:none; }
#debug-body.hidden { display:none; }
#debug-panel .dbg-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:6px 12px; font-size:12px; }
