/* =========================================================
   Fantalega — Design tokens
   Bianco panna / grigio metallo / azzurro / blu notte
   ========================================================= */
:root {
  --cream: #F2ECDD;
  --cream-dim: #C9C2AE;
  --metal: #8B8F99;
  --metal-soft: #3C4356;
  --azure: #3B93E0;
  --azure-dim: #2A6EA8;
  --azure-glow: rgba(59, 147, 224, 0.35);
  --midnight: #0A1526;
  --midnight-2: #101F38;
  --midnight-3: #17294A;
  --danger: #D9635F;
  --danger-dim: #7A3230;

  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 9px;

  --font-display: 'Oswald', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'Roboto Mono', monospace;

  --nav-height: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html, body {
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }
    html::-webkit-scrollbar,
    body::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

body {
  background: var(--midnight);
  color: var(--cream);
  font-family: var(--font-body);
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2, h3 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--azure);
  outline-offset: 2px;
}

/* ---------- Page header ---------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 18px 14px;
  max-width: 640px;
  margin: 0 auto;
}
.page-title { font-size: 1.4rem; color: var(--cream); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--azure);
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 999px;
  padding: 11px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-small { padding: 8px 14px; font-size: 0.78rem; }
.btn-primary { background: var(--azure); color: var(--midnight); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--cream);
  border-color: var(--metal-soft);
}
.btn-danger { background: var(--danger); color: var(--midnight); }
.btn-block { width: 100%; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--midnight-2);
  border-top: 1px solid var(--midnight-3);
  display: flex;
  z-index: 50;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--metal);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  position: relative;
}
.nav-item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.nav-item.active { color: var(--azure); }
.nav-item.active::before {
  content: "";
  position: absolute;
  top: 2px;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: var(--azure);
  box-shadow: 0 0 8px var(--azure-glow);
}

/* ---------- Placeholder pages ---------- */
.placeholder-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 60px 24px;
  text-align: center;
}
.placeholder-main h2 { font-size: 1.6rem; margin-bottom: 10px; }
.placeholder-main p { color: var(--cream-dim); line-height: 1.5; }

/* ---------- Home hero ---------- */
.hero {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 22px 20px;
  position: relative;
}
.hero::before {
  content: "";
  position: absolute;
  top: -60px; right: -80px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, var(--azure-glow), transparent 70%);
  z-index: 0;
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; }
.hero-title {
  font-size: 2.4rem;
  line-height: 1.05;
  margin-top: 10px;
  color: var(--cream);
}
.hero-title span { color: var(--azure); }
.hero-sub {
  font-family: var(--font-body);
  color: var(--cream-dim);
  margin-top: 14px;
  line-height: 1.55;
  font-size: 0.95rem;
  max-width: 46ch;
}

.quick-links {
  max-width: 640px;
  margin: 26px auto 0;
  padding: 0 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quick-link {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--midnight-2);
  border: 1px solid var(--midnight-3);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--cream);
}
.quick-link .ql-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--midnight-3);
  display: flex; align-items: center; justify-content: center;
  color: var(--azure);
  flex-shrink: 0;
}
.quick-link .ql-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.quick-link .ql-text { flex: 1; }
.quick-link .ql-title { font-family: var(--font-display); text-transform: uppercase; font-size: 0.95rem; letter-spacing: 0.02em; }
.quick-link .ql-desc { font-size: 0.78rem; color: var(--metal); margin-top: 2px; }
.quick-link .ql-chevron { color: var(--metal-soft); }

/* ---------- Utility page ---------- */
.utility-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 14px 20px;
}
.status-msg {
  font-size: 0.85rem;
  background: var(--midnight-3);
  border: 1px solid var(--metal-soft);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
}
.status-msg.error { border-color: var(--danger-dim); color: #F0B9B6; }
.loading { color: var(--metal); text-align: center; padding: 40px 0; }

.teams-grid { display: flex; flex-direction: column; gap: 12px; }

.team-card {
  background: var(--midnight-2);
  border: 1px solid var(--midnight-3);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.team-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
}
.team-name-block { display: flex; align-items: baseline; gap: 8px; }
.team-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.team-credits {
  font-family: var(--font-mono);
  color: var(--azure);
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
}
.team-credits.low { color: var(--danger); }
.chevron { color: var(--metal); transition: transform 0.2s ease; flex-shrink: 0; }
.chevron svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
.team-card.open .chevron { transform: rotate(180deg); }

.team-body { display: none; border-top: 1px solid var(--midnight-3); }
.team-card.open .team-body { display: block; }

.role-group { padding: 12px 16px; border-top: 1px solid var(--midnight-3); }
.role-group:first-child { border-top: none; }
.role-header { display: flex; align-items: center; justify-content: space-between; }
.role-name { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--metal); }
.slot-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--midnight-3);
  color: var(--cream);
  padding: 2px 9px;
  border-radius: 999px;
}
.slot-pill.full { color: var(--azure); border: 1px solid var(--azure-dim); }

.player-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.player-item { display: flex; justify-content: space-between; font-size: 0.85rem; }
.player-name { color: var(--cream); }
.player-cost { font-family: var(--font-mono); color: var(--metal); }
.empty-role { font-size: 0.78rem; color: var(--metal-soft); font-style: italic; margin-top: 6px; }

.add-player-row { padding: 10px 16px 16px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 21, 38, 0.72);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
}
@media (min-width: 480px) {
  .modal-overlay { align-items: center; padding: 20px; }
}
.modal {
  background: var(--midnight-2);
  border: 1px solid var(--midnight-3);
  border-radius: 22px 22px 0 0;
  width: 100%;
  max-width: 420px;
  padding: 24px 22px calc(24px + var(--safe-bottom));
}
@media (min-width: 480px) {
  .modal { border-radius: var(--radius-lg); }
}
.modal h2 { font-size: 1.15rem; margin-bottom: 6px; }
.modal-subtitle { color: var(--cream-dim); font-size: 0.85rem; line-height: 1.4; margin: 0 0 16px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 0.82rem; color: var(--metal); }
.field input,
.field select {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--cream);
  background: var(--midnight-3);
  border: 1px solid var(--metal-soft);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
}
.field input:focus,
.field select:focus { border-color: var(--azure); }
.field select:disabled { opacity: 0.5; }

.field-error {
  color: var(--danger);
  font-size: 0.82rem;
  margin: -6px 0 14px;
}

.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions .btn { flex: 1; }

.modal-overlay[hidden] {
  display: none !important;
}


/* Pulsante rimuovi giocatore */
.player-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.remove-player-btn {
  background: none;
  border: none;
  color: var(--metal);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 4px;
  line-height: 1;
}
.remove-player-btn:hover {
  color: var(--danger);
}

/* Icona rename */
.rename-btn {
  background: none;
  border: none;
  color: var(--metal);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  padding: 4px;
}
.rename-btn:hover {
  color: var(--azure);
}

/* Stile select con freccia personalizzata */
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238B8F99' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.field select:hover {
  border-color: var(--azure);
}

.page-main,
.utility-main,
.overview-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 18px 20px;
}