/* Kids clock – parents' site. Flat, friendly, phone first. */
:root {
  --bg: #F6F7FB;
  --card: #FFFFFF;
  --line: #E4E7EF;
  --line-dark: #CDD2DE;
  --text: #22263A;
  --muted: #7A8099;
  --primary: #FF8A3D;       /* the clock's orange frame */
  --primary-dark: #E2681A;
  --cyan: #2BC8FF;          /* the clock's glowing eyes */
  --cyan-soft: #E3F7FF;
  --cyan-dark: #119ACC;
  --green: #3BC47A;
  --green-dark: #27A260;
  --red: #F0566A;
  --face: #0E1220;
  --radius: 18px;
  font-family: "Rubik", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100dvh; }
button, input, select { font: inherit; color: inherit; }
.app { max-width: 560px; margin: 0 auto; padding: 16px 16px 104px; }

/* ---------- header with the little clock face ---------- */
.top { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; }
.face { width: 46px; height: 46px; border-radius: 15px; background: var(--face); border: 4px solid var(--primary);
  display: flex; align-items: center; justify-content: center; gap: 7px; flex: none; }
.face i { width: 8px; height: 14px; border-radius: 4px; background: #6FF3FF; box-shadow: 0 0 6px var(--cyan); animation: blink 5s infinite; }
@keyframes blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
.top h1 { font-size: 22px; margin: 0; font-weight: 800; }
.top p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

h2 { font-size: 18px; margin: 22px 4px 10px; font-weight: 700; }
.hint { color: var(--muted); font-size: 14px; margin: -4px 4px 12px; line-height: 1.5; }

/* ---------- cards & pressable buttons ---------- */
.card { background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.row .grow { flex: 1; min-width: 0; }
.title { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.badge { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; flex: none; background: var(--cyan-soft); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 16px; padding: 13px 18px;
  font-weight: 700; font-size: 16px; cursor: pointer; background: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-dark);
  transition: transform .06s, box-shadow .06s; min-height: 48px; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--primary-dark); }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--text); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line-dark); }
.btn.ghost:active { box-shadow: 0 1px 0 var(--line-dark); }
.btn.cyan { background: var(--cyan); box-shadow: 0 4px 0 var(--cyan-dark); }
.btn.green { background: var(--green); box-shadow: 0 4px 0 var(--green-dark); }
.btn:disabled { opacity: .5; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 2px solid var(--line); background: #fff; display: grid; place-items: center;
  cursor: pointer; font-size: 17px; flex: none; }
.icon-btn:active { background: var(--bg); }
.icon-btn:disabled { opacity: .3; pointer-events: none; }
.icon-btn.danger { color: var(--red); }
.actions { display: flex; gap: 10px; margin-top: 14px; }
.actions .btn { flex: 1; }

/* ---------- forms ---------- */
label.f { display: block; margin-bottom: 12px; }
label.f span { display: block; font-weight: 500; margin: 0 4px 6px; font-size: 15px; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], select {
  width: 100%; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #fff; font-size: 17px; min-height: 50px; }
input:focus, select:focus { outline: none; border-color: var(--cyan); background: #FBFEFF; }
input[type=range] { width: 100%; accent-color: var(--primary); }
.err { color: var(--red); font-weight: 500; margin: 8px 4px; min-height: 1.2em; }

/* ---------- day chips, icon picker, toggles ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.chip { flex: none; min-width: 52px; height: 52px; padding: 0 12px; border-radius: 16px; border: 2px solid var(--line); border-bottom-width: 4px;
  background: #fff; font-weight: 700; font-size: 18px; cursor: pointer; }
.chips .chip { flex: 1 0 44px; min-width: 44px; padding: 0 4px; }
.chip.on { background: var(--cyan-soft); border-color: var(--cyan); color: var(--cyan-dark); }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days .chip { min-width: 40px; height: 40px; font-size: 15px; border-radius: 12px; padding: 0 8px; border-bottom-width: 3px; }
.icons { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.icons button { aspect-ratio: 1; min-width: 0; padding: 0; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-size: 20px; cursor: pointer; }
.icons button.on { border-color: var(--cyan); background: var(--cyan-soft); }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--line-dark); transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 24px; height: 24px; border-radius: 50%; background: #fff; top: 4px; right: 4px; transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(-20px); }

/* ---------- lesson list ---------- */
.lesson { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 8px 10px; margin-bottom: 8px; }
.lesson .n { width: 30px; height: 30px; border-radius: 50%; background: var(--cyan-soft); color: var(--cyan-dark); font-weight: 700; display: grid; place-items: center; flex: none; }
.lesson .t { flex: 1; font-weight: 500; font-size: 17px; overflow-wrap: anywhere; }
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; }

/* ---------- photo preview table ---------- */
.ptable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.ptable td { border-bottom: 1px solid var(--line); padding: 6px 4px; vertical-align: top; }
.ptable td:first-child { font-weight: 700; width: 34px; color: var(--cyan-dark); }

/* ---------- empty states ---------- */
.empty { text-align: center; color: var(--muted); padding: 22px 10px; }
.empty b { display: block; font-size: 34px; margin-bottom: 6px; }

/* ---------- bottom tab bar ---------- */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 2px solid var(--line);
  display: flex; justify-content: center; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
.tabs .in { display: flex; width: 100%; max-width: 560px; }
.tabs button { flex: 1; border: 0; background: none; padding: 6px 2px; border-radius: 14px; cursor: pointer; color: var(--muted);
  font-size: 12px; font-weight: 500; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabs button b { font-size: 22px; font-weight: 400; line-height: 1.2; }
.tabs button.on { color: var(--primary-dark); background: #FFF2E8; }

/* ---------- bottom sheet (add / edit) ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(20, 24, 40, .45); z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; border-radius: 24px 24px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 92dvh; overflow-y: auto; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet h3 { margin: 0 4px 14px; font-size: 20px; }

.toast { position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: #fff;
  padding: 10px 18px; border-radius: 14px; font-weight: 500; opacity: 0; transition: .25s; pointer-events: none; z-index: 20; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.welcome { text-align: center; padding: 24px 0 8px; }
.welcome .face { width: 96px; height: 96px; border-radius: 30px; border-width: 7px; margin: 0 auto 16px; gap: 14px; }
.welcome .face i { width: 16px; height: 30px; border-radius: 8px; }
.welcome h1 { margin: 0 0 6px; font-size: 26px; }
.welcome p { color: var(--muted); margin: 0 0 22px; line-height: 1.5; }
.link { background: none; border: 0; color: var(--cyan-dark); font-weight: 700; cursor: pointer; padding: 10px; font-size: 15px; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 22px; letter-spacing: 3px; font-weight: 700; direction: ltr; display: inline-block; }
.stat { display: flex; gap: 10px; }
.stat .card { flex: 1; text-align: center; padding: 12px 6px; margin: 0; }
.stat .big { font-size: 24px; font-weight: 800; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--line-dark); margin-left: 6px; }
.dot.on { background: var(--green); }
