/* Mini Oyun Arenası — canlı, "arcade" temalı: koyu mor/indigo zemin + neon
   teal/pembe/sarı vurgular. date=pembe pastel, ortak-hikaye=krem/kahve,
   yirmi-soru=lacivert/altın temalarından kasıtlı olarak ayrışıyor. */
:root {
  --bg-0: #120b24;
  --bg-1: #1e1440;
  --bg-2: #2a1c58;
  --card-bg: #251a45;
  --text: #f4f1ff;
  --text-dim: #b7abd9;
  --teal: #2dd4bf;
  --pink: #f472b6;
  --yellow: #fbbf24;
  --red: #f87171;
  --green: #4ade80;
  --radius: 20px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow-x: hidden; color-scheme: dark only; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(circle at 20% 0%, var(--bg-2), var(--bg-0) 60%);
  color: var(--text);
  overflow-x: hidden;
}

.hidden { display: none !important; }

.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: flex; flex-direction: column; }

/* ---------------- Intro ---------------- */
[data-screen="intro"] { align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.intro-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border-radius: 28px;
  padding: 2.2rem 1.75rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  text-align: center;
}
.intro-card h1 { font-size: 1.6rem; margin-bottom: 0.5rem; }
.cover-sub { font-size: 0.95rem; color: var(--text-dim); margin-bottom: 1.5rem; line-height: 1.4; }
#name-input {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1rem;
}
#name-input:focus { outline: 2px solid var(--teal); }
.primary-btn, #start-btn {
  width: 100%;
  padding: 0.9rem 1rem;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--teal), var(--pink));
  color: #120b24;
  font-weight: 700;
  font-size: 1.02rem;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.primary-btn:active, #start-btn:active { transform: scale(0.97); }
.primary-btn:disabled, #start-btn:disabled { opacity: 0.6; cursor: default; }
.secondary-btn {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 0.6rem;
}
.intro-status { margin-top: 1rem; font-size: 0.9rem; color: var(--text-dim); }
.intro-status.error { color: var(--red); }

/* ---------------- Game shell ---------------- */
[data-screen="game"] { padding: 0 0 2rem; }
.arena-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  position: sticky;
  top: 0;
  background: rgba(18, 11, 36, 0.85);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.icon-btn {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 1.1rem;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
}
.overall-score {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  flex: 1;
  justify-content: center;
}
.score-chip { padding: 0.35rem 0.7rem; border-radius: 999px; background: rgba(255, 255, 255, 0.07); }
.score-chip.mine { color: var(--teal); }
.score-chip.theirs { color: var(--pink); }
.score-vs { color: var(--text-dim); font-size: 0.75rem; }

/* ---------------- Arena menu ---------------- */
.arena-menu { padding: 1rem 1.1rem 2rem; }
.menu-title { text-align: center; font-size: 1.05rem; margin-bottom: 1rem; color: var(--text-dim); }
.game-cards { display: grid; grid-template-columns: 1fr; gap: 0.85rem; max-width: 480px; margin: 0 auto; }
@media (min-width: 560px) { .game-cards { grid-template-columns: 1fr 1fr; } }
.game-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, var(--card-bg), var(--bg-2));
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.game-card:active { transform: scale(0.97); }
.game-card:hover { box-shadow: 0 10px 24px rgba(45, 212, 191, 0.18); }
.game-card-emoji { font-size: 1.8rem; }
.game-card-name { font-weight: 700; font-size: 1.02rem; }
.game-card-desc { font-size: 0.82rem; color: var(--text-dim); line-height: 1.3; }

/* ---------------- Genel oyun görünümü ---------------- */
.game-view { padding: 0.5rem 1.1rem 2rem; display: flex; flex-direction: column; align-items: center; min-height: 60vh; }
.finish-actions { display: flex; flex-direction: column; gap: 0.6rem; width: 100%; max-width: 320px; margin: 1.2rem auto 0; }

/* ---------------- Oyun içi "Nasıl Oynanır?" açıklaması ---------------- */
.game-instructions {
  width: 100%;
  max-width: 480px;
  background: rgba(45, 212, 191, 0.07);
  border: 1px solid rgba(45, 212, 191, 0.25);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.2rem;
  text-align: left;
}
.game-instructions-title { font-weight: 700; margin-bottom: 0.35rem; }
.game-instructions p:not(.game-instructions-title) { font-size: 0.85rem; color: var(--text-dim); line-height: 1.45; }

/* ---------------- Meslek Avı ---------------- */
.ph-choose-view, .ph-playing-view, .ph-finished-view { width: 100%; max-width: 480px; text-align: center; }
.ph-choose-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
#ph-choose-search {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 0.7rem;
}
.ph-choose-waiting { color: var(--text-dim); margin-top: 1rem; }

.ph-boxes { display: flex; gap: 0.8rem; margin-bottom: 1rem; }
.ph-box {
  flex: 1;
  padding: 1.2rem 0.6rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.ph-box.active-turn { border-color: var(--yellow); box-shadow: 0 0 18px rgba(251, 191, 36, 0.35); }
.ph-box-icon { display: block; font-size: 2rem; margin-bottom: 0.3rem; }
.ph-box-label { font-size: 0.85rem; color: var(--text-dim); }
.ph-remaining-row { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 1rem; }
.ph-turn-title { font-weight: 700; margin-bottom: 0.7rem; }
.ph-turn-buttons { display: flex; gap: 0.7rem; }
.ph-turn-buttons button { flex: 1; }
.ph-picker { text-align: left; }
.ph-picker input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 0.7rem;
}
.ph-question-list, .ph-guess-list { max-height: 40vh; overflow-y: auto; display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.7rem; }
.ph-category-header { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); margin: 0.5rem 0 0.1rem; }
.ph-question-item, .ph-guess-item {
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}
.ph-question-item:active, .ph-guess-item:active { transform: scale(0.98); background: rgba(255, 255, 255, 0.1); }
.ph-waiting-turn { color: var(--text-dim); margin: 1rem 0; }
.ph-pending-question { background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.3); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.ph-pending-question-text { font-weight: 600; margin-bottom: 0.7rem; }
.ph-answer-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.ph-answer-btn {
  flex: 1;
  padding: 0.7rem 0.4rem;
  border-radius: 12px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.ph-answer-btn:active { transform: scale(0.95); }
.ph-history { text-align: left; display: flex; flex-direction: column-reverse; gap: 0.4rem; max-height: 30vh; overflow-y: auto; margin-top: 0.5rem; }
.ph-history-item { font-size: 0.82rem; color: var(--text-dim); padding: 0.4rem 0.6rem; border-radius: 10px; background: rgba(255, 255, 255, 0.03); }
.ph-history-item b { color: var(--text); }
.ph-finished-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 1.2rem; }
.ph-reveal-boxes { display: flex; gap: 0.8rem; margin-bottom: 0.5rem; }
.ph-reveal-box { flex: 1; padding: 1rem 0.7rem; border-radius: 16px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); }
.ph-reveal-label { display: block; font-size: 0.78rem; color: var(--text-dim); margin-bottom: 0.4rem; }
.ph-reveal-value { display: block; font-weight: 700; font-size: 0.95rem; }

/* ---------------- Gizli Oy Verme ---------------- */
.sv-progress-row {
  width: 100%;
  max-width: 460px;
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.8rem;
}
.sv-match-count { font-weight: 700; color: var(--yellow); }
.sv-question {
  width: 100%;
  max-width: 460px;
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.2rem;
  line-height: 1.35;
}
.sv-options {
  width: 100%;
  max-width: 460px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.sv-option {
  padding: 1.1rem 0.9rem;
  min-height: 5.5rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, var(--card-bg), var(--bg-2));
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.sv-option:active { transform: scale(0.95); }
.sv-option.selected { box-shadow: 0 0 0 3px var(--teal) inset; }
.sv-option:disabled { opacity: 0.55; cursor: default; }
.sv-waiting { margin-top: 1.2rem; color: var(--text-dim); font-size: 0.9rem; text-align: center; }
.sv-reveal { text-align: center; margin-top: 0.5rem; width: 100%; max-width: 460px; }
.sv-reveal-result { font-size: 1.3rem; font-weight: 800; margin-bottom: 1rem; }
.sv-reveal-choices { display: flex; gap: 0.8rem; }
.sv-reveal-choice {
  flex: 1;
  padding: 1rem 0.7rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.sv-reveal-choice.matched { border-color: var(--yellow); box-shadow: 0 0 20px rgba(251, 191, 36, 0.35); }
.sv-reveal-label { display: block; font-size: 0.78rem; color: var(--text-dim); margin-bottom: 0.4rem; }
.sv-reveal-value { display: block; font-weight: 700; font-size: 0.95rem; }
.sv-finished { text-align: center; margin-top: 1.5rem; }
.sv-finished-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.4rem; }
.sv-finished-detail { color: var(--text-dim); font-size: 0.95rem; }

/* ---------------- Gizli Eşleşme ---------------- */
.sm-progress { display: block; text-align: center; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 1rem; }
.sm-question {
  max-width: 460px;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  margin: 0 auto 1.4rem;
  line-height: 1.35;
}
.sm-options { width: 100%; max-width: 460px; display: flex; gap: 0.9rem; }
.sm-option {
  flex: 1;
  padding: 1.6rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, var(--card-bg), var(--bg-2));
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.sm-option:active { transform: scale(0.94); }
.sm-option.picked { box-shadow: 0 0 0 3px var(--yellow) inset; background: linear-gradient(135deg, #3d2f66, #2a1c58); }
.sm-waiting-view, .sm-reveal-view { text-align: center; width: 100%; max-width: 480px; }
.sm-chest-icon { font-size: 3.2rem; margin-bottom: 0.6rem; }
.sm-waiting-text { color: var(--text-dim); }
.sm-match-list { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.5rem; }
.sm-match-card {
  padding: 0.9rem 1.1rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  text-align: left;
}
.sm-match-card.matched { border-color: var(--yellow); box-shadow: 0 0 18px rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.08); }
.sm-match-q { font-size: 0.88rem; color: var(--text-dim); margin-bottom: 0.35rem; }
.sm-match-choices { display: flex; gap: 0.6rem; font-size: 0.85rem; font-weight: 600; flex-wrap: wrap; }
.sm-match-choices span { padding: 0.2rem 0.55rem; border-radius: 999px; background: rgba(255, 255, 255, 0.07); }
.sm-final { margin-top: 1.5rem; }
.sm-final-label { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 0.2rem; }
.sm-final-value { font-size: 3rem; font-weight: 800; background: linear-gradient(135deg, var(--teal), var(--yellow)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sm-final-note { color: var(--text-dim); font-size: 0.9rem; margin-top: 0.3rem; margin-bottom: 0.5rem; }
.sm-source-note { color: var(--text-dim); font-size: 0.78rem; text-align: center; margin-top: 0.9rem; opacity: 0.75; }

/* ---------------- Çizgi Çekme Savaşı ---------------- */
.arena-countdown { display: flex; align-items: center; justify-content: center; min-height: 40vh; }
.arena-countdown #tw-countdown-num {
  font-size: clamp(4rem, 22vw, 7rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--teal), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tw-playing { width: 100%; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; }
.tw-rope-track {
  position: relative;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), rgba(255, 255, 255, 0.08) 50%, var(--pink));
  margin: 2rem 0 0.5rem;
}
.tw-rope-fill { position: absolute; inset: 0; border-radius: 999px; pointer-events: none; }
.tw-rope-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  font-size: 1.8rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}
.tw-side-labels { display: flex; justify-content: space-between; width: 100%; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 2rem; }
.tw-tap-btn {
  width: 100%;
  max-width: 320px;
  padding: 2.4rem 1rem;
  border-radius: 28px;
  border: none;
  background: linear-gradient(135deg, var(--teal), var(--pink));
  color: #120b24;
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}
.tw-tap-btn:active { transform: scale(0.96); }
.tw-tap-count { margin-top: 1rem; color: var(--text-dim); font-size: 0.9rem; }
.tw-finished { text-align: center; margin-top: 2rem; }
.tw-finished-title { font-size: 1.6rem; font-weight: 800; }

/* ---------------- Link paylaşım overlay (ortak-hikaye/yirmi-soru ile aynı desen) ---------------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 20, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 50;
}
.overlay-card {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border-radius: 24px;
  padding: 1.8rem 1.5rem;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.overlay-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.3rem; }
.overlay-sub { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 1rem; }
.share-link-text {
  font-size: 0.78rem;
  word-break: break-all;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 0.7rem;
  margin-bottom: 1rem;
  color: var(--text-dim);
}
.copied-note { margin-top: 0.6rem; color: var(--green); font-size: 0.85rem; }

/* ---------------- Parçacık patlaması (date/ortak-hikaye/yirmi-soru ile aynı desen) ---------------- */
.burst-particle {
  position: fixed;
  pointer-events: none;
  z-index: 60;
  animation: burst-fly 1.1s ease-out forwards;
}
@keyframes burst-fly {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.4); opacity: 0; }
}

/* ---------------- Genel hata bildirimi ---------------- */
.error-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  max-width: min(90vw, 380px);
  background: #3a1414;
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecaca;
  padding: 0.75rem 1.1rem;
  border-radius: 14px;
  font-size: 0.85rem;
  text-align: center;
  z-index: 70;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.shake { animation: shake-anim 0.45s; }
@keyframes shake-anim {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
