/* ==========================================
   MATEMATİK DÜELLO
   testçöz.com
   ========================================== */

:root {
  /* Takım Renkleri */
  --blue-team: #1976D2;
  --blue-team-dark: #1565C0;
  --blue-team-light: #42A5F5;
  --blue-team-bg: #E3F2FD;

  --red-team: #D32F2F;
  --red-team-dark: #C62828;
  --red-team-light: #EF5350;
  --red-team-bg: #FFEBEE;

  /* Aksan */
  --primary: #FF9800;
  --primary-dark: #F57C00;
  --primary-darker: #E65100;

  /* Durum */
  --success: #43A047;
  --success-dark: #2E7D32;
  --danger: #E53935;
  --danger-dark: #C62828;

  /* Arka Plan */
  --bg-body: #f0f3f7;
  --bg-card: #ffffff;
  --bg-subtle: #f5f5f5;

  /* Yazı */
  --text-primary: #212121;
  --text-secondary: #757575;
  --text-muted: #9e9e9e;

  /* Gölge */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.18);

  /* Köşe */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Geçiş */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Oyun Tahtası */
  --board-max-width: 1280px;
  --board-max-height: 640px;
  --board-gap: clamp(10px, 1.6vw, 20px);

  /* Tipografi */
  --panel-title-size: clamp(13px, 1.4vw, 16px);
  --equation-size: clamp(1.3rem, 3.2vh, 2.2rem);
  --btn-size: clamp(56px, 9vh, 85px);
  --btn-font: clamp(1.4rem, 3vh, 2.2rem);
}


/* ===== RESET ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  height: 100svh;
  display: grid;
  place-items: center;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-tap-highlight-color: transparent;
}


/* ===== OYUN KABUK ===== */
.game-shell {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(8px, 1.5vw, 16px);
  overflow: hidden;
}

.game-stage {
  --game-scale: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transform: scale(var(--game-scale));
  transform-origin: center;
  transition: transform 0.25s ease;
  will-change: transform;
}

.game-board {
  width: var(--board-max-width);
  max-width: 100%;
  height: var(--board-max-height);
  max-height: 100%;
  display: grid;
  gap: var(--board-gap);
  align-items: stretch;
  grid-template-columns: 0.9fr 1.2fr 0.9fr;
  grid-template-areas: 'left arena right';
  position: relative;
}


/* ===== ÜST & ALT BANNER ===== */
.site-header-bar,
.site-footer-bar {
  width: 100%;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 12px;
  letter-spacing: 0.3px;
  z-index: 10;
  flex-shrink: 0;
}

.site-header-bar a,
.site-footer-bar a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.site-header-bar a:hover,
.site-footer-bar a:hover {
  color: var(--blue-team);
}

.site-header-bar strong {
  color: var(--blue-team);
  font-weight: 700;
}


/* ===== OYUNCU PANELLERİ ===== */
.player-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel-left {
  grid-area: left;
  border-top: 4px solid var(--blue-team);
}

.panel-right {
  grid-area: right;
  border-top: 4px solid var(--red-team);
}

.panel-header {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: var(--panel-title-size);
  flex: 0 0 auto;
}

.panel-left .panel-header {
  background: linear-gradient(135deg, var(--blue-team), var(--blue-team-dark));
  color: #fff;
}

.panel-right .panel-header {
  background: linear-gradient(135deg, var(--red-team), var(--red-team-dark));
  color: #fff;
}

.panel-mascot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6em;
  height: 1.6em;
  flex-shrink: 0;
}

.panel-mascot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.panel-header h3 {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: inherit;
}

.score-badge {
  background: #fff;
  color: var(--blue-team);
  padding: 3px 10px;
  border-radius: 18px;
  font-size: clamp(16px, 2.2vh, 20px);
  font-weight: 900;
  min-width: 36px;
  text-align: center;
  flex: 0 0 auto;
}

.panel-right .score-badge {
  color: var(--red-team);
}


/* Panel Gövde */
.panel-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2vh, 20px);
  padding: clamp(10px, 2vh, 20px) 14px;
}


/* Denklem Kutusu */
.equation-box {
  width: 100%;
  max-width: 260px;
  padding: clamp(10px, 2vh, 18px) 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  text-align: center;
  border: 2px solid #e0e0e0;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.06);
  transition: var(--transition);
  min-height: clamp(52px, 8vh, 80px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-left .equation-box {
  background: var(--blue-team-bg);
  border-color: rgba(25, 118, 210, 0.15);
}

.panel-right .equation-box {
  background: var(--red-team-bg);
  border-color: rgba(230, 74, 25, 0.15);
}

.equation-text {
  font-size: var(--equation-size);
  font-weight: 900;
  color: var(--text-primary);
  white-space: nowrap;
}

.equation-box.flash-correct {
  background: rgba(67, 160, 71, 0.2) !important;
  border-color: var(--success) !important;
  transform: scale(1.03);
}

.equation-box.flash-wrong {
  background: rgba(229, 57, 53, 0.2) !important;
  border-color: var(--danger) !important;
  animation: shakeBox 0.4s;
}

.equation-box.waiting {
  opacity: 0.45;
}

@keyframes shakeBox {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}


/* Aksiyon Butonları */
.action-buttons {
  display: flex;
  gap: clamp(16px, 3vw, 28px);
}

.action-btn {
  width: var(--btn-size);
  height: var(--btn-size);
  border-radius: 50%;
  border: 4px solid;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: var(--btn-font);
  font-weight: 900;
  transition: all 0.15s;
}

.action-btn:active {
  transform: scale(0.9);
}

.action-btn.btn-true {
  background: linear-gradient(180deg, #66BB6A, #43A047);
  border-color: #2E7D32;
  box-shadow: 0 5px 0 #1B5E20, 0 7px 16px rgba(0,0,0,0.25);
  color: #fff;
}

.action-btn.btn-true:active {
  box-shadow: 0 2px 0 #1B5E20;
  transform: translateY(3px) scale(0.95);
}

.action-btn.btn-false {
  background: linear-gradient(180deg, #EF5350, #E53935);
  border-color: #C62828;
  box-shadow: 0 5px 0 #B71C1C, 0 7px 16px rgba(0,0,0,0.25);
  color: #fff;
}

.action-btn.btn-false:active {
  box-shadow: 0 2px 0 #B71C1C;
  transform: translateY(3px) scale(0.95);
}

.action-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}


/* Klavye İpucu */
.key-hint {
  flex: 0 0 auto;
  padding: 6px 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  background: var(--bg-subtle);
}


/* ===== ARENA KONTEYNER ===== */
.arena-container {
  grid-area: arena;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.arena-scoreboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
  border-radius: var(--radius-md);
  font-size: 12px;
  flex: 0 0 auto;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-weight: 700;
  min-width: 55px;
}

.score-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 700;
  white-space: nowrap;
}

.score-value {
  font-size: clamp(16px, 2.5vh, 22px);
  font-weight: 900;
}

.score-value.blue { color: var(--blue-team); }
.score-value.red { color: var(--red-team); }

.round-timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.round-info {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-secondary);
}

.timer-display {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: clamp(14px, 2vh, 18px);
  font-weight: 900;
  color: var(--blue-team-dark);
  background: var(--bg-card);
  padding: 3px 10px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.timer-display.urgent {
  color: var(--danger);
  animation: timerPulse 0.5s infinite;
}

@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.timer-icon {
  font-size: 12px;
}


/* ===== YARIŞ PİSTİ ===== */
.race-track {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  background: url('img/pist2.png') center/100% 100% no-repeat;
  border-radius: var(--radius-md);
  margin-top: 6px;
}

.finish-line,
.start-line {
  display: none;
}

.track-inner {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

.track-line {
  display: none;
}

.track-character {
  position: absolute;
  transition: bottom 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 3;
}

.track-character img {
  width: clamp(70px, 12vh, 110px);
  height: auto;
  display: block;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.5));
}

.track-character.char-p1 {
  left: 36%;
  transform: translateX(-50%);
}

.track-character.char-p2 {
  left: 64%;
  transform: translateX(-50%);
}

.track-character.bounce img {
  animation: charBounce 0.5s ease;
}

@keyframes charBounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.35); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.track-step {
  display: none;
}


/* Arena Mesaj */
.arena-msg {
  position: absolute;
  bottom: 8%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: clamp(13px, 1.8vh, 17px);
  font-weight: 900;
  z-index: 4;
  pointer-events: none;
  min-height: 18px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6), 0 0 10px rgba(0,0,0,0.3);
}


/* ===== KONFETİ ===== */
.confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  top: -10px;
  pointer-events: none;
  z-index: 6;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  to {
    transform: translateY(500px) rotate(720deg);
    opacity: 0;
  }
}


/* ===== KAZANAN OVERLAY ===== */
.winner-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
  border-radius: var(--radius-md);
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.winner-content {
  text-align: center;
  color: #fff;
  padding: 10px 16px;
  max-height: 100%;
  overflow-y: auto;
}

.winner-trophy {
  width: clamp(60px, 10vh, 90px);
  height: clamp(60px, 10vh, 90px);
  margin: 0 auto 4px;
  animation: trophyDrop 0.7s ease-out;
  font-size: clamp(40px, 7vh, 64px);
  line-height: 1;
}

@keyframes trophyDrop {
  0% { transform: scale(0) rotate(-180deg); }
  60% { transform: scale(1.15) rotate(10deg); }
  100% { transform: scale(1) rotate(0); }
}

.winner-title {
  font-size: clamp(16px, 2.8vh, 26px);
  font-weight: 900;
  margin-bottom: 2px;
}

.winner-message {
  font-size: clamp(11px, 1.6vh, 14px);
  color: rgba(255,255,255,0.7);
  margin-bottom: 10px;
}

.winner-stats {
  display: flex;
  gap: clamp(10px, 2vw, 22px);
  justify-content: center;
  margin-bottom: 10px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.stat-icon {
  width: clamp(28px, 4vh, 40px);
  height: clamp(28px, 4vh, 40px);
}

.stat-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.label-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  vertical-align: middle;
}

.stat-val {
  font-size: clamp(18px, 3vh, 26px);
  font-weight: 900;
}

.stat-label {
  font-size: 10px;
  color: rgba(255,255,255,0.6);
}

.winner-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
  margin-bottom: 8px;
}

.btn-replay {
  padding: 8px 24px;
  font-size: clamp(13px, 1.8vh, 16px);
  font-weight: 800;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.btn-replay:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-replay:active {
  transform: translateY(0);
}

.winner-share {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}

.share-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.share-btn:hover {
  transform: translateY(-2px);
}

.share-copy { background: #546E7A; color: #fff; }
.share-whatsapp { background: #25D366; color: #fff; }
.share-twitter { background: #000; color: #fff; }

.winner-brand {
  display: inline-block;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  text-decoration: none;
}

.winner-brand:hover {
  color: rgba(255,255,255,0.7);
}


/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-overlay[style*="display: none"] {
  pointer-events: none;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(640px, 92vw);
  max-height: min(94svh, 780px);
  overflow-y: auto;
  padding: clamp(18px, 2.5vw, 28px) clamp(16px, 2.5vw, 24px);
  animation: slideUp 0.35s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}


/* Maskotlar */
.modal-mascots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vw, 32px);
  margin-bottom: 12px;
}

.mascot-char {
  width: clamp(56px, 10vw, 80px);
  height: clamp(56px, 10vw, 80px);
  animation: mascotBounce 2s infinite;
}

.mascot-char img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mascot-char.tiger {
  animation-delay: 0.3s;
}

@keyframes mascotBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.mascot-vs {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  color: var(--primary);
  text-shadow: 2px 2px 0 rgba(0,0,0,0.1);
  animation: vsPulse 1.5s infinite;
}

@keyframes vsPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}


.modal-title {
  text-align: center;
  font-size: clamp(22px, 2.8vw, 30px);
  font-weight: 900;
  background: linear-gradient(135deg, var(--blue-team), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 2px;
}

.modal-subtitle {
  text-align: center;
  font-size: clamp(13px, 1.6vw, 16px);
  color: var(--text-secondary);
  margin-bottom: 12px;
}


/* Ayar Grupları */
.setting-group {
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.setting-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.grade-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.grade-btn {
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}

.grade-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.grade-btn.active {
  border-color: var(--primary);
  background: rgba(255, 152, 0, 0.1);
  box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.15);
}

.grade-num {
  display: block;
  font-size: 1.4em;
  font-weight: 900;
  color: var(--text-primary);
}

.grade-btn.active .grade-num {
  color: var(--primary-dark);
}

.grade-text {
  display: block;
  font-size: 0.7em;
  font-weight: 600;
  color: var(--text-muted);
}

.rounds-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.rounds-btn {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}

.rounds-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.rounds-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.2);
}

.rounds-num {
  display: block;
  font-size: 1.8em;
  font-weight: 900;
}

.rounds-text {
  display: block;
  font-size: 0.7em;
  font-weight: 600;
  opacity: 0.6;
}


/* Nasıl Oynanır */
.how-to-play {
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 12px;
}

.how-to-play h3 {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.how-to-play p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 3px;
}

.how-to-play .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.how-to-play strong {
  color: var(--success);
}


/* Başla Butonu */
.start-btn {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 12px;
  padding: 14px 24px;
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 900;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 6px 0 var(--primary-darker), var(--shadow-md);
  transition: var(--transition);
  letter-spacing: 1px;
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--primary-darker), var(--shadow-lg);
}

.start-btn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 var(--primary-darker);
}

.modal-brand {
  text-align: center;
}

.modal-brand a {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.modal-brand a:hover {
  color: var(--primary);
}


/* ===== GERİ SAYIM ===== */
.countdown-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 998;
  font-size: clamp(60px, 12vw, 100px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 24px rgba(25, 118, 210, 0.8);
  animation: cdPop 0.5s ease-out;
}

.countdown-overlay.go {
  color: var(--success);
  text-shadow: 0 0 24px rgba(67, 160, 71, 0.8);
}

@keyframes cdPop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}


/* ===== ANA SAYFA + KONTROL BUTONLARI ===== */
.home-btn {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1001;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  color: var(--blue-team-dark);
  cursor: pointer;
  transition: var(--transition);
}

.home-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.home-btn:active {
  transform: translateY(0);
}

.view-controls {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 1001;
}

.view-btn {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.92);
  color: var(--blue-team-dark);
  box-shadow: var(--shadow-md);
  display: grid;
  place-items: center;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}

.view-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.view-btn:active {
  transform: translateY(0);
}


/* ===== RESPONSIVE ===== */

@media (max-width: 820px) {
  :root {
    --board-max-height: 100%;
  }

  .game-board {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 0.7fr 1.3fr;
    grid-template-areas:
      'arena arena'
      'left right';
  }

  .player-panel {
    height: 100%;
  }

  .panel-body {
    gap: clamp(8px, 1.5vh, 14px);
    padding: 8px 10px;
  }

  .arena-scoreboard {
    font-size: 11px;
  }

  .score-item {
    min-width: 45px;
  }

  .race-track {
    margin-top: 6px;
  }
}

@media (max-height: 420px) {
  .panel-header {
    padding: 6px 10px;
  }

  .panel-body {
    gap: 8px;
    padding: 6px 10px;
  }

  .equation-box {
    padding: 8px 12px;
    min-height: 40px;
  }

  .arena-scoreboard {
    padding: 5px 8px;
  }
}

@media (max-height: 620px) {
  .modal-content {
    max-height: 90svh;
    overflow-y: auto;
  }
}

/* Dikey telefon düzeni */
@media (max-width: 600px) and (orientation: portrait) {
  .game-shell {
    padding: 0 4px;
  }

  .game-board {
    grid-template-rows: 1fr auto;
    gap: 6px;
  }

  .arena-container {
    padding: 6px 8px;
    border-radius: var(--radius-sm);
  }

  .arena-scoreboard {
    padding: 5px 8px;
  }

  .score-item {
    min-width: 46px;
    gap: 1px;
  }

  .score-label {
    font-size: 10px;
  }

  .timer-display {
    padding: 3px 10px;
    font-size: 13px;
  }

  .player-panel {
    border-radius: var(--radius-sm);
    height: 100%;
  }

  .panel-header {
    padding: 5px 8px;
  }

  .score-badge {
    padding: 2px 7px;
    font-size: 13px;
    min-width: 28px;
  }

  .panel-body {
    gap: 8px;
    padding: 6px 8px;
  }

  .equation-box {
    max-width: 100%;
    padding: 8px 10px;
    min-height: 40px;
  }

  .equation-text {
    font-size: clamp(1rem, 4vw, 1.5rem);
  }

  .action-buttons {
    gap: 14px;
  }

  .key-hint {
    font-size: 9px;
    padding: 4px 6px;
  }

  .home-btn {
    padding: 5px 8px;
    border-radius: 8px;
    top: 4px;
    left: 4px;
  }

  .home-btn svg {
    width: 14px;
    height: 14px;
  }

  .view-controls {
    bottom: 4px;
    left: 4px;
  }

  .view-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
  }

  .site-header-bar,
  .site-footer-bar {
    font-size: 11px;
    padding: 4px 8px;
  }

  .track-character img {
    width: clamp(50px, 9vh, 80px);
  }
}

/* Dokunmatik cihazlar */
@media (hover: none) and (pointer: coarse) {
  .action-btn:hover,
  .grade-btn:hover,
  .rounds-btn:hover,
  .start-btn:hover,
  .btn-replay:hover,
  .share-btn:hover {
    transform: none;
    box-shadow: inherit;
  }

  .action-btn:active {
    transform: scale(0.9);
  }

  .start-btn:active,
  .btn-replay:active {
    transform: translateY(2px);
  }
}

/* Mobil portrait - kazanan overlay tam ekran */
@media (max-width: 600px) and (orientation: portrait) {
  .winner-overlay {
    position: fixed;
    inset: 0;
    border-radius: 0;
    z-index: 9990;
  }
  .winner-content {
    padding: 20px 16px;
  }
  .winner-trophy {
    font-size: 52px;
    margin-bottom: 8px;
  }
  .winner-title {
    font-size: clamp(22px, 5vw, 30px);
  }
  .winner-stats {
    margin-bottom: 16px;
  }
}

/* Diğer Oyunlar butonu */
.btn-other-games {
  padding: 10px 28px;
  font-size: clamp(14px, 2vh, 18px);
  font-weight: 700;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 2px solid rgba(255,255,255,0.5);
  cursor: pointer;
  color: #fff;
  background: rgba(255,255,255,0.12);
  text-decoration: none;
  transition: var(--transition);
  display: inline-block;
}
.btn-other-games:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.8);
  color: #fff;
}
