:root {
  --bg-dark: #090b10;
  --bg-panel: rgba(14, 17, 25, 0.92);
  --bg-card: rgba(22, 27, 40, 0.88);
  --border: rgba(255, 255, 255, 0.11);
  --accent-red: #e62e2d;
  --accent-red-glow: rgba(230, 46, 45, 0.45);
  --accent-amber: #f59e0b;
  --accent-green: #10b981;
  --accent-cyan: #06b6d4;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --font-sans: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'Consolas', 'Courier New', monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
}

#canvas-container {
  position: fixed;
  inset: 0;
  z-index: 1;
  filter: contrast(1.06) saturate(0.95) brightness(0.99);
}

#postfx-vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 250, 235, 0.03) 0%, rgba(10, 12, 16, 0.14) 68%, rgba(3, 5, 8, 0.52) 100%);
  transition: box-shadow 0.08s linear;
}

/* Professional Loading Screen */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #111622 0%, #06080c 100%);
  transition: opacity 0.45s ease;
}

.loading-box {
  width: min(480px, 88vw);
  background: rgba(14, 17, 25, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 3px solid var(--accent-red);
  border-radius: 14px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
}

.loading-logo {
  width: 240px;
  height: auto;
  margin-bottom: 18px;
}

.loading-progress-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin: 16px 0 10px 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.loading-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-red), var(--accent-amber), var(--accent-green));
  transition: width 0.18s ease;
}

.loading-status-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Overlay Screens */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(14, 18, 28, 0.65) 0%, rgba(5, 7, 12, 0.92) 100%);
  backdrop-filter: blur(8px);
  transition: opacity 0.25s ease;
}

.hidden {
  display: none !important;
}

.modal-panel {
  width: min(880px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent-red);
  border-radius: 12px;
  padding: 28px 34px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(230, 46, 45, 0.12);
}

.brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 22px;
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent-red);
  margin-bottom: 4px;
}

.brand-title h1 {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ffffff, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gamepad-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.gamepad-pill.connected {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6b7280;
}

.gamepad-pill.connected .status-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

/* Menu navigation & layout */
.menu-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
}

@media (max-width: 760px) {
  .menu-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #e5e7eb;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 7px;
  font-weight: 600;
}

.form-group label span.val {
  color: var(--text-main);
  font-family: var(--font-mono);
  font-weight: 700;
}

input[type="text"], select {
  width: 100%;
  padding: 11px 14px;
  background: rgba(9, 11, 16, 0.85);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  user-select: text;
}

input[type="text"]:focus, select:focus {
  border-color: var(--accent-red);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-red);
  cursor: pointer;
}

/* Telemetry Preview Bars */
.phys-bars {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.28);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.phys-bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.phys-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.phys-bar-header strong {
  font-family: var(--font-mono);
  color: var(--text-main);
}

.phys-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.phys-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-red), var(--accent-amber));
  border-radius: 4px;
  transition: width 0.2s ease;
}

/* Buttons */
.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  transition: all 0.18s ease;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.btn:disabled, .btn.btn-disabled {
  opacity: 0.48;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.btn-primary {
  background: linear-gradient(135deg, #e62e2d, #b91c1c);
  border-color: #ef4444;
  box-shadow: 0 6px 20px var(--accent-red-glow);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #f03e3d, #dc2626);
  box-shadow: 0 8px 25px rgba(230, 46, 45, 0.65);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.78rem;
}

.badge-soon {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fcd34d;
  letter-spacing: 0.05em;
}

/* Table for records */
.records-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 0.88rem;
}

.records-table th, .records-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.records-table th {
  color: var(--text-muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.records-table td.mono {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-amber);
}

/* Track preview canvas in menu */
.track-preview-box {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* HUD */
#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.hud-panel {
  background: rgba(10, 13, 20, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.timing-grid {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 6px 18px;
  align-items: baseline;
}

.timing-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.timing-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.timing-value.current {
  font-size: 1.45rem;
  color: #ffffff;
}

.timing-value.best {
  color: #a855f7;
}

.timing-value.last {
  color: var(--accent-green);
}

.checkpoints-bar {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.cp-pip {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.2s;
}

.cp-pip.passed {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.hud-telemetry-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.meta-pills {
  display: flex;
  gap: 8px;
}

.meta-pill {
  background: rgba(10, 13, 20, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 6px 11px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.meta-pill span {
  color: var(--text-muted);
  margin-right: 4px;
}

.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.speedo-box {
  min-width: 220px;
  border-left: 4px solid var(--accent-red);
  margin-left: auto;
}

#hud.mobile-hud-layout .speedo-box {
  margin-left: auto;
  margin-right: auto;
}

.speed-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.speed-val {
  font-family: var(--font-mono);
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
}

.speed-unit {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.rpm-bar-outer {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  margin-top: 8px;
  overflow: hidden;
}

.rpm-bar-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981 0%, #f59e0b 70%, #ef4444 92%);
  transition: width 0.05s linear;
}

.pedal-bars {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.pedal-meter {
  flex: 1;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.pedal-fill.thr { background: #10b981; height: 100%; width: 0%; }
.pedal-fill.brk { background: #ef4444; height: 100%; width: 0%; }

/* Center Countdown & Notifications */
#center-banner {
  position: fixed;
  top: 32%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
  pointer-events: none;
  text-align: center;
}

.countdown-text {
  font-size: 6rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: 0 0 35px rgba(230, 46, 45, 0.9), 0 8px 20px rgba(0, 0, 0, 0.9);
  animation: popIn 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.countdown-text.go {
  color: #10b981;
  text-shadow: 0 0 35px rgba(16, 185, 129, 0.9), 0 8px 20px rgba(0, 0, 0, 0.9);
}

.toast-banner {
  margin-top: 12px;
  background: rgba(14, 17, 25, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-left: 4px solid var(--accent-amber);
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

@keyframes popIn {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.controls-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.key-badge {
  display: inline-block;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #fff;
}

/* Mobile Touch Controls Overlay (Shown ONLY if player selects "Sim" on mobile question) */
#mobile-controls {
  position: fixed;
  inset: 0;
  z-index: 16;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.mobile-top-actions {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.mob-top-btn {
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(15, 19, 28, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #f3f4f6;
  font-weight: 700;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  backdrop-filter: blur(8px);
  touch-action: manipulation;
  white-space: nowrap;
}

.mob-top-btn:active {
  background: rgba(239, 68, 68, 0.7);
  border-color: #f87171;
}

/* Left Side Steering Buttons (ESQ / DIR) */
.mobile-steer-cluster {
  position: absolute;
  bottom: 12px;
  left: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  pointer-events: auto;
}

/* Analog Virtual Joystick for Steering (Left Side Alternative) */
.mobile-joystick-zone {
  position: absolute;
  bottom: 12px;
  left: 14px;
  width: 130px;
  height: 130px;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.joystick-base {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 26, 38, 0.72) 0%, rgba(10, 13, 20, 0.88) 100%);
  border: 2px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65), inset 0 0 16px rgba(56, 189, 248, 0.14);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.joystick-base::before,
.joystick-base::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.joystick-base::before {
  width: 78%;
  height: 2px;
  border-radius: 1px;
}

.joystick-base::after {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

.joystick-arrows {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.38);
  pointer-events: none;
}

.joystick-knob {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f87171, #dc2626 65%, #991b1b 100%);
  border: 2px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.7), 0 0 10px rgba(239, 68, 68, 0.45);
  transform: translate3d(0px, 0px, 0px);
  pointer-events: none;
  transition: transform 0.04s linear;
}

.joystick-knob.active {
  transition: none;
  background: radial-gradient(circle at 35% 35%, #38bdf8, #0284c7 65%, #0369a1 100%);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.8), 0 0 14px rgba(56, 189, 248, 0.75);
}

/* Right Side Pedals (FREIO / ACEL) */
.mobile-pedal-cluster {
  position: absolute;
  bottom: 12px;
  right: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  pointer-events: auto;
}

.mob-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 19, 28, 0.74);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(6px);
  transition: transform 0.06s, background 0.08s, border-color 0.08s;
  touch-action: none;
  cursor: pointer;
}

.mob-btn.steer-btn {
  width: 72px;
  height: 68px;
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(14, 24, 38, 0.78);
}

.mob-btn.steer-btn .steer-arrow {
  font-size: 1.35rem;
  line-height: 1;
}

.mob-btn.pedal-brake {
  width: 76px;
  height: 76px;
  border-color: rgba(239, 68, 68, 0.65);
  background: rgba(45, 14, 18, 0.78);
}

.mob-btn.pedal-accel {
  width: 82px;
  height: 94px;
  border-color: rgba(16, 185, 129, 0.65);
  background: rgba(12, 42, 30, 0.78);
}

.mob-btn .pedal-title {
  font-size: 0.95rem;
  line-height: 1.1;
}

.mob-btn.active-touch {
  transform: scale(0.94);
  border-color: #ffffff;
  background: rgba(239, 68, 68, 0.65);
}

.mob-btn.steer-btn.active-touch {
  background: rgba(56, 189, 248, 0.65);
}

.mob-btn.pedal-accel.active-touch {
  background: rgba(16, 185, 129, 0.68);
}

.mob-btn span.sub {
  font-size: 0.56rem;
  letter-spacing: 0.05em;
  color: #d1d5db;
  margin-top: 3px;
  text-transform: uppercase;
}

/* Compact Mobile HUD Layout (Activated when player chooses "Sim" on mobile prompt) */
#hud.mobile-hud-layout {
  padding: 8px 12px;
}

#hud.mobile-hud-layout .hud-panel {
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(10, 13, 20, 0.68);
}

#hud.mobile-hud-layout .timing-grid {
  gap: 2px 10px;
}

#hud.mobile-hud-layout .timing-label {
  font-size: 0.56rem;
}

#hud.mobile-hud-layout .timing-value {
  font-size: 0.76rem;
}

#hud.mobile-hud-layout #hud-mode-label {
  font-size: 0.68rem !important;
}

#hud.mobile-hud-layout #hud-driver-name {
  font-size: 0.76rem !important;
}

#hud.mobile-hud-layout .timing-value.current {
  font-size: 0.94rem;
}

#hud.mobile-hud-layout .checkpoints-bar {
  margin-top: 4px;
  gap: 4px;
}

#hud.mobile-hud-layout .cp-pip {
  height: 4px;
}

#hud.mobile-hud-layout .hud-telemetry-right {
  gap: 5px;
}

#hud.mobile-hud-layout .meta-pills {
  gap: 4px;
}

#hud.mobile-hud-layout .meta-pill {
  padding: 3px 6px;
  font-size: 0.58rem;
  border-radius: 4px;
}

#hud.mobile-hud-layout #hud-minimap {
  width: 86px !important;
  height: 62px !important;
}

#hud.mobile-hud-layout .speedo-box {
  min-width: 124px;
  padding: 5px 10px;
  margin-left: auto;
  margin-right: auto;
  border-left-width: 3px;
}

#hud.mobile-hud-layout .speed-val {
  font-size: 1.45rem;
}

#hud.mobile-hud-layout .speed-unit {
  font-size: 0.65rem;
}

#hud.mobile-hud-layout #hud-rpm-text {
  font-size: 0.62rem !important;
}

#hud.mobile-hud-layout .rpm-bar-outer {
  height: 5px;
  margin-top: 4px;
}

#hud.mobile-hud-layout .pedal-bars {
  display: none;
}

/* Quick Chat Overlay for Online Multiplayer */
.quick-chat-cluster {
  position: absolute;
  top: 90px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(10, 13, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 6px 8px;
  backdrop-filter: blur(8px);
  z-index: 12;
  pointer-events: auto;
}

.chat-header-tag {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.quick-chat-buttons {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-preset-btn {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  padding: 4px 8px;
  color: #f1f5f9;
  font-size: 0.70rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  touch-action: manipulation;
}

.chat-preset-btn:hover, .chat-preset-btn:active {
  background: rgba(56, 189, 248, 0.35);
  border-color: #38bdf8;
  color: #ffffff;
}

#hud.mobile-hud-layout .quick-chat-cluster {
  top: 72px;
  right: 10px;
  padding: 4px 6px;
  gap: 3px;
}

#hud.mobile-hud-layout .chat-preset-btn {
  font-size: 0.60rem;
  padding: 3px 6px;
}

/* Custom Controls Keybinding Table */
.bindings-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 10px;
  margin-bottom: 12px;
}

.bindings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.binding-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}

@media (max-width: 640px) {
  .binding-grid { grid-template-columns: 1fr; }
}

.binding-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.32);
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.binding-label {
  font-size: 0.78rem;
  color: #e5e7eb;
  font-weight: 600;
}

.binding-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(30, 41, 59, 0.9);
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  min-width: 105px;
  text-align: center;
  transition: all 0.14s;
}

.binding-btn:hover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

.binding-btn.listening {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
  color: #fde68a;
  animation: pulseBind 0.9s infinite alternate;
}

@keyframes pulseBind {
  from { opacity: 0.7; }
  to { opacity: 1.0; }
}
