/* Rotate device overlay for portrait mode on mobile */
.rotate-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: #0a1128;
  z-index: 99999;
  display: none;
  justify-content: center;
  align-items: center;
}

.rotate-content {
  text-align: center;
  padding: 2rem;
}

.rotate-content .rotate-icon {
  font-size: 80px;
  line-height: 1;
  margin-bottom: 10px;
  animation: tilt-phone 1.5s ease-in-out infinite;
}

.rotate-content .rotate-arrow {
  font-size: 50px;
  line-height: 1;
  color: #6cf0ff;
  margin-bottom: 20px;
}

.rotate-content h2 {
  font-size: 24px;
  font-weight: 700;
  color: #6cf0ff;
  margin: 0 0 10px 0;
}

.rotate-content p {
  font-size: 16px;
  color: #94a3b8;
  margin: 0;
}

@keyframes tilt-phone {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}

/* Show rotate overlay on mobile portrait */
@media screen and (max-width: 768px) and (orientation: portrait) {
  .rotate-overlay {
    display: flex !important;
  }
  
  .app {
    display: none !important;
  }
}

:root {
  --bg: #080b12;
  --panel: #0f1625;
  --panel-strong: #131b2d;
  --accent: #6cf0ff;
  --accent-2: #7dd3fc;
  --text: #e6edf3;
  --muted: #8b949e;
  --danger: #ff6b6b;
  --success: #3fb950;
  --shadow: 0 12px 30px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(circle at 20% 20%, rgba(108,240,255,0.06), transparent 28%),
    radial-gradient(circle at 80% 16%, rgba(125,211,252,0.08), transparent 24%),
    linear-gradient(135deg, #05070c 0%, #0a0f1c 40%, #0d1424 100%);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.logo { font-weight: 700; text-transform: uppercase; color: var(--text); }
.version { font-size: 0.9rem; }

.screen { 
  display: none;
  animation: screenFadeIn 0.3s ease-out;
}
.screen:not(.hidden) { display: block; }
.hidden { display: none; }

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

.card {
  background: linear-gradient(160deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}

/* Menu card ultra-compact */
.menu-card {
  text-align: center;
  max-width: 360px;
  margin: 0 auto;
}

.menu-card .actions {
  margin: 1.5rem 0 1rem;
}

.menu-card .btn-large {
  font-size: 1.25rem;
  padding: 1rem 3rem;
}

/* Éléments visibles après première partie */
.after-first-run {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.menu-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.75rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.link-btn:hover {
  color: var(--accent);
  background: rgba(108, 240, 255, 0.1);
}

/* Settings compact */
.settings-card {
  max-width: 320px;
  margin: 0 auto;
}

.settings-card h2 {
  text-align: center;
  margin-bottom: 1.5rem;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.setting-row label {
  flex: 1;
  font-size: 0.95rem;
}

.setting-row input[type="range"] {
  width: 100px;
}

h1, h2, h3 { margin-top: 0; }
.lead { color: var(--muted); }

/* Enhanced Menu Styles */
.game-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.game-logo {
  width: 80px;
  height: 80px;
  filter: drop-shadow(0 4px 12px rgba(108, 240, 255, 0.3));
  animation: float 3s ease-in-out infinite;
}

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

.game-header h1 {
  font-size: 2.5rem;
  margin: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 400;
  text-align: center;
  margin-bottom: 0;
  opacity: 0.7;
}

/* Stats ligne compacte */
.stats-line {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  font-size: 0.9rem;
}

.stat-inline {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
}

.stat-inline strong {
  color: var(--accent);
  font-size: 1.1rem;
}

/* Sélecteurs compacts */
.selectors-compact {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.select-compact {
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid rgba(108, 240, 255, 0.3);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
}

.select-compact:focus {
  border-color: var(--accent);
  outline: none;
}

/* Selection footer compact */
.selection-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  margin: 0.5rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.selection-footer .count-value {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
}

.keep-checkbox {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.keep-checkbox input {
  width: 16px;
  height: 16px;
}

.how-to-play {
  margin: 0.9rem 0 1rem;
}

.how-to-play-summary h3 {
  font-size: 1rem;
  margin: 0;
  color: var(--accent);
}

.how-to-play-body {
  padding: 0.75rem 0.9rem 0.9rem;
}

.help-line {
  margin: 0.4rem 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.controls-guide {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0.25rem 0.5rem;
  background: linear-gradient(135deg, rgba(108, 240, 255, 0.15), rgba(56, 189, 248, 0.15));
  border: 1px solid rgba(108, 240, 255, 0.3);
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(108, 240, 255, 0.1);
  flex-shrink: 0;
}

.control-desc {
  color: var(--text);
  font-size: 0.8125rem;
}

.how-tip {
  margin-top: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: rgba(251, 191, 36, 0.1);
  border-left: 3px solid rgba(251, 191, 36, 0.5);
  border-radius: 0.375rem;
  color: rgba(251, 191, 36, 0.95);
  font-size: 0.875rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin: 1rem 0;
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  padding: 0.75rem 0.6rem;
  text-align: center;
  transition: all 0.2s ease;
}

.stat-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(108, 240, 255, 0.3);
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.challenge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.challenge-header h3 {
  font-size: 1.125rem;
  margin: 0;
}

.challenge-progress {
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 600;
  background: rgba(108, 240, 255, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
}

.btn-large {
  font-size: 1.125rem;
  padding: 0.875rem 2rem;
  width: 100%;
}

.btn-medium {
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--accent);
  color: var(--accent);
}

.btn-medium:hover {
  background: rgba(108, 240, 255, 0.15);
}

.btn-icon {
  margin-right: 0.5rem;
}

/* Collapsible sections */
.collapsible {
  border: 1px solid rgba(108, 240, 255, 0.2);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.collapsible summary {
  cursor: pointer;
  list-style: none;
  -webkit-user-select: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem;
}

.collapsible summary::-webkit-details-marker {
  display: none;
}

.collapsible summary::after {
  content: '▼';
  font-size: 0.7rem;
  margin-left: auto;
  transition: transform 0.2s;
  opacity: 0.6;
}

.collapsible[open] summary::after {
  transform: rotate(180deg);
}

.secondary-actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin-top: 0.75rem;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.1rem;
}

.theme-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.theme-selector label {
  white-space: nowrap;
  font-size: 0.9rem;
}

.theme-selector select {
  flex: 1;
}

.character-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.character-selector label {
  white-space: nowrap;
  font-size: 0.9rem;
}

.character-selector select {
  flex: 1;
}

/* Theme Selector Highlight on Patch Select Screen */
.selectors-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 600px) {
  .selectors-row {
    flex-direction: row;
    gap: 1.5rem;
  }
  
  .selectors-row .theme-selector-highlight {
    flex: 1;
    margin-bottom: 0;
  }
}

.theme-selector-highlight {
  background: linear-gradient(135deg, rgba(108, 240, 255, 0.08), rgba(56, 189, 248, 0.08));
  border: 2px solid rgba(108, 240, 255, 0.3);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px rgba(108, 240, 255, 0.1);
  transition: all 0.3s ease;
}

.theme-selector-highlight:hover {
  border-color: rgba(108, 240, 255, 0.5);
  box-shadow: 0 6px 20px rgba(108, 240, 255, 0.2);
  transform: translateY(-2px);
}

.theme-selector-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--accent);
}

.theme-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.theme-label {
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.theme-select-large {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.5rem;
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-select-large:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(108, 240, 255, 0.4);
}

.theme-select-large:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 240, 255, 0.1);
}

.theme-select-large option {
  background: var(--bg-dark);
  color: var(--text);
  padding: 0.5rem;
}

/* Selection Screen Styles */
.select-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.select-subtitle {
  color: var(--muted);
  margin-top: 0.5rem;
}

.selection-info {
  margin-bottom: 1.5rem;
}

.info-badge {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: rgba(251, 191, 36, 0.95);
}

.badge-icon {
  font-size: 1.25rem;
}

.selection-footer {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0.5rem;
}

.selection-count {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.count-label {
  color: var(--muted);
}

.count-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.count-max {
  color: var(--muted);
}

/* Effects Screen Styles */
.effects-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.effects-subtitle {
  color: var(--muted);
  margin-top: 0.5rem;
}

.effects-legend {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.legend-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  border: 2px solid;
}

.legend-buff .legend-dot {
  border-color: rgba(63, 185, 80, 0.8);
  background: rgba(63, 185, 80, 0.3);
}

.legend-malus .legend-dot {
  border-color: rgba(255, 107, 107, 0.8);
  background: rgba(255, 107, 107, 0.3);
}

.legend-mixed .legend-dot {
  border-color: rgba(251, 191, 36, 0.8);
  background: rgba(251, 191, 36, 0.3);
}

.actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.25s ease-out, border-color 0.25s ease-out, background 0.25s ease-out, box-shadow 0.25s ease-out;
  font-weight: 600;
}
button:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 18px rgba(108,240,255,0.25); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

button.primary { 
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); 
  color: #041121; 
  border-color: transparent;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 20px rgba(108, 240, 255, 0.35);
}
button.primary:hover {
  box-shadow: 0 6px 28px rgba(108, 240, 255, 0.5);
  transform: translateY(-3px);
}

button.ghost { background: transparent; }
button.small { padding: 6px 12px; }

.patch-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 16px; }
.patch-list.mini { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 12px; }
.power-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 10px; background: rgba(108,240,255,0.12); border: 1px solid rgba(108,240,255,0.4); font-weight: 600; }
.power-timer { color: var(--muted); font-size: 0.9rem; }
.power-desc { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.effect-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.effect-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 14px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); }
.effect-chip .pill { margin: 0; }
.orb-legend { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 2px; }
.orb-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 12px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12); font-size: 0.95rem; }
.orb-dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,0.15); background: #fff; }
.current-orb { display: flex; align-items: center; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.current-orb .label { color: var(--muted); }
.run-effects-head { margin-top: 4px; color: var(--muted); font-weight: 600; }
.controls-hint { 
  margin: 8px 0; 
  padding: 0.625rem 0.875rem;
  background: rgba(108, 240, 255, 0.08);
  border: 1px solid rgba(108, 240, 255, 0.2);
  border-radius: 0.5rem;
  color: var(--text); 
  font-size: 0.9rem;
  text-align: center;
}
.jump-bar { display: flex; justify-content: center; margin: 12px 0 4px; }
.hint { margin: 8px 0; color: var(--muted); font-size: 0.95rem; }
.row { display: flex; align-items: center; gap: 8px; margin: 8px 0; color: var(--muted); }
.challenge-block { 
  margin-top: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.75rem;
  padding: 1rem;
  min-height: 3rem;
}

.challenge-title { font-weight: 700; color: var(--text); margin-bottom: 6px; }

.challenge-list { 
  list-style: none; 
  padding: 0; 
  margin: 0; 
  display: grid; 
  gap: 0.5rem;
  min-height: 2rem;
} 


.challenge-list li { 
  padding: 0.75rem 1rem; 
  border: 1px solid rgba(255,255,255,0.08); 
  border-radius: 0.5rem; 
  background: rgba(255,255,255,0.02); 
  display: flex; 
  align-items: center; 
  gap: 0.75rem;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.challenge-list li:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.15);
}

.challenge-list li.completed { 
  border-color: rgba(63, 185, 80, 0.4); 
  background: rgba(63, 185, 80, 0.08);
  color: rgba(63, 185, 80, 0.95); 
}

.challenge-list .check { 
  width: 1.75rem; 
  height: 1.75rem; 
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
  font-weight: 700;
  transition: all 0.2s ease;
}

.challenge-list .check.filled { 
  color: rgba(63, 185, 80, 1);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(63, 185, 80, 0.5);
}

.challenge-list li strong {
  color: var(--accent);
  font-weight: 600;
}

.challenge-list li.completed strong {
  color: rgba(63, 185, 80, 1);
}

.random-box {
  border: 1px dashed rgba(108,240,255,0.4);
  background: rgba(108,240,255,0.05);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}
.random-title { font-weight: 600; margin-bottom: 6px; color: var(--accent); }
.random-list { margin: 0; padding-left: 18px; color: var(--text); }
.patch-card {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  cursor: pointer;
  transition: border-color 0.3s ease-out, transform 0.25s ease-out, box-shadow 0.3s ease-out;
  position: relative;
  overflow: hidden;
}
.patch-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), transparent);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
}
.patch-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(108,240,255,0.12), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease-out;
}
.patch-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.patch-card:hover::after { opacity: 1; }
.patch-card.selected {
  border-color: #38bdf8; /* accent renforcé */
  box-shadow: 0 10px 22px rgba(0,0,0,0.32), 0 0 0 1px rgba(56,189,248,0.6);
  position: relative;
  background: linear-gradient(150deg, rgba(56,189,248,0.25), rgba(125,211,252,0.12));
}
.patch-card.selected::before { background: linear-gradient(135deg, rgba(56,189,248,0.55), transparent); }
.patch-card.buff { border-color: rgba(63,185,80,0.35); }
.patch-card.buff::before { background: linear-gradient(140deg, rgba(63,185,80,0.5), transparent); }
.patch-card.malus { border-color: rgba(255,107,107,0.5); }
.patch-card.malus::before { background: linear-gradient(140deg, rgba(255,107,107,0.55), transparent); }
.patch-card.mixed { border-color: rgba(125,211,252,0.4); }
.patch-card.mixed::before { background: linear-gradient(140deg, rgba(125,211,252,0.5), transparent); }
.patch-card.locked { opacity: 0.5; cursor: not-allowed; }
.patch-card h3 { margin: 6px 0; }
.patch-card p { margin: 0; color: var(--muted); }

/* Patch header with tag */
.patch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.patch-header h3 {
  margin: 0;
  font-size: 1rem;
}

.patch-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.patch-tag.buff {
  background: rgba(63, 185, 80, 0.2);
  color: #4ade80;
  border: 1px solid rgba(63, 185, 80, 0.4);
}

.patch-tag.malus {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.4);
}

.patch-tag.mixed {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.patch-effect {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
  margin: 0.25rem 0 0.5rem !important;
}

.patch-meta { font-size: 0.85rem; color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; margin-left: 6px; border: 1px solid rgba(255,255,255,0.12); }
.badge.locked { color: var(--danger); border-color: rgba(255,107,107,0.4); }
.badge.buff { background: rgba(63,185,80,0.12); color: var(--success); border-color: rgba(63,185,80,0.4); }
.badge.malus { background: rgba(255,107,107,0.12); color: var(--danger); border-color: rgba(255,107,107,0.5); }
.badge.mixed { background: rgba(125,211,252,0.12); color: var(--accent); border-color: rgba(125,211,252,0.45); }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  font-weight: 600;
  font-size: 0.85rem;
}
.pill.buff { color: var(--success); border-color: rgba(63,185,80,0.4); background: rgba(63,185,80,0.12); }
.pill.malus { color: var(--danger); border-color: rgba(255,107,107,0.5); background: rgba(255,107,107,0.12); }
.pill.mixed { color: var(--accent); border-color: rgba(125,211,252,0.45); background: rgba(125,211,252,0.12); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 0.85rem;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
}
.state-tag .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.state-tag.selected { border-color: rgba(108,240,255,0.6); background: rgba(108,240,255,0.12); color: var(--accent); }
.state-tag.locked { border-color: rgba(255,107,107,0.5); color: var(--danger); background: rgba(255,107,107,0.12); }

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}
.hud { flex-direction: column; align-items: flex-start; }
.hud-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.hud-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.hud-badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 0.9rem;
}
.hud-powers { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.power-hud-item { min-width: 120px; padding: 6px; border-radius: 10px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); }
.power-hud-label { font-size: 0.9rem; color: var(--text); }
.power-hud-bar { width: 100%; height: 6px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.power-hud-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }
#gameCanvas {
  width: 100%;
  background:
    linear-gradient(180deg, rgba(108,240,255,0.08) 0%, transparent 30%),
    linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 40%, transparent 100%),
    #060a12;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.45), 0 0 0 1px rgba(108,240,255,0.1);
}

.actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

#screen-game { position: relative; }
.canvas-wrapper { position: relative; }
.canvas-wrapper {
  background: rgba(0,0,0,0.2);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  min-height: 320px;
  height: 55vh;
  max-height: 80vh;
  margin-bottom: 12px;
  width: 100%;
}
.canvas-wrapper canvas {
  width: 100%;
  height: 100%;
  display: block;
}
/* Canvas HUD - Hidden when game is running, UI is now in canvas */
.canvas-hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Show HUD only when game is not running (menu/pause states) */
#screen-game:not(.game-running) .canvas-hud {
  opacity: 1;
}
.canvas-hud-left { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.canvas-hud-right { display: flex; gap: 8px; align-items: center; pointer-events: auto; }
.canvas-hud .hud-chip { pointer-events: auto; }
.current-orb.floating {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.35);
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}
.current-orb.floating .label { color: #c5d4e1; }

/* Floating Play Button - Always visible on menu */
.floating-play-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: none; /* Hidden by default, shown only on menu screen */
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #041121;
  border: none;
  border-radius: 3rem;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(108, 240, 255, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: pulseGlow 2s ease-in-out infinite;
}

.floating-play-btn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 32px rgba(108, 240, 255, 0.5), 0 6px 16px rgba(0, 0, 0, 0.4);
}

.floating-play-btn:active {
  transform: translateY(-2px) scale(1.02);
}

.floating-play-btn .play-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.floating-play-btn .play-text {
  font-size: 1.125rem;
}

/* Show floating play button only when menu screen is visible */
body:has(#screen-menu:not(.hidden)) .floating-play-btn {
  display: flex !important;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(108, 240, 255, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
  }
  50% {
    box-shadow: 0 8px 32px rgba(108, 240, 255, 0.6), 0 4px 16px rgba(0, 0, 0, 0.4);
  }
}

.floating-fullscreen { 
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  font-size: 1.05rem;
  display: none !important;
}
.floating-fullscreen:hover { background: rgba(255,255,255,0.14); }

/* Fullscreen mode for canvas wrapper - truly immersive */
.canvas-wrapper:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  border-radius: 0;
  border: none;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-wrapper:fullscreen canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
}

#screen-game:fullscreen {
  background: #000;
  padding: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  justify-content: center;
}
#screen-game:fullscreen .canvas-wrapper {
  width: 100%;
  max-width: 100vw;
  max-height: 100vh;
  height: 100vh;
  margin: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  border: none;
}
#screen-game:fullscreen .floating-fullscreen {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 100;
}
#screen-game:fullscreen .hud-overlay {
  top: 12px;
  left: 12px;
  display: none;
}

/* Hide ALL external UI in fullscreen for immersive experience */
#screen-game:fullscreen .run-effects-head,
#screen-game:fullscreen #runEffects,
#screen-game:fullscreen .orb-legend,
#screen-game:fullscreen #powerQueueLabel,
#screen-game:fullscreen .controls-hint,
#screen-game:fullscreen .canvas-hud,
#screen-game:fullscreen .jump-bar {
  display: none !important;
}
.hud-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  pointer-events: none;
  display: none;
}

/* Canvas overlay buttons */
.canvas-overlay-btn {
  display: none;
  position: absolute;
  background: rgba(15, 22, 37, 0.95);
  border: 2px solid rgba(108, 240, 255, 0.6);
  border-radius: 10px;
  color: rgba(108, 240, 255, 1);
  font-family: Inter, system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 1000;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hud-row {
  gap: 4px;
  font-size: 0.9rem;
}

.canvas-overlay-btn:hover {
  background: rgba(25, 32, 47, 0.98);
  border-color: rgba(108, 240, 255, 0.9);
  box-shadow: 0 0 20px rgba(108, 240, 255, 0.4);
  transform: scale(1.05);
}

.canvas-overlay-btn:active {
  transform: scale(0.95);
}

#pauseBtn, #fullscreenBtn {
  width: 36px;
  height: 36px;
  top: 16px;
}

#pauseBtn {
  right: 60px;
}

#fullscreenBtn {
  right: 16px;
}

#gameOverRestartBtn, #gameOverMenuBtn {
  height: 44px;
  padding: 0 24px;
  top: 50%;
  transform: translateY(50px);
}

#gameOverRestartBtn {
  background: linear-gradient(180deg, #6cf0ff 0%, #38bdf8 100%);
  color: #041121;
  border-color: transparent;
}

#gameOverRestartBtn:hover {
  box-shadow: 0 0 25px rgba(108, 240, 255, 0.6);
  background: linear-gradient(180deg, #7ef5ff 0%, #48ceff 100%);
}

/* Canvas overlay buttons for reliable click detection */
.canvas-overlay-btn {
  position: absolute;
  background: rgba(15, 22, 37, 0.95);
  border: 2px solid rgba(108, 240, 255, 0.6);
  border-radius: 10px;
  color: rgba(108, 240, 255, 1);
  font-family: Inter, system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 1000;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}

.canvas-overlay-btn:hover {
  background: rgba(25, 32, 47, 0.98);
  border-color: rgba(108, 240, 255, 0.9);
  box-shadow: 0 0 20px rgba(108, 240, 255, 0.4);
  transform: scale(1.05);
}

.canvas-overlay-btn:active {
  transform: scale(0.95);
}

#canvasPauseBtn, #canvasFullscreenBtn {
  width: 2.5rem;
  height: 2.5rem;
  top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  font-size: 1rem;
}

#canvasPauseBtn {
  right: 4.25rem;
}

#canvasFullscreenBtn {
  right: 1rem;
}

#canvasGameOverRestartBtn, #canvasGameOverMenuBtn {
  height: 44px;
  padding: 0 24px;
  top: 50%;
  transform: translateY(50px);
}

#canvasGameOverRestartBtn {
  left: 50%;
  margin-left: -155px;
  background: linear-gradient(180deg, #6cf0ff 0%, #38bdf8 100%);
  color: #041121;
  border-color: transparent;
}

#canvasGameOverRestartBtn:hover {
  box-shadow: 0 0 25px rgba(108, 240, 255, 0.6);
  background: linear-gradient(180deg, #7ef5ff 0%, #48ceff 100%);
}

#canvasGameOverMenuBtn {
  left: 50%;
  margin-left: 15px;
}

.canvas-start-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) translateY(80px) !important;
  width: 200px;
  height: 50px;
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(180deg, #6cf0ff 0%, #38bdf8 100%);
  color: #041121;
  border-radius: 14px;
  border: none;
  box-shadow: 0 4px 20px rgba(108, 240, 255, 0.4);
}

.canvas-start-btn:hover {
  box-shadow: 0 6px 30px rgba(108, 240, 255, 0.6);
  background: linear-gradient(180deg, #7ef5ff 0%, #48ceff 100%);
  transform: translate(-50%, -50%) translateY(78px) scale(1.05) !important;
}

.canvas-start-btn:active {
  box-shadow: 0 2px 15px rgba(108, 240, 255, 0.5);
  transform: translate(-50%, -50%) translateY(82px) scale(0.98) !important;
}

/* Start Screen Overlay HTML */
.start-screen-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 998;
  animation: fadeIn 0.3s ease-out;
}

.start-screen-overlay.active {
  display: flex;
}

.start-screen-panel {
  background: rgba(15, 22, 37, 0.98);
  border: 0.15rem solid rgba(108, 240, 255, 0.6);
  border-radius: 1.25rem;
  padding: 2.25rem 2.75rem 2.5rem;
  max-width: 35rem;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 1.25rem rgba(108, 240, 255, 0.4), 0 0.625rem 2.5rem rgba(0, 0, 0, 0.6);
  animation: slideUp 0.4s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.start-screen-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: rgba(108, 240, 255, 1);
  margin: 0 0 1.75rem 0;
  text-shadow: 0 0 0.625rem rgba(108, 240, 255, 0.3);
}

.start-screen-effects {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  min-height: 8.75rem;
  width: 100%;
}

.start-effect-card {
  background: rgba(19, 27, 45, 0.95);
  border: 0.15rem solid rgba(125, 211, 252, 0.6);
  border-radius: 0.875rem;
  padding: 0.75rem;
  width: 8.75rem;
  min-height: 8.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.start-effect-card.buff {
  border-color: rgba(63, 185, 80, 0.6);
  box-shadow: 0 0 0.9375rem rgba(63, 185, 80, 0.2);
}

.start-effect-card.malus {
  border-color: rgba(255, 107, 107, 0.6);
  box-shadow: 0 0 0.9375rem rgba(255, 107, 107, 0.2);
}

.start-effect-card:hover {
  transform: translateY(-0.125rem);
  box-shadow: 0 0.375rem 1rem rgba(0, 0, 0, 0.4);
}

.start-effect-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.5rem;
  text-align: center;
}

.start-effect-desc {
  font-size: 0.6875rem;
  font-weight: 400;
  color: rgba(139, 148, 158, 0.9);
  line-height: 1.4;
  text-align: center;
}

.start-screen-btn {
  width: 12.5rem;
  height: 3.125rem;
  border-radius: 0.875rem;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.0625rem;
  background: linear-gradient(180deg, #6cf0ff 0%, #38bdf8 100%);
  color: #041121;
  border: none;
  cursor: pointer;
  box-shadow: 0 0.25rem 1.25rem rgba(108, 240, 255, 0.4);
  transition: all 0.2s ease;
  margin-bottom: 1rem;
}

.start-screen-btn:hover {
  box-shadow: 0 0.375rem 1.875rem rgba(108, 240, 255, 0.6);
  background: linear-gradient(180deg, #7ef5ff 0%, #48ceff 100%);
  transform: translateY(-0.125rem);
}

.start-screen-btn:active {
  transform: translateY(0);
  box-shadow: 0 0.125rem 0.9375rem rgba(108, 240, 255, 0.5);
}

.start-screen-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: rgba(139, 148, 158, 0.85);
}

/* Game Over Overlay HTML */
.game-over-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 7, 12, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: fadeIn 0.2s ease-out;
}

.game-over-overlay.active {
  display: flex;
}

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

.game-over-panel {
  background: rgba(15, 22, 37, 0.98);
  border: 2.5px solid rgba(255, 107, 107, 0.7);
  border-radius: 20px;
  padding: 32px 40px 28px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 20px rgba(255, 107, 107, 0.5), 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.25s ease-out;
}

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

.game-over-title {
  font-size: 2.25rem;
  font-weight: 700;
  color: #ff7b7b;
  margin: 0 0 1.75rem 0;
  text-shadow: 0 0 0.9375rem rgba(255, 107, 107, 0.6);
  letter-spacing: 0.03125rem;
}

.game-over-score-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(139, 148, 158, 0.9);
  margin: 0 0 0.75rem 0;
  text-transform: uppercase;
  letter-spacing: 0.03125rem;
}

.game-over-score-value {
  font-size: 3rem;
  font-weight: 700;
  color: rgba(108, 240, 255, 1);
  margin: 0 0 1rem 0;
  text-shadow: 0 0 0.9375rem rgba(108, 240, 255, 0.4);
  line-height: 1;
  transition: all 0.3s ease;
}

.game-over-score-value.new-best {
  color: #ffd700;
  text-shadow: 0 0 1.25rem rgba(255, 215, 0, 0.6);
  animation: score-celebrate 0.5s ease-out;
}

@keyframes score-celebrate {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.game-over-best {
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(139, 148, 158, 0.85);
  margin: 0 0 2.25rem 0;
  transition: all 0.3s ease;
}

.game-over-best.new-best {
  color: #ffd700;
  font-weight: 600;
}

.game-over-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.game-over-btn {
  flex: 1;
  max-width: 12.5rem;
  height: 3.125rem;
  border-radius: 0.875rem;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.game-over-btn-restart {
  background: linear-gradient(180deg, #6cf0ff 0%, #38bdf8 100%);
  color: #041121;
  box-shadow: 0 0.25rem 0.9375rem rgba(108, 240, 255, 0.4);
  animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0.25rem 0.9375rem rgba(108, 240, 255, 0.4); }
  50% { box-shadow: 0 0.25rem 1.5rem rgba(108, 240, 255, 0.7); }
}

.game-over-btn-restart:hover {
  box-shadow: 0 0.375rem 1.5625rem rgba(108, 240, 255, 0.6);
  background: linear-gradient(180deg, #7ef5ff 0%, #48ceff 100%);
  transform: translateY(-0.125rem) scale(1.03);
  animation: none;
}

.game-over-btn-menu {
  background: rgba(19, 27, 45, 0.95);
  color: rgba(108, 240, 255, 1);
  border: 0.125rem solid rgba(108, 240, 255, 0.5);
}

.game-over-btn-menu:hover {
  background: rgba(25, 32, 47, 0.98);
  border-color: rgba(108, 240, 255, 0.8);
  box-shadow: 0 0.25rem 1.25rem rgba(108, 240, 255, 0.4);
  transform: translateY(-0.125rem) scale(1.03);
}

.game-over-btn:active {
  transform: translateY(0) scale(0.95);
}

/* Hide external UI elements when game is running */
.run-effects-head,
#runEffects,
.orb-legend,
#powerQueueLabel,
.controls-hint,
.jump-bar,
.canvas-hud {
  display: none !important;
}

#screen-game.game-running .canvas-hud {
  display: none !important;
}
.start-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 12, 0.82);
  display: none !important; /* Always hidden - now in canvas */
  align-items: center;
  justify-content: center;
  z-index: 3;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.start-overlay.hidden { display: none; }
.start-overlay.death { display: none !important; } /* Death overlay is now in canvas */
.start-panel {
  width: min(760px, 90vw);
  background: linear-gradient(150deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.55);
  text-align: center;
}
.start-kicker { margin: 0 0 6px; letter-spacing: 0.6px; color: var(--accent); font-weight: 700; text-transform: uppercase; font-size: 0.9rem; }
.start-effects { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 16px 0; }
.start-actions { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.start-hint { color: var(--muted); font-size: 0.95rem; }
.start-overlay .patch-card { cursor: default; }
.start-overlay .patch-card h3 { margin-top: 4px; }
/* Animations removed - now handled in canvas */
.start-overlay.death .start-panel { border: 1px solid rgba(255,107,107,0.3); box-shadow: 0 18px 40px rgba(0,0,0,0.6); }
.start-overlay.death .start-panel h3 { color: #ff7b7b; }

@keyframes flyDown {
  to { transform: translateY(220px) scale(0.86); opacity: 0; }
}
@keyframes overlayFade {
  to { opacity: 0; transform: scale(0.95); }
}

@media (max-width: 900px) {
  .app { padding: 16px; }
  .hud { flex-direction: column; align-items: flex-start; gap: 6px; }
  #gameCanvas { height: 320px; }
  .patch-list.mini { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

@media (max-width: 640px) {
  .app { padding: 12px; }
  .card { padding: 18px; }
  .actions { width: 100%; flex-direction: column; }
  .start-panel { width: calc(100% - 28px); padding: 18px; }
  .start-effects { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .canvas-wrapper { height: 320px; min-height: 0; max-height: none; }
  #gameCanvas { height: 240px; }
  .controls-hint { font-size: 0.9rem; }
  .run-effects-head { margin-top: 12px; }
  .hud-actions { flex-wrap: wrap; }
  .hud-badges { width: 100%; }
  .hud-row { gap: 6px; }
}

@media (max-width: 480px) {
  .hud { gap: 4px; }
  #runEffects { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .canvas-wrapper { height: 260px; min-height: 0; }
  #gameCanvas { height: 220px; }
  button { width: 100%; }
  .jump-bar { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(8,11,18,0.9), rgba(8,11,18,0.95)); padding-bottom: 12px; }
}

/* Mobile-focused layout */
@media (max-width: 540px) {
  body { font-size: 15px; }
  .top-bar { flex-direction: column; align-items: flex-start; gap: 4px; }
  .version { font-size: 0.85rem; }
  .card { padding: 16px; }
  .patch-list { grid-template-columns: 1fr; }
  .canvas-wrapper { height: 55vh; min-height: 220px; }
  .canvas-hud { flex-direction: column; align-items: flex-start; gap: 6px; }
  .canvas-hud-left, .canvas-hud-right { width: 100%; justify-content: space-between; }
  .canvas-hud-right { justify-content: flex-start; gap: 6px; }
  .hud-chip { width: auto; }
  .controls-hint { font-size: 0.9rem; }
  .run-effects-head { margin-top: 12px; }
  .orb-legend { flex-direction: column; align-items: flex-start; }
  .actions button { width: 100%; }
}

/* Catalogue: purely informatif, sans effet de hover/click */
#screen-effects .patch-card {
  cursor: default;
}
#screen-effects .patch-card:hover {
  transform: none;
  border-color: rgba(255,255,255,0.08);
  box-shadow: var(--shadow);
}

/* Fullscreen mode improvements */
@media (max-width: 768px) {
  .game-header h1 {
    font-size: 2rem;
  }
  
  .tagline {
    font-size: 1rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .stat-card {
    padding: 0.75rem;
  }
  
  .how-to-play {
    padding: 0.875rem 1rem;
  }
  
  .how-to-play h3 {
    font-size: 0.9375rem;
  }
  
  .how-to-play p {
    font-size: 0.875rem;
  }
  
  .control-key {
    min-width: 2rem;
    font-size: 0.75rem;
  }
  
  .control-desc {
    font-size: 0.75rem;
  }
  
  .floating-play-btn {
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }
  
  .floating-play-btn .play-icon {
    font-size: 1.25rem;
  }
  
  .floating-play-btn .play-text {
    font-size: 1rem;
  }
  
  .theme-selector-highlight {
    padding: 0.875rem 1rem;
  }
  
  .theme-icon {
    font-size: 1.25rem;
  }
  
  .theme-label {
    font-size: 0.9375rem;
  }
  
  .theme-select-large {
    font-size: 0.9375rem;
    padding: 0.625rem 0.875rem;
  }
  
  .secondary-actions {
    flex-direction: column;
  }
  
  .theme-selector {
    width: 100%;
  }
  
  .effects-legend {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .challenge-list li {
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
  }
  
  .btn-large {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
  }
  
  #screen-game:fullscreen {
    padding: 0;
  }
  #screen-game:fullscreen .canvas-wrapper {
    max-width: 100vw;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.875rem;
  }
  
  .game-header h1 {
    font-size: 2.25rem;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 900px) and (orientation: landscape) {
  .app {
    padding: 0.5rem;
    max-width: 100%;
  }
  
  .canvas-wrapper {
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    width: 100%;
  }
  
  #gameCanvas {
    height: 100%;
    width: 100%;
  }
  
  #screen-game:fullscreen .canvas-wrapper {
    height: 100vh;
  }
  
  /* Reduce overlay panel sizes for landscape */
  .start-screen-panel {
    padding: 1rem 1.5rem;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  .start-screen-title {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
  }
  
  .start-screen-effects {
    margin-bottom: 1rem;
    min-height: auto;
    gap: 0.5rem;
  }
  
  .start-effect-card {
    width: 6rem;
    min-height: 5.5rem;
    padding: 0.5rem;
  }
  
  .start-effect-name {
    font-size: 0.6875rem;
    margin-bottom: 0.25rem;
  }
  
  .start-effect-desc {
    font-size: 0.5625rem;
  }
  
  .start-screen-btn {
    width: 8rem;
    height: 2.25rem;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
  }
  
  .start-screen-hint {
    font-size: 0.625rem;
  }
  
  /* Game over panel compact */
  .game-over-panel {
    padding: 1rem 1.5rem;
    max-width: 85%;
    max-height: 85vh;
  }
  
  .game-over-title {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
  }
  
  .game-over-score-value {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }
  
  .game-over-best {
    margin-bottom: 1rem;
    font-size: 0.75rem;
  }
  
  .game-over-btn {
    height: 2.25rem;
    font-size: 0.875rem;
    max-width: 8rem;
  }
  
  .game-over-buttons {
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .game-header h1 {
    font-size: 1.75rem;
  }
  
  .tagline {
    font-size: 0.9375rem;
  }
  
  .card {
    padding: 1rem;
  }
  
  .stat-icon {
    font-size: 1.125rem;
  }
  
  .stat-value {
    font-size: 1.25rem;
  }
  
  .challenge-list .check {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.875rem;
  }
  
  .floating-play-btn {
    bottom: 0.75rem;
    right: 0.75rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    gap: 0.375rem;
  }
  
  .floating-play-btn .play-icon {
    font-size: 1rem;
  }
  
  .floating-play-btn .play-text {
    font-size: 0.8125rem;
  }
  
  .theme-selector-highlight {
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.75rem;
  }
  
  .theme-selector-header {
    margin-bottom: 0.375rem;
  }
  
  .theme-icon {
    font-size: 1rem;
  }
  
  .theme-label {
    font-size: 0.8125rem;
  }
  
  .theme-select-large {
    font-size: 0.8125rem;
    padding: 0.375rem 0.625rem;
  }
  
  /* Compact panels for small portrait screens */
  .start-screen-panel {
    padding: 1.25rem 1.5rem;
    max-width: 95%;
  }
  
  .start-screen-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }
  
  .start-effect-card {
    width: 7rem;
    min-height: 6rem;
    padding: 0.5rem;
  }
  
  .start-effect-name {
    font-size: 0.75rem;
  }
  
  .start-effect-desc {
    font-size: 0.5625rem;
  }
  
  .start-screen-btn {
    width: 10rem;
    height: 2.5rem;
    font-size: 0.9375rem;
  }
  
  .game-over-panel {
    padding: 1.25rem 1.5rem;
  }
  
  .game-over-title {
    font-size: 1.75rem;
    margin-bottom: 1rem;
  }
  
  .game-over-score-value {
    font-size: 2.25rem;
  }
}

/* Extra small landscape - phones in landscape */
@media (max-height: 450px) and (orientation: landscape) {
  .app {
    padding: 0.25rem;
  }
  
  .canvas-wrapper {
    height: 100vh;
    min-height: 0;
  }
  
  .start-screen-panel {
    padding: 0.75rem 1rem;
    max-height: 95vh;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
  }
  
  .start-screen-title {
    width: 100%;
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }
  
  .start-screen-effects {
    flex-direction: row;
    margin-bottom: 0;
    min-height: auto;
    gap: 0.375rem;
    flex: 1;
  }
  
  .start-effect-card {
    width: 5rem;
    min-height: 4.5rem;
    padding: 0.375rem;
  }
  
  .start-effect-name {
    font-size: 0.5625rem;
    margin-bottom: 0.125rem;
  }
  
  .start-effect-desc {
    font-size: 0.5rem;
    line-height: 1.2;
  }
  
  .start-screen-btn {
    width: 6rem;
    height: 2rem;
    font-size: 0.75rem;
    margin-bottom: 0;
  }
  
  .start-screen-hint {
    display: none;
  }
  
  .game-over-panel {
    padding: 0.75rem 1rem;
    max-height: 90vh;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }
  
  .game-over-title {
    width: 100%;
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
  }
  
  .game-over-score-label {
    font-size: 0.625rem;
    margin-bottom: 0.25rem;
  }
  
  .game-over-score-value {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
  }
  
  .game-over-best {
    font-size: 0.625rem;
    margin-bottom: 0.5rem;
    width: 100%;
  }
  
  .game-over-buttons {
    width: auto;
  }
  
  .game-over-btn {
    height: 1.75rem;
    font-size: 0.75rem;
    max-width: 6rem;
    border-radius: 0.5rem;
  }
}

/* Very small screens - stack controls */
@media (max-width: 400px) {
  .control-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* Prevent zoom on double-tap for better mobile UX */
button, .canvas-wrapper, #gameCanvas {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
