/* === Recursion Roulette — Game-Specific Styles === */

/* Rule Zone */
.rule-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 0;
  min-height: 36px;
}
.tier-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
  display: none;
}
.tier-badge.show {
  display: inline-block;
}
.tier-badge.t1 {
  background: rgba(61, 212, 122, 0.15);
  color: var(--win);
  border: 1px solid rgba(61, 212, 122, 0.3);
}
.tier-badge.t2 {
  background: rgba(240, 160, 48, 0.12);
  color: var(--r2);
  border: 1px solid rgba(240, 160, 48, 0.3);
}
.tier-badge.t3 {
  background: rgba(144, 96, 224, 0.12);
  color: var(--r3);
  border: 1px solid rgba(144, 96, 224, 0.3);
}
.tier-badge.t4 {
  background: rgba(224, 64, 96, 0.12);
  color: var(--lose);
  border: 1px solid rgba(224, 64, 96, 0.3);
}
.rule-formula {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* Sequence Zone */
.seq-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
  padding: 8px 4px;
  min-height: 60px;
}
.seq-cell {
  width: 40px;
  height: 48px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: all 0.3s;
  position: relative;
}
.seq-cell .seq-idx {
  font-size: 8px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  line-height: 1;
}
.seq-cell .seq-val {
  font-size: 16px;
  color: var(--text);
  line-height: 1.2;
}
.seq-cell.seed {
  border-color: var(--border-glow);
  background: var(--surface);
}
.seq-cell.seed .seq-val {
  color: var(--gold);
}
.seq-cell.correct {
  border-color: var(--win);
  background: rgba(61, 212, 122, 0.08);
  animation: cellPop 0.3s ease-out;
}
.seq-cell.correct .seq-val {
  color: var(--win);
}
.seq-cell.wrong {
  border-color: var(--lose);
  background: rgba(224, 64, 96, 0.08);
  animation: cellShake 0.35s ease-out;
}
.seq-cell.wrong .seq-val {
  color: var(--lose);
}
.seq-cell.pending {
  border-color: var(--zero);
  border-style: dashed;
  animation: pendingPulse 1.4s ease-in-out infinite;
}
.seq-cell.skipped {
  border-color: var(--text-muted);
  background: var(--surface);
}
.seq-cell.skipped .seq-val {
  color: var(--text-dim);
}
.seq-cell.peek {
  border-color: var(--r3);
  border-style: dotted;
  background: rgba(144, 96, 224, 0.06);
}
.seq-cell.peek .seq-val {
  color: var(--r3);
}
.seq-cell.timeout .seq-val {
  color: var(--lose);
}
.seq-arrow {
  font-size: 14px;
  color: var(--text-muted);
  opacity: 0.4;
  font-family: var(--font-mono);
}
.seq-cell .pred-mark {
  position: absolute;
  top: -6px;
  right: -4px;
  font-size: 10px;
  font-weight: 700;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.seq-cell.correct .pred-mark {
  background: var(--win);
  color: #fff;
}
.seq-cell.wrong .pred-mark,
.seq-cell.timeout .pred-mark {
  background: var(--lose);
  color: #fff;
}

/* Timer Zone */
.timer-zone {
  height: 4px;
  margin: 2px 10px;
  border-radius: 2px;
  background: var(--surface-2);
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s;
}
.timer-zone.active {
  opacity: 1;
}
.timer-bar {
  height: 100%;
  border-radius: 2px;
  background: var(--zero);
  width: 100%;
  transition:
    width 0.1s linear,
    background-color 0.5s;
}
.timer-bar.warning {
  background: var(--r2);
}
.timer-bar.danger {
  background: var(--lose);
}

/* Predict Info */
.predict-info {
  text-align: center;
  min-height: 20px;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.8px;
}

/* Keypad */
.keypad {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 8px;
  padding: 0 4px;
}
.key-btn {
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--border-glow);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1;
  position: relative;
}
.key-btn:hover {
  border-color: var(--zero);
  background: var(--surface);
}
.key-btn:active {
  transform: scale(0.93);
}
.key-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.key-lbl {
  font-size: 7px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  line-height: 1;
}
.action-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

/* Streak counter */
.streak-display {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}
.streak-display .streak-count {
  color: var(--gold);
  font-size: 16px;
}

/* History row */
.history-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeSlideUp 0.4s ease-out both;
}
.hist-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  opacity: 0.85;
}

/* Animations */
@keyframes cellPop {
  0% {
    transform: scale(0.9);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes cellShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-3px);
  }
  40% {
    transform: translateX(3px);
  }
  60% {
    transform: translateX(-2px);
  }
  80% {
    transform: translateX(1px);
  }
}
@keyframes pendingPulse {
  0%,
  100% {
    border-color: var(--zero);
    opacity: 0.7;
  }
  50% {
    border-color: var(--gold);
    opacity: 1;
  }
}
@keyframes fadeSlideUp {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 390px) {
  .keypad {
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
  }
  .key-btn {
    height: 36px;
    font-size: 12px;
  }
  .seq-cell {
    width: 34px;
    height: 42px;
  }
  .seq-cell .seq-val {
    font-size: 14px;
  }
}
@media (max-height: 600px) {
  .seq-zone {
    padding: 4px;
    min-height: 48px;
  }
  .key-btn {
    height: 34px;
  }
  .rule-zone {
    padding: 2px 0;
    min-height: 28px;
  }
}
@media (min-width: 521px) {
  .seq-cell {
    width: 46px;
    height: 54px;
  }
  .seq-cell .seq-val {
    font-size: 18px;
  }
  .key-btn {
    height: 44px;
    font-size: 15px;
  }
}
