@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,600;0,800;1,600&family=Plus+Jakarta+Sans:wght@400;600;700;800&display=swap');

:root {
  --bg-table: radial-gradient(circle at 50% 30%, #0d4a36 0%, #06241a 70%, #02110c 100%);
  --gold-main: #f1c40f;
  --gold-light: #fef08a;
  --gold-gradient: linear-gradient(135deg, #fef08a 0%, #f1c40f 50%, #b7950b 100%);
  --panel-bg: rgba(4, 26, 18, 0.9);
  --font-title: 'Playfair Display', serif;
  --font-ui: 'Plus Jakarta Sans', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }

body {
  font-family: var(--font-ui);
  background: var(--bg-table);
  color: #f8fafc;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 850px;
  background: var(--panel-bg);
  border: 3px solid;
  border-image: var(--gold-gradient) 1;
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), inset 0 0 40px rgba(0, 0, 0, 0.6);
  position: relative;
  backdrop-filter: blur(12px);
}

h1 {
  font-family: var(--font-title);
  font-size: 2.5rem;
  text-align: center;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 5px 15px rgba(0,0,0,0.5);
  margin-bottom: 20px;
}

h2, h3 {
  font-family: var(--font-title);
  text-align: center;
  color: var(--gold-light);
  margin-bottom: 15px;
}

.screen {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.3s ease-in-out;
}

.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

button, .btn {
  background: var(--gold-gradient);
  color: #111827;
  border: none;
  padding: 14px 24px;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
  transition: all 0.2s ease;
  text-align: center;
}

button:hover { transform: translateY(-2px); filter: brightness(1.05); }
button:active { transform: translateY(1px); }

.btn-secondary {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  color: #f3f4f6;
  border: 1px solid rgba(241, 196, 15, 0.3);
}

.form-group { display: flex; flex-direction: column; gap: 6px; }

label { font-weight: 700; color: #e5e7eb; font-size: 0.95rem; }

input[type="text"], input[type="number"], select {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(241, 196, 15, 0.4);
  background: rgba(3, 15, 11, 0.8);
  color: #fff;
  font-size: 1rem;
  font-family: var(--font-ui);
  outline: none;
}

.cards-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
  min-height: 135px;
  padding: 16px;
  background: rgba(2, 13, 9, 0.6);
  border: 1px solid rgba(241, 196, 15, 0.2);
  border-radius: 18px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

.card {
  width: 78px;
  height: 118px;
  background-color: #ffffff;
  border: 2px solid #1e293b;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px;
  user-select: none;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0,0,0,0.4);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover { transform: translateY(-6px); }
.card.selected {
  transform: translateY(-14px);
  border: 3px solid #dc2626;
  box-shadow: 0 0 15px #dc2626;
}

.card.coppe, .card.denari { color: #dc2626; }
.card.spade, .card.bastoni { color: #000000; }

.card-val { font-size: 1.4rem; font-weight: 900; line-height: 1; }
.card-suit { font-size: 2rem; align-self: center; line-height: 1; }

.info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(3, 15, 11, 0.85);
  border: 1px solid rgba(241, 196, 15, 0.3);
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 0.95rem;
}

.info-bar strong { color: var(--gold-light); }

.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(3, 11, 8, 0.9);
  justify-content: center;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.modal-content {
  background: linear-gradient(135deg, #0d281e 0%, #04120c 100%);
  border: 2px solid;
  border-image: var(--gold-gradient) 1;
  padding: 24px;
  border-radius: 20px;
  max-width: 520px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.rules-text { font-size: 0.9rem; line-height: 1.6; color: #e5e7eb; }
.rules-text h3 { margin-top: 14px; text-align: left; font-size: 1.1rem; }

#privacy-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle at center, #0f3d2e 0%, #061a13 100%);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 25px;
  z-index: 25;
}

.bussa-btn {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: white;
  border: 2px solid #fca5a5;
  padding: 10px 20px;
  font-size: 0.9rem;
}

.pwa-step {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(241, 196, 15, 0.2);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  text-align: left;
}