/* =============================================
   Renk Kodlama Zeka Oyunu – renk-kodlama.css
   Mastermind-style colour-code puzzle
   ============================================= */

/* ---------- Page Layout ---------- */
.rk-page {
  min-height: 100vh;
  background: var(--bg, #0d0d1a);
  color: var(--text, #f0f0f0);
  font-family: 'Poppins', sans-serif;
}

/* ---------- Header ---------- */
.rk-header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

.rk-back {
  display: inline-block;
  color: var(--accent, #f472b6);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  transition: opacity 0.2s;
}
.rk-back:hover { opacity: 0.7; }

.rk-title {
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  font-weight: 700;
  background: linear-gradient(135deg, #f472b6, #fb923c, #facc15);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 0.25rem;
}

.rk-subtitle {
  font-size: 0.95rem;
  opacity: 0.7;
  margin: 0;
}

/* ---------- Main ---------- */
.rk-main {
  max-width: 520px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

.rk-game-wrap {
  position: relative;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 1.5rem;
  padding: 1.5rem;
  overflow: hidden;
}

/* ---------- Stats Bar ---------- */
.rk-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 1.25rem;
}

.rk-stat {
  text-align: center;
}

.rk-stat-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.6;
  margin-bottom: 0.15rem;
}

.rk-stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #f472b6;
}

/* ---------- Board (past guesses) ---------- */
.rk-board {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  min-height: 20px;
}

.rk-board-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: rkRowIn 0.3s ease-out;
}

@keyframes rkRowIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rk-board-pegs {
  display: flex;
  gap: 0.4rem;
  flex: 1;
}

/* ---------- Peg (colour dot) ---------- */
.rk-peg {
  box-sizing: border-box;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
  transition: transform 0.15s;
  box-shadow: 0 0 8px rgba(0,0,0,0.3);
}

.rk-peg.empty {
  background: rgba(255,255,255,0.06);
  border-style: dashed;
}

/* Geçmiş tahmin: kalın koyu kenar + beyaz iç hat (yeşil/sarı top ile aynı renkte kaybolmaz) */
.rk-peg--exact {
  border: 5px solid #064e3b;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.95),
    0 0 0 2px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(34, 197, 94, 0.9),
    0 0 10px rgba(0, 0, 0, 0.45);
}

.rk-peg--partial {
  border: 5px solid #9a3412;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.95),
    0 0 0 2px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(251, 191, 36, 0.85),
    0 0 10px rgba(0, 0, 0, 0.45);
}

/* ---------- Feedback dots (legacy) ---------- */
.rk-feedback {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  width: 44px;
  flex-shrink: 0;
}

.rk-fb-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
}

.rk-fb-dot.correct {
  background: #22c55e;
  border-color: #16a34a;
  box-shadow: 0 0 6px rgba(34,197,94,0.6);
}

.rk-fb-dot.misplaced {
  background: #facc15;
  border-color: #ca8a04;
  box-shadow: 0 0 6px rgba(250,204,21,0.6);
}

/* ---------- Current Guess Row ---------- */
.rk-current-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  background: rgba(244, 114, 182, 0.08);
  border: 1px solid rgba(244, 114, 182, 0.2);
  border-radius: 0.75rem;
  padding: 0.6rem 0.75rem;
}

.rk-peg-slot--guess {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.15s;
  position: relative;
}

.rk-peg-slot--guess:hover {
  border-color: rgba(244, 114, 182, 0.6);
  transform: scale(1.08);
}

.rk-peg-slot--guess.filled {
  border-style: solid;
  border-color: rgba(255,255,255,0.3);
}

.rk-peg-slot--guess.selected-slot {
  box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.7);
  border-color: #f472b6;
}

/* ---------- Color Palette ---------- */
.rk-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.rk-color-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.rk-color-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.rk-color-btn.active {
  border-color: #fff;
  transform: scale(1.15);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.4);
}

/* ---------- Actions ---------- */
.rk-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* ---------- Buttons ---------- */
.rk-btn {
  padding: 0.6rem 1.4rem;
  border: none;
  border-radius: 2rem;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.rk-btn:hover:not(:disabled) {
  transform: scale(1.04);
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
}

.rk-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.rk-btn-start {
  background: linear-gradient(135deg, #f472b6, #fb923c);
  color: #fff;
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

.rk-btn-guess {
  background: linear-gradient(135deg, #f472b6, #facc15);
  color: #111;
  margin-left: auto;
  white-space: nowrap;
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
}

.rk-btn-secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text, #f0f0f0);
  border: 1px solid rgba(255,255,255,0.12);
}

.rk-btn-secondary:hover:not(:disabled) {
  background: rgba(255,255,255,0.14);
}

/* ---------- Overlay ---------- */
.rk-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13,13,26,0.92);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1.5rem;
  z-index: 10;
}

.rk-overlay.hidden {
  display: none;
}

.rk-overlay-box {
  text-align: center;
  padding: 2rem;
  max-width: 360px;
}

.rk-overlay-icon {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
  animation: rkIconFloat 2s ease-in-out infinite alternate;
}

@keyframes rkIconFloat {
  from { transform: translateY(0) rotate(-5deg); }
  to   { transform: translateY(-10px) rotate(5deg); }
}

.rk-overlay-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  background: linear-gradient(135deg, #f472b6, #fb923c, #facc15);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.rk-overlay-desc {
  font-size: 0.88rem;
  opacity: 0.78;
  line-height: 1.65;
  margin: 0 0 1rem;
}

/* Secret code revealed on game over */
.rk-overlay-secret {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.rk-overlay-secret .rk-peg {
  width: 32px;
  height: 32px;
}

/* ---------- How to Play ---------- */
.rk-how {
  margin-top: 1.25rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 1rem;
  overflow: hidden;
}

.rk-how summary {
  padding: 0.9rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rk-how summary::before {
  content: '▶';
  font-size: 0.65rem;
  transition: transform 0.2s;
  opacity: 0.7;
}

.rk-how[open] summary::before {
  transform: rotate(90deg);
}

.rk-how-inner {
  padding: 0 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rk-how-inner p {
  font-size: 0.85rem;
  opacity: 0.75;
  line-height: 1.6;
  margin: 0;
  padding-left: 1rem;
  border-left: 3px solid rgba(244, 114, 182, 0.4);
}

/* ---------- Win/Loss flashes ---------- */
@keyframes rkWinPulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
  70%  { box-shadow: 0 0 0 16px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.rk-peg.win-flash {
  animation: rkWinPulse 0.6s ease-out;
}

/* ---------- Responsive ---------- */
@media (max-width: 420px) {
  .rk-game-wrap { padding: 1rem; }
  .rk-peg { width: 30px; height: 30px; }
  .rk-peg-slot--guess { width: 34px; height: 34px; }
  .rk-color-btn { width: 38px; height: 38px; }
  .rk-feedback { width: 36px; }
  .rk-fb-dot { width: 13px; height: 13px; }
}
