:root {
  /* Cambia qui il tuo sfondo */
  --bg-url: url('sfondo.png');
  --surface: rgba(255, 255, 255, 0.55);
  --text: #161616ff;
  --muted: rgba(53, 53, 53, 0.75);
  --accent: #127ed0ff;
  --danger: #ef4444;
}

/* Reset minimo */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji',
    'Segoe UI Emoji';
  font-size: 16px;
}

/* Backdrop immagine: unico per tutti gli stati */
#bg-image {
  position: fixed;
  inset: 0;
  background-image: var(--bg-url);
  background-size: cover;
  background-position: center;
  z-index: -3;
}

/* Layer del video di Pingu: resta “sullo sfondo” ma sopra l’immagine */
#pingu-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none; /* non blocca i click dell'UI */
  overflow: hidden;
}

/* Lo sprite (GIF) mantiene il ratio, poggiato in basso e mosso via JS */
#pingu-sprite {
  position: absolute;
  bottom: 5vh; /* “terra” */
  left: -500; /* x iniziale, poi JS lo muove */
  height: 34vmin; /* grandezza relativa */
  width: auto;
  transform: translateX(0) scaleX(1);
  will-change: transform;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}

#dino-sprite {
  position: absolute;
  bottom: 2vh; /* “terra” */
  left: -1500; /* x iniziale, poi JS lo muove */
  height: 40vmin; /* grandezza relativa */
  width: auto;
  transform: translateX(0) scaleX(1);
  will-change: transform;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}

/* Layout principale */
.container {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#contenuto {
  flex: 1;
  justify-content: center;
  align-items: center;
  display: flex;
  padding-bottom: 34vmin; /* spazio per Pingu */
}

#contenuto.finished {
  padding-bottom: 0;
}

/* Card UI */
.card {
  width: min(720px, 92vw);
  background: var(--surface);
  backdrop-filter: blur(8px);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
}
.card h2 {
  margin: 0 0 24px;
}

.card#finished {
  text-align: center;
  font-size: 18px;
}

.card#finished .actions {
  justify-content: center;
}

.hidden {
  display: none !important;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
  margin-top: 24px;
}
label span {
  display: block;
  opacity: 0.9;
  margin-bottom: 6px;
}
input[type='number'] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--muted);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  outline: none;
  font-size: 16px;
}
input[type='number']:focus {
  border-color: var(--accent);
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}
.btn {
  font-size: 16px;
  font-weight: 600;
  padding: 16px 32px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  background: rgb(0 0 0);
  color: white;
}
.btn.primary {
  background: var(--accent);
  color: white;
}
.btn.primary:hover {
  filter: brightness(0.95);
}
.btn.danger {
  background: transparent;
  border: 2px solid var(--danger);
  color: var(--danger);
}
.btn.danger:hover {
  background: rgba(255, 255, 255, 0.5);
}
.btn.outline {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
}
.btn.outline:hover {
  background: rgba(255, 255, 255, 0.5);
}
.btn.all {
  text-align: center;
  width: 100%;
}

.heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.time {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-size: clamp(48px, 11vw, 240px);
  font-weight: 700;
  line-height: 1;
  margin: 12px 0 4px;
  color: var(--accent);
}

.topbar img {
  width: 35%;
  min-width: 200px;
}

.topbar {
  width: 100%;
  padding: 24px 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
}

#running {
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.noot-video {
  width: 100%;
  max-height: 40vh;
  display: block;
  margin-top: 10px;
  border-radius: 16px;
  object-fit: contain;
}

/* Responsive piccoli schermi */
@media (max-width: 520px) {
  .grid {
    grid-template-columns: 1fr;
  }
}
