/* SUPER CYPHER Arcade CSS */
@font-face {
  font-family: 'Pixel';
  src: url('pixel.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Readout';
  src: url('mono.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #05070a;
  color: #ffffff;
  font-family: 'Readout', 'Consolas', 'Monaco', monospace;
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

header.arcade-header {
  background: #0d1218;
  border-bottom: 2px solid #00ff88;
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 20;
}

.arcade-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.arcade-back-link {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.75rem;
  border: 1px solid #334155;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  transition: all 0.2s ease;
}

.arcade-back-link:hover {
  color: #00ff88;
  border-color: #00ff88;
  background: rgba(0, 255, 136, 0.1);
}

.arcade-title {
  font-family: 'Pixel', monospace;
  font-weight: 400;
  color: #ffffff;
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.arcade-btn-group {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
}

.arcade-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid #1f2735;
  color: #8899ac;
  padding: 5px 9px;
  border-radius: 4px;
  font-family: 'Readout', 'Consolas', 'Monaco', monospace;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.arcade-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.arcade-btn.on {
  border-color: #00ff88;
  color: #00ff88;
  background: rgba(0, 255, 136, 0.12);
}

.arcade-btn.btn-s1 { color: #00ff88; border-color: rgba(0, 255, 136, 0.4); }
.arcade-btn.btn-s2 { color: #38bdf8; border-color: rgba(56, 189, 248, 0.4); }
.arcade-btn.btn-s3 { color: #e879f9; border-color: rgba(232, 121, 249, 0.4); }
.arcade-btn.special-amber {
  border-color: #ffa502;
  color: #ffa502;
  background: rgba(255, 165, 2, 0.12);
}
.arcade-btn.special-pink {
  color: #ec4899;
  border-color: #ec4899;
  background: rgba(236, 72, 153, 0.12);
}
.arcade-btn.special-gold {
  color: #facc15;
  border-color: #facc15;
  background: rgba(250, 204, 21, 0.12);
}
.arcade-btn.special-cyan {
  color: #38bdf8;
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
}
.arcade-btn.special-pause {
  color: #38bdf8;
  border-color: #38bdf8;
  font-weight: 800;
}
.arcade-btn.special-restart {
  color: #00ff88;
  border-color: #00ff88;
}

.hud-bar {
  background: #070a0e;
  border-bottom: 1px solid #1f2735;
  padding: 6px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  z-index: 15;
}

.hud-left {
  display: flex;
  gap: 16px;
  align-items: center;
}

.hud-right {
  display: flex;
  gap: 16px;
  align-items: center;
}

.hud-lives-val {
  color: #ff4757;
  font-weight: 800;
}

.hud-score-val {
  color: #00ff88;
  font-weight: 800;
}

.hud-weapon-val {
  color: #ffa502;
  font-weight: 800;
}

.hud-boss-wrap {
  display: none;
  align-items: center;
  gap: 8px;
}

.hud-boss-label {
  color: #ff4757;
  font-weight: 700;
  font-size: 0.75rem;
}

.hud-boss-meter {
  width: 100px;
  height: 8px;
  background: #222222;
  border: 1px solid #555555;
  border-radius: 2px;
  overflow: hidden;
}

.hud-boss-fill {
  width: 100%;
  height: 100%;
  background: #ff4757;
  transition: width 0.1s linear;
}

.hud-stage-name {
  color: #8899ac;
  font-size: 0.75rem;
}

#super-cypher-viewport {
  flex: 1;
  position: relative;
  background: #000000;
  overflow: hidden;
}

#super-cypher-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.touch-controls {
  position: absolute;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  left: calc(16px + env(safe-area-inset-left, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 100;
}

.dpad-container {
  pointer-events: auto;
  touch-action: none;
}

.dpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 4px;
}

.touch-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(14, 18, 24, 0.75);
  border: 2px solid #00ff88;
  color: #00ff88;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  backdrop-filter: blur(4px);
  touch-action: none;
  cursor: pointer;
}

.touch-btn:active, .touch-btn.active {
  background: #00ff88;
  color: #000000;
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.8);
}

.touch-btn-up { grid-column: 2; grid-row: 1; }
.touch-btn-left { grid-column: 1; grid-row: 2; }
.touch-btn-center {
  grid-column: 2;
  grid-row: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.touch-btn-right { grid-column: 3; grid-row: 2; }
.touch-btn-down { grid-column: 2; grid-row: 3; }

.touch-btn-diag {
  width: 44px;
  height: 44px;
  background: transparent;
  touch-action: none;
  cursor: pointer;
}
.touch-btn-ul { grid-column: 1; grid-row: 1; }
.touch-btn-ur { grid-column: 3; grid-row: 1; }
.touch-btn-dl { grid-column: 1; grid-row: 3; }
.touch-btn-dr { grid-column: 3; grid-row: 3; }

.action-container {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.action-sub-row {
  display: flex;
  gap: 8px;
}

.action-main-cluster {
  display: flex;
  gap: 12px;
  align-items: center;
}

.touch-btn-pause {
  width: 42px;
  height: 42px;
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  font-size: 0.65rem;
  color: #38bdf8;
  font-weight: 800;
}

.touch-btn-wpn {
  width: 42px;
  height: 42px;
  background: rgba(255, 165, 2, 0.25);
  border-color: #ffa502;
  font-size: 0.7rem;
  color: #ffa502;
  font-weight: 800;
}

.touch-btn-fire {
  width: 56px;
  height: 56px;
  background: rgba(255, 71, 87, 0.25);
  border-color: #ff4757;
  color: #ff4757;
  font-weight: 800;
}

.touch-btn-jump {
  width: 56px;
  height: 56px;
  background: rgba(0, 255, 136, 0.25);
  border-color: #00ff88;
  color: #00ff88;
  font-weight: 800;
}

/* Modals and Overlays */
.sc-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 9, 0.88);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  z-index: 50;
}

.sc-modal-title {
  font-family: 'Pixel', monospace;
  font-size: 1.4rem;
  font-weight: 400;
  color: #ffffff;
  letter-spacing: 2px;
  margin-bottom: 6px;
  text-shadow: 0 0 16px rgba(0, 255, 136, 0.6);
}

.sc-modal-sub {
  color: #00ff88;
  font-size: 0.8rem;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.sc-mode-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.sc-mode-tab {
  font-size: 0.8rem;
  padding: 8px 16px;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.sc-mode-tab.tab-free-active {
  background: #00ff88;
  color: #05070a;
  border: 2px solid #00ff88;
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.4);
}

.sc-mode-tab.tab-free-inactive {
  background: transparent;
  color: #00ff88;
  border: 2px solid #00ff88;
  box-shadow: none;
}

.sc-mode-tab.tab-ranked-active {
  background: #facc15;
  color: #05070a;
  border: 2px solid #facc15;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.4);
}

.sc-mode-tab.tab-ranked-inactive {
  background: transparent;
  color: #facc15;
  border: 2px solid #facc15;
  box-shadow: none;
}

.sc-launch-btn {
  font-size: 0.95rem;
  padding: 12px 28px;
  background: #00ff88;
  color: #000000;
  border: none;
  font-family: inherit;
  font-weight: 900;
  cursor: pointer;
  border-radius: 4px;
  box-shadow: 0 0 18px rgba(0, 255, 136, 0.5);
  transition: transform 0.1s, box-shadow 0.2s;
}

.sc-launch-btn:hover {
  transform: translateY(-1px);
}

.sc-mode-desc {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 12px;
  max-width: 540px;
  line-height: 1.45;
}

.sc-instructions {
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 12px;
  line-height: 1.4;
}

.sc-fixed-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.sc-dialog-box {
  background: #090d16;
  border: 2px solid #facc15;
  box-shadow: 0 0 30px rgba(250, 204, 21, 0.25);
  border-radius: 8px;
  max-width: 620px;
  width: 100%;
  padding: 20px;
  color: #ffffff;
}

.sc-dialog-box.box-cyan {
  border-color: #38bdf8;
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.25);
}

.sc-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.sc-dialog-title {
  color: #facc15;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 1px;
}

.sc-dialog-title.title-cyan {
  color: #38bdf8;
}

.sc-dialog-subtitle {
  color: #94a3b8;
  font-size: 0.72rem;
  margin-top: 2px;
}

.sc-dialog-close {
  background: transparent;
  border: 1px solid #475569;
  color: #94a3b8;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
}

.sc-dialog-close:hover {
  color: #ffffff;
  border-color: #cbd5e1;
}

.sc-rules-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 0.72rem;
  color: #cbd5e1;
  line-height: 1.4;
}

.sc-rules-title {
  color: #facc15;
  font-weight: 800;
  margin-bottom: 4px;
}

.sc-rules-highlight {
  color: #00ff88;
  margin-top: 4px;
}

.sc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  margin-bottom: 16px;
}

.sc-table th {
  border-bottom: 1px solid #334155;
  color: #94a3b8;
  text-align: left;
  padding: 6px 8px;
}

.sc-table td {
  border-bottom: 1px solid #1e293b;
  padding: 7px 8px;
}

.sc-rank-gold { color: #facc15; font-weight: 800; }
.sc-rank-silver { color: #e2e8f0; font-weight: 800; }
.sc-rank-bronze { color: #cd7f32; font-weight: 800; }
.sc-score-cell { color: #00ff88; font-weight: 800; }
.sc-haul-cell { color: #38bdf8; }

.sc-badge-verified {
  background: rgba(0, 255, 136, 0.15);
  color: #00ff88;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.68rem;
  border: 1px solid #00ff88;
}

.sc-dialog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.sc-wallet-status {
  font-size: 0.72rem;
  color: #94a3b8;
}

.sc-tourney-btn {
  background: #facc15;
  color: #000000;
  border: none;
  padding: 8px 14px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.78rem;
  cursor: pointer;
  border-radius: 4px;
}

.sc-proof-content {
  font-size: 0.75rem;
  line-height: 1.5;
  color: #e2e8f0;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 14px;
  word-break: break-all;
}

.sc-proof-row {
  margin-bottom: 6px;
}

.sc-proof-k {
  color: #94a3b8;
}

.sc-proof-v {
  color: #38bdf8;
  font-weight: 700;
}

.sc-proof-v.valid {
  color: #00ff88;
}

.sc-proof-hash {
  font-size: 0.7rem;
  color: #facc15;
  font-family: monospace;
}

#toast {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  background: #00ff88;
  color: #000000;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.8rem;
  display: none;
  z-index: 5000;
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.6);
}

#sc-haul-panel {
  display: none !important;
}

/* ==========================================================================
   Mission Controls and Keycap Styling
   ========================================================================== */
.keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background: #1e293b;
  color: #f1f5f9;
  font-family: 'Readout', 'Consolas', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 4px;
  border: 1px solid #475569;
  border-bottom: 2px solid #0f172a;
  box-shadow: 0 2px 0 #0f172a, 0 0 6px rgba(0, 0, 0, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  margin: 0 2px;
  vertical-align: middle;
  user-select: none;
}

.keycap-sm {
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-size: 0.62rem;
  border-radius: 3px;
  margin: 0 1px;
}

.keycap-accent {
  background: #0369a1;
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 2px 0 #082f49, 0 0 6px rgba(56, 189, 248, 0.4);
}

.keycap-red {
  background: #991b1b;
  border-color: #f87171;
  color: #ffffff;
  box-shadow: 0 2px 0 #450a0a, 0 0 6px rgba(239, 68, 68, 0.4);
}

.keycap-gold {
  background: #854d0e;
  border-color: #facc15;
  color: #fef08a;
  box-shadow: 0 2px 0 #422006, 0 0 6px rgba(250, 204, 21, 0.4);
}

/* Controls Card in Start Overlay */
.sc-controls-card {
  width: 100%;
  max-width: 620px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 12px 14px;
  margin: 10px 0;
  text-align: left;
}

.sc-controls-title {
  font-family: 'Pixel', monospace;
  font-size: 0.72rem;
  color: #00ff88;
  letter-spacing: 1px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 255, 136, 0.2);
  padding-bottom: 4px;
}

.sc-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 14px;
}

.sc-ctrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.73rem;
  padding: 3px 0;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.08);
}

.sc-ctrl-action {
  color: #94a3b8;
  font-weight: 500;
}

.sc-ctrl-keys {
  display: flex;
  align-items: center;
  gap: 2px;
}

.sc-konami-hint {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #1e293b;
  font-size: 0.7rem;
  color: #facc15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
}

/* Persistent HUD Helper Bar */
.hud-helper-bar {
  background: #090d13;
  border-top: 1px solid #1f2735;
  padding: 6px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: #94a3b8;
  z-index: 10;
  flex-wrap: wrap;
  gap: 6px;
}

.hud-helper-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.hud-helper-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.hud-helper-btn {
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid #facc15;
  color: #facc15;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.hud-helper-btn:hover {
  background: #facc15;
  color: #000000;
}

/* Dedicated Controls Modal */
.sc-modal-controls {
  max-width: 680px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
}

.sc-keymap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.74rem;
  margin: 10px 0 14px 0;
}

.sc-keymap-table th {
  background: #111827;
  color: #00ff88;
  font-family: 'Pixel', monospace;
  font-size: 0.68rem;
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid #1f2937;
}

.sc-keymap-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #1e293b;
  color: #e2e8f0;
}

.sc-keymap-table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.sc-tips-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.sc-tip-card {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 0.72rem;
  line-height: 1.4;
}

.sc-tip-title {
  color: #38bdf8;
  font-weight: 700;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

@media (max-width: 950px) {
  .arcade-btn-group .btn-secondary-arcade {
    display: none !important;
  }
  .mobile-only-btn {
    display: inline-flex !important;
  }
}

@media (max-width: 720px) {
  .sc-controls-grid {
    grid-template-columns: 1fr;
  }
  .sc-tips-grid {
    grid-template-columns: 1fr;
  }
  .hud-helper-bar {
    display: none;
  }
}

@media (max-width: 640px) {
  header.arcade-header {
    padding: 6px 10px;
  }
  .arcade-title {
    font-size: 0.75rem;
  }
  .arcade-btn {
    padding: 4px 7px;
    font-size: 0.68rem;
  }
  .hud-bar {
    font-size: 0.72rem;
    padding: 4px 10px;
  }
  .sc-modal-title {
    font-size: 1.15rem;
  }
}

/* Options Drawer Modal */
.sc-modal-options {
  max-width: 580px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
}

.sc-options-section {
  margin-bottom: 12px;
  text-align: left;
}

.sc-options-label {
  font-family: 'Pixel', monospace;
  font-size: 0.68rem;
  color: #00ff88;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(0, 255, 136, 0.2);
  padding-bottom: 2px;
}

.sc-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 6px;
}

.mobile-only-btn {
  display: none;
}

/* Mobile Rotation Notice */
.mobile-rotate-notice {
  display: none;
}

@media (max-width: 600px) and (orientation: portrait) {
  .mobile-rotate-notice {
    display: flex;
    position: fixed;
    inset: 0;
    background: rgba(5, 7, 10, 0.96);
    z-index: 99999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    backdrop-filter: blur(8px);
  }
  .rotate-icon {
    font-size: 3.2rem;
    color: #00ff88;
    margin-bottom: 14px;
    animation: rotatePulse 2.2s infinite ease-in-out;
  }
  .rotate-text {
    font-family: 'Pixel', monospace;
    font-size: 1.1rem;
    color: #ffffff;
    margin-bottom: 6px;
    letter-spacing: 1px;
    text-shadow: 0 0 12px rgba(0, 255, 136, 0.5);
  }
  .rotate-sub {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 20px;
    max-width: 260px;
    line-height: 1.4;
  }
  .rotate-dismiss {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 6px 16px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.72rem;
    cursor: pointer;
  }
}

@keyframes rotatePulse {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(90deg) scale(1.1); color: #38bdf8; }
  100% { transform: rotate(0deg) scale(1); }
}

/* ==========================================================================
   Mobile Landscape Mode Optimization (Tuned for Phones)
   ========================================================================== */
@media (max-height: 540px), (orientation: landscape) and (max-width: 950px) {
  /* Complete elimination of keyboard helper bar in landscape mode */
  .hud-helper-bar {
    display: none !important;
  }

  #toast {
    top: 36px;
    padding: 3px 10px;
    font-size: 0.68rem;
  }

  /* Ultra-compact single-row header */
  header.arcade-header {
    position: relative;
    z-index: 50;
    padding: 3px 10px;
    height: 32px;
    min-height: 32px;
    background: rgba(13, 18, 24, 0.95);
    border-bottom: 1px solid #00ff88;
    flex-wrap: nowrap;
    overflow: hidden;
    gap: 6px;
  }

  .arcade-title-group {
    gap: 8px;
    flex-shrink: 0;
  }

  .arcade-back-link {
    font-size: 0.65rem;
    padding: 2px 6px;
  }

  .arcade-title {
    font-size: 0.72rem;
    white-space: nowrap;
  }

  /* In mobile landscape, hide the bulky secondary warp and cheat buttons */
  .arcade-btn-group .btn-secondary-arcade {
    display: none !important;
  }

  .arcade-btn-group {
    gap: 4px;
    flex-wrap: nowrap;
    margin-left: auto;
  }

  .mobile-only-btn {
    display: inline-flex !important;
  }

  .arcade-btn {
    padding: 2px 7px;
    font-size: 0.65rem;
    height: 24px;
    line-height: 20px;
  }

  /* Slim overlay HUD docked inside the top edge of viewport */
  .hud-bar {
    padding: 3px 12px;
    font-size: 0.68rem;
    background: rgba(7, 10, 14, 0.85);
    backdrop-filter: blur(4px);
    border-bottom: 1px solid rgba(31, 39, 53, 0.8);
    position: absolute;
    top: 32px;
    left: 0;
    right: 0;
    z-index: 25;
    pointer-events: none;
  }

  .hud-boss-meter {
    width: 65px;
    height: 6px;
  }

  /* Viewport takes full height under header */
  #super-cypher-viewport {
    flex: 1;
    position: relative;
    height: calc(100vh - 32px);
    width: 100vw;
  }

  /* Touch controls optimized for thumbs with safe area insets */
  .touch-controls {
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    left: calc(12px + env(safe-area-inset-left, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    align-items: flex-end;
  }

  /* D-Pad cross */
  .dpad-grid {
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(3, 40px);
    gap: 3px;
  }

  .touch-btn {
    width: 40px;
    height: 40px;
    font-size: 0.82rem;
    background: rgba(14, 18, 24, 0.72);
    backdrop-filter: blur(6px);
  }

  .touch-btn-center {
    width: 40px;
    height: 40px;
  }

  .touch-btn-diag {
    width: 40px;
    height: 40px;
  }

  .touch-btn:active, .touch-btn.active {
    background: #00ff88;
    color: #000000;
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.8);
  }

  /* Action buttons cluster */
  .action-container {
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }

  .action-sub-row {
    display: flex;
    gap: 6px;
  }

  .touch-btn-pause, .touch-btn-wpn {
    width: 36px;
    height: 36px;
    font-size: 0.65rem;
  }

  .action-main-cluster {
    display: flex;
    gap: 12px;
    align-items: center;
  }

  .touch-btn-fire {
    width: 56px;
    height: 56px;
    font-size: 0.82rem;
    background: rgba(255, 71, 87, 0.3);
    border-color: #ff4757;
    color: #ff4757;
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.35);
  }

  .touch-btn-fire:active {
    background: #ff4757;
    color: #ffffff;
    box-shadow: 0 0 18px rgba(255, 71, 87, 0.8);
  }

  .touch-btn-jump {
    width: 56px;
    height: 56px;
    font-size: 0.82rem;
    background: rgba(0, 255, 136, 0.3);
    border-color: #00ff88;
    color: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.35);
  }

  .touch-btn-jump:active {
    background: #00ff88;
    color: #000000;
    box-shadow: 0 0 18px rgba(0, 255, 136, 0.8);
  }

  /* Start overlay in landscape */
  .sc-modal-overlay {
    padding: 8px 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }

  .sc-modal-title {
    font-size: 1.05rem;
    margin-bottom: 2px;
  }

  .sc-modal-sub {
    font-size: 0.68rem;
    margin-bottom: 6px;
  }

  .sc-mode-tabs {
    margin-bottom: 6px;
    gap: 6px;
  }

  .sc-mode-tab {
    font-size: 0.72rem;
    padding: 5px 12px;
  }

  .sc-launch-btn {
    font-size: 0.8rem;
    padding: 7px 16px;
  }

  .sc-controls-card {
    padding: 6px 10px;
    margin: 6px 0;
  }

  .sc-controls-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 3px 8px;
  }

  .sc-ctrl-row {
    font-size: 0.65rem;
    padding: 2px 0;
  }

  .keycap {
    min-width: 18px;
    height: 18px;
    font-size: 0.62rem;
    padding: 0 3px;
  }

  .sc-dialog-box {
    max-height: 90vh;
    padding: 10px;
  }
}
