* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #111827;
  color: #f9fafb;
}

.game-shell {
  width: 100vw;
  height: 100vh;
}

.canvas-wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.canvas-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 28px;
  pointer-events: none;
}

.canvas-overlay.hidden {
  display: none;
}

.canvas-overlay:not(.hidden) {
  pointer-events: auto;
}

.canvas-overlay-panel {
  background: rgba(17, 24, 39, 0.92);
  border: 2px solid #10b981;
  border-radius: 8px;
  padding: 14px 24px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.canvas-overlay-hint {
  margin: 0;
  color: #d1d5db;
  font-size: 15px;
}

.back-to-gym-btn {
  padding: 12px 28px;
  font-size: 16px;
  font-weight: bold;
  color: #052e16;
  background: #22c55e;
  border: 2px solid #16a34a;
  border-radius: 6px;
  cursor: pointer;
}

.back-to-gym-btn:hover {
  background: #16a34a;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #1f2937;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hud-panel {
  position: absolute;
  width: min(320px, 28vw);
  background: #1f2937;
  border: 2px solid #374151;
  padding: 16px;
  color: #f9fafb;
  pointer-events: auto;
}

.hud-left-stack {
  position: absolute;
  top: 18px;
  left: 18px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: min(260px, 30vw);
  z-index: 1;
  pointer-events: none;
}

.hud-left-stack > .hud-panel {
  position: relative;
  inset: auto;
  width: 100%;
  pointer-events: auto;
}

.calories-panel {
  border-color: #059669;
  background: linear-gradient(160deg, #1f2937 0%, #111827 100%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.calories-line {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.hud-instructions h1 {
  margin: 0 0 12px;
  font-size: 24px;
}

.hud-instructions p {
  margin: 6px 0;
}

.hr-monitor-panel {
  border-color: #9f1239;
  background: linear-gradient(160deg, #1f2937 0%, #111827 100%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.hr-monitor-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fecaca;
}

.hr-monitor-bpm {
  margin: 4px 0;
  font-size: 26px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  color: #f9fafb;
}

.hr-monitor-zone {
  margin: 6px 0 0;
  font-size: 14px;
  color: #d1d5db;
}

.hud-instructions {
  top: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.body-stats-panel {
  bottom: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.hud-instructions h1,
.hud-instructions p,
.body-stats-panel h3,
.body-stats-panel p {
  align-self: flex-end;
  max-width: 100%;
}

.body-stats-panel h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
  color: #e5e7eb;
}

.body-stats-panel p {
  margin: 4px 0;
  color: #d1d5db;
  font-size: 14px;
}

.dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.dialog.hidden {
  display: none;
}

.dialog-content {
  background: #1f2937;
  border: 3px solid #374151;
  padding: 32px;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.dialog-content h2 {
  margin-top: 0;
  margin-bottom: 24px;
  color: #f9fafb;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #d1d5db;
}

.form-group input {
  width: 100%;
  padding: 8px;
  border: 1px solid #374151;
  background: #111827;
  color: #f9fafb;
  border-radius: 4px;
  font-size: 14px;
}

.difficulty-buttons {
  display: flex;
  gap: 8px;
}

.difficulty-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid #374151;
  background: #111827;
  color: #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s ease;
}

.difficulty-btn:hover {
  border-color: #6366f1;
  color: #f9fafb;
}

.difficulty-btn.active {
  background: #6366f1;
  border-color: #6366f1;
  color: #f9fafb;
}

.start-btn {
  width: 100%;
  padding: 12px;
  background: #10b981;
  color: #f9fafb;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s ease;
  margin-top: 16px;
}

.start-btn:hover {
  background: #059669;
}

.setup-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.minigame-btn {
  padding: 12px;
  background: #3b82f6;
  color: #f9fafb;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.minigame-btn:hover {
  background: #2563eb;
}

.cancel-btn {
  padding: 12px;
  background: #ef4444;
  color: #f9fafb;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.cancel-btn:hover {
  background: #dc2626;
}

.startup-actions .start-btn,
.startup-actions .minigame-btn,
.startup-actions .cancel-btn {
  width: 100%;
}

.startup-actions .minigame-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-group input[type="checkbox"] {
  margin-right: 8px;
  width: auto;
  cursor: pointer;
}

.form-group input[type="checkbox"] + label {
  display: inline;
  margin: 0;
}
