/* StudyPal: kid-facing pieces on top of ui.css (top bar extras, phone tab bar, homework cards, PIN pad, focus timer). */
body { font-size: 15px; }
input[type=date] { background: var(--field); color: var(--text); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; font: inherit; width: 100%; box-sizing: border-box; }
dialog input[type=text], dialog select, dialog textarea { width: 100%; box-sizing: border-box; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } }

/* ---------- top bar ---------- */
.logo .word { font: 800 20px/1 var(--sans); letter-spacing: -.02em; color: var(--head); }
.logo img { height: 36px; width: 36px; border-radius: 10px; }
.shell nav a, .shell .right a { display: inline-flex; align-items: center; gap: 6px; }
.shell .ni { font-size: 16px; line-height: 1; }
.starpill { display: inline-flex; align-items: center; gap: 2px; padding: 6px 12px; border-radius: 99px; background: color-mix(in srgb, #ffd23f 28%, var(--panel)); border: 1px solid color-mix(in srgb, #e0a800 45%, var(--panel)); font-weight: 700; color: var(--text); white-space: nowrap; }
.tabbar { display: none; }
@media (max-width: 920px) {
  .shell .rnav { display: none !important; }
  .shell nav { display: none !important; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--panel); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px -18px rgba(0,0,0,.5); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; border-radius: 10px; }
  .tabbar a .ni { font-size: 20px; line-height: 1.1; }
  .tabbar a.on { color: var(--text); background: var(--accent-soft); }
  .wrap { padding-bottom: 96px; }
}

/* ---------- home ---------- */
.hello { display: flex; align-items: center; gap: 18px; margin: 22px 0 16px; flex-wrap: wrap; }
.hello h1 { font-size: 30px; margin: 0; line-height: 1.15; }
.hello p { margin: 4px 0 0; color: var(--muted); }
.hello .grow { flex: 1; min-width: 220px; }
.bigstart { display: flex; align-items: center; gap: 12px; padding: 16px 22px; font-size: 18px; font-weight: 700; border-radius: 18px !important; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 10px; flex-wrap: wrap; }
.sec-h h2 { margin: 0; font-size: 20px; text-transform: none; letter-spacing: -.01em; color: var(--head); }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); border: 2px dashed var(--line2); border-radius: var(--r, 14px); }
.empty b { display: block; font-size: 17px; color: var(--text); margin-bottom: 4px; }
.empty .e-ico { font-size: 40px; display: block; margin-bottom: 6px; }

/* ---------- homework card ---------- */
.hw-list { display: grid; gap: 10px; }
.hw-card { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-left: 6px solid var(--subj, var(--accent)); border-radius: var(--r, 14px); padding: 14px 16px; box-shadow: var(--shadow); }
.hw-card.st-done { opacity: .78; }
.hw-card.st-back { border-color: #f0a33c; border-left-color: #f0a33c; background: color-mix(in srgb, #f0a33c 8%, var(--panel)); }
.hw-card.st-check { background: color-mix(in srgb, var(--accent) 5%, var(--panel)); }
.hw-ico { font-size: 28px; width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--subj, var(--accent)) 16%, var(--panel)); flex: none; }
.hw-main { flex: 1; min-width: 0; }
.hw-sub { font: 700 11px/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hw-sub .tag { text-transform: none; letter-spacing: 0; margin: 0; font-size: 11.5px; }
.tag.wait { color: var(--accent); border-color: var(--accent); }
.tag.back { color: #b86a00; border-color: #f0a33c; }
.hw-title { font-weight: 700; font-size: 16.5px; margin: 3px 0 4px; overflow-wrap: anywhere; }
.hw-note { background: color-mix(in srgb, #f0a33c 16%, var(--panel)); border-radius: 10px; padding: 6px 10px; margin: 4px 0 6px; font-size: 14px; }
.hw-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.hw-meta .due.today { color: var(--accent); font-weight: 700; }
.hw-meta .due.late { color: var(--bad); font-weight: 700; }
.hw-act { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 600px) { .hw-card { flex-wrap: wrap; } .hw-act { width: 100%; justify-content: stretch; } .hw-act > * { flex: 1; justify-content: center; } }
.s-maths { --subj: #3b82f6; } .s-english { --subj: #ef4444; } .s-reading { --subj: #f59e0b; } .s-spelling { --subj: #ec4899; } .s-science { --subj: #10b981; }
.s-hsie { --subj: #0ea5e9; } .s-language { --subj: #8b5cf6; } .s-art { --subj: #f97316; } .s-project { --subj: #14b8a6; } .s-other { --subj: #64748b; }

/* ---------- add homework ---------- */
.subj-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.subj-pick .subj { display: flex; align-items: center; gap: 6px; padding: 8px 10px; font-size: 13px; border-radius: 10px; text-align: left; }
.subj-pick .subj span { font-size: 18px; }
.subj-pick .subj.on { background: var(--accent-soft); border-color: var(--accent); font-weight: 700; }
dialog.hw-dlg { width: 560px; }

/* ---------- PIN pad ---------- */
dialog.pin-dlg { width: 320px; text-align: center; }
.pin-lock { font-size: 34px; }
.pin-msg { margin: 6px 0 14px; color: var(--muted); }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin-bottom: 16px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line2); }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pin-pad button { justify-content: center; text-align: center; font-size: 22px; font-weight: 700; padding: 14px 0; border-radius: 14px; }
dialog.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- focus timer ---------- */
.focus-wrap { max-width: 640px; margin: 0 auto; text-align: center; }
.ring { position: relative; width: min(78vw, 340px); aspect-ratio: 1; margin: 18px auto 8px; }
.ring svg.r { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .r-bg { fill: none; stroke: var(--panel2); stroke-width: 14; }
.ring .r-fg { fill: none; stroke: var(--accent); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset .9s linear; }
.ring .r-mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .r-time { font: 800 54px/1 var(--sans); font-variant-numeric: tabular-nums; color: var(--head); }
.ring .r-sub { color: var(--muted); margin-top: 6px; font-size: 14px; }
.ring .r-pet { width: 120px; height: 104px; margin-bottom: 4px; }
.ring .r-pet svg { width: 100%; height: 100%; }
.focus-stars { font-size: 26px; min-height: 36px; letter-spacing: 4px; }
.focus-say { display: inline-block; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 10px 16px; margin: 6px auto 14px; box-shadow: var(--shadow); max-width: 460px; }
.len-pick { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0 4px; }
.len-pick button { min-width: 74px; padding: 12px 14px; font-weight: 700; font-size: 15px; border-radius: 14px; }
.len-pick button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0; }
.mode-pick button { text-align: left; padding: 12px 14px; border-radius: 14px; display: block; white-space: normal; }
.mode-pick button b { display: block; font-size: 15px; margin-bottom: 2px; }
.mode-pick button small { color: var(--muted); font-size: 12.5px; }
.mode-pick button.on { border-color: var(--accent); background: var(--accent-soft); }
.task-pick { width: 100%; font-size: 15px; padding: 10px 12px; }
.paused-bar { background: color-mix(in srgb, #f0a33c 20%, var(--panel)); border: 1px solid #f0a33c; border-radius: 14px; padding: 10px 14px; margin: 8px 0; font-weight: 600; }
.star-pop { position: fixed; left: 50%; top: 40%; z-index: 80; font: 800 40px/1 var(--sans); transform: translate(-50%, 0); pointer-events: none; animation: starpop 1.6s ease-out forwards; }
@keyframes starpop { 0% { opacity: 0; transform: translate(-50%, 20px) scale(.6); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -90px) scale(1); } }
.focus-run .shell, .focus-run .tabbar { display: none; }
.focus-run .wrap { padding-top: 10px; }

/* ---------- grown-ups ---------- */
.pstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.pstat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r, 14px); padding: 14px 16px; box-shadow: var(--shadow); }
.pstat b { display: block; font-size: 26px; color: var(--head); }
.pstat span { color: var(--muted); font-size: 12.5px; }
.rule { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.rule:first-of-type { border-top: 0; }
.rule .rt { flex: 1; min-width: 220px; }
.rule .rt b { display: block; }
.rule .rt small { color: var(--muted); }
.rule select, .rule input[type=number] { width: auto; min-width: 110px; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line2); transition: .2s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { left: 23px; }
.log-list { display: grid; gap: 6px; }
.log-row { display: flex; gap: 10px; align-items: center; font-size: 13.5px; padding: 6px 0; border-top: 1px solid var(--line); }
.log-row:first-child { border-top: 0; }
.log-row .lr-n { font-weight: 800; min-width: 44px; }
.log-row .lr-w { flex: 1; }
.log-row small { color: var(--muted); }
.ring .r-svg { width: 100%; height: 100%; } .ring .r-svg svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.hw-act .btn, .hw-act button { white-space: nowrap; }
input:not([type]) { background: var(--field); color: var(--text); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; font: inherit; box-sizing: border-box; }

/* ---------- pet on the home screen + news + rewards ---------- */
.hello-pet { width: 104px; height: 92px; flex: none; display: block; border-radius: 20px; background: var(--accent-soft); padding: 4px; transition: transform .15s; }
.hello-pet:hover { transform: scale(1.05) rotate(-2deg); }
.hello-pet svg { width: 100%; height: 100%; }
.pet-say { margin-top: 8px; display: inline-block; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 7px 12px; font-size: 14px; max-width: 560px; box-shadow: var(--shadow); }
.pet-say .pet-coins { white-space: nowrap; font-weight: 700; }
dialog.news { width: 440px; }
.news-pet { width: 150px; height: 130px; margin: 0 auto; }
.news-pet svg { width: 100%; height: 100%; }
.news-coins { text-align: center; font-weight: 700; color: #b7791f; margin: 0 0 12px; font-size: 15px; }
.news-list { display: grid; gap: 8px; }
.news-i { display: flex; gap: 10px; align-items: flex-start; background: var(--panel2); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.news-i.back { background: color-mix(in srgb, #f0a33c 14%, var(--panel)); }
.news-i .ni-ico { font-size: 22px; line-height: 1; }
.news-i .ni-msg { margin-top: 3px; font-style: italic; }
.hi-earn { margin: 12px 0 0; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, #ffd23f 22%, var(--panel)); font-weight: 600; font-size: 14px; }
.hi-task { display: flex; gap: 8px; align-items: center; font-size: 16px; }
.hw-details { font-size: 13.5px; color: var(--muted); margin: 0 0 4px; }
.hw-note.ok { background: color-mix(in srgb, #35c98b 15%, var(--panel)); }
.ph-row { display: flex; gap: 10px; flex-wrap: wrap; }
.ph-t { position: relative; width: 96px; height: 120px; }
.ph-t img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; border: 1px solid var(--line2); }
.ph-x { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%; padding: 0; justify-content: center; font-size: 12px; }
.ph-add { width: 96px; height: 120px; flex-direction: column; justify-content: center; text-align: center; white-space: normal; font-size: 12.5px; border: 2px dashed var(--line2); border-radius: 12px !important; gap: 4px; }
.ph-add span { font-size: 28px; }
.rw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.rw-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r, 14px); padding: 14px; display: grid; gap: 6px; justify-items: start; box-shadow: var(--shadow); }
.rw-card.can { border-color: var(--accent); }
.rw-ico { font-size: 30px; }
.rw-cost { font-weight: 700; color: var(--muted); font-size: 13px; }
.rw-bar { width: 100%; height: 8px; border-radius: 99px; background: var(--panel2); overflow: hidden; }
.rw-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffd23f, #f59e0b); }
.rw-card small { color: var(--muted); }
@media (max-width: 520px) { .hello-pet { width: 80px; height: 72px; } }
dialog { max-height: calc(100dvh - 32px); overflow: auto; }
input[type=email] { background: var(--field); color: var(--text); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; font: inherit; box-sizing: border-box; }

/* ---------- accounts ---------- */
.connect { max-width: 440px; margin: 40px auto 0; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 30px 24px; box-shadow: var(--shadow); }
.connect h1 { margin: 10px 0 6px; font-size: 26px; }
.connect p { color: var(--muted); margin: 0 0 16px; }
.cn-logo img { border-radius: 18px; }
.code-in { width: 100%; text-align: center; font: 800 34px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .3em; padding: 14px 10px; border: 2px solid var(--line2); border-radius: 14px; background: var(--field); color: var(--text); text-transform: uppercase; }
.code-in:focus { border-color: var(--accent); outline: none; }
dialog.acct-dlg { width: 380px; }
.acct-form input { width: 100%; }
input[type=email] { background: var(--field); color: var(--text); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; font: inherit; box-sizing: border-box; }
.connecting .shell nav, .connecting .shell .right, .connecting .tabbar { display: none !important; }

/* ---------- chores (kid) ---------- */
.chore-prog { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font-weight: 700; color: var(--muted); }
.chore-prog .g-bar { flex: 1; height: 14px; border-radius: 99px; background: var(--panel2); overflow: hidden; }
.chore-prog .g-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #35c98b, #1f8a5b); transition: width .4s; }
.chore-list { display: grid; gap: 10px; }
.ch-card { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r, 14px); padding: 14px 16px; box-shadow: var(--shadow); }
.ch-card.st-done { background: color-mix(in srgb, #35c98b 9%, var(--panel)); }
.ch-card.st-back { border-color: #f0a33c; background: color-mix(in srgb, #f0a33c 8%, var(--panel)); }
.ch-card.later { opacity: .75; box-shadow: none; }
.ch-ico { font-size: 34px; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--panel2); flex: none; }
.ch-main { flex: 1; min-width: 0; }
.ch-main b { font-size: 17px; display: block; margin-bottom: 3px; overflow-wrap: anywhere; }
.ch-go { font-size: 16px; font-weight: 700; padding: 12px 18px; border-radius: 14px !important; white-space: nowrap; }
.ch-done { color: #1f8a5b; font-weight: 800; font-size: 16px; text-align: center; white-space: nowrap; }
.ch-done small { display: block; font-size: 12.5px; font-weight: 700; color: #b7791f; }
.ch-wait { color: var(--accent); font-weight: 700; white-space: nowrap; }
@media (max-width: 520px) { .ch-card { flex-wrap: wrap; } .ch-go { width: 100%; justify-content: center; } }
.chore-home { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r, 14px); padding: 12px 16px; margin: 0 0 16px; box-shadow: var(--shadow); }
.chore-home .ci { font-size: 28px; }
.chore-home b { display: block; }
.chore-home small { color: var(--muted); }
.chore-home .go { margin-left: auto; font-weight: 700; color: var(--accent); white-space: nowrap; }
