@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Mono:wght@300;400;500&display=swap');

:root {
  --bg: #0c0c0b;
  --surface: #131311;
  --border: #1f1f1d;
  --text: #e8e4dc;
  --muted: #555350;
  --accent: #e8630a;
  --font-serif: 'DM Serif Display', Georgia, serif;
  --font-mono: 'DM Mono', monospace;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  min-height: 100vh;
  padding: 0 20px;
  max-width: 480px;
  margin: 0 auto;
}

/* ---- SCHERMATA CARICAMENTO ---- */
#loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  flex-direction: column;
  gap: 16px;
}

.loading-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

/* ---- SCHERMATA ERRORE ---- */
#error-screen {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

#error-screen p {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--muted);
}

/* ---- SCHERMATA ARCHIVIO (accendino morto) ---- */
#archive-screen {
  display: none;
  padding: 40px 0;
}

.archive-badge {
  display: inline-block;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 4px 10px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.archive-subtitle {
  margin: 0 auto 24px;
  max-width: 320px;
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.4;
}

.dormant-banner {
  padding: 24px 16px 20px;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
}

.dormant-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.dormant-subtitle {
  color: var(--muted);
  line-height: 1.5;
}

/* ---- SCHERMATA ATTIVAZIONE ---- */
#activation-screen {
  display: none;
  padding: 60px 0 40px;
  animation: fadeIn 0.6s ease;
}

/* ---- SCHERMATA PASSAGGIO ---- */
#passage-screen {
  display: none;
  padding: 40px 0;
  animation: fadeIn 0.6s ease;
}

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

/* ---- TIPOGRAFIA COMUNE ---- */
.intro-text {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  line-height: 1.4;
  color: var(--muted);
  margin-bottom: 40px;
  font-style: italic;
}

.lighter-name {
  font-family: var(--font-serif);
  font-size: 2.8rem;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 8px;
}

.lighter-serial {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 32px;
}

/* ---- STATS ---- */
.stats-row {
  display: flex;
  gap: 24px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-size: 1.4rem;
  font-family: var(--font-serif);
  color: var(--accent);
}

.stat-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---- MAPPA SVG ---- */
.map-container {
  margin-bottom: 40px;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  padding: 16px;
}

.map-container svg {
  width: 100%;
  height: auto;
  display: block;
}

.map-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.origin-map-container {
  margin-bottom: 28px;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  padding: 16px;
}

.origin-map-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.origin-map-container img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  background: #0c0c0b;
}

.origin-map-leaflet {
  width: 100%;
  height: 320px;
  border-radius: 4px;
  background: #0c0c0b;
}

#passage-origin-map {
  border-radius: 4px;
}

/* Percorso sulla mappa */
.route-path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  stroke-linecap: round;
}

.map-point {
  fill: var(--accent);
  cursor: pointer;
  transition: r 0.2s;
}

.map-point:hover {
  r: 5;
}

.map-point-pulse {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
  animation: mapPulse 2s infinite;
}

@keyframes mapPulse {
  0% { r: 4; opacity: 1; }
  100% { r: 10; opacity: 0; }
}

/* ---- TIMELINE ---- */
.timeline-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 40px;
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 20px;
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-dot-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 4px;
  min-width: 16px;
}

.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.timeline-dot.first {
  background: var(--accent);
}

.timeline-dot.latest {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.timeline-line {
  flex: 1;
  width: 1px;
  background: var(--border);
  margin-top: 4px;
}

.timeline-content {
  flex: 1;
  min-width: 0;
}

.timeline-meta {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.timeline-message {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 8px;
}

.timeline-photo {
  width: 100%;
  max-width: 280px;
  border-radius: 3px;
  margin-top: 8px;
  border: 1px solid var(--border);
}

.timeline-next {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 8px;
  font-style: italic;
}

.timeline-next span {
  color: var(--accent);
}

.activation-badge {
  display: inline-block;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 2px 6px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ---- SEPARATORE ---- */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* ---- FORM ---- */
.form-section-title {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.field label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

.field input,
.field textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 12px 14px;
  border-radius: 3px;
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
}

.field textarea {
  resize: none;
  min-height: 90px;
  line-height: 1.5;
}

.char-count {
  font-size: 0.65rem;
  color: var(--muted);
  text-align: right;
  margin-top: -4px;
}

.char-count.over {
  color: #c0392b;
}

/* ---- UPLOAD FOTO ---- */
.photo-upload-area {
  border: 1px dashed var(--border);
  border-radius: 3px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
}

.photo-upload-area:hover {
  border-color: var(--accent);
}

.photo-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.photo-upload-text {
  font-size: 0.75rem;
  color: var(--muted);
  pointer-events: none;
}

.photo-preview {
  width: 100%;
  border-radius: 3px;
  margin-top: 10px;
  display: none;
  border: 1px solid var(--border);
}

/* ---- CHECKBOX GDPR ---- */
.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.checkbox-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-field label {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
  cursor: pointer;
}

.checkbox-field label a {
  color: var(--accent);
  text-decoration: none;
}

/* ---- CONTATORE POSIZIONE ---- */
.position-badge {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 24px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.position-number {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--accent);
}

/* ---- BOTTONE ---- */
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #0c0c0b;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  border: none;
  padding: 16px;
  border-radius: 3px;
  cursor: pointer;
  text-transform: uppercase;
  margin-top: 8px;
  transition: opacity 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary.loading {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---- SCHERMATA CONFERMA ---- */
#confirm-screen {
  display: none;
  padding: 60px 0 40px;
  animation: fadeIn 0.6s ease;
  text-align: center;
}

.confirm-icon {
  font-size: 2rem;
  margin-bottom: 24px;
  color: var(--accent);
}

.confirm-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  line-height: 1.3;
  margin-bottom: 16px;
}

.confirm-sub {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 300px;
  margin: 0 auto;
}

/* ---- FOOTER ---- */
.page-footer {
  padding: 40px 0 24px;
  text-align: center;
}

.footer-brand {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--border);
  text-transform: uppercase;
}
