/* The eye break (js/eyes/break.js): every 20 minutes of learning, the app goes dark and
   shows only a 20-second countdown, dim and calm, so the child looks away from it.
   Also the grown-ups' switch for it (js/eyes/setting.js on grownups.html). */

html.eye-break-on, html.eye-break-on body { overflow: hidden; }

/* A modal <dialog> filling the screen (the browser's dialog box styles undone). */
.eye-break {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: #000;
  color: rgb(255 255 255 / 0.72);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  animation: eye-break-dark 0.8s ease-out;
}

.eye-break[open] { display: grid; place-items: center; }
.eye-break::backdrop { background: #000; animation: eye-break-dark 0.8s ease-out; }

@keyframes eye-break-dark { from { background: rgb(0 0 0 / 0); } }

.eye-break-timer {
  position: relative;
  width: min(56vmin, 300px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  animation: eye-break-in 0.8s ease-out;
}

@keyframes eye-break-in { from { opacity: 0; transform: scale(0.92); } }

.eye-break-timer svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.eye-break-track, .eye-break-left { fill: none; stroke-width: 4; }
.eye-break-track { stroke: rgb(255 255 255 / 0.1); }
.eye-break-left { stroke: #3f8f78; stroke-linecap: round; transition: stroke-dashoffset 0.2s linear, stroke 0.4s; }

.eye-break-secs {
  font: 500 clamp(56px, 22vmin, 128px)/1 var(--ks-brand-font, 'Fredoka', system-ui, sans-serif);
  font-variant-numeric: tabular-nums;
}

.eye-break-done .eye-break-left { stroke: #4caf7a; }
.eye-break-done .eye-break-secs { color: #6cc495; }

@media (prefers-reduced-motion: reduce) {
  .eye-break, .eye-break::backdrop, .eye-break-timer { animation: none; }
  .eye-break-left { transition: none; }
}

/* ---- The grown-ups' switch ---- */

.eye-break-setting .eye-break-switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin-top: 4px;
  font-weight: 600;
  cursor: pointer;
}
.eye-break-setting .eye-break-switch input { width: 26px; height: 26px; margin: 0; accent-color: var(--ks-reading, #1f9d55); cursor: pointer; }
.eye-break-setting .eye-break-saved { margin: 6px 0 0; color: var(--muted, #5b6474); }
.eye-break-setting .eye-break-saved:empty { display: none; }
