/* ============================================
   Shanom Portfolio — rhythm.css
   🎮 Boba Rhythm — mini rhythm game easter egg
   ============================================ */

/* ===== Footer launcher ===== */
.rhythm-launch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 0.9rem;
  padding: 7px 16px;
  border: 1.5px dashed var(--brown-light);
  border-radius: 50px;
  background: rgba(232, 196, 154, 0.14);
  color: var(--text-mid);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: var(--transition);
}

.rhythm-launch:hover {
  border-style: solid;
  border-color: var(--lime-bright);
  background: linear-gradient(135deg, rgba(168, 213, 162, 0.35), rgba(240, 168, 112, 0.3));
  color: var(--brown-dark);
  transform: translateY(-2px) rotate(-1deg);
  box-shadow: 0 6px 18px var(--shadow-green);
}

.rhythm-launch-emoji {
  display: inline-block;
  animation: bobble 2.4s ease-in-out infinite;
}

/* ===== Overlay ===== */
.rhythm-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  /* ไม่ใช้ backdrop-filter เต็มจอ — มันกินเฟรมเรตตอนเกมกำลังวาด canvas */
  background: rgba(28, 18, 10, 0.88);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.rhythm-overlay.open {
  display: flex;
  opacity: 1;
}

.rhythm-panel {
  position: relative;
  width: min(94vw, 440px);
  max-height: 94vh;
  padding: 14px 14px 16px;
  border: 1.5px solid rgba(232, 196, 154, 0.35);
  border-radius: 24px;
  background: linear-gradient(170deg, #2A1B10 0%, #1C120A 60%, #231812 100%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  color: #FFF4E8;
  transform: translateY(18px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.rhythm-overlay.open .rhythm-panel {
  transform: translateY(0) scale(1);
}

.rhythm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.rhythm-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: #FFD9AE;
  display: flex;
  align-items: center;
  gap: 7px;
}

.rhythm-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(232, 196, 154, 0.35);
  color: #E8C49A;
  font-size: 0.9rem;
  line-height: 1;
  transition: var(--transition);
}

.rhythm-close:hover {
  background: rgba(232, 100, 74, 0.35);
  color: #fff;
  transform: rotate(90deg);
}

/* ===== HUD ===== */
.rhythm-hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}

.rhythm-stat {
  padding: 6px 8px;
  border: 1px solid rgba(232, 196, 154, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
}

.rhythm-stat-k {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(232, 196, 154, 0.7);
}

.rhythm-stat-v {
  display: block;
  font-size: 1.02rem;
  font-weight: 700;
  color: #FFF4E8;
}

.rhythm-progress {
  height: 3px;
  margin-bottom: 10px;
  border-radius: 3px;
  background: rgba(232, 196, 154, 0.18);
  overflow: hidden;
}

.rhythm-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, #F0A870, #7DC97A);
}

/* ===== Speed selector ===== */
.rhythm-speed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.rh-speed-label {
  font-size: 0.66rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(232, 196, 154, 0.7);
}

.rh-chips {
  display: inline-flex;
  gap: 5px;
}

.rhythm-chip {
  padding: 3px 10px;
  border: 1px solid rgba(232, 196, 154, 0.35);
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.04);
  color: #E8C49A;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: var(--transition);
}

.rhythm-chip:hover {
  background: rgba(232, 196, 154, 0.18);
  transform: translateY(-1px);
}

.rhythm-chip.on {
  background: linear-gradient(135deg, #F0A870, #7DC97A);
  border-color: transparent;
  color: #1C120A;
  box-shadow: 0 3px 12px rgba(240, 168, 112, 0.35);
}

/* ===== Canvas ===== */
.rhythm-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.28);
  touch-action: none;
}

.rhythm-hint {
  margin-top: 10px;
  text-align: center;
  font-size: 0.74rem;
  color: rgba(232, 196, 154, 0.75);
  letter-spacing: 0.4px;
}

.rhythm-keys {
  display: inline-flex;
  gap: 4px;
  vertical-align: middle;
}

.rhythm-key {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid rgba(232, 196, 154, 0.4);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: rgba(232, 196, 154, 0.12);
  font-size: 0.68rem;
  font-weight: 700;
  color: #FFD9AE;
}

/* ===== Result screen ===== */
.rhythm-result {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 1.4rem;
  border-radius: 24px;
  background: rgba(20, 12, 7, 0.94);
  text-align: center;
}

.rhythm-result.open {
  display: flex;
}

.rhythm-rank {
  font-size: 4.2rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, #FFD9AE, #7DC97A);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rhythm-rank-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes rhythm-rank-pop {

  0%,
  100% {
    transform: scale(1);
  }

  35% {
    transform: scale(1.22) rotate(-3deg);
  }

  70% {
    transform: scale(0.96);
  }
}

.rhythm-rank-sub {
  font-size: 0.9rem;
  font-weight: 600;
  color: #FFD9AE;
  margin-bottom: 0.5rem;
}

.rhythm-result-row {
  display: flex;
  gap: 1.4rem;
  font-size: 0.82rem;
  color: rgba(255, 244, 232, 0.85);
  font-variant-numeric: tabular-nums;
}

.rhythm-result-row b {
  display: block;
  font-size: 1.15rem;
  color: #fff;
}

.rhythm-judges {
  display: flex;
  gap: 0.7rem;
  margin: 0.5rem 0 0.2rem;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.rhythm-judges span {
  opacity: 0.9;
}

.rhythm-actions {
  display: flex;
  gap: 10px;
  margin-top: 0.7rem;
}

.rhythm-btn {
  padding: 9px 20px;
  border-radius: 50px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  transition: var(--transition);
}

.rhythm-btn-primary {
  background: linear-gradient(135deg, #E8864A, #C4855A);
  color: #fff;
  box-shadow: 0 6px 20px rgba(232, 134, 74, 0.4);
}

.rhythm-btn-ghost {
  border: 1.5px solid rgba(232, 196, 154, 0.4);
  color: #E8C49A;
}

.rhythm-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

@media (prefers-reduced-motion: reduce) {

  .rhythm-launch-emoji,
  .rhythm-rank {
    animation: none !important;
  }

  .rhythm-panel,
  .rhythm-overlay {
    transition: none;
  }
}

@media (max-width: 560px) {
  .rhythm-panel {
    padding: 10px 10px 12px;
  }

  .rhythm-rank {
    font-size: 3.2rem;
  }

  .rhythm-result-row {
    gap: 0.9rem;
    font-size: 0.75rem;
  }
}
