/* -----------------------------------------------------------------
 * Wedding Game — stile mobile-first, festoso e ad alto contrasto.
 * Desktop semplicemente centra la colonna mobile, più avanti
 * possiamo differenziare con media query.
 * ----------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

:root {
  --c-bg-main: #00656e;
  --c-bg-1: #5b2ab3;
  --c-bg-2: #ff3d88;
  --c-bg-3: #ff8a3d;
  --c-surface: rgba(255, 255, 255, 0.14);
  --c-surface-strong: rgba(255, 255, 255, 0.95);
  --c-text: #e86800;
  --c-text-dark: #1f1145;
  --c-muted: rgba(232, 104, 0, 0.78);
  --c-primary: #ffd23f;
  --c-primary-hover: #ffde6c;
  --c-danger: #ff3d3d;
  --c-danger-hover: #ff6363;
  --c-success: #2ee59d;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-pill: 999px;

  --shadow-card: 0 18px 40px rgba(0, 30, 35, 0.35);
  --shadow-btn: 0 10px 22px rgba(0, 50, 58, 0.35);

  --font-display: 'EB Garamond', Garamond, 'Palatino Linotype', Palatino, Georgia,
    serif;
  --font-body: 'EB Garamond', Garamond, 'Palatino Linotype', Palatino, Georgia, serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--c-text);
  background: var(--c-bg-main);
  background-attachment: fixed;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Bolle di sfondo animate --------------------------------------------------- */
.bg-bubbles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.bg-bubbles span {
  position: absolute;
  bottom: -120px;
  width: 40px;
  height: 40px;
  background: rgba(232, 104, 0, 0.14);
  border-radius: 50%;
  animation: rise 18s linear infinite;
}
.bg-bubbles span:nth-child(1) { left: 10%;  width: 30px; height: 30px; animation-duration: 20s; }
.bg-bubbles span:nth-child(2) { left: 30%;  width: 70px; height: 70px; animation-duration: 24s; animation-delay: 3s; }
.bg-bubbles span:nth-child(3) { left: 55%;  width: 20px; height: 20px; animation-duration: 14s; animation-delay: 6s; }
.bg-bubbles span:nth-child(4) { left: 75%;  width: 55px; height: 55px; animation-duration: 22s; animation-delay: 2s; }
.bg-bubbles span:nth-child(5) { left: 90%;  width: 40px; height: 40px; animation-duration: 26s; animation-delay: 8s; }

@keyframes rise {
  0%   { transform: translateY(0) scale(0.9); opacity: 0; }
  10%  { opacity: 0.8; }
  100% { transform: translateY(-120vh) scale(1.1); opacity: 0; }
}

/* Layout -------------------------------------------------------------------- */
.container {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding:
    calc(24px + var(--safe-top))
    20px
    calc(32px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 100dvh;
}
.container--narrow {
  max-width: 440px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.stack--sm { gap: 10px; }
.stack--lg { gap: 22px; }

/* Hero ---------------------------------------------------------------------- */
.hero {
  text-align: center;
  padding-top: 8px;
}
.hero__logo {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  background: linear-gradient(135deg, #ffd23f, #ff3d88);
  display: inline-grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  color: #2a0e55;
  margin-bottom: 14px;
  box-shadow: 0 12px 30px rgba(255, 61, 136, 0.4);
  transform: rotate(-4deg);
}
.hero__title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.22);
}
.hero__subtitle {
  color: var(--c-muted);
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}

/* Topbar -------------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 2px;
}
.topbar__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  margin: 0;
  flex: 1;
  text-align: center;
}
.topbar__back {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.12);
  color: var(--c-text);
  border: none;
  display: grid;
  place-items: center;
  font-size: 22px;
  text-decoration: none;
  cursor: pointer;
}
.topbar__back:active { transform: scale(0.95); }

/* Card / input -------------------------------------------------------------- */
.card {
  background: var(--c-surface-strong);
  color: var(--c-text-dark);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
}
.card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  margin: 0 0 6px;
}
.card__subtitle {
  margin: 0 0 16px;
  color: #5b4b82;
  font-size: 15px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field__label {
  font-size: 13px;
  font-weight: 700;
  color: #5b4b82;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(91, 42, 179, 0.15);
  background: #ffffff;
  color: var(--c-text-dark);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus {
  outline: none;
  border-color: #e86800;
  box-shadow: 0 0 0 4px rgba(232, 104, 0, 0.22);
}
.input--code {
  text-align: center;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 10px;
  text-transform: uppercase;
  padding-left: 26px; /* compensa letter-spacing */
}

/* Bottoni ------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--block { width: 100%; }
.btn--sm { min-height: 40px; padding: 0 14px; font-size: 14px; }

.btn--primary {
  background: linear-gradient(135deg, #ffd23f, #ff8a3d);
  color: #2a0e55;
  box-shadow: var(--shadow-btn);
}
.btn--primary:hover { background: linear-gradient(135deg, #ffde6c, #ffa366); }

.btn--secondary {
  background: rgba(0, 0, 0, 0.12);
  color: var(--c-text);
  border: 1px solid rgba(232, 104, 0, 0.35);
}
.btn--secondary:hover { background: rgba(0, 0, 0, 0.18); }

.btn--ghost {
  background: rgba(0, 0, 0, 0.1);
  color: var(--c-text);
}
.btn--ghost:hover { background: rgba(0, 0, 0, 0.16); }

.card .btn--ghost {
  background: rgba(91, 42, 179, 0.1);
  color: var(--c-bg-1);
}
.card .btn--ghost:hover { background: rgba(91, 42, 179, 0.18); }

.btn--danger {
  background: var(--c-danger);
  color: white;
}
.btn--danger:hover { background: var(--c-danger-hover); }

/* Stato / pill -------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  background: rgba(46, 229, 157, 0.18);
  color: #0f7f4e;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.pill--ghost {
  background: rgba(0, 0, 0, 0.1);
  color: var(--c-text);
}
.pill--count {
  background: rgba(91, 42, 179, 0.15);
  color: var(--c-bg-1);
  margin-left: 6px;
}
.pill--playing { background: rgba(255, 138, 61, 0.2); color: #b24612; }
.pill--closed  { background: rgba(255, 61, 61, 0.18);  color: #a41212; }

/* Form errors --------------------------------------------------------------- */
.form-error {
  margin: 0;
  color: var(--c-danger);
  background: rgba(255, 61, 61, 0.1);
  border: 1px solid rgba(255, 61, 61, 0.25);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
}

/* Footer -------------------------------------------------------------------- */
.footer {
  margin-top: auto;
  text-align: center;
  padding-top: 20px;
}
.ghost-link {
  color: var(--c-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px dashed rgba(232, 104, 0, 0.45);
  padding-bottom: 2px;
}
.ghost-link:hover { color: var(--c-text); }

/* Section heading ----------------------------------------------------------- */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0;
}
.section-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
}
.section-heading--tight {
  margin-bottom: 14px;
}

.empty-state {
  text-align: center;
  color: var(--c-muted);
  font-size: 15px;
  padding: 14px;
  border: 1px dashed rgba(232, 104, 0, 0.35);
  border-radius: var(--radius-md);
}
.card .empty-state {
  color: #7b6ba0;
  border-color: rgba(91, 42, 179, 0.25);
}

/* Lobby code card ----------------------------------------------------------- */
.code-card {
  background: linear-gradient(135deg, #ffd23f, #ff3d88);
  color: #2a0e55;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  text-align: center;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.code-card__label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.7;
}
.code-card__value {
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 700;
  letter-spacing: 10px;
  padding-left: 10px;
  line-height: 1;
}
.code-card .btn--ghost {
  background: rgba(42, 14, 85, 0.12);
  color: #2a0e55;
}
.code-card .btn--ghost:hover {
  background: rgba(42, 14, 85, 0.2);
}

/* Lista giocatori ----------------------------------------------------------- */
.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 8px;
  background: rgba(91, 42, 179, 0.08);
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 14px;
  color: var(--c-text-dark);
}
.player-chip__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  color: white;
  font-size: 13px;
  background: linear-gradient(135deg, #ff3d88, #5b2ab3);
}
.player-chip__status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-success);
  box-shadow: 0 0 0 3px rgba(46, 229, 157, 0.25);
}
.player-chip__status--off {
  background: #b3b3c2;
  box-shadow: 0 0 0 3px rgba(150, 150, 170, 0.25);
}
.player-chip__kick {
  margin-left: 4px;
  border: none;
  background: transparent;
  color: var(--c-danger);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* Game picker --------------------------------------------------------------- */
.game-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.game-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(91, 42, 179, 0.06);
  border: 2px solid transparent;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.game-card:hover {
  background: rgba(91, 42, 179, 0.1);
}
.game-card.is-selected {
  border-color: var(--c-bg-2);
  background: rgba(255, 61, 136, 0.08);
}
.game-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffd23f, #ff8a3d);
  color: #2a0e55;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.game-card__body { flex: 1; min-width: 0; }
.game-card__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--c-text-dark);
  margin: 0 0 2px;
}
.game-card__desc {
  margin: 0;
  font-size: 13px;
  color: #7b6ba0;
  line-height: 1.35;
}

.selected-game {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(91, 42, 179, 0.06);
  margin-bottom: 14px;
}
.hint {
  margin: 0;
  color: #7b6ba0;
  font-size: 14px;
  text-align: center;
}

/* Lobby list (GM dashboard) ------------------------------------------------- */
.lobby-row {
  background: var(--c-surface-strong);
  color: var(--c-text-dark);
  border-radius: var(--radius-lg);
  padding: 18px 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lobby-row__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.lobby-row__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  margin: 0;
}
.lobby-row__code {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 4px;
  color: var(--c-bg-2);
}
.lobby-row__meta {
  color: #7b6ba0;
  font-size: 13px;
}
.lobby-row__actions {
  display: flex;
  gap: 8px;
}
.lobby-row__actions .btn {
  flex: 1;
}

/* Toast --------------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #003d44;
  color: var(--c-text);
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  z-index: 100;
  max-width: calc(100vw - 32px);
  text-align: center;
}

/* Desktop: centra e dà più respiro --------------------------------------- */
@media (min-width: 720px) {
  .container {
    padding-top: 48px;
    padding-bottom: 48px;
  }
  .hero__title { font-size: 44px; }
}
