/* 
  SnakeMath - PS5 Theme
  Landscape Layout with Dark Mode
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-primary: #000000;
  --bg-secondary: #0d0d0d;
  --bg-card: #1a1a1a;
  --ps-blue: #0070d1;
  --ps-blue-glow: rgba(0, 112, 209, 0.4);
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --success: #00d26a;
  --success-glow: rgba(0, 210, 106, 0.4);
  --error: #ff3b3b;
  --error-glow: rgba(255, 59, 59, 0.4);
  --border-radius: 12px;
  --transition: all 0.2s ease;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Landing page needs scroll */
body.landing-page,
body.landing-page html {
  overflow-y: auto !important;
  overflow-x: hidden;
  height: auto;
}

html:has(body.landing-page) {
  overflow-y: auto !important;
  overflow-x: hidden;
}

/* ==================== */
/* Rotate Warning */
/* ==================== */

#rotate-warning {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.rotate-content {
  text-align: center;
  padding: 40px;
}

.rotate-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: rotatePhone 2s ease-in-out infinite;
}

.rotate-arrow {
  font-size: 3rem;
  color: var(--ps-blue);
  margin-bottom: 20px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes rotatePhone {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-20deg); }
  75% { transform: rotate(20deg); }
}

#rotate-warning h2 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

#rotate-warning p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 280px;
  margin: 0 auto;
}

/* Hide rotate warning - we now support portrait mode */
#rotate-warning {
  display: none !important;
}

/* ==================== */
/* Main Game Layout */
/* ==================== */

#game-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  background: linear-gradient(180deg, #000000 0%, #0a0a0a 100%);
  padding: 20px 16px;
  box-sizing: border-box;
  overflow: hidden;
}

.game-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  min-height: 0;
  position: relative;
}

/* ==================== */
/* Control Panels */
/* ==================== */

.control-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  min-width: 180px;
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.control-panel.left-panel {
  display: none;
}

/* Portrait controls - hidden by default (landscape) */
.control-panel.portrait-controls {
  display: none;
  position: relative;
  right: auto;
  top: auto;
  transform: none;
}

/* D-Pad Container */
.dpad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.dpad-middle {
  display: flex;
  align-items: center;
  gap: 35px;
}

.dpad-center {
  width: 0;
  height: 60px;
  background: transparent;
}

.control-btn {
  width: 60px;
  height: 60px;
  background: var(--bg-card);
  border: 2px solid #2a2a2a;
  border-radius: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.control-btn:hover {
  background: var(--ps-blue);
  border-color: var(--ps-blue);
  box-shadow: 0 0 20px var(--ps-blue-glow);
  transform: scale(1.08);
}

.control-btn:active {
  transform: scale(0.92);
  box-shadow: 0 0 30px var(--ps-blue-glow);
}

.btn-icon {
  font-size: 1.3rem;
}

.btn-label {
  font-size: 0.6rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ==================== */
/* Game Center Area */
/* ==================== */

.game-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
  overflow: visible;
}

/* Header Stats Bar */
.header-bar {
  width: 100%;
  padding: 8px 0;
}

.stat-group {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.stat-item {
  background: var(--bg-card);
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid #2a2a2a;
  text-align: center;
  min-width: 70px;
}

.stat-item .stat-label {
  display: block;
  font-size: 0.6rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.stat-item .stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-item .stat-value.score {
  color: var(--ps-blue);
}

.stat-item .stat-value.high-score {
  color: #ffd700;
}

/* Canvas Container */
.canvas-container {
  position: relative;
  width: 600px;
  max-width: 100%;
  margin: 0 auto;
}

#gameCanvas {
  display: block;
  background: var(--bg-secondary);
  border: 2px solid #2a2a2a;
  border-radius: var(--border-radius);
  box-shadow: 0 0 20px var(--ps-blue-glow);
  /* Fixed size for game logic - DO NOT change without updating JS */
  width: 600px;
  height: 400px;
  max-width: 100%;
  max-height: calc(100vh - 240px);
  object-fit: contain;
  margin: 0 auto;
}

/* Question Bar - same width as canvas */
.question-bar {
  width: 600px;
  max-width: 100%;
  box-sizing: border-box;
}

#question {
  background: var(--bg-card);
  padding: 12px 24px;
  border-radius: var(--border-radius);
  font-size: 1.1rem;
  font-weight: 600;
  border: 1px solid #2a2a2a;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

#question .highlight {
  color: var(--ps-blue);
}

/* Action Bar */
.action-bar {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.action-btn {
  padding: 10px 24px;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
  border: none;
}

.action-btn.primary {
  background: var(--ps-blue);
  color: var(--text-primary);
  box-shadow: 0 4px 16px var(--ps-blue-glow);
}

.action-btn.primary:hover {
  background: #0080e8;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px var(--ps-blue-glow);
}

.action-btn.secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid #2a2a2a;
}

.action-btn.secondary:hover {
  border-color: var(--ps-blue);
  box-shadow: 0 0 12px var(--ps-blue-glow);
}

/* Footer */
.game-footer {
  text-align: center;
  padding: 8px;
  border-top: 1px solid #1a1a1a;
}

.game-footer p {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.game-footer a {
  color: var(--ps-blue);
  text-decoration: none;
  transition: var(--transition);
}

.game-footer a:hover {
  color: #00a2ff;
}

/* ==================== */
/* Responsive Adjustments */
/* ==================== */

/* Small landscape screens */
@media screen and (max-height: 500px) {
  .game-section {
    padding: 5px;
    gap: 8px;
  }
  
  .game-center {
    gap: 4px;
  }
  
  #gameCanvas {
    max-height: calc(100vh - 160px);
    width: auto;
    height: auto;
  }
  
  .question-bar {
    width: auto;
    max-width: 100%;
  }
  
  .control-btn {
    width: 48px;
    height: 48px;
  }
  
  .control-panel {
    padding: 8px;
    min-width: 140px;
    right: 10px;
  }
  
  .btn-icon {
    font-size: 1.1rem;
  }
  
  .btn-label {
    display: none;
  }
  
  .stat-item {
    padding: 3px 8px;
    min-width: 50px;
  }
  
  .stat-item .stat-label {
    font-size: 0.45rem;
  }
  
  .stat-item .stat-value {
    font-size: 0.8rem;
  }
  
  .header-bar {
    padding: 2px 0;
  }
  
  .stat-group {
    gap: 6px;
  }
  
  #question {
    padding: 6px 12px;
    font-size: 0.85rem;
  }
  
  .question-bar {
    max-width: 100%;
  }
  
  .action-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
  }
  
  .action-bar {
    gap: 8px;
  }
  
  .game-footer {
    display: none;
  }
  
  .dpad-container {
    gap: 4px;
  }
  
  .dpad-middle {
    gap: 28px;
  }
  
  .dpad-center {
    width: 0;
    height: 42px;
  }
}

/* Very small height */
@media screen and (max-height: 400px) {
  #game-wrapper {
    padding: 10px 8px;
  }
  
  #gameCanvas {
    max-height: calc(100vh - 130px);
    width: auto;
    height: auto;
  }
  
  .question-bar {
    width: auto;
  }
  
  .control-btn {
    width: 42px;
    height: 42px;
  }
  
  .control-panel {
    padding: 5px;
    min-width: 120px;
    right: 8px;
  }
  
  .btn-icon {
    font-size: 1rem;
  }
  
  .dpad-container {
    gap: 3px;
  }
  
  .dpad-middle {
    gap: 26px;
  }
  
  .dpad-center {
    width: 0;
    height: 38px;
  }
  
  .stat-item {
    padding: 2px 6px;
    min-width: 45px;
  }
  
  .stat-item .stat-label {
    font-size: 0.4rem;
  }
  
  .stat-item .stat-value {
    font-size: 0.7rem;
  }
  
  #question {
    padding: 4px 10px;
    font-size: 0.75rem;
  }
  
  .action-bar {
    gap: 6px;
  }
  
  .action-btn {
    padding: 5px 10px;
    font-size: 0.7rem;
  }
}

/* Extra small height - very compact mobile landscape */
@media screen and (max-height: 350px) {
  .game-section {
    padding: 2px;
    gap: 5px;
  }
  
  .game-center {
    gap: 2px;
  }
  
  .canvas-container {
    max-height: calc(100vh - 80px);
  }
  
  #gameCanvas {
    max-height: calc(100vh - 80px);
  }
  
  .header-bar {
    padding: 0;
  }
  
  .stat-group {
    gap: 4px;
  }
  
  .stat-item {
    padding: 2px 5px;
    min-width: 40px;
    border-radius: 6px;
  }
  
  .stat-item .stat-label {
    font-size: 0.35rem;
    margin-bottom: 0;
  }
  
  .stat-item .stat-value {
    font-size: 0.65rem;
  }
  
  .control-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }
  
  .control-panel {
    padding: 3px;
    min-width: 110px;
    right: 5px;
  }
  
  .btn-icon {
    font-size: 0.9rem;
  }
  
  .dpad-container {
    gap: 2px;
  }
  
  .dpad-middle {
    gap: 22px;
  }
  
  .dpad-center {
    width: 0;
    height: 34px;
  }
  
  #question {
    padding: 3px 8px;
    font-size: 0.7rem;
    border-radius: 8px;
  }
  
  .action-bar {
    gap: 4px;
  }
  
  .action-btn {
    padding: 4px 8px;
    font-size: 0.65rem;
    border-radius: 15px;
  }
}

/* Narrow width landscape (width < 700px) */
@media screen and (max-width: 700px) and (orientation: landscape) {
  .control-panel {
    padding: 5px;
    min-width: 100px;
    right: 5px;
  }
  
  .control-btn {
    width: 40px;
    height: 40px;
  }
  
  .btn-icon {
    font-size: 0.95rem;
  }
  
  .btn-label {
    display: none;
  }
  
  .dpad-container {
    gap: 3px;
  }
  
  .dpad-middle {
    gap: 22px;
  }
  
  .dpad-center {
    width: 0;
    height: 36px;
  }
}

/* Large screens */
@media screen and (min-width: 1200px) {
  .control-btn {
    width: 80px;
    height: 80px;
  }
  
  .dpad-container {
    gap: 10px;
  }
  
  .dpad-middle {
    gap: 40px;
  }
  
  .dpad-center {
    width: 0;
    height: 70px;
  }
  
  .btn-icon {
    font-size: 1.8rem;
  }
  
  .btn-label {
    font-size: 0.75rem;
  }
  
  .stat-item {
    padding: 12px 20px;
    min-width: 90px;
  }
  
  .stat-item .stat-value {
    font-size: 1.3rem;
  }
  
  #question {
    font-size: 1.3rem;
    padding: 16px 32px;
  }
}

/* Landing Page Styles */
section.main {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: linear-gradient(180deg, #000000 0%, #0a0a0a 100%);
  padding: 40px 20px;
  overflow-y: visible;
}

section.main .container {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-bottom: 40px;
}

section.main .col {
  background: var(--bg-card);
  padding: 32px;
  border-radius: 20px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
}

section.main h1 {
  font-size: 1.8rem;
  margin-bottom: 4px;
  background: linear-gradient(90deg, var(--ps-blue), #00a2ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

section.main h4 {
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

section.main h5 {
  color: var(--ps-blue);
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 20px;
  margin-bottom: 10px;
  text-align: left;
}

.cara-main {
  font-size: 0.85rem;
  margin-bottom: 6px;
  text-align: left;
  color: var(--text-secondary);
  line-height: 1.5;
}

.cara-main strong {
  color: var(--text-primary);
  font-weight: 600;
}

section.main #footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #2a2a2a;
  text-align: center;
}

section.main #footer p {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

section.main #footer a {
  color: var(--ps-blue);
  text-decoration: none;
}

#start-btn {
  display: block;
  margin: 24px auto 0;
  width: fit-content;
  background: var(--ps-blue);
  padding: 14px 32px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 16px var(--ps-blue-glow);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  text-decoration: none;
  text-align: center;
}

#start-btn:hover {
  background: #0080e8;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px var(--ps-blue-glow);
}

#start-btn:active {
  transform: translateY(0);
}

/* Food Glow Animation */
@keyframes foodGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Accuracy Colors */
.accuracy-good {
  color: var(--success) !important;
}

.accuracy-bad {
  color: var(--error) !important;
}

/* ==================== */
/* Game Over Modal - PS5 Style */
/* ==================== */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.show {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to { 
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-content {
  background: linear-gradient(145deg, #1a1a1a 0%, #0d0d0d 100%);
  border: 1px solid #2a2a2a;
  border-radius: 20px;
  padding: 32px 40px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  box-shadow: 
    0 0 40px rgba(0, 112, 209, 0.2),
    0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.4s ease;
}

.modal-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 16px;
  background: linear-gradient(90deg, var(--ps-blue), #00a2ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.high-score-badge {
  background: linear-gradient(90deg, #ffd700, #ffb347);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 20px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.02); }
}

.modal-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.modal-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: 10px;
  border: 1px solid #2a2a2a;
}

.modal-stat-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.modal-stat-value {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1rem;
}

.modal-stat:first-child .modal-stat-value {
  color: var(--ps-blue);
  font-size: 1.2rem;
}

.modal-button {
  background: var(--ps-blue);
  color: var(--text-primary);
  border: none;
  padding: 14px 40px;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px var(--ps-blue-glow);
  font-family: 'Inter', sans-serif;
}

.modal-button:hover {
  background: #0080e8;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px var(--ps-blue-glow);
}

.modal-button:active {
  transform: translateY(0);
}

/* Level Badge */
.level-badge {
  display: inline-block;
  background: var(--ps-blue);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 8px;
}

/* ==================== */
/* Homepage Responsive Styles */
/* ==================== */

/* Desktop - Large screens (1200px+) */
@media screen and (min-width: 1200px) {
  section.main .col {
    max-width: 520px;
    padding: 40px 48px;
  }
  
  section.main h1 {
    font-size: 2.2rem;
  }
  
  section.main h4 {
    font-size: 1rem;
    margin-bottom: 20px;
  }
  
  section.main h5 {
    font-size: 1rem;
    margin-top: 24px;
    margin-bottom: 12px;
  }
  
  .cara-main {
    font-size: 0.95rem;
    margin-bottom: 8px;
  }
  
  #start-btn {
    padding: 16px 40px;
    margin-top: 28px;
    font-size: 1.1rem;
  }
  
  section.main #footer {
    margin-top: 28px;
  }
  
  section.main #footer p {
    font-size: 0.8rem;
  }
}

/* Tablet - Medium screens (768px - 1199px) */
@media screen and (min-width: 768px) and (max-width: 1199px) {
  section.main .col {
    max-width: 480px;
    padding: 36px 40px;
  }
  
  section.main h1 {
    font-size: 2rem;
  }
  
  section.main h4 {
    font-size: 0.9rem;
    margin-bottom: 18px;
  }
  
  section.main h5 {
    font-size: 0.95rem;
    margin-top: 22px;
    margin-bottom: 10px;
  }
  
  .cara-main {
    font-size: 0.9rem;
    margin-bottom: 7px;
  }
  
  #start-btn {
    padding: 15px 36px;
    margin-top: 26px;
    font-size: 1.05rem;
  }
}

/* Mobile - Small screens (max 767px) */
@media screen and (max-width: 767px) {
  section.main {
    padding: 16px;
    align-items: flex-start;
    padding-top: 24px;
    padding-bottom: 24px;
    min-height: auto;
  }
  
  section.main .container {
    padding-bottom: 20px;
  }
  
  section.main .col {
    max-width: 100%;
    padding: 24px 20px;
    border-radius: 16px;
  }
  
  section.main h1 {
    font-size: 1.4rem;
  }
  
  section.main h4 {
    font-size: 0.8rem;
    margin-bottom: 14px;
  }
  
  section.main h5 {
    font-size: 0.85rem;
    margin-top: 16px;
    margin-bottom: 8px;
  }
  
  .cara-main {
    font-size: 0.8rem;
    margin-bottom: 5px;
    line-height: 1.4;
  }
  
  #start-btn {
    padding: 12px 28px;
    margin-top: 20px;
    width: 100%;
    font-size: 0.95rem;
  }
  
  section.main #footer {
    margin-top: 20px;
    padding-top: 12px;
  }
  
  section.main #footer p {
    font-size: 0.65rem;
  }
}

/* Extra Small Mobile (max 400px) */
@media screen and (max-width: 400px) {
  section.main {
    padding: 12px;
    padding-top: 16px;
    padding-bottom: 16px;
  }
  
  section.main .col {
    padding: 18px 14px;
  }
  
  section.main h1 {
    font-size: 1.2rem;
  }
  
  section.main h4 {
    font-size: 0.7rem;
  }
  
  section.main h5 {
    font-size: 0.75rem;
    margin-top: 12px;
    margin-bottom: 6px;
  }
  
  .cara-main {
    font-size: 0.7rem;
    margin-bottom: 4px;
    line-height: 1.35;
  }
  
  #start-btn {
    padding: 10px 20px;
    font-size: 0.85rem;
  }
  
  section.main #footer {
    margin-top: 16px;
    padding-top: 10px;
  }
  
  section.main #footer p {
    font-size: 0.6rem;
  }
}

/* ==================== */
/* Portrait Mode for Tablet/Mobile */
/* ==================== */

@media screen and (max-width: 900px) and (orientation: portrait) {
  #game-wrapper {
    display: flex !important;
    padding: 16px 12px;
    height: 100vh;
    overflow-y: auto;
  }
  
  .game-section {
    flex-direction: column;
    padding: 0;
    gap: 10px;
  }
  
  .game-center {
    width: 100%;
    gap: 8px;
  }
  
  /* Hide landscape controls, show portrait controls */
  .control-panel.landscape-controls {
    display: none !important;
  }
  
  .control-panel.portrait-controls {
    display: flex !important;
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    padding: 10px;
    min-width: auto;
    width: 100%;
    max-width: 250px;
    margin: 10px auto 0;
  }
  
  /* Scale canvas for portrait - maintain aspect ratio */
  .canvas-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
  }
  
  #gameCanvas {
    width: 100%;
    height: auto;
    max-height: none;
    aspect-ratio: 600 / 400;
  }
  
  /* Stats bar compact */
  .header-bar {
    padding: 4px 0;
  }
  
  .stat-group {
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .stat-item {
    padding: 4px 10px;
    min-width: 55px;
  }
  
  .stat-item .stat-label {
    font-size: 0.5rem;
  }
  
  .stat-item .stat-value {
    font-size: 0.85rem;
  }
  
  /* Question bar */
  .question-bar {
    width: 100%;
    max-width: 400px;
  }
  
  #question {
    padding: 10px 16px;
    font-size: 0.95rem;
  }
  
  /* Action buttons */
  .action-bar {
    gap: 10px;
  }
  
  .action-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }
  
  /* D-pad stays same layout but smaller */
  .control-btn {
    width: 55px;
    height: 55px;
  }
  
  .btn-icon {
    font-size: 1.2rem;
  }
  
  .btn-label {
    display: none;
  }
  
  .dpad-container {
    gap: 6px;
  }
  
  .dpad-middle {
    gap: 30px;
  }
  
  .dpad-center {
    width: 0;
    height: 50px;
  }
  
  /* Hide footer in portrait */
  .game-footer {
    display: none;
  }
}

/* Small portrait phones */
@media screen and (max-width: 400px) and (orientation: portrait) {
  #game-wrapper {
    padding: 10px 8px;
  }
  
  .canvas-container {
    max-width: 100%;
  }
  
  .question-bar {
    max-width: 100%;
  }
  
  .stat-item {
    padding: 3px 8px;
    min-width: 50px;
  }
  
  .stat-item .stat-label {
    font-size: 0.45rem;
  }
  
  .stat-item .stat-value {
    font-size: 0.75rem;
  }
  
  #question {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
  
  .control-btn {
    width: 48px;
    height: 48px;
  }
  
  .btn-icon {
    font-size: 1rem;
  }
  
  .dpad-container {
    gap: 4px;
  }
  
  .dpad-middle {
    gap: 26px;
  }
  
  .dpad-center {
    width: 0;
    height: 44px;
  }
  
  .action-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}
