/* ==========================================================================
   SAVONA ANARCHY: Retro-Cinematic Platformer Styling
   Ispirato a Prince of Persia & Another World con estetica brutalista milanese,
   letterboxing cinematografico, micro-tipografia e accenti rosso anarchia.
   ========================================================================== */

:root {
  --color-bg: #090a0d;
  --color-surface: rgba(14, 17, 22, 0.94);
  --color-surface-border: rgba(255, 255, 255, 0.14);
  --color-accent: #e74c3c;        /* Rosso anarchia */
  --color-accent-hover: #c0392b;
  --color-yellow: #f1c40f;
  --color-text-main: #f8f9fa;
  --color-text-muted: #a4b0be;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", Menlo, monospace;
}

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

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

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#ui-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.clickable {
  pointer-events: auto;
}

/* ==========================================================================
   SCHERMATA START & GAME OVER
   ========================================================================== */

#start-screen, #game-over-screen {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 14, 0.88);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  z-index: 40;
}

.hidden {
  display: none !important;
}

.start-card, .game-over-card {
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: 4px;
  max-width: 640px;
  width: 100%;
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9);
}

.brand-badge {
  display: inline-block;
  background: var(--color-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 2px;
  margin-bottom: 12px;
}

.brand-badge.danger {
  background: #c0392b;
}

.game-title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -1px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.game-title span {
  color: var(--color-accent);
}

.game-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.55;
  margin-bottom: 24px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 28px;
  text-align: left;
}

.control-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.key-badge {
  background: #20242c;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 2px;
  min-width: 38px;
  text-align: center;
}

.control-desc {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.control-sub {
  display: block;
  font-size: 11px;
  color: var(--color-text-muted);
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 14px 28px;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  width: 100%;
  transition: background 0.18s ease;
}

.btn-primary:hover {
  background: var(--color-accent-hover);
}

.btn-primary.danger {
  background: #c0392b;
}

/* ==========================================================================
   HUD DI GIOCO
   ========================================================================== */

.hud-top-bar {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
}

.stats-card {
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: 4px;
  padding: 10px 20px;
  display: flex;
  gap: 24px;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
}

.stat-value {
  font-size: 22px;
  font-weight: 900;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.stat-value.highlight {
  color: var(--color-accent);
}

/* Game Over Card */
.go-title {
  font-size: 30px;
  font-weight: 900;
  color: #e74c3c;
  margin-bottom: 8px;
}

.go-desc {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 22px;
}

.go-stats {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-around;
  font-size: 13px;
  color: #ccc;
}

.go-stats strong {
  color: #fff;
  font-size: 18px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   CONTROLLI TOUCH
   ========================================================================== */

#touch-controls {
  position: absolute;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 20px;
  right: 20px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}

@media (max-width: 900px), (pointer: coarse) {
  #touch-controls {
    display: flex;
  }
}

.touch-cluster {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.btn-touch {
  width: 58px;
  height: 58px;
  border-radius: 4px;
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  transition: background 0.1s;
}

.btn-touch:active {
  background: var(--color-accent);
}
