body {
  background-color: #2a2c30;
  color: #fff;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: #2a2c30;
}
.container {
  max-width: 1200px;
  width: 95%;
  overflow-x: hidden;
  padding: 0;
  margin: 0 auto;
}
.page {
  width: 100%;
  padding: 0.25rem;
  padding-top: 0.25rem;
  box-sizing: border-box;
  display: none;
}
.page.active {
  display: block;
}
table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  table-layout: fixed;
  background-color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
td,
th {
  font-size: 0.7rem;
  border: 1px solid #555;
  padding: 0.15rem 0.1rem;
  text-align: center;
  min-width: 0;
  white-space: nowrap;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: clip;
  line-height: 1.2;
}
/* 期号列 */
td.col-issue,
th.col-issue {
  font-size: 0.6rem;
  padding: 0.1rem 0.05rem;
  white-space: nowrap;
}
th {
  background-color: #4a4a4a;
  color: #fff;
  font-weight: 600;
}
td {
  background-color: #333;
  color: #fff;
}
/* 房间名 / 预测：允许换行，保证一屏塞下全部列 */
th.col-room,
td.col-room,
th.col-pred,
td.col-pred {
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
}
.summary-table {
  width: 100%;
  margin: 0.25rem auto;
  table-layout: fixed;
}
/* 上路 / 下路 / 潮玩助手 分组表头 */
th.group-upper {
  background: #5c4a78 !important;
  color: #f3e8ff;
  font-weight: 700;
}
th.group-lower {
  background: #6b3d3d !important;
  color: #ffe4e6;
  font-weight: 700;
}
th.group-assist {
  background: #2a4a6e !important;
  color: #dbeafe;
  font-weight: 700;
}
th.parity-odd {
  background: #3d4a5c !important;
  color: #93c5fd;
  font-size: 0.65rem;
}
th.parity-even {
  background: #4a3d4a !important;
  color: #f9a8d4;
  font-size: 0.65rem;
}
th.assist-h {
  background: #243b55 !important;
  color: #bfdbfe;
  font-size: 0.65rem;
}
th.assist-spacer {
  background: #243b55 !important;
  padding: 0 !important;
  border-left: 1px solid #555;
}
th.col-room.side-upper,
td.col-room.side-upper {
  background-color: #3a3348;
}
th.col-room.side-lower,
td.col-room.side-lower {
  background-color: #3d2e2e;
}
td.col-room.side-upper.red-cell,
td.col-room.side-lower.red-cell {
  background-color: #333;
}
td.col-assist {
  background-color: #2a3544;
  min-width: 0;
  padding: 0.1rem 0.05rem;
}
.assist-hash {
  color: #60a5fa;
  font-weight: 800;
  font-size: 0.85rem;
  line-height: 1;
}
.trend-table tr:nth-child(even) td.col-issue,
.trend-table tr:nth-child(even) td.col-pred {
  background-color: #2a2a2a;
}
.trend-table tr:nth-child(even) td.col-room.side-upper {
  background-color: #322c40;
}
.trend-table tr:nth-child(even) td.col-room.side-lower {
  background-color: #352828;
}
.trend-table tr:nth-child(even) td.col-assist {
  background-color: #243040;
}
.summary-table .thead-rooms th.col-room {
  font-size: 0.65rem;
}
@media (max-width: 768px) {
  th.group-upper,
  th.group-lower,
  th.group-assist,
  th.parity-odd,
  th.parity-even,
  th.assist-h {
    font-size: 0.45rem;
    padding: 0.08rem 0.02rem;
  }
  .assist-hash {
    font-size: 0.7rem;
  }
  td.col-assist {
    font-size: 0.45rem;
  }
}

.red-cell img,
.red-cell img.bomb-icon {
  filter: none;
  width: 1.15rem;
  height: 1.15rem;
}
.switch-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1rem;
}
.switch-buttons button {
  background-color: #4a4a4a;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  margin: 0.5rem 0;
  cursor: pointer;
  border-radius: 0.375rem;
  width: 10rem;
  transition: background-color 0.3s ease;
}
.switch-buttons button:hover {
  background-color: #6a6a6a;
}
.back-icon {
  display: none;
  position: fixed;
  top: 0.625rem;
  left: 0.625rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  color: #f1c40f;
  cursor: pointer;
  transition: color 0.3s ease;
  z-index: 1000;
  line-height: 0;
}
.back-icon svg {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
}
.back-icon:hover {
  color: #f39c12;
}
#mainContent {
  text-align: center;
  font-size: 1.25rem;
  margin: 0;
  padding: 0.5rem 0;
}
#mainContent a {
  color: red;
  text-decoration: none;
  display: block;
  margin: 0.25rem 0;
  transition: color 0.3s ease;
  font-weight: 700;
}
#mainContent a:hover {
  color: #c00;
  text-decoration: underline;
}
.loading {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  z-index: 1000;
}
.summary-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 0.25rem;
}
.summary-title {
  text-align: center;
  margin: 0.25rem 0 0.1875rem;
  color: #f1c40f;
  font-weight: 700;
  font-size: 0.875rem;
}
/* 与原版一致：预测正确=红，预测错误=绿 */
.prediction-success {
  color: #dc3545;
  font-weight: 700;
}
.prediction-failure {
  color: #28a745;
  font-weight: 700;
}
.prediction-pending {
  color: #e8edf2;
  font-weight: 700;
}
.algorithm-selector-container {
  margin: 0.75rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}
.algorithm-selector {
  background-color: #4a4a4a;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid #6a6a6a;
  font-size: 0.875rem;
  cursor: pointer;
  outline: 0;
  height: 2.25rem;
}
.algorithm-selector option {
  background-color: #4a4a4a;
  color: #fff;
}
@media (max-width: 768px) {
  .container {
    width: 100%;
    padding: 0 2px;
    box-sizing: border-box;
  }
  .page {
    padding: 0.15rem 0;
  }
  table {
    width: 100%;
    max-width: 100%;
    font-size: 0.55rem;
  }
  td,
  th {
    padding: 0.1rem 0.05rem;
    font-size: 0.55rem;
    min-width: 0;
  }
  td.col-issue,
  th.col-issue {
    font-size: 0.5rem;
    letter-spacing: -0.02em;
  }
  /* 房间多时再缩小，保证一屏放下 */
  table[data-rooms="6"] td,
  table[data-rooms="6"] th,
  table[data-rooms="7"] td,
  table[data-rooms="7"] th,
  table[data-rooms="8"] td,
  table[data-rooms="8"] th {
    font-size: 0.5rem;
  }
  table[data-rooms="6"] td.col-issue,
  table[data-rooms="6"] th.col-issue,
  table[data-rooms="7"] td.col-issue,
  table[data-rooms="7"] th.col-issue,
  table[data-rooms="8"] td.col-issue,
  table[data-rooms="8"] th.col-issue {
    font-size: 0.45rem;
  }
  .bomb-icon,
  .red-cell img.bomb-icon {
    width: 0.95rem;
    height: 0.95rem;
  }
  .summary-table {
    width: 100%;
  }
  .algorithm-selector {
    width: auto;
    flex: 1;
  }
}
.error-message {
  color: red;
  text-align: center;
  margin-top: 1rem;
  display: none;
}
.highlight-cell {
  background-color: #f1c40f !important;
  color: #000 !important;
  transition: background-color 0.1s;
}
.random-btn {
  background: linear-gradient(135deg, #f39c12 0, #d35400 100%);
  color: #fff;
  border: none;
  padding: 0 1rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  margin-left: 0;
}
.random-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  filter: brightness(1.1);
}
.random-btn:active {
  transform: translateY(0);
}
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(3px);
}
.modal-overlay.show {
  display: flex;
}
.modal-content {
  background-color: #2c2c2c;
  padding: 1.5rem;
  border-radius: 0.75rem;
  width: 85%;
  max-width: 320px;
  text-align: center;
  border: 1px solid #4a4a4a;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  animation: modalPop 0.3s ease-out;
}
@keyframes modalPop {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-10px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(10px);
  }
}
.modal-title {
  color: #f1c40f;
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 700;
}
.modal-tip {
  color: #aaa;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}
.modal-input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1.25rem;
  background-color: #1a1a1a;
  border: 1px solid #4a4a4a;
  color: #fff;
  border-radius: 0.5rem;
  box-sizing: border-box;
  outline: 0;
  font-size: 1rem;
  text-align: center;
  transition: border-color 0.3s;
}
.modal-input:focus {
  border-color: #f1c40f;
}
.modal-buttons {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.modal-btn {
  flex: 1;
  padding: 0.75rem;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.modal-btn.confirm {
  background: linear-gradient(135deg, #f1c40f 0, #f39c12 100%);
  color: #000;
}
.modal-btn.cancel {
  background-color: #4a4a4a;
  color: #ccc;
}
.modal-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.modal-btn:active {
  transform: translateY(0);
}
.copyright-banner {
  text-align: center;
  padding: 0.25rem 0;
  margin: 0;
  background-color: #2c2c2c;
}
.copyright-banner a {
  color: #3b82f6;
  text-decoration: none;
  margin: 0 0.5rem;
  font-size: 0.9rem;
}
.page-title {
  text-align: center;
  color: #3b82f6;
  font-size: 1.25rem;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}
.hit-mark {
  color: #ef4444;
  font-weight: 700;
  font-size: 1rem;
}
.miss-mark {
  color: #666;
}
.bomb-icon {
  width: 1.15rem;
  height: 1.15rem;
  vertical-align: middle;
  display: inline-block;
}
.red-cell img.bomb-icon {
  filter: none;
  width: 1.15rem;
  height: 1.15rem;
}
/* 跑马灯：仅用于「随机预测」时统计表头房间名 */
.summary-table th.marquee-on {
  background-color: #f1c40f !important;
  color: #000 !important;
  transition: background-color 0.05s;
}
.summary-table th.marquee-selected {
  background-color: #e67e22 !important;
  color: #fff !important;
  box-shadow: inset 0 0 0 2px #f1c40f;
}

/* 金属背景：纯 CSS，无图片请求 */
html[data-metal="steel"] body::before {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 4px),
    linear-gradient(165deg, #8a9098 0%, #4e535c 28%, #2c3036 52%, #5a616a 78%, #3a3e44 100%);
}
html[data-metal="gun"] body::before {
  background:
    repeating-linear-gradient(180deg, rgba(180, 210, 230, 0.05) 0 1px, transparent 1px 5px),
    linear-gradient(160deg, #4a5560 0%, #1e272e 40%, #12181c 58%, #3a4650 100%);
}
html[data-metal="gold"] body::before {
  background:
    repeating-linear-gradient(92deg, rgba(255, 236, 180, 0.08) 0 1px, transparent 1px 4px),
    linear-gradient(155deg, #d4b56a 0%, #8a6a32 32%, #3d2e14 55%, #c4a056 82%, #6e5424 100%);
}
html[data-metal="bronze"] body::before {
  background:
    repeating-linear-gradient(88deg, rgba(255, 190, 140, 0.07) 0 1px, transparent 1px 4px),
    linear-gradient(150deg, #b07850 0%, #6a3e28 34%, #2a1810 56%, #8a4e32 80%, #4a281c 100%);
}
html[data-metal="titan"] body::before {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 5px),
    linear-gradient(170deg, #4a4a4a 0%, #2c2c2c 42%, #1a1a1a 60%, #3a3a3a 100%);
}

.metal-picker {
  position: fixed;
  right: 0.6rem;
  bottom: 0.6rem;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.45rem;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.metal-picker-label {
  color: #ddd;
  font-size: 0.7rem;
  padding: 0 0.2rem 0 0.35rem;
  white-space: nowrap;
}
.metal-picker button {
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
}
.metal-picker button.is-on {
  outline: 2px solid #f1c40f;
  outline-offset: 1px;
}
.metal-picker [data-metal="steel"] {
  background: linear-gradient(135deg, #c5c9ce, #5a5f66);
}
.metal-picker [data-metal="gun"] {
  background: linear-gradient(135deg, #6a7a88, #1a2228);
}
.metal-picker [data-metal="gold"] {
  background: linear-gradient(135deg, #ecd89a, #6e5424);
}
.metal-picker [data-metal="bronze"] {
  background: linear-gradient(135deg, #c48858, #4a281c);
}
.metal-picker [data-metal="titan"] {
  background: linear-gradient(135deg, #666, #1a1a1a);
}
