@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Manrope:wght@400;600;700;800&display=swap');

:root {
  --grass: #189652;
  --grass-dark: #0E6B3A;
  --grass-soft: #E3F6EA;
  --gold: #FFB100;
  --gold-soft: #FFF2D6;
  --coral: #FF5F5F;
  --coral-soft: #FFE6E6;
  --cream: #FFFBF2;
  --card: #FFFFFF;
  --ink: #172A20;
  --ink-soft: #5C6B62;
  --line: #EAE3D2;
  --radius: 20px;
  --shadow-sticker: 4px 4px 0 rgba(23, 42, 32, 0.9);
  --shadow-soft: 0 6px 20px rgba(23, 42, 32, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Manrope', sans-serif;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle, rgba(24,150,82,0.07) 2px, transparent 2px);
  background-size: 26px 26px;
}

h1, h2, h3, .display {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--grass-dark);
  margin: 0;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 106px;
}

header.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 4px 20px;
}

.logo-mark {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--grass);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2.5px solid var(--ink);
  box-shadow: var(--shadow-sticker);
}
.logo-mark svg { width: 26px; height: 26px; }

header.top h1 { font-size: 25px; }
header.top .tag {
  font-size: 12px;
  font-weight: 800;
  color: var(--grass-dark);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tabs {
  position: fixed;
  bottom: 12px; left: 12px; right: 12px;
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 18px;
  display: flex;
  z-index: 20;
  box-shadow: var(--shadow-sticker);
  padding: 5px;
  gap: 5px;
}
.tab {
  flex: 1;
  padding: 11px 0;
  text-align: center;
  font-family: 'Fredoka', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: none;
  border-radius: 13px;
  cursor: pointer;
}
.tab.active { color: white; background: var(--grass); }

.card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sticker);
  padding: 18px 16px;
  margin-bottom: 16px;
}

select {
  width: 100%;
  padding: 14px 14px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  background: var(--cream);
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}

.section-label {
  font-family: 'Fredoka', sans-serif;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--grass-dark);
  margin: 24px 4px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.challenge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(23,42,32,0.9);
  margin-bottom: 11px;
}
.challenge .icon-bubble {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  border: 2px solid var(--ink);
}
.challenge.bonus .icon-bubble { background: var(--grass-soft); }
.challenge.speciale .icon-bubble { background: var(--gold-soft); }
.challenge.malus .icon-bubble { background: var(--coral-soft); }

.challenge .info { flex: 1; min-width: 0; }
.challenge .title { font-size: 14px; line-height: 1.35; font-weight: 700; color: var(--ink); }

.pts {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 12.5px;
  margin-top: 4px;
  display: inline-block;
  padding: 2px 9px;
  border-radius: 100px;
  border: 1.5px solid var(--ink);
}
.pts.bonus { background: var(--grass-soft); color: var(--grass-dark); }
.pts.speciale { background: var(--gold-soft); color: #8A5B00; }
.pts.malus { background: var(--coral-soft); color: #B23434; }

.upload-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--grass);
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(23,42,32,0.9);
}
.upload-btn:active { transform: translate(2px, 2px); box-shadow: none; }

.challenge.speciale { border-color: var(--gold); box-shadow: 3px 3px 0 var(--gold); }

.lb-item { margin-bottom: 11px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border-radius: 16px;
  background: var(--card);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(23,42,32,0.9);
}
.lb-rank {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--cream);
  border: 2px solid var(--ink);
  flex-shrink: 0;
}
.lb-row.rank-1 .lb-rank { background: var(--gold); font-size: 17px; }
.lb-row.rank-2 .lb-rank { background: #E3E3E3; }
.lb-row.rank-3 .lb-rank { background: #E7C4A0; }

.lb-name { flex: 1; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 15.5px; }
.lb-score { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 19px; color: var(--grass-dark); }

.lb-bar-track {
  position: relative;
  height: 8px;
  background: var(--line);
  border-radius: 100px;
  margin-top: 9px;
  overflow: hidden;
  border: 1.5px solid var(--ink);
}
.lb-bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--grass);
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(.34,1.56,.64,1);
}
.lb-row.rank-1 .lb-bar-fill { background: var(--gold); }

.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 14px;
}

.toast {
  position: fixed;
  bottom: 90px; left: 16px; right: 16px;
  background: var(--ink);
  color: white;
  padding: 14px 16px;
  border-radius: 14px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  box-shadow: var(--shadow-sticker);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  transform: translateY(8px) scale(0.98);
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }

/* Modal upload */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(23, 42, 32, 0.55);
  display: none;
  align-items: flex-end;
  z-index: 40;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--cream);
  width: 100%;
  border-radius: 24px 24px 0 0;
  border: 2.5px solid var(--ink);
  border-bottom: none;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
}
.modal h3 { font-size: 18px; margin-bottom: 6px; }
.modal .pts-line { display: inline-block; margin-bottom: 16px; }
.file-input-label {
  display: block;
  border: 2.5px dashed var(--grass);
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  color: var(--grass-dark);
  font-family: 'Fredoka', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 14px;
  background: var(--grass-soft);
}
input[type=file] { display: none; }
.preview-name { font-size: 12.5px; color: var(--ink-soft); margin-top: -8px; margin-bottom: 14px; word-break: break-all; font-weight: 600; }
.btn-row { display: flex; gap: 10px; }
.btn {
  flex: 1;
  padding: 14px;
  border-radius: 100px;
  border: 2px solid var(--ink);
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(23,42,32,0.9);
}
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn-primary { background: var(--grass); color: white; }
.btn-secondary { background: var(--card); color: var(--ink-soft); }
.btn:disabled { opacity: 0.45; box-shadow: none; }

/* Admin */
.admin-item { display: flex; flex-direction: column; gap: 11px; }
.admin-media { width: 100%; border-radius: 12px; max-height: 320px; object-fit: cover; background: #000; border: 2px solid var(--ink); }
.admin-meta { font-size: 13.5px; color: var(--ink-soft); font-weight: 600; }
.admin-meta b { color: var(--ink); font-family: 'Fredoka', sans-serif; }
.admin-btns { display: flex; gap: 10px; }
.btn-approve { background: var(--grass); color: white; }
.btn-reject { background: var(--coral); color: white; }

.pin-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}
.pin-screen input {
  font-family: 'Fredoka', sans-serif;
  font-size: 22px;
  letter-spacing: 0.3em;
  text-align: center;
  padding: 14px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  width: 200px;
}

/* Confetti */
.confetti-piece {
  position: fixed;
  top: 40%;
  left: 50%;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  z-index: 60;
  pointer-events: none;
}
