:root { color-scheme: dark; font-family: system-ui,sans-serif; background:#111721; color:#fff9ef; }
* { box-sizing:border-box; }
body { margin:0; }
header { text-align:center; padding:28px 20px 8px; }
header img { width:min(230px,68vw); height:auto; }
main { width:min(100% - 32px,580px); margin:0 auto; padding:24px 0 56px; }
h1 { margin:0 0 12px; font-size:clamp(2rem,7vw,3.2rem); letter-spacing:-.04em; line-height:1.06; }
h2 { font-size:1.22rem; margin:0; }
p { line-height:1.55; color:#d0d9e8; }
section,article { border:1px solid #344258; border-radius:16px; padding:16px; margin:12px 0; background:#1a2331; }
form,fieldset { display:grid; gap:14px; }
fieldset { border:0; padding:0; margin:0; }
legend { margin-bottom:10px; font-weight:700; }
label:not(.choice) { display:grid; gap:6px; }
button,input,textarea { font:inherit; }
button,input:not([type=checkbox]),textarea { min-height:48px; border-radius:12px; border:1px solid #50607a; padding:10px 14px; background:#192332; color:inherit; }
textarea { width:100%; resize:vertical; }
button { cursor:pointer; }
button:disabled { opacity:.6; }
.primary { background:#ffce72; color:#161c25; font-weight:750; border-color:#ffce72; }
.choice,.nav,.instructor { display:flex; gap:12px; align-items:center; }
.choice { padding:8px 0; }
.choice input { width:22px; height:22px; accent-color:#ffce72; flex-shrink:0; }
.nav { flex-wrap:wrap; margin:16px 0; }
.instructor img { height:56px; width:56px; border-radius:50%; object-fit:cover; }
.instructor p, .message p { margin:.3rem 0; }
.message p { overflow-wrap:anywhere; white-space:pre-wrap; }
#thread { max-height:48vh; overflow:auto; }
:focus-visible { outline:3px solid #ffce72; outline-offset:3px; }
[role=alert] { color:#ffbbae; }
[role=alert]:empty { display:none; }

.selected-class { padding: 0; margin: 0; overflow: hidden; }
.classroom-profile { display: grid; gap: 14px; padding: 20px; text-align: left; background: #20314c; }
.classroom-profile .instructor img, .classroom-avatar { width: 72px; height: 72px; border-radius: 50%; flex: 0 0 72px; }
.classroom-avatar { display: grid; place-items: center; background: #344763; font-size: 30px; }
.parent-class-children, .parent-class-updates { margin: 0; padding: 14px 20px; }
.parent-class-children legend { float: left; width: 100%; margin: 0; }
.parent-class-updates { border-top: 1px solid #344258; }
.parent-class-updates h3 { margin: 0; font-size: 1rem; }
.parent-class-updates p { margin: 8px 0 0; }
.classroom-update-item { white-space: pre-wrap; overflow-wrap: anywhere; }
.notification-opt-in { margin-top: 14px; }

.instructor-feed { margin-top: 22px; background: #172334; }
.instructor-post { width: min(100%, 450px); background: #20334c; border-bottom-left-radius: 5px; }
.instructor-post p { margin: 6px 0; }
.instructor-post-room { font-size: .9rem; color: #b9cce7; }
.instructor-post img { display: block; max-width: 100%; max-height: 360px; border-radius: 12px; margin: 12px 0; }
.instructor-post button { margin-top: 8px; }
.instructor-contact { text-align: left; color: #ffce72; }

.family-child-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.child-alert-action button { min-height: 40px; }
.child-alert { display: inline-block; padding: 3px 7px; border-radius: 7px; color: var(--alert-color); animation: child-alert-pulse 1.8s ease-in-out infinite; }
.child-alert--urgent { --alert-color: #ff8a8a; }
.child-alert--standard { --alert-color: #86e9af; }
@keyframes child-alert-pulse {
  0%, 100% { text-shadow: none; }
  50% { text-shadow: 0 0 10px var(--alert-color); }
}
@media (prefers-reduced-motion: reduce) {
  .child-alert { animation: none; }
}

body > header {
  padding-top: max(22px, env(safe-area-inset-top));
  padding-inline: 16px;
}
main {
  width: min(100%, 612px);
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  overflow-wrap: anywhere;
}
main :is(section, article, form, fieldset, input, button, textarea) { min-width: 0; max-width: 100%; }
main :is(input, textarea) { font-size: 1rem; }
.choice > span, .instructor > div { min-width: 0; }
.family-layout, .family-check-in { min-width: 0; }
.instructor-post img { height: auto; object-fit: contain; }
#thread { max-height: 48dvh; }
@media (max-width: 420px) {
  .nav { gap: 8px; }
  .nav button { padding-inline: 10px; }
  .classroom-profile, .parent-class-children { padding: 14px; }
  .classroom-profile .instructor img, .classroom-avatar { width: 48px; height: 48px; flex-basis: 48px; }
  .child-alert-action button { min-height: 44px; }
}
@media (orientation: landscape) and (max-height: 540px) {
  body > header { padding-bottom: 4px; }
  body > header img { width: min(150px, 25vw); }
  main { padding-top: 12px; }
}
@media (min-width: 900px) {
  main:has(.family-layout) { width: min(100%, 1080px); }
  .family-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .family-layout .instructor-feed { margin-top: 0; }
}

.app-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 10;
  background: #111721;
  border-bottom: 1px solid #344258;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
}
.app-header a { display: inline-flex; border-radius: 8px; }
.app-header img { width: min(140px, 36vw); display: block; }
.phone-screen { max-width: 440px; margin: 0 auto; text-align: center; }
.phone-screen h1 { font-size: clamp(1.65rem, 6vw, 2.25rem); margin-bottom: 18px; }
.phone-screen form { gap: 12px; }
.phone-display {
  display: grid; place-items: center; min-height: 52px; padding: 8px;
  border: 1px solid #344258; border-radius: 12px; background: #0d131c;
  font-size: clamp(1.25rem, 5vw, 1.6rem); font-variant-numeric: tabular-nums;
}
.phone-keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.phone-keys button { min-height: clamp(54px, 9dvh, 82px); padding-inline: 4px; touch-action: manipulation; }
.phone-keys [data-phone-key]:not([data-phone-key="delete"]) { font-size: clamp(1.5rem, 5vw, 2rem); }
.parent-home { max-width: 500px; margin: 0 auto; }
.parent-identity { text-align: center; margin-bottom: 26px; }
.parent-identity h1 { font-size: clamp(1.55rem, 6vw, 2.25rem); margin: 12px 0 5px; }
.parent-identity p { margin: 3px 0; }
.signed-in-label { font-size: .875rem; }
.profile-photo-button {
  display: inline-grid; place-items: center; padding: 0; border: 0;
  min-height: 44px; min-width: 44px; border-radius: 50%; background: transparent;
}
.profile-photo {
  display: grid; place-items: center; flex-shrink: 0; object-fit: cover;
  width: 48px; height: 48px; border-radius: 50%; background: #344763;
}
.profile-placeholder { font-size: 20px; }
.parent-identity .profile-photo, .profile-preview .profile-photo { width: 76px; height: 76px; font-size: 30px; }
.profile-preview { display: flex; justify-content: center; }
.home-child { justify-content: start; padding: 12px; }
.home-child-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.home-child .child-alert-action { margin-left: auto; }
.checkin-child { justify-content: flex-start; }
.family-check-in > .selected-class { margin-top: 14px; }
.checkin-child .choice { flex: 1; min-width: 0; }
.check-in-light { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: #65e6a0; }
.check-in-light.has-alert { animation: status-light-pulse 1.8s ease-in-out infinite; }
.check-in-light.is-urgent { background: #ff7777; }
@keyframes status-light-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .42; box-shadow: 0 0 9px currentColor; }
}
@media (prefers-reduced-motion: reduce) {
  .check-in-light.has-alert { animation: none; }
}
