/* =====================
   RESET E BASE
===================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
}

body {
  background: #f9f9f9;
  color: #333;
  padding: 10px;
}

/* =====================
   TITOLO
===================== */
.title-container {
  text-align: center;
  font-size: 24px;
  margin-bottom: 15px;
}

.title-container img {
  width: 20px;
  vertical-align: middle;
  margin-left: 5px;
}

/* =====================
   CONTAINER GENERICO
===================== */
.container {
  background: #fff;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* =====================
   HIDDEN
===================== */
.hidden {
  display: none;
}

/* =====================
   BOX INSTALL
===================== */
#installInstructions {
  background:#f4d03f;
  color:#000;
  padding:10px;
  margin-bottom:10px;
  border-radius:8px;
  text-align:center;
  position: relative;
}

#installInstructions button {
  margin-top: 10px;
  padding: 6px 12px;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: #000;
  color: #f4d03f;
  transition: 0.3s;
}

#installInstructions button:hover {
  background: #333;
}

/*===================*/

.close-install {
  position: absolute;
  top: 5px;
  right: 5px;
  background: transparent;
  border: none;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
}

/* =====================
   SETUP PARTITA
===================== */
#setup label,
#setup select,
#setup input {
  display: block;
  margin: 5px 0 10px 0;
  width: 100%;
  padding: 5px;
  font-size: 14px;
}

#setup button {
  margin-top: 10px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}

/* =====================
   SCOREBOARD
===================== */
.scoreboard {
  display: flex;
  justify-content: space-around;
  margin-bottom: 15px;
}

.scoreboard .coppia {
  text-align: center;
  width: 45%;
}

.scoreboard .score {
  font-size: 28px;
  font-weight: bold;
  margin-top: 5px;
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  min-width: 50px;
}

.vincitore {
  background-color: #4CAF50;
  color: #fff;
}

/* =====================
   COLONNE PUNTI
===================== */
.columns {
  display: flex;
  gap: 20px;
  margin-bottom: 10px;
}

.columns .col {
  flex: 1;
  background:  #04B127;
  padding: 10px;
  border-radius: 5px;
}

.columns .col h3 {
  text-align: center;
  margin-bottom: 8px;
}

.columns .col input {
  width: 100%;
  padding: 5px;
  margin-bottom: 8px;
}

/* =====================
   COPPIE 4 GIOCATORI
===================== */
.coppia {
  display: flex;
  flex-direction: column; /* label sopra riga input */
  gap: 5px;
  margin-bottom: 15px;
  padding: 10px;
  border-radius: 8px;
}

.coppia1 {
  background-color: rgba(244, 208, 63, 0.2); /* giallo chiaro trasparente */
}

.coppia2 {
  background-color: rgba(52, 152, 219, 0.2); /* blu chiaro trasparente */
}

.labelCoppia {
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  font-family: "Arial", sans-serif; /* Cambia font qui facilmente */
}

.coppia input,
.coppia select {
  width: 100%;          /* riempie tutto il div genitore */
  box-sizing: border-box;
}

/* Contenitore riga input */
.coppia > div:last-child {
  display: flex;
  gap: 10px;
}

/* Ogni input + select dentro la riga */
.coppia > div:last-child > div {
  flex: 1;             /* tutti i campi occupano lo stesso spazio */
  display: flex;
  flex-direction: column; /* input sopra select, se necessario */
}






/* =====================
   BOTTONI
===================== */
button {
  background-color: #1b6b52;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  margin-top: 5px;
}

button:hover {
  background-color: #14513b;
}

/* =====================
   STORICO PARTITE
===================== */
/* =====================
   STORICO PARTITE
===================== */
.storicoPartite button {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 6px;
  background: #f4d03f;
  font-weight: bold;
  cursor: pointer;
  border: none;
  transition: 0.3s;
}

.storicoPartite button:hover {
  background: #e0c13f;
}

/* Background e stile storico */
#storicoWrapper {
  margin-top: 10px;
  overflow-x: auto;
}

.storicoPartite {
  background: rgba(255,255,255,0.1); /* sfondo trasparente */
  margin: 6px 0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.3s;
}

/* Hover effetto per lo storico */
.storicoPartite:hover {
  background: rgba(244, 208, 63, 0.2); /* giallo chiaro trasparente */
}

/* Sezione tabella */
#storicoPartiteTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

/* Le righe della tabella */
#storicoPartiteTable th, #storicoPartiteTable td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  text-align: center;
}

/* Classe per evidenziare i vincitori */
.vincitoreStorico {
  color: #f4d03f;
  font-weight: bold;
}

/* Transizione per mostrare/nascondere lo storico */
#storicoPartite.show {
  display: block;
  opacity: 1;
  transition: opacity 0.3s ease-in-out;
}

#storicoPartite.hide {
  opacity: 0;
  display: none;
}

/* =====================
   RESPONSIVE
===================== */
@media (max-width: 600px) {
  .columns {
    flex-direction: column;
  }

  .scoreboard {
    flex-direction: column;
    gap: 10px;
  }

  .scoreboard .coppia {
    width: 100%;
  }
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  font-family: Arial, sans-serif;
  background: linear-gradient(to bottom,#0a2d1f,#145a43);
  color: #fff;
  margin: 0;
  padding: 10px;
}

/* TITOLI */
h1, h2 {
  text-align: center;
}

/* CONTAINER */
.container {
  max-width: 720px;
  margin: auto;
  background: #1b6b52;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* UTILITY */
.hidden { display: none; }

/* FORM */
input, select, button {
  width: 100%;
  padding: 10px;
  margin: 6px 0;
  border-radius: 8px;
  border: none;
  font-size: 16px;
}

input::placeholder {
  color: #ccc;
}

/* BOTTONI */
button {
  background: #f4d03f;
  color: #000;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
}

button:hover {
  background: #e0c13f;
}

button:disabled {
  background: #888;
  cursor: not-allowed;
}

/* SCORE */
.scoreboard {
  display: flex;
  justify-content: space-between;
  margin: 15px 0;
    flex-direction: row;
}

.score {
  font-size: 28px;
  font-weight: bold;
  padding: 5px;
  border-radius: 6px;
  text-align: center;
}

.vincitore {
  animation: lampeggio 1s infinite alternate;
}

@keyframes lampeggio {
  from { background-color: #f4d03f; color: #000; }
  to { background-color: #fff; color: #000; }
}

/* COLONNE */
.columns {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
    flex-direction: row;
}

.col {
  flex: 1;
  background: #276b50;
  padding: 15px;
  border-radius: 10px;
}

.col h3 {
  text-align: center;
  margin-top: 0;
  font-size: 18px;
}

/* STORICO */
.mano {
  border-top: 1px solid #fff;
  margin-top: 10px;
  padding-top: 6px;
  font-size: 14px;
}

/*.filtro {
  margin-bottom: 5px;
  padding: 5px;
  border-radius: 6px;
  font-size: 14px;
}*/

.filtro {
  display: none;
}

#setup input.filtro {
  display: none;
}

.storicoPartite {
  background: rgba(255,255,255,0.1);
  margin: 5px 0;
  padding: 6px;
  border-radius: 6px;
  font-size: 14px;
}

.storicoPartite b {
  color: #f4d03f;
}

/* TITOLO */
.title-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 28px;
  font-weight: bold;
}

.title-container img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

/* INSTALL BOX */
#installInstructions {
  background: #f4d03f;
  color: #000;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 8px;
  text-align: center;
}

#installBtn {
  display: none;
  margin-bottom: 10px;
}

/* Layout a diamante per i nomi dei giocatori */
/* Allarga il contenitore principale del tavolo */
.tavolo-nomi {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin: 20px auto;
  width: 100%;
  max-width: 500px; /* Aumentato per dare più spazio */
}

/* Espande i contenitori delle coppie e i loro input */
.coppia-A, .coppia-B {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 50%;
}

/* Forza gli input e i select ad occupare tutto lo spazio del loro contenitore */
.tavolo-nomi select, 
.tavolo-nomi input[type="text"] {
  width: 100%;
  min-width: 150px; /* Dimensione minima per non farli diventare troppo piccoli */
  padding: 10px;
  font-size: 16px; /* Migliora la leggibilità su mobile */
  border-radius: 8px;
}

/* Gestione della riga centrale (Ovest ed Est) */
.tavolo-centro {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  gap: 30px; /* Spazio tra i due giocatori laterali */
}

/* Assicura che i contenitori Ovest ed Est non collassino */
.tavolo-centro > div {
  flex: 1; 
}

.coppia-A select { border: 2px solid #f4d03f; } /* Giallo per Nord-Sud */
.coppia-B select { border: 2px solid #1b6b52; } /* Verde per Est-Ovest */