:root {
  --bg: #fdf6ec;
  --ink: #43356b;
  --muted: #8a7bb0;
  --teal: #2bb3a3;
  --teal-dark: #1f8d80;
  --orange: #ff8a3d;
  --orange-dark: #e8752c;
  --green: #4aa870;
  --green-dark: #38875a;
  --red: #dd5566;
  --red-dark: #b64252;
  --yellow: #ffc93c;
  --card-shadow: #e3d8c7;
  --track: #ece2d2;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body {
  font-family: 'Baloo 2', 'Trebuchet MS', sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
  overflow-x: hidden; /* eğik kartların köşeleri dar ekranda yatay kaydırma yaratmasın */
}

.screen {
  min-height: 100dvh;
  max-width: 620px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 24px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  position: relative;
}

.hidden { display: none !important; }

/* ---------- ortak parçalar ---------- */

.btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 0.5px;
  border: none;
  border-radius: 20px;
  min-height: 68px;
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  color: var(--ink);
}
.btn:active { transform: translateY(3px); }

.btn-primary {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 6px 0 var(--teal-dark);
  min-height: 76px;
  font-size: 27px;
}
.btn-primary:active { box-shadow: 0 3px 0 var(--teal-dark); }

.btn-outline {
  background: #fff;
  border: 3px solid #d9cdf0;
  box-shadow: none;
}

.install-btn {
  min-height: 52px;
  font-size: 16px;
  width: 100%;
  max-width: 440px;
  color: var(--muted);
}

.btn-amber { background: #fff3d6; box-shadow: 0 5px 0 #ecd9a8; color: #a6740c; }
.btn-amber:active { box-shadow: 0 2px 0 #ecd9a8; }
.btn-sky { background: #eaf3ff; box-shadow: 0 5px 0 #c3d9f2; color: #3c5a80; }
.btn-sky:active { box-shadow: 0 2px 0 #c3d9f2; }
.btn-outline .hint { font-size: 14px; font-weight: 700; color: var(--muted); }
.btn.small { min-height: 52px; font-size: 18px; padding: 0 18px; }
.btn.wide { width: 100%; max-width: 440px; }

.icon-btn {
  width: 54px;
  height: 54px;
  border: none;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 4px 0 var(--card-shadow);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--card-shadow); }
.icon-btn.corner { position: absolute; top: max(20px, env(safe-area-inset-top)); right: 20px; z-index: 5; }

.screen-title { font-size: 38px; font-weight: 800; margin: 0; text-align: center; }

/* ---------- giriş ---------- */

.deco { position: absolute; pointer-events: none; animation: floaty 3.5s ease-in-out infinite; font-family: inherit; }
.deco-1 { top: 7%; left: 8%; animation-duration: 3.2s; }
.deco-2 { top: 14%; right: 12%; animation-delay: 0.6s; animation-duration: 3.8s; }
.deco-3 { bottom: 17%; left: 11%; animation-delay: 0.9s; animation-duration: 4s; }
.deco-4 { bottom: 9%; right: 14%; animation-delay: 1.4s; animation-duration: 3.4s; }
.deco-5 { top: 32%; left: 6%; animation-delay: 1.1s; animation-duration: 4.4s; }
.deco-6 { top: 41%; right: 6%; animation-delay: 0.3s; }
.deco text { font-family: 'Baloo 2', 'Trebuchet MS', sans-serif; }

.hero { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.mascot-bob { animation: bob 2.6s ease-in-out infinite; }
.hero h1 { font-size: clamp(38px, 9vw, 54px); font-weight: 800; margin: 0; line-height: 1.05; }
.hero h1 span { color: var(--orange); }
.subtitle { font-size: 19px; font-weight: 600; color: var(--muted); margin: 0; }

.card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 26px;
  box-shadow: 0 10px 24px rgba(67, 53, 107, 0.12);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card-label { font-size: 20px; font-weight: 700; }
.entry-card { transform: rotate(-1deg); }

.name-error { font-size: 16px; font-weight: 700; color: var(--red-dark); }

/* bu cihazda daha önce oynayanlar — tek dokunuşla seçim */
.saved-names { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 4px; }
.saved-names-label { width: 100%; font-size: 15px; font-weight: 700; color: var(--muted); }
.saved-name-chip { position: relative; display: inline-flex; max-width: 100%; }
.chip-pick {
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  background: #f1edff;
  border: 2px solid #d8cfff;
  border-radius: 999px;
  padding: 7px 16px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.chip-pick:active { transform: scale(0.96); background: #e4ddff; }
.chip-x {
  position: absolute;
  top: -7px;
  right: -5px;
  width: 21px;
  height: 21px;
  padding: 0;
  border-radius: 50%;
  background: #dd5566;
  color: #fff;
  border: 2px solid #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.chip-x:active { transform: scale(0.9); }

.streak-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff3d6;
  border-radius: 14px;
  padding: 8px 14px;
  font-size: 16px;
  font-weight: 800;
  color: #d97a1b;
}

.champion-card {
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff3d6;
  border: 3px solid var(--yellow);
  border-radius: 22px;
  padding: 11px 18px;
  transform: rotate(-0.5deg);
}
.champion-card .cc-title { font-size: 13px; font-weight: 700; color: #a6740c; letter-spacing: 1px; }
.champion-card .cc-name { font-size: 20px; font-weight: 800; color: var(--ink); }

.greet-row { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.greet-text { font-size: 24px; font-weight: 700; flex: 1; min-width: 0; }
.greet-text b { color: var(--orange); }
.change-name {
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 10px;
}

.btn-row { display: flex; gap: 12px; }
.btn-row .btn { flex: 1; min-height: 60px; font-size: 17px; padding: 0 10px; border-radius: 18px; gap: 8px; }

#nameInput {
  font-family: inherit;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  height: 64px;
  border: 3px solid #e8dff5;
  border-radius: 18px;
  background: #faf7ff;
  padding: 0 20px;
  outline: none;
  width: 100%;
  -webkit-user-select: text;
  user-select: text;
}
#nameInput:focus { border-color: var(--teal); }

.mini-board {
  width: 100%;
  max-width: 440px;
  background: #fff3d6;
  border: none;
  border-radius: 22px;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: rotate(0.8deg);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.mini-board:active { transform: rotate(0.8deg) translateY(2px); }
.mini-board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mini-board-head .mini-board-title { flex: 1; min-width: 0; }
.see-all { display: flex; align-items: center; gap: 2px; font-size: 15px; font-weight: 700; color: #d99a1b; white-space: nowrap; }
.mini-board-title { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 700; color: #a6740c; }
.mini-list { display: flex; flex-direction: column; gap: 6px; }
.mini-row { display: flex; justify-content: space-between; font-size: 18px; font-weight: 600; }
.mini-row b { font-weight: 800; }
.mini-empty { font-size: 16px; font-weight: 600; color: #a6740c; }

/* ---------- pratik seçimi ---------- */

.table-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 440px;
}
.table-btn {
  font-family: inherit;
  font-size: 30px;
  font-weight: 800;
  color: var(--ink);
  background: #fff;
  border: none;
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--card-shadow);
  aspect-ratio: 1;
  cursor: pointer;
}
.table-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--card-shadow); }

/* ---------- oyun ---------- */

#screen-game { justify-content: flex-start; gap: 16px; }

.topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 16px;
  padding: 8px 16px;
}
.timer-pill { background: #fff; box-shadow: 0 4px 12px rgba(67, 53, 107, 0.1); font-size: 26px; font-weight: 800; }
.timer-pill.low { color: var(--red-dark); }
.score-pill { position: relative; background: var(--ink); color: #fff; font-size: 26px; font-weight: 800; }
.score-label { font-size: 15px; font-weight: 700; color: #b7a8e0; letter-spacing: 2px; }

#floatLayer { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.float-note {
  position: absolute;
  top: -4px;
  right: 8px;
  font-size: 38px;
  font-weight: 800;
  text-shadow: 0 2px 0 #fff;
  pointer-events: none;
}
.float-plus { color: var(--green); animation: floatUp 1s ease-out forwards; }
.float-bonus { color: var(--orange); animation: floatUp 1.3s ease-out forwards; }
.float-minus { color: var(--red); animation: dropShake 1.1s ease-in forwards; }

@keyframes floatUp {
  0% { opacity: 0; transform: translateY(6px) scale(0.7); }
  18% { opacity: 1; transform: translateY(-14px) scale(1.15); }
  65% { opacity: 1; transform: translateY(-44px) scale(1); }
  100% { opacity: 0; transform: translateY(-78px) scale(0.95); }
}
@keyframes dropShake {
  0% { opacity: 0; transform: translateY(-16px) rotate(0deg); }
  15% { opacity: 1; transform: translateY(4px) rotate(-6deg); }
  40% { opacity: 1; transform: translateY(20px) rotate(5deg); }
  65% { opacity: 1; transform: translateY(36px) rotate(-4deg); }
  100% { opacity: 0; transform: translateY(64px) rotate(2deg); }
}

.progress-track { position: relative; width: 100%; height: 16px; border-radius: 8px; background: var(--track); }
.progress-fill { height: 100%; border-radius: 8px; background: var(--teal); width: 100%; transition: width 0.95s linear, background-color 0.3s; }
.progress-fill.low { background: var(--red); }
#progressStar {
  position: absolute;
  top: -9px;
  left: 100%;
  transform: translateX(-50%) rotate(-10deg);
  transition: left 0.95s linear;
  pointer-events: none;
}

.game-middle {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
}
.streak-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff3d6;
  border-radius: 999px;
  padding: 5px 18px 5px 10px;
  font-size: 18px;
  font-weight: 800;
  color: #d97a1b;
}
.question-card {
  position: relative;
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 12px 28px rgba(67, 53, 107, 0.12);
  padding: 8vh 5vw;
  min-width: 70%;
  text-align: center;
  transform: rotate(-1.5deg);
}
.q-star { position: absolute; pointer-events: none; }
.q-star-1 { top: -14px; right: 26px; transform: rotate(18deg); }
.q-star-2 { bottom: -8px; left: 34px; transform: rotate(-14deg); opacity: 0.7; }

.cheer-pill {
  visibility: hidden;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 999px;
  padding: 5px 20px 5px 8px;
  box-shadow: 0 4px 12px rgba(67, 53, 107, 0.1);
  font-size: 17px;
  font-weight: 800;
  color: var(--muted);
}
.cheer-pill.show { visibility: visible; }
#questionText { font-size: clamp(52px, 13vw, 92px); font-weight: 800; line-height: 1; white-space: nowrap; }

.answers { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.answer-btn {
  font-family: inherit;
  min-height: 86px;
  border: none;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 6px 0 var(--card-shadow);
  font-size: 40px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  position: relative;
}
.answer-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--card-shadow); }
.answer-btn:disabled { cursor: default; }
.answer-btn[data-i="0"] { background: #eaf3ff; box-shadow: 0 6px 0 #c3d9f2; }
.answer-btn[data-i="1"] { background: #fff3d6; box-shadow: 0 6px 0 #eeda9f; }
.answer-btn[data-i="2"] { background: #ffe9ee; box-shadow: 0 6px 0 #f0c6d2; }
.answer-btn.correct { background: var(--green); box-shadow: 0 6px 0 var(--green-dark); color: #fff; animation: popIn 0.5s ease-out; }
.answer-btn.wrong { background: var(--red); box-shadow: 0 6px 0 var(--red-dark); color: #fff; animation: wiggle 0.6s ease-in-out; }
.answer-btn.reveal { background: var(--green); box-shadow: 0 6px 0 var(--green-dark); color: #fff; animation: blinkGreen 0.45s ease-in-out 4; }
.answer-btn .tag {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 2px 12px;
}

@keyframes popIn { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes wiggle {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
@keyframes blinkGreen {
  0%, 100% { filter: none; }
  50% { filter: brightness(1.18); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-9px) rotate(3deg); }
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes spinRays {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes confDrift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(18deg); }
}

/* ---------- tur sonu ---------- */

.end-title-row { display: flex; align-items: flex-end; gap: 12px; }
.end-title-row .screen-title { padding-bottom: 10px; }

.score-circle-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.rays {
  position: absolute;
  top: 110px;
  left: 50%;
  width: 340px;
  height: 340px;
  margin: -170px 0 0 -170px;
  animation: spinRays 24s linear infinite;
  opacity: 0.5;
  pointer-events: none;
}
.drift { position: absolute; width: 13px; height: 20px; border-radius: 4px; animation: confDrift 3.5s ease-in-out infinite; pointer-events: none; }
.d1 { top: 8%; left: 12%; background: var(--teal); animation-duration: 3s; }
.d2 { top: 13%; right: 15%; background: var(--red); animation-delay: 0.5s; animation-duration: 3.6s; }
.d3 { top: 24%; left: 22%; background: var(--orange); animation-delay: 0.9s; animation-duration: 3.3s; }
.d4 { top: 20%; right: 9%; width: 14px; height: 14px; border-radius: 50%; background: var(--yellow); animation-delay: 0.2s; animation-duration: 4s; }
.d5 { bottom: 20%; left: 10%; background: var(--muted); animation-delay: 1.2s; animation-duration: 3.8s; }
.d6 { bottom: 13%; right: 12%; background: var(--teal); animation-delay: 0.7s; }
.score-circle {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: #fff;
  border: 11px solid var(--yellow);
  box-shadow: 0 14px 30px rgba(67, 53, 107, 0.14);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.end-score { font-size: 72px; font-weight: 800; line-height: 1; }
.end-score-label { font-size: 20px; font-weight: 700; color: var(--muted); letter-spacing: 3px; }
.record-ribbon {
  position: relative;
  transform: rotate(-2deg);
  margin-top: -20px;
  background: var(--orange);
  border-radius: 14px;
  padding: 8px 22px;
  box-shadow: 0 4px 0 var(--orange-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 21px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1px;
}

.stats-row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.stat { display: flex; align-items: center; gap: 10px; border-radius: 18px; padding: 12px 22px; font-size: 22px; font-weight: 700; }
.stat-good { background: #e4f6ea; color: var(--green-dark); transform: rotate(-1deg); }
.stat-bad { background: #fde5e9; color: var(--red-dark); transform: rotate(1deg); }

.save-status { font-size: 16px; font-weight: 600; color: var(--muted); min-height: 22px; }
.end-buttons { display: flex; flex-direction: column; gap: 14px; width: 100%; align-items: center; }

/* ---------- puan tablosu ---------- */

#screen-board { justify-content: flex-start; }
.board-header { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.board-title { display: flex; align-items: center; justify-content: center; flex: 1; min-width: 0; gap: 10px; font-size: 32px; font-weight: 800; }
.board-spacer { width: 54px; }

.tabs { width: 100%; display: flex; gap: 10px; background: var(--track); border-radius: 18px; padding: 7px; }
.tab {
  flex: 1;
  font-family: inherit;
  font-size: 19px;
  font-weight: 700;
  color: #7a6f96;
  border: none;
  border-radius: 12px;
  background: transparent;
  min-height: 50px;
  cursor: pointer;
}
.tab.active { background: var(--ink); color: #fff; font-weight: 800; }

.board-list { width: 100%; flex: 1; display: flex; flex-direction: column; gap: 11px; overflow-y: auto; padding-top: 10px; }
.rank-wrap { position: relative; flex-shrink: 0; }
.rank-wrap .badge-top { position: absolute; pointer-events: none; }
.rank-wrap .crown { top: -17px; left: 6px; transform: rotate(8deg); }
.rank-wrap .medal-2 { top: -17px; left: 6px; transform: rotate(8deg); }
.rank-wrap .medal-3 { top: -17px; left: 6px; transform: rotate(-8deg); }
.board-row {
  display: flex;
  align-items: center;
  gap: 15px;
  background: #fff;
  border-radius: 20px;
  padding: 12px 18px;
  box-shadow: 0 4px 12px rgba(67, 53, 107, 0.08);
}
.board-row .rank {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #f1ece2;
  color: #8a8375;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  font-weight: 800;
  flex-shrink: 0;
}
.board-row.r1 { background: #fff3d6; border: 3px solid var(--yellow); transform: rotate(-0.6deg); }
.board-row.r1 .rank { background: var(--yellow); color: #7a5a00; }
.board-row.r2 { background: #f4f6fa; border: 3px solid #d6d9e0; transform: rotate(0.4deg); }
.board-row.r2 .rank { background: #d6d9e0; color: #5c6270; }
.board-row.r3 { background: #fbf1e6; border: 3px solid #e8b98c; transform: rotate(-0.3deg); }
.board-row.r3 .rank { background: #e8b98c; color: #7a4a12; }
.board-row.me { background: #e9f8f5; border: 3px solid var(--teal); }
.board-row.me .rank { background: var(--teal); color: #fff; }
.board-row.me .name { color: var(--teal-dark); }
.board-row .name { flex: 1; font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.board-row .you-tag { font-size: 14px; font-weight: 700; color: #fff; background: var(--teal); border-radius: 9px; padding: 1px 10px; }
.board-row .best { font-size: 24px; font-weight: 800; }
.board-empty { text-align: center; font-size: 18px; font-weight: 600; color: var(--muted); padding: 30px 0; }

/* ---------- profil karakterleri ---------- */

.av { display: block; }
.av svg { display: block; width: 100%; height: 100%; }

.avatar-btn {
  position: relative;
  width: 52px;
  height: 52px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.edit-badge {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--orange);
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.avatar-btn:active { transform: scale(0.94); }
.avatar-btn .av { width: 52px; height: 52px; }

#screen-avatar { justify-content: flex-start; }
.avatar-status-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.rename-form { display: flex; gap: 10px; width: 100%; max-width: 440px; }
.rename-form input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  height: 56px;
  border: 3px solid #e8dff5;
  border-radius: 16px;
  background: #faf7ff;
  padding: 0 16px;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}
.rename-form input:focus { border-color: var(--teal); }
.rename-form .btn { min-height: 56px; font-size: 18px; }
.avatar-status {
  align-self: center;
  background: #fff3d6;
  border-radius: 999px;
  padding: 6px 20px;
  font-size: 16px;
  font-weight: 700;
  color: #a6740c;
  min-height: 20px;
}
.avatar-grid {
  width: 100%;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
  overflow-y: auto;
}
.avatar-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.avatar-pick {
  position: relative;
  width: 92px;
  height: 92px;
  border: 4px solid transparent;
  border-radius: 50%;
  padding: 3px;
  background: none;
  cursor: pointer;
  box-sizing: content-box;
}
.avatar-pick:active { transform: scale(0.94); }
.avatar-pick.selected { border-color: var(--teal); }
.avatar-pick .av { width: 92px; height: 92px; }
.sel-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-locked { position: relative; padding: 7px; }
.avatar-locked .av { width: 92px; height: 92px; filter: grayscale(1); opacity: 0.45; }
.lock-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-name { font-size: 16px; font-weight: 700; }
.avatar-name.on { color: var(--teal-dark); font-weight: 800; }
.avatar-cond { font-size: 13px; font-weight: 700; color: var(--muted); }

.unlock-banner {
  display: none;
  align-items: center;
  gap: 14px;
  background: #fff3d6;
  border: 3px solid var(--yellow);
  border-radius: 20px;
  padding: 12px 20px;
  max-width: 440px;
}
.unlock-banner.show { display: flex; }
.unlock-banner .av { width: 62px; height: 62px; flex-shrink: 0; }
.unlock-banner b { font-size: 19px; color: #a6740c; }
.unlock-banner .sub { font-size: 15px; font-weight: 600; color: #a6740c; }

.row-av { width: 40px; height: 40px; flex-shrink: 0; }
.row-av svg { width: 100%; height: 100%; display: block; }
.mini-av { width: 26px; height: 26px; display: inline-block; vertical-align: middle; }
.mini-av svg { width: 100%; height: 100%; display: block; }
.mini-row .mini-left { display: flex; align-items: center; gap: 8px; }

/* ---------- dar ekran (telefon) ---------- */

@media (max-width: 430px) {
  .screen { padding-left: 14px; padding-right: 14px; }
  .hero h1 { font-size: 32px; }
  .deco-2 { display: none; } /* dar ekranda başlığın üstüne biniyor */
  .mini-board-title { font-size: 16px; }
  .btn-row .btn { font-size: 14px; gap: 6px; padding: 0 6px; }
  .greet-text { font-size: 20px; }
  .timer-pill { font-size: 22px; padding: 8px 12px; }
  .score-pill { font-size: 22px; padding: 8px 14px; }
  .float-note { font-size: 32px; }
  .question-card { padding: 6vh 4vw; }
  #questionText { font-size: clamp(42px, 14vw, 80px); }
  .answer-btn { min-height: 74px; font-size: 34px; }
  .score-circle { width: 185px; height: 185px; border-width: 9px; }
  .end-score { font-size: 60px; }
  .rays { width: 290px; height: 290px; margin: -145px 0 0 -145px; top: 95px; }
  .board-title { font-size: 25px; }
  .tab { font-size: 16px; }
  .avatar-pick, .avatar-pick .av, .avatar-locked .av { width: 82px; height: 82px; }
  .stat { font-size: 18px; padding: 10px 16px; }
  .cheer-pill { font-size: 15px; }
  .streak-pill { font-size: 15px; }
}

/* ---------- istatistikler ---------- */

#screen-stats { justify-content: flex-start; }
.stats-content { width: 100%; flex: 1; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; }
.stats-section {
  background: #fff;
  border-radius: 22px;
  padding: 20px 22px;
  box-shadow: 0 4px 12px rgba(67, 53, 107, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stats-section h3 { margin: 0; font-size: 21px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.stats-note { font-size: 15px; font-weight: 600; color: var(--muted); }
.table-stat { display: flex; align-items: center; gap: 12px; }
.table-stat .t-label { width: 62px; font-size: 19px; font-weight: 800; flex-shrink: 0; }
.table-stat .t-track { flex: 1; height: 20px; border-radius: 10px; background: var(--track); overflow: hidden; }
.table-stat .t-fill { height: 100%; border-radius: 10px; }
.table-stat .t-fill.good { background: var(--green); }
.table-stat .t-fill.mid { background: var(--orange); }
.table-stat .t-fill.bad { background: var(--red); }
.table-stat .t-pct { width: 88px; text-align: right; font-size: 16px; font-weight: 700; color: var(--muted); flex-shrink: 0; }
.round-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #faf7ff;
  border-radius: 14px;
  padding: 9px 16px;
}
.round-row .r-date { font-size: 14px; font-weight: 600; color: var(--muted); flex-shrink: 0; }
.round-row .r-dy { font-size: 15px; font-weight: 600; color: var(--muted); }
.round-row .r-ok { color: var(--green-dark); font-weight: 700; }
.round-row .r-no { color: var(--red-dark); font-weight: 700; }
.round-row .r-score { font-size: 19px; font-weight: 800; flex-shrink: 0; }

.fact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fde5e9;
  border-radius: 16px;
  padding: 10px 18px;
}
.fact-row .fact { font-size: 22px; font-weight: 800; color: var(--red-dark); }
.fact-row .fact-count { font-size: 16px; font-weight: 700; color: var(--red-dark); }
.stats-empty { text-align: center; font-size: 18px; font-weight: 600; color: var(--muted); padding: 30px 0; }
.badge-row { display: flex; flex-wrap: wrap; gap: 10px; }
.badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #e4f6ea;
  color: var(--green-dark);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 18px;
  font-weight: 800;
}

/* ---------- konfeti ---------- */

#confettiLayer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti {
  position: absolute;
  top: -16px;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(560deg); opacity: 0.8; }
}

/* ---------- sınıf seçimi ---------- */

.grade-row { display: flex; gap: 8px; }
.grade-btn {
  flex: 1;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: var(--muted);
  background: #f1edff;
  border: 3px solid transparent;
  border-radius: 14px;
  min-height: 44px;
  cursor: pointer;
  white-space: nowrap;
  padding: 0 4px;
}
.grade-btn:active { transform: translateY(2px); }
.grade-btn.selected { background: var(--ink); color: #fff; border-color: var(--ink); }

/* her oyunun giriş ekranında ana sayfaya dönüş linki bulunur (platform kuralı) */
.back-link {
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
}

/* sınıf artık ana sayfadaki profilden seçilir; burada bilgi satırı olarak görünür */
.grade-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  background: #f1edff;
  border-radius: 12px;
  padding: 8px 14px;
}
.grade-line b { color: var(--teal-dark); }
.grade-edit-link { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--muted); text-decoration: none; }

/* zorluk seviyesi düğmeleri (sınıf düğmeleriyle aynı kalıp, seçimde kendi rengi) */
.lvl-hint { font-size: 14px; font-weight: 700; color: var(--muted); }
.lvl-btn.lvl-1.selected { background: var(--green); border-color: var(--green); }
.lvl-btn.lvl-2.selected { background: var(--orange); border-color: var(--orange); }
.lvl-btn.lvl-3.selected { background: var(--red); border-color: var(--red); }

/* soru kartındaki puan rozeti: +2 / +3 / +5 */
.q-pts {
  position: absolute;
  top: -14px;
  left: 22px;
  border-radius: 999px;
  padding: 3px 14px;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  transform: rotate(-6deg);
}
.q-pts-2 { background: var(--green); box-shadow: 0 3px 0 var(--green-dark); }
.q-pts-3 { background: var(--orange); box-shadow: 0 3px 0 var(--orange-dark); }
.q-pts-5 { background: var(--red); box-shadow: 0 3px 0 var(--red-dark); }

/* ---------- işlem seçimi (dört işlem) ---------- */

.op-pick-label { margin-top: 2px; }
.op-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.op-card {
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  border: 3px solid transparent;
  border-radius: 18px;
  cursor: pointer;
  color: var(--ink);
}
.op-card:active { transform: translateY(2px); }
.op-card .op-sym { font-size: 30px; font-weight: 800; line-height: 1; }
.op-card .op-name { font-size: 18px; font-weight: 700; }
.op-mul { background: #e9f8f5; }
.op-mul .op-sym { color: var(--teal-dark); }
.op-add { background: #e4f6ea; }
.op-add .op-sym { color: var(--green-dark); }
.op-sub { background: #fff3d6; }
.op-sub .op-sym { color: #a6740c; }
.op-div { background: #f3eafe; }
.op-div .op-sym { color: #7c5fc0; }
.op-card.selected { border-color: var(--ink); box-shadow: 0 4px 0 var(--card-shadow); }

/* Müfredatta henüz olmayan işlem: soluk kart + "2. sınıfta açılır" notu */
.op-card .op-lock-note { display: none; font-size: 12px; font-weight: 700; color: var(--muted); }
.op-card.locked { flex-direction: column; gap: 2px; opacity: 0.55; cursor: default; filter: grayscale(0.6); }
.op-card.locked:active { transform: none; }
.op-card.locked .op-lock-note { display: block; }

/* puan tablosunda işlem ve sınıf sekmeleri */
.op-tabs { margin-bottom: -8px; }
.op-tabs .tab { font-size: 26px; font-weight: 800; min-height: 46px; }
.grade-tabs { margin-bottom: -8px; }
.grade-tabs .tab { font-size: 15px; min-height: 40px; white-space: nowrap; padding: 0 2px; }

/* istatistiklerde işlem satırları */
.round-row .r-op { font-size: 20px; font-weight: 800; width: 22px; text-align: center; flex-shrink: 0; color: var(--muted); }
.table-stat .op-label { width: 108px; font-size: 17px; }

@media (max-width: 430px) {
  .op-card { min-height: 50px; gap: 8px; }
  .op-card .op-sym { font-size: 25px; }
  .op-card .op-name { font-size: 15px; }
  .table-stat .op-label { width: 96px; font-size: 15px; }
}

/* yatay iPad: soru ve cevaplar yanyana sığmasa da dikey düzen korunur, sadece boşluklar kısılır */
@media (max-height: 620px) {
  .question-card { padding: 4vh 5vw; }
  .answer-btn { min-height: 66px; font-size: 32px; }
  .screen { gap: 12px; }
}
