:root {
  --bg: #14161a;
  --panel: #1b1e24;
  --line: #23272f;
  --line-soft: #1f2229;
  --text: #e6e9ef;
  --text-dim: #8b93a3;
  --text-faint: #5d6675;
  --accent: #8fa8b8;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "SF Mono", "JetBrains Mono", "Menlo", "Consolas", ui-monospace, monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage {
  display: flex;
  align-items: stretch;
  gap: 26px;
  height: 100%;
  max-height: 900px;
}

/* ---------- board ---------- */

.board-wrap {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  display: flex;
}

#board {
  display: block;
  border-radius: 4px;
  background: var(--bg);
}

/* ---------- 消除浮字（DOM 层，叠在 3D 画布上） ---------- */

.floaters {
  position: absolute;
  inset: 10px;
  pointer-events: none;
  overflow: hidden;
  border-radius: 4px;
}

.floaters span {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  letter-spacing: 0.3em;
  text-shadow: 0 2px 14px rgba(10, 12, 15, 0.85);
  animation: float-up 950ms cubic-bezier(0.16, 0.9, 0.28, 1) both;
}

.floaters .f-name {
  font-size: 17px;
  font-weight: 500;
  color: rgba(196, 214, 226, 0.95);
}

.floaters .f-big {
  font-size: 25px;
  font-weight: 600;
  color: rgba(220, 236, 244, 0.98);
}

.floaters .f-combo {
  font-size: 12px;
  font-weight: 500;
  color: rgba(184, 168, 112, 0.95);
}

@keyframes float-up {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.86); }
  14%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  62%  { opacity: 1; transform: translate(-50%, -108%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -142%) scale(1); }
}

/* ---------- WebGL 不可用 ---------- */

.nowebgl {
  position: absolute;
  inset: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #171a20;
  border-radius: 4px;
}

.nowebgl[hidden] { display: none; }

.nowebgl p {
  margin: 0;
  font-size: 12px;
  line-height: 2;
  text-align: center;
  color: var(--text-dim);
}

.overlay {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: rgba(20, 22, 26, 0.82);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 180ms ease-out both;
}

.overlay[hidden] { display: none; }

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.overlay-inner { text-align: center; }

.overlay-title {
  margin: 0 0 10px;
  font-size: 22px;
  letter-spacing: 0.24em;
  color: var(--text);
  font-weight: 500;
}

.overlay-sub {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  line-height: 1.9;
  white-space: pre-line;
}

/* ---------- side panel ---------- */

.panel {
  width: 188px;
  flex: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.block { display: block; }

.label {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--text-faint);
  text-transform: uppercase;
}

.value {
  margin: 0;
  font-size: 26px;
  font-weight: 400;
  line-height: 1.1;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  transform-origin: 100% 50%;
}

.value.bump { animation: bump 320ms cubic-bezier(0.2, 1.5, 0.4, 1) both; }

@keyframes bump {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.13); color: #cfe0e8; }
  100% { transform: scale(1); }
}

/* 分数增量浮字 */
.value-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
}

.gain {
  font-size: 12px;
  color: var(--accent);
  opacity: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.gain.show { animation: gain-float 900ms cubic-bezier(0.2, 0.8, 0.3, 1) both; }

@keyframes gain-float {
  0%   { opacity: 0; transform: translateY(6px); }
  18%  { opacity: 1; transform: translateY(0); }
  70%  { opacity: 1; transform: translateY(-2px); }
  100% { opacity: 0; transform: translateY(-9px); }
}

/* 升级进度条 */
.progress {
  margin-top: 8px;
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  opacity: 0.55;
  border-radius: 2px;
  transition: width 260ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

.progress.flash i {
  animation: prog-flash 520ms ease-out;
}

@keyframes prog-flash {
  0%   { opacity: 1; background: #dfe9ee; }
  100% { opacity: 0.55; background: var(--accent); }
}

.next {
  display: block;
  width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #171a1f;
}

/* 3D 预览用第二个 WebGL 上下文，高度由 JS 按宽度算 */
canvas.next { height: 100px; }

.keys dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  font-size: 11px;
  color: var(--text-dim);
}

.keys dt { color: var(--text-faint); letter-spacing: 0.06em; }
.keys dd { margin: 0; text-align: right; }

.actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.actions button {
  appearance: none;
  border: 1px solid var(--line);
  background: #21252c;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.14em;
  padding: 9px 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.actions button:hover {
  background: #272c34;
  color: var(--text);
  border-color: #333944;
}

.actions button:active { transform: translateY(1px); }

.actions button.off {
  color: var(--text-faint);
  border-color: var(--line-soft);
  background: #1d2027;
}

@media (max-height: 560px) {
  .keys { display: none; }
}
