/* ==========================================
   算24 Game — 主站风格（zkxx.xyz）
   白底 + 暗红标题 + 黑框直角 + 硬边阴影
   ========================================== */

.game24-wrapper {
  position: relative;
  z-index: 1;
  background: #fff;
  border: 2px solid #000;
  border-radius: 0;
  padding: 24px 28px 20px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.2);
  user-select: none;
}

/* 游戏主体区：垂直居中内容，避免下方空白 */
.g24-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 400px;
}

/* ===== 顶部信息栏 ===== */
.game24-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.game24-title {
  font-size: 1.5rem;
  font-weight: 400;
  color: #cf2e2e;   /* 主站暗红标题 */
  letter-spacing: 3px;
  border-bottom: 3px solid #cf2e2e;
  padding-bottom: 4px;
}

.game24-timer {
  background: #f6f6f6;
  border: 2px solid #000;
  border-radius: 0;
  padding: 6px 16px;
  min-width: 90px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #000;
  letter-spacing: 1px;
}

/* 当前关卡显示（排位：第 N 关；自由：已解 N 组） */
.game24-level {
  background: #fff;
  border: 2px solid #000;
  border-radius: 0;
  padding: 6px 12px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #cf2e2e;
  letter-spacing: 1px;
}

/* 排位倒计时最后 10 秒警告 / 超时变红 */
.g24-timer-warn {
  color: #cf2e2e;
  animation: timerWarn 500ms ease-in-out infinite alternate;
}
.g24-timer-danger {
  color: #fff;
  background: #cf2e2e;
  animation: timerWarn 400ms ease-in-out infinite alternate;
}

@keyframes timerWarn {
  0%   { transform: scale(1); }
  100% { transform: scale(1.06); }
}

/* ===== 牌区 ===== */
.game24-board {
  position: relative;
  width: 420px;
  height: 112px;
  margin: 0 auto 14px;
  touch-action: none;   /* 触屏拖动不滚动页面 */
}

/* 单张牌 */
.g24-card {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #ffffff;
  border: 2px solid #000;
  border-radius: 0;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.15);
  transition: left 200ms ease-out, top 200ms ease-out;
  will-change: transform;
}

/* 运算得出的牌（非原始牌，底色区分） */
.g24-card-made {
  background: #f6f6f6;
}

/* 选中态：暗红边框 + 阴影抬高 */
.g24-card-selected {
  border-color: #cf2e2e;
  box-shadow: 3px 3px 0 rgba(207, 46, 46, 0.4);
  transform: translateY(-6px);
}

.g24-card-num {
  display: inline-block;
  line-height: 1;
  font-size: 1.8rem;
  font-weight: 700;
  color: #000;
  white-space: nowrap;
}

/* 胜出闪光（常驻呼吸光效；z-index 浮在结算层之上，24 牌始终可见） */
.g24-card-win {
  border-color: #9dff20;
  box-shadow: 0 0 24px 6px rgba(157, 255, 32, 0.7);
  animation: winGlow 1.2s ease-in-out infinite alternate;
  z-index: 10;
}

@keyframes winGlow {
  0%   { box-shadow: 0 0 14px 4px rgba(157, 255, 32, 0.5); }
  100% { box-shadow: 0 0 30px 9px rgba(157, 255, 32, 0.85); }
}

/* ===== 运算符行 ===== */
.game24-ops {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.g24-op {
  width: 58px;
  height: 48px;
  font-size: 1.3rem;
  background: #f6f6f6;
  border: 2px solid #000;
  border-radius: 0;
  color: #000;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2);
  transition: background 0.15s, transform 0.1s, box-shadow 0.1s;
  font-family: inherit;
  font-weight: 700;
}

.g24-op:hover {
  background: #cf2e2e;
  color: #fff;
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.2);
}

.g24-op:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

/* 已点运算符（等待右运算数）：暗红底白字 */
.g24-op.g24-op-active {
  background: #cf2e2e;
  color: #fff;
  border-color: #cf2e2e;
  box-shadow: 3px 3px 0 rgba(207, 46, 46, 0.3);
}

/* ===== 辅助按钮行 ===== */
.game24-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.game24-actions .btn-new-game {
  padding: 6px 14px;
  font-size: 0.8rem;
}

/* 次要按钮（浅灰底黑字，与主按钮区分） */
.btn-new-game.g24-btn-ghost {
  background: #f6f6f6;
  color: #000;
}
.btn-new-game.g24-btn-ghost:hover {
  background: #000;
  color: #fff;
}

/* ===== 状态消息 ===== */
.game24-msg {
  min-height: 20px;
  text-align: center;
  font-size: 0.8rem;
  color: #555;
  letter-spacing: 1px;
  opacity: 0;
}

/* ===== 步骤历史 ===== */
/* 提示框：固定高度，内容出现/消失面板大小不变 */
.g24-hint-box {
  height: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
}

.g24-hint-text {
  font-size: 0.8rem;
  color: #345c00;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 8px;
}

/* 平时显示的操作引导提示 */
.g24-hint-tip {
  font-size: 0.75rem;
  color: #aaa;
  letter-spacing: 1px;
  text-align: center;
  white-space: nowrap;
}

/* 步骤历史：固定 3 行高度，行数变化面板大小不变 */
.game24-history {
  height: 66px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e5e5e5;
  text-align: center;
  overflow: hidden;
}

.g24-history-line {
  font-size: 0.85rem;
  color: #000;
  letter-spacing: 1px;
  animation: g24LineIn 200ms ease-out;
}

@keyframes g24LineIn {
  0%   { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}

.g24-history-empty {
  font-size: 0.75rem;
  color: #aaa;
  letter-spacing: 2px;
}

/* ===== 结算覆盖层：全屏自适应内容，去掉滚动条（24牌浮在其上） ===== */
.game24-result {
  position: absolute;
  inset: 0;
  height: auto;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  z-index: 5;
  text-align: center;
  padding: 70px 14px 14px;   /* 顶部留空，文字下移避开 24 牌光效 */
  overflow: hidden;   /* 无滚动条 */
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}

.game24-result.show {
  opacity: 1;
  transform: translateY(0);
}

.g24-result-big {
  font-size: 1.8rem;
  font-weight: 400;
  color: #cf2e2e;
  letter-spacing: 4px;
  border-bottom: 3px solid #cf2e2e;
  padding-bottom: 6px;
}

.g24-result-time {
  font-size: 0.95rem;
  color: #555;
  letter-spacing: 1px;
}

.g24-result-info {
  font-size: 0.8rem;
  color: #345c00;
  letter-spacing: 1px;
}

.g24-result-btns {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

/* ===== 锁定覆盖层 ===== */
.game24-lock {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  z-index: 6;
  border-radius: 0;
}

/* ===== 准备界面 ===== */
.game24-ready {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.94);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  z-index: 5;
  border-radius: 0;
}

.g24-ready-title {
  font-size: 1.6rem;
  font-weight: 400;
  color: #cf2e2e;
  letter-spacing: 6px;
  border-bottom: 3px solid #cf2e2e;
  padding-bottom: 8px;
}

.g24-ready-sub {
  font-size: 0.85rem;
  color: #555;
  letter-spacing: 2px;
}
