{{/* Germany daily smartphone minutes by age group — JIM-Studie 2025 */}}
{{ $lang := .Page.Language.Lang }}
<div style="background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:1.5rem;text-align:center;margin:2rem 0">
  <h4 style="margin:0 0 0.25rem;font-size:0.95rem;color:#334155;font-family:system-ui,sans-serif">{{ if eq $lang "de" }}Tägliche Smartphone-Nutzung nach Alter{{ else if eq $lang "fr" }}Utilisation quotidienne du smartphone par âge{{ else }}Daily smartphone use by age{{ end }}</h4>
  <div style="margin:0 0 1rem;font-size:0.8rem;color:#64748b;font-family:system-ui,sans-serif">{{ if eq $lang "de" }}Minuten pro Tag · JIM-Studie 2025{{ else if eq $lang "fr" }}Minutes par jour · étude JIM 2025{{ else }}Minutes per day · JIM-Studie 2025{{ end }}</div>
  <canvas id="germany-screentime-chart"></canvas>
</div>
<script src="{{ "js/chart.umd.min.js" | relURL }}"></script>
<script>
(function() {
  const lang = '{{ $lang }}';
  const labels = {
    en: ['12–13 yrs', '14–15 yrs', '16–17 yrs', '18–19 yrs'],
    de: ['12–13 J.', '14–15 J.', '16–17 J.', '18–19 J.'],
    fr: ['12–13 ans', '14–15 ans', '16–17 ans', '18–19 ans']
  };
  new Chart(document.getElementById('germany-screentime-chart'), {
    type: 'bar',
    data: {
      labels: labels[lang] || labels.en,
      datasets: [{
        data: [120, 210, 265, 285],
        backgroundColor: ['#a5b4fc', '#818cf8', '#6366f1', '#4338ca'],
        borderRadius: 6, barThickness: 40
      }]
    },
    options: {
      responsive: true, maintainAspectRatio: true,
      plugins: {
        legend: { display: false },
        tooltip: { callbacks: { label: function(ctx) { const h = Math.floor(ctx.raw/60); const m = ctx.raw % 60; return ctx.raw + ' min (' + h + 'h ' + m + ')'; } } }
      },
      scales: {
        y: { beginAtZero: true, max: 320, ticks: { callback: function(v) { return v + ' min'; }, font: { size: 11, family: 'system-ui' } }, grid: { color: '#f1f5f9' } },
        x: { ticks: { font: { size: 11, family: 'system-ui' } }, grid: { display: false } }
      }
    }
  });
})();
</script>
