/* ═══════════════════════════════════════════
   arrivooo — style.css
   Modifica qui per cambiare l'aspetto globale
   ═══════════════════════════════════════════ */

/* ── Variabili — tocca solo questa sezione per reskinare ── */
:root {
  --bg:           #0a0a0f;
  --surface:      #12121a;
  --border:       rgba(255, 255, 255, 0.07);
  --text:         #e8e4dc;
  --muted:        rgba(232, 228, 220, 0.4);
  --accent:       #e8c9a0;

  --color-amore:     #d4604a;
  --color-amicizia:  #e8c94a;
  --color-neutral:   #555566;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-mono:    'DM Mono', monospace;

  --radius:       16px;
  --transition:   4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  /* Blocca zoom doppio tap su iOS */
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* ═══════════════════════════════════════════
   UI VIEW (schermate onboarding)
   ═══════════════════════════════════════════ */
#ui-view {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

/* Sfondo animato */
#ui-view::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(212, 96, 74, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 20%, rgba(232, 201, 160, 0.06) 0%, transparent 60%);
  animation: breathe 8s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes breathe {
  from { opacity: 0.6; transform: scale(1); }
  to   { opacity: 1;   transform: scale(1.05); }
}

/* ── Schermata generica ── */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 360px;
  animation: fadeIn 0.4s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Wordmark ── */
.wordmark {
  font-size: clamp(2.8rem, 11vw, 4.8rem);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 8px;
}
.wordmark em {
  font-style: italic;
  color: var(--accent);
}

/* ── Tagline ── */
.tagline {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 48px;
  text-align: center;
  line-height: 1.6;
}

/* ── Selettore modalità ── */
.mode-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  width: 100%;
}

.mode-btn {
  flex: 1;
  padding: 14px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.mode-btn .mode-icon { font-size: 1.5rem; }
.mode-btn.selected {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(232, 201, 160, 0.06);
}

/* ── Bottone primario ── */
.btn-primary {
  width: 100%;
  padding: 18px;
  background: var(--accent);
  color: #0a0a0f;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-primary:active  { transform: scale(0.98); opacity: 0.9; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Share box ── */
.share-box {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
  display: none;
  flex-direction: column;
  gap: 10px;
}
.share-box.visible { display: flex; }

.share-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.share-url {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  word-break: break-all;
  line-height: 1.5;
}

.btn-copy {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.2s;
  align-self: flex-start;
}
.btn-copy:hover { background: rgba(232, 201, 160, 0.08); }

/* ── Waiting screen ── */
.waiting-pulse {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(232, 201, 160, 0.1);
  margin-bottom: 32px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}
.waiting-pulse::before,
.waiting-pulse::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(232, 201, 160, 0.25);
  width: 64px;
  height: 64px;
  opacity: 0;
  animation: ripple 2.5s ease-out infinite;
}
.waiting-pulse::after { animation-delay: 1.25s; }

@keyframes ripple {
  0%   { width: 64px;  height: 64px;  opacity: 0.7; }
  100% { width: 150px; height: 150px; opacity: 0; }
}

.waiting-title {
  font-size: 1.6rem;
  font-weight: 300;
  margin-bottom: 8px;
  text-align: center;
}
.waiting-sub {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  text-align: center;
  line-height: 1.7;
}

/* ── Messaggi errore ── */
.error-msg {
  font-size: 0.88rem;
  color: var(--color-amore);
  font-style: italic;
  text-align: center;
  margin-top: 16px;
  min-height: 20px;
  line-height: 1.5;
}

/* ── Privacy note ── */
.privacy-note {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
  margin-top: 24px;
  font-style: italic;
}

/* ═══════════════════════════════════════════
   MAP VIEW
   ═══════════════════════════════════════════ */
#map-view {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
}
#map-view.active { display: flex; }

#leaflet-map {
  flex: 1;
  width: 100%;
  z-index: 0;
}

/* Override Leaflet per tema scuro */
.leaflet-tile { filter: brightness(0.85) saturate(0.7); }
.leaflet-control-attribution { display: none !important; }
.leaflet-control-zoom { display: none !important; }

/* Tint overlay */
#map-tint {
  position: fixed;
  inset: 0;
  pointer-events: none;
  transition: background 3s ease;
  z-index: 1;
}

/* ── Overlay "quasi lì" ── */
#overlay-quasili {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 15, 0.88);
  backdrop-filter: blur(12px);
  transition: opacity 0.6s ease;
}
#overlay-quasili.hidden {
  opacity: 0;
  pointer-events: none;
}

.quasili-pulse {
  font-size: 3.5rem;
  animation: heartbeat 1.4s ease-in-out infinite;
  margin-bottom: 20px;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14%       { transform: scale(1.2); }
  28%       { transform: scale(1); }
  42%       { transform: scale(1.15); }
}

.quasili-text {
  font-size: clamp(2.4rem, 9vw, 4rem);
  font-weight: 300;
  letter-spacing: -0.03em;
}
.quasili-sub {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 10px;
  text-align: center;
  line-height: 1.6;
}

/* ── HUD ── */
#hud {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 20px 24px 36px;
  background: linear-gradient(to top, rgba(10, 10, 15, 0.96) 60%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#gps-warning {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--color-amicizia);
  text-transform: uppercase;
  padding: 4px 12px;
  border: 1px solid rgba(232, 201, 74, 0.3);
  border-radius: 99px;
  margin-bottom: 4px;
}
#gps-warning.hidden { display: none; }

#dist-label {
  font-size: clamp(2.4rem, 9vw, 3.8rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  transition: color 2s ease;
  text-align: center;
  line-height: 1;
}

#dist-sub {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

#progress-bar {
  width: 100%;
  max-width: 300px;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
#progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width var(--transition), background 2s ease;
  width: 100%;
  background: var(--color-neutral);
}

#other-status {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 2px;
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ═══════════════════════════════════════════
   INTERACTION PANEL
   ═══════════════════════════════════════════ */
#interaction-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 15;
  padding: 0 16px 32px;
  background: linear-gradient(to top, rgba(10,10,15,0.98) 60%, transparent);
  display: none;
  flex-direction: column;
  gap: 10px;
}
#interaction-panel.active { display: flex; }

/* HUD si sposta su quando il panel è attivo */
#hud {
  padding-bottom: 160px;
  transition: padding-bottom 0.3s ease;
}

/* ── Emoji row ── */
.emoji-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 4px 0;
}

.emoji-btn {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  padding: 4px;
  transition: transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
}
.emoji-btn:active { transform: scale(0.85); }

/* ── Frasi predefinite ── */
.phrases-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.phrase-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 99px;
  padding: 8px 16px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.phrase-btn:active {
  background: rgba(255,255,255,0.12);
}
.phrase-btn.pen-btn {
  color: var(--accent);
  border-color: rgba(232,201,160,0.25);
  padding: 8px 14px;
}

/* ── Input custom ── */
#custom-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}
#custom-input-wrap.visible { display: flex; }

#custom-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 99px;
  padding: 10px 18px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.95rem;
  outline: none;
}
#custom-input::placeholder { color: var(--muted); }
#custom-input:focus { border-color: rgba(232,201,160,0.4); }

#custom-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #0a0a0f;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
#custom-send:active { opacity: 0.8; }

/* ═══════════════════════════════════════════
   EMOJI FLOTTANTI
   ═══════════════════════════════════════════ */
#emoji-stage {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 45;
  overflow: hidden;
}

.floating-emoji {
  position: absolute;
  bottom: 180px;
  font-size: 2.2rem;
  pointer-events: none;
  animation: floatUp 5s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes floatUp {
  0%   { transform: translateY(0)      scale(1)    rotate(0deg);        opacity: 1; }
  60%  { transform: translateY(-52vh)  scale(1.15) rotate(var(--rot));  opacity: 1; }
  80%  { transform: translateY(-68vh)  scale(1.0)  rotate(var(--rot));  opacity: 0.6; }
  100% { transform: translateY(-82vh)  scale(0.75) rotate(var(--rot));  opacity: 0; }
}

/* ═══════════════════════════════════════════
   MESSAGGIO IN SOVRIMPRESSIONE
   ═══════════════════════════════════════════ */
#msg-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  /* NO blur globale — solo sulla bubble */
  opacity: 1;
  transition: opacity 0.6s ease;
}
#msg-overlay.hidden {
  display: none;
}
#msg-overlay.fading {
  opacity: 0;
}

#msg-bubble {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 24px;
  padding: 24px 36px;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-style: italic;
  font-weight: 300;
  color: #ffffff;
  text-align: center;
  max-width: 78vw;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
  animation: msgAppear 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

@keyframes msgAppear {
  from { transform: scale(0.7) translateY(20px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

/* ── Bottone TRILLO ── */
#btn-trillo {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 20;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
#btn-trillo.active { display: flex; }
#btn-trillo:active { transform: scale(0.88); }

/* Animazione shake schermo quando ricevi trillo */
@keyframes screenShake {
  0%,100% { transform: translateX(0); }
  15%     { transform: translateX(-8px) rotate(-1deg); }
  30%     { transform: translateX(8px)  rotate(1deg); }
  45%     { transform: translateX(-6px) rotate(-0.5deg); }
  60%     { transform: translateX(6px)  rotate(0.5deg); }
  75%     { transform: translateX(-3px); }
  90%     { transform: translateX(3px); }
}

/* ═══════════════════════════════════════════
   AGGIUNTE / MODIFICHE v2
   ═══════════════════════════════════════════ */

/* ── Rejoin banner ── */
#rejoin-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(232, 201, 160, 0.10);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(232, 201, 160, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  gap: 12px;
  animation: slideDown 0.3s ease;
}
#rejoin-banner.hidden { display: none; }

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.rejoin-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rejoin-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.rejoin-countdown {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.btn-rejoin {
  background: var(--accent);
  color: #0a0a0f;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.btn-rejoin:active { opacity: 0.8; }

/* ── GPS Indicator ── */
.gps-indicator {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  border-radius: 99px;
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--muted);
  transition: color 0.4s, border-color 0.4s;
}
.gps-indicator svg { flex-shrink: 0; }
.gps-indicator.gps-gps  { color: rgba(232,201,160,0.9); border-color: rgba(232,201,160,0.2); }
.gps-indicator.gps-wifi { color: rgba(180,200,255,0.8); border-color: rgba(180,200,255,0.15); }
.gps-indicator.gps-bts  { color: rgba(255,160,100,0.8); border-color: rgba(255,160,100,0.2); }

/* ── Bottone TRILLA — centrato in alto ── */
#btn-trillo {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  padding: 8px 22px;
  border-radius: 99px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.22);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
#btn-trillo.active { display: flex; }
#btn-trillo:active { background: rgba(255,255,255,0.06); }
#btn-trillo.trillo-sent {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Flash trillo ── */
#trillo-flash {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(255,255,255,0.12);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
}
#trillo-flash.active {
  animation: trilloFlash 0.6s ease;
}
@keyframes trilloFlash {
  0%   { opacity: 0.4; }
  30%  { opacity: 0; }
  50%  { opacity: 0.25; }
  100% { opacity: 0; }
}

/* ── Icone monocromo SVG ── */
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: rgba(255,255,255,0.75);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
  border-radius: 50%;
}
.icon-btn svg {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}
.icon-btn:active { color: #fff; }

/* Animazione vibrazione al tap */
@keyframes btnVibrate {
  0%   { transform: rotate(0deg)    scale(1); }
  15%  { transform: rotate(-8deg)   scale(1.1); }
  30%  { transform: rotate(8deg)    scale(1.1); }
  45%  { transform: rotate(-5deg)   scale(1.05); }
  60%  { transform: rotate(5deg)    scale(1.05); }
  75%  { transform: rotate(-2deg)   scale(1); }
  90%  { transform: rotate(2deg)    scale(1); }
  100% { transform: rotate(0deg)    scale(1); }
}
.icon-btn.vibrating {
  animation: btnVibrate 0.4s ease;
}

/* ── Icone flottanti monocromo ── */
.floating-icon {
  position: absolute;
  bottom: 180px;
  width: 32px;
  height: 32px;
  color: rgba(255,255,255,0.85);
  pointer-events: none;
  animation: floatUp 5s ease-out forwards;
  will-change: transform, opacity;
}
.floating-icon svg {
  width: 100%;
  height: 100%;
}

/* ── Quasi lì — contatore finale ── */
#quasili-dist-final {
  font-family: var(--font-mono);
  font-weight: 300;
  line-height: 1;
  text-align: center;
  margin-top: 12px;
  transition: font-size 0.8s ease, color 1.5s ease;
  letter-spacing: -0.02em;
}
#quasili-dist-final.moving-away {
  animation: distPulseAway 0.5s ease;
}
@keyframes distPulseAway {
  0%   { opacity: 1; }
  40%  { opacity: 0.4; transform: scale(0.97); }
  100% { opacity: 1; transform: scale(1); }
}

/* Rimuoviamo il vecchio #gps-warning — sostituito da gps-indicator */
#gps-warning { display: none !important; }

/* ── Toast ── */
#toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 200;
  background: rgba(232, 201, 160, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(232, 201, 160, 0.2);
  border-radius: 99px;
  padding: 8px 18px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Quasi lì overlay — rimuove vecchio avviso e sistema padding ── */
.quasili-sub {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 10px;
  text-align: center;
  line-height: 1.7;
  max-width: 260px;
}

/* Shake schermo al trillo rimosso (usiamo flash visivo) */
@keyframes screenShake {
  0%,100% { transform: translateX(0); }
  15%     { transform: translateX(-8px) rotate(-1deg); }
  30%     { transform: translateX(8px)  rotate(1deg); }
  45%     { transform: translateX(-6px) rotate(-0.5deg); }
  60%     { transform: translateX(6px)  rotate(0.5deg); }
  75%     { transform: translateX(-3px); }
  90%     { transform: translateX(3px); }
}
