/* Mini-game breaks, reading timer, focus mode. Loaded after styles.css and
 * only uses its color variables, so every theme works. */

/* ---------- Reading timer ---------- */
.read-timer { margin-left: 12px; }
.progress-info { gap: 8px; }
.progress-info #posLabel { flex: 1; }

/* ---------- Look away: a black screen with white text ---------- */
.break-layer .look-away {
  position: fixed;
  inset: 0;
  z-index: 71;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  background: #000;
  color: #fff;
  text-align: center;
  cursor: pointer;
}
.look-away-text { margin: 0; font-size: clamp(1.4rem, 4.5vw, 2.4rem); font-weight: 500; }
.look-away-count { margin: 0; font-size: clamp(1.1rem, 3vw, 1.6rem); opacity: 0.75; }

/* ---------- Break layer ---------- */
.break-layer {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}
.break-layer[hidden] { display: none; }
.break-card {
  width: min(460px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  animation: break-in 0.22s ease-out;
}
.break-card h2 { margin: 0 0 10px; font-size: 1.3rem; }
.break-line { margin: 0 0 8px; color: var(--muted); line-height: 1.45; }
.break-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.break-quiet { display: block; margin-top: 14px; font-size: 0.85rem; color: var(--muted); }
.break-list { display: grid; gap: 8px; margin-top: 8px; }
.break-pick {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  text-align: left;
  padding: 10px 14px;
}
.break-pick strong { grid-column: 1; }
.break-pick span { grid-column: 1; color: var(--muted); font-size: 0.85rem; }
.break-pick em { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-style: normal; font-size: 0.8rem; color: var(--accent-2); }

.break-rest { text-align: center; }
.break-rest-text { font-size: 1.15rem; line-height: 1.5; min-height: 3.2em; margin: 14px 0; }
.break-rest .break-time { margin: 8px auto; max-width: 280px; }
.break-rest .break-actions { justify-content: center; }
.break-daily { width: 100%; margin-top: 8px; border-color: var(--accent-2); }
/* The game screen takes as much of the window as it can. */
.break-card.break-game {
  width: min(520px, 100%);
  height: 100%;
  max-height: 760px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow: hidden;
}
.break-head { display: flex; align-items: center; gap: 10px; flex: none; }
.break-head strong { flex: none; }
.break-time { flex: 1; height: 6px; border-radius: 3px; background: var(--control); overflow: hidden; }
.break-time i { display: block; height: 100%; width: 100%; background: var(--accent-2); }
.break-small { padding: 5px 12px; font-size: 0.85rem; }
.break-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--stage);
  outline: none;
}
.break-canvas { display: block; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 6px; }
.break-stage.is-paused .break-canvas { opacity: 0.35; }
.break-intro {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  text-align: center;
  background: color-mix(in srgb, var(--stage) 92%, transparent);
  border-radius: 10px;
}
.break-intro[hidden] { display: none; }
.break-intro p { margin: 0; max-width: 32ch; }
.break-intro .break-controls { color: var(--muted); font-size: 0.85rem; margin-bottom: 8px; }

/* On-screen buttons for touch screens; hidden where there is a keyboard and mouse. */
.break-pad { display: none; flex: none; justify-content: center; gap: 8px; }
@media (pointer: coarse), (max-width: 640px) {
  .break-pad { display: flex; }
}
.pad-btn {
  width: 56px;
  height: 56px;
  padding: 0;
  font-size: 1.2rem;
  border-radius: 14px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.pad-btn.on { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
body.break-open { overflow: hidden; }
@keyframes break-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .break-card { animation: none; } }

/* ---------- Settings tab ---------- */
[data-pane="breaks"] input:disabled { opacity: 0.45; }
[data-pane="breaks"] .setting:has(input:disabled) label { opacity: 0.55; }
[data-pane="breaks"] .row { align-items: center; justify-content: space-between; }

/* ---------- Focus mode ---------- */
/* Same trick as playing: things fade and stop taking clicks, but keep their
   room so the layout does not jump. */
body.focus-mode .top-brand,
body.focus-mode .top-actions,
body.focus-mode .review-btns,
body.focus-mode .progress,
body.focus-mode .speed-row,
body.focus-mode .ctl-skip,
body.focus-mode .read-timer,
body.focus-mode .toast,
body.focus-mode .cleanup-note {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
body.focus-mode .ctl-main { opacity: 0.4; }
body.focus-mode .ctl-main:hover, body.focus-mode .ctl-main:focus-visible { opacity: 1; }
body.focus-mode .empty-state { opacity: 0.6; }
.focus-exit {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  z-index: 55;
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  opacity: 0.55;
}
.focus-exit:hover, .focus-exit:focus-visible { opacity: 1; background: var(--control); color: var(--text); }
.focus-exit[hidden] { display: none; }
body.playing .focus-exit { opacity: 0; pointer-events: none; }
body.playing.peek .focus-exit { opacity: 0.55; pointer-events: auto; }
/* A quiz or summary is open in focus mode: the way out stays in view and clickable, above the questions. */
body.overlay-open .focus-exit, body.playing.overlay-open .focus-exit { opacity: 0.85; pointer-events: auto; z-index: 90; }
#btnFocus[aria-pressed="true"] { color: var(--accent-2); }

/* ---------- Wide break cards ---------- */
@media (min-width: 560px) {
  .break-card.break-wide { width: min(640px, 100%); }
  .break-card.break-wide .break-list { grid-template-columns: 1fr 1fr; }
}
.break-quiet + .break-quiet { margin-top: 6px; }
.break-more { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 4px 18px; margin-top: 6px; }
.break-more .break-quiet { margin-top: 8px; }
.break-stop { display: flex; flex-direction: column; align-items: center; }
.break-stop-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; animation: break-stop-in 0.25s cubic-bezier(.2,.8,.3,1) both; }
.break-stop-list[hidden] { display: none; }
.break-stop-item { font-size: 0.85rem; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; }
.break-stop-item:hover { color: var(--text); background: var(--control); }
@keyframes break-stop-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
