/* ── Widescreen row layout ── */
.app {
  padding: 0;
  display: flex;
  flex-direction: row;
  gap: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  align-items: stretch;
}

.sidebar {
  width: 110px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px 8px;
  background: var(--surface);
}

.sidebar-left  { border-right: 1px solid var(--border); }
.sidebar-right { border-left:  1px solid var(--border); }

.sidebar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hud-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hud-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  min-width: 3ch;
  text-align: center;
}

.sidebar-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 90%;
}

.sidebar-btns .btn {
  width: 100%;
  font-size: 0.72rem;
  padding: 6px 4px;
}

#lives-display {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  max-width: 80px;
}
#lives-display svg {
  width: 14px;
  height: 14px;
}

/* ── Board ── */
.board-wrapper {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: stretch;
}

.board {
  position: relative;
  width: 100%;
  background: #000010;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* ── Overlay ── */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 16, 0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 20;
  animation: fadein 0.35s ease;
}
.overlay[hidden] { display: none; }

.overlay-title {
  font-size: clamp(24px, 6vmin, 48px);
  font-weight: 900;
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 0 0 20px rgba(255,255,180,0.7);
}

.overlay-sub {
  font-size: clamp(12px, 2.5vmin, 17px);
  color: #aadaff;
  letter-spacing: 1px;
  min-height: 1.4em;
  text-align: center;
}

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

/* ── Mobile controls ── */
.mobile-controls {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 12px;
  pointer-events: none;
  z-index: 15;
}

.mc-left {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.mc-right {
  pointer-events: auto;
}

.mc-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.75);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s, border-color 0.1s;
}

.mc-btn:active, .mc-btn.pressed {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.7);
}

.mc-fire {
  width: 62px;
  height: 62px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  border-color: rgba(255,180,60,0.6);
  color: rgba(255,220,100,0.9);
  background: rgba(255,140,0,0.1);
}
.mc-fire:active, .mc-fire.pressed {
  background: rgba(255,140,0,0.28);
  border-color: rgba(255,200,60,0.9);
}

@media (pointer: fine) {
  .mobile-controls { display: none; }
}
@media (pointer: coarse) {
  .sidebar-btns { display: none; }
}

/* ── Mobile: stack vertically ── */
@media (max-width: 540px) {
  .app {
    flex-direction: column;
    height: auto !important;
  }
  .sidebar {
    flex-direction: row;
    width: 100%;
    height: auto;
    padding: 6px 16px;
    justify-content: space-around;
    gap: 12px;
  }
  .sidebar-left  { border-right: none; border-bottom: 1px solid var(--border); order: 1; }
  .sidebar-right { border-left:  none; border-top:    1px solid var(--border); order: 3; }
  .board-wrapper { order: 2; }
  .sidebar-item  { flex-direction: row; align-items: baseline; gap: 6px; }
  .hud-value     { font-size: 1.2rem; }
  .sidebar-btns  { flex-direction: row; width: auto; }
  #game-canvas   { width: 100%; height: auto; aspect-ratio: 1/1; }
}
