:root {
  --ink: #1c315c;
  --muted: #5c6d88;
  --card: rgba(255, 255, 255, .84);
  --line: rgba(255, 255, 255, .72);
  --blue: #3d8eef;
  --pink: #f48bb4;
  --leaf: #3ecf86;
  --sun: #f6c445;
  --violet: #7a4de0;
  --coral: #f08a4b;
  --cream: #f7f8ff;
  --danger: #d4536a;
  --ok: #1f9d62;
  --shadow: 0 22px 50px rgba(40, 72, 140, .12);
  --radius: 34px;
  --nova: linear-gradient(105deg, #5b4ad8 0%, #c44bd4 40%, #f06a9a 72%, #f5a24a 100%);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
  color: var(--ink);
  background: linear-gradient(165deg, #eef5ff 0%, #fff5fa 46%, #f3fff8 100%);
}
body[data-theme="cielo"] {
  background: linear-gradient(165deg, #e7f3ff 0%, #f4fbff 50%, #fff8ee 100%);
}
body[data-theme="lavanda"] {
  background: linear-gradient(165deg, #f4efff 0%, #fff3f8 52%, #f3fff8 100%);
}
body[data-theme="contraste"] {
  --ink: #10233f;
  --muted: #24324a;
  --card: #ffffff;
  background: #f4f7fb;
}
body[data-theme="admin"] {
  --card: rgba(255, 255, 255, .92);
}
a { color: inherit; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.skip {
  position: absolute; left: 1rem; top: -4rem; background: #fff; padding: .6rem 1rem; z-index: 5;
  border-radius: 999px;
}
.skip:focus { top: 1rem; }

.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob {
  position: absolute;
  filter: blur(2px);
  opacity: .72;
}
.blob-blue {
  width: 280px; height: 220px; left: -70px; top: 80px;
  background: radial-gradient(circle at 40% 40%, rgba(61,142,239,.55), rgba(61,142,239,0) 70%);
  border-radius: 60% 40% 55% 45%;
}
.blob-pink {
  width: 320px; height: 240px; right: -80px; top: -20px;
  background: radial-gradient(circle at 50% 50%, rgba(244,139,180,.6), rgba(244,139,180,0) 68%);
  border-radius: 45% 55% 40% 60%;
}
.blob-green {
  width: 260px; height: 200px; right: 8%; bottom: -30px;
  background: radial-gradient(circle at 40% 40%, rgba(62,207,134,.45), rgba(62,207,134,0) 70%);
  border-radius: 50% 40% 60% 40%;
}
.blob-sun {
  width: 180px; height: 160px; left: 18%; bottom: 8%;
  background: radial-gradient(circle at 50% 50%, rgba(246,196,69,.45), rgba(246,196,69,0) 70%);
  border-radius: 50%;
}
.floatie { position: absolute; overflow: visible; }
.float-cloud { width: 120px; top: 18%; left: 42%; opacity: .85; }
.float-star { width: 54px; top: 12%; right: 18%; }
.float-leaf { width: 58px; bottom: 14%; left: 6%; }
.float-sun { width: 64px; bottom: 18%; right: 8%; opacity: .9; }
.sky-quiet .floatie, .sky-quiet .blob { opacity: .35; }
body.is-child .float-star { animation: drift 7s ease-in-out infinite; }
body.is-child .float-cloud { animation: drift 9s ease-in-out infinite reverse; }
@keyframes drift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.shell, header, main { position: relative; z-index: 1; }
.shell { width: 90%; margin: 0 auto; }
body[data-theme="admin"] .shell { width: 90%; }
.topbar, .child-bar, .admin-bar {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap;
  width: 90%;
  margin: .55rem auto 2.75rem;
  padding: .25rem 1rem .25rem .55rem;
  border-radius: 28px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  z-index: 6;
}
.brand { display: flex; align-items: center; text-decoration: none; flex: 0 0 auto; }
.brand-logo, .hero-logo {
  display: block;
  height: 72px;
  width: auto;
  max-width: none;
  object-fit: contain;
}
.hero-logo { height: 188px; max-width: min(420px, 100%); margin: 0 auto .2rem; }
.child-bar .brand-logo { height: 64px; }
.topbar form label, .admin-bar form label, .child-bar form label {
  display: flex; align-items: center; gap: .4rem; font-weight: 650;
}
.topbar select, .admin-bar select, .child-bar select { width: auto; min-width: 7.5rem; }
.child-name { font-size: 1.2rem; }

nav { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.nav-link, .button, .text-button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 46px; padding: .65rem 1.05rem; border-radius: 999px; text-decoration: none;
  border: 1px solid transparent;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.nav-link { background: rgba(255,255,255,.7); }
.nav-link:hover, .button.secondary:hover, .text-button:hover { transform: translateY(-2px); background: #fff; }
.button {
  background: var(--nova); color: white; border: 0; font-weight: 750;
  box-shadow: 0 10px 22px rgba(122, 77, 224, .28);
}
.button:hover { transform: translateY(-2px); filter: saturate(1.08); }
.button.secondary {
  background: white; color: var(--ink);
  border: 1px solid rgba(28,49,92,.08);
  box-shadow: 0 8px 18px rgba(40, 72, 140, .08);
}
.button.wide { width: 100%; }
.button:disabled { opacity: .6; cursor: wait; transform: none; }
.text-button { background: transparent; padding-inline: .7rem; }
.button:focus-visible, .nav-link:focus-visible, .text-button:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(61, 142, 239, .55);
  outline-offset: 3px;
}

.glass {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 42px 30px 46px 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 1rem; padding: .7rem 0 1.4rem; align-items: stretch; }
.hero-copy, .panel { padding: 1.25rem 1.35rem; }
.hero-copy { display: flex; flex-direction: column; justify-content: center; }
.login-card { width: min(460px, 100%); margin: 1.4rem auto 2rem; }
.hero-copy h1 {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: .2rem 0 1rem; }
.chips span {
  padding: .45rem .9rem;
  border-radius: 999px;
  background: white;
  font-weight: 750;
  box-shadow: 0 8px 16px rgba(40, 72, 140, .08);
}
.chips span:nth-child(1) { color: #2f74cf; }
.chips span:nth-child(2) { color: #1f9d62; }
.chips span:nth-child(3) { color: #7a4de0; }
.chips span:nth-child(4) { color: #e06a38; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .6rem; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.muted { color: var(--muted); }
.grid { display: grid; gap: 1rem; }
.cards { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.module-card, .student-card, .stat {
  padding: 1.15rem; text-decoration: none; display: flex; flex-direction: column; gap: .45rem; min-height: 140px;
  transition: transform .18s ease, box-shadow .18s ease;
}
.module-card, .student-card { position: relative; overflow: hidden; }
.module-card:hover, .student-card:hover, .stat:hover { transform: translateY(-4px) rotate(-.3deg); }
.module-badge {
  width: 74px; height: 68px; display: grid; place-items: center;
  border-radius: 46% 54% 42% 58%;
  background: #fff;
  background: color-mix(in srgb, var(--accent, var(--blue)) 28%, white);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.7);
}
.module-icon { width: 52px; height: 52px; }
.avatar {
  width: 76px; height: 76px; object-fit: cover;
  border-radius: 48% 52% 46% 54%;
  background: white;
  padding: 4px;
  box-shadow: 0 10px 0 rgba(61,142,239,.08), 0 14px 24px rgba(40,72,140,.12);
}
.avatar.tiny { width: 46px; height: 46px; }
.nav-avatar { width: 28px; height: 28px; padding: 0; box-shadow: none; }
.row { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
label { display: grid; gap: .35rem; font-weight: 650; min-width: 0; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]),
select,
textarea {
  width: 100%; min-width: 0; max-width: 100%; min-height: 48px;
  border-radius: 22px; border: 1px solid rgba(28,49,92,.14);
  background-color: #fff; padding: .7rem 1rem;
}
select {
  appearance: none;
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%231c315c' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .85rem center;
  background-size: 14px;
}
textarea { min-height: 120px; border-radius: 22px; }
input[type="date"], input[type="datetime-local"], input[type="time"] { border-radius: 22px; }
input[type="checkbox"] {
  appearance: none;
  width: 1.25rem; height: 1.25rem; margin: 0;
  border-radius: 8px;
  border: 2px solid rgba(28,49,92,.22);
  background: #fff;
  display: inline-grid; place-items: center;
  flex: 0 0 auto;
}
input[type="checkbox"]:checked {
  border-color: transparent;
  background: var(--nova);
}
input[type="checkbox"]:checked::after {
  content: "";
  width: .28rem; height: .55rem;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
.form-grid { display: grid; gap: 1rem; min-width: 0; }
.account-layout { display: flex; flex-direction: column; gap: 2.75rem; min-width: 0; }
.account-layout > .panel { padding: 1.75rem 1.9rem; }
.account-layout > .form-grid { gap: 1.6rem; }
.account-layout h1 { margin-bottom: .85rem; }
.account-layout fieldset { margin: 0; padding: 1.15rem 1.25rem; }
.account-layout .avatar-picker { gap: .9rem 1rem; }
.danger-card {
  display: grid; gap: 1.25rem; align-content: start; justify-items: start;
}
.danger-card h2 { margin: 0; }
.danger-card .check { gap: .85rem; align-items: center; line-height: 1.45; }
.button.danger {
  background: #fff; color: var(--danger);
  border: 1px solid rgba(212, 83, 106, .35);
  box-shadow: 0 8px 18px rgba(212, 83, 106, .12);
}
.check { font-weight: 500; grid-template-columns: auto 1fr; align-items: center; }
.field-error { color: var(--danger); font-weight: 650; }
.flash { padding: .9rem 1rem; border-radius: 22px; margin: .5rem 0 1rem; }
.flash.success { background: #e7f8ef; }
.flash.error { background: #fde8ee; }
.banner {
  display: none; position: sticky; top: 0; z-index: 4; background: var(--ink); color: white; text-align: center; padding: .7rem;
}
.banner.show { display: block; }
.choices, .option-grid { display: grid; gap: .7rem; }
.choice, .card-face, .group-bin {
  min-height: 68px; border-radius: 28px 36px 26px 34px;
  border: 2px solid rgba(28,49,92,.08);
  background: white; padding: .85rem 1rem; display: flex; align-items: center; gap: .8rem;
  text-align: left; font-weight: 700;
  box-shadow: 0 8px 16px rgba(40,72,140,.06);
  transition: transform .16s ease, border-color .16s ease;
}
.choice:hover, .card-face:hover { transform: translateY(-2px); }
.choice.selected, .card-face.up { border-color: var(--violet); background: #f6f2ff; }
.choice.bad { border-color: #f0b3c0; }
.symbol { width: 32px; height: 32px; display: inline-grid; place-items: center; color: var(--violet); }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 0 1px rgba(28,49,92,.2); }
.progress-line { height: 12px; background: rgba(28,49,92,.08); border-radius: 99px; overflow: hidden; }
.progress-line span { display: block; height: 100%; background: var(--nova); }
.child-main { padding-bottom: 2.4rem; }
.prompt { font-size: clamp(1.4rem, 3vw, 2rem); }
.canvas-wrap { display: grid; gap: .7rem; }
canvas { width: 100%; height: auto; background: white; border-radius: 32px 40px 28px 36px; touch-action: none; border: 0; box-shadow: inset 0 0 0 1px rgba(28,49,92,.08); }
.palette { display: flex; flex-wrap: wrap; gap: .5rem; }
.swatch-btn { width: 48px; height: 48px; border-radius: 50%; border: 3px solid white; box-shadow: 0 6px 12px rgba(40,72,140,.15); }
.stars { color: #e0a11a; letter-spacing: .12em; }
.table-wrap { overflow-x: auto; min-width: 0; }
.table-wrap th, .table-wrap td { padding: 1.05rem 1.15rem; vertical-align: middle; }
.table-actions, .table-actions form {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem;
}
.table-actions .check { display: inline-flex; align-items: center; gap: .45rem; margin: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .75rem; border-bottom: 1px solid rgba(28,49,92,.08); vertical-align: top; }
.avatar-picker, .theme-picker { display: flex; flex-wrap: wrap; gap: .6rem; }
.avatar-picker label, .theme-picker label {
  display: flex; align-items: center; gap: .4rem; font-weight: 650;
  background: white; border-radius: 999px; padding: .4rem .7rem;
}
.done-card { text-align: center; padding: 2rem 1rem; }
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 1rem 1.15rem;
  align-items: end;
  margin: 0 0 1.15rem;
  min-width: 0;
}
.filters .button { justify-self: start; min-width: 8.5rem; }
.pager {
  display: flex; justify-content: center; align-items: center; flex-wrap: wrap;
  gap: .75rem 1rem;
  margin: 1.15rem 0 .2rem;
}
.pager span { font-weight: 700; color: var(--muted); }
body[data-theme="admin"] main > section { display: flex; flex-direction: column; gap: 1.15rem; }
body[data-theme="admin"] main > section.account-layout { gap: 2.75rem; }
body[data-theme="admin"] main > section > .filters,
body[data-theme="admin"] main > section > .pager { margin: 0; }
.account-menu { position: relative; }
.account-trigger {
  width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink); cursor: pointer;
  background: radial-gradient(circle at 32% 28%, #ffffff 0%, #e7eefb 58%, #d5e2f6 100%);
  box-shadow: 0 10px 18px rgba(40, 72, 140, .18), inset 0 0 0 1px rgba(255,255,255,.95);
}
.account-trigger svg { width: 24px; height: 24px; }
.account-trigger.has-avatar { padding: 3px; }
.account-trigger img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.account-trigger:hover, .account-trigger[aria-expanded="true"] { transform: translateY(-2px); }
.account-panel {
  position: absolute; top: calc(100% + .7rem); right: 0; z-index: 8;
  width: min(260px, 78vw); padding: 1rem; display: grid; gap: .75rem;
  border-radius: 28px;
}
.account-panel[hidden] { display: none !important; }
.account-panel::before {
  content: ""; position: absolute; top: -6px; right: 18px;
  width: 12px; height: 12px; background: #fff; transform: rotate(45deg);
  border-left: 1px solid var(--line); border-top: 1px solid var(--line);
}
.account-name { margin: 0; font-weight: 800; }
.account-mail { margin: -.35rem 0 0; word-break: break-word; }
.account-panel .button, .account-panel form { width: 100%; }
.account-logout {
  width: 100%; min-height: 46px; border-radius: 999px; border: 1px solid rgba(212, 83, 106, .28);
  background: #fff; color: var(--danger); font-weight: 750;
}
.score-chart { width: min(100%, 420px); height: auto; background: white; border-radius: 28px 36px 24px 32px; }
.question-block { margin: .8rem 0; border-radius: 28px 36px 24px 32px; }
fieldset { border: 1px solid rgba(28,49,92,.1); border-radius: 28px; padding: .9rem; min-width: 0; }
main { padding-bottom: 2rem; }
@media (max-width: 800px) {
  .shell, .topbar, .child-bar, .admin-bar { width: calc(100% - 10px); }
  .topbar, .child-bar, .admin-bar {
    margin-top: .3rem;
    padding: .2rem .4rem;
    gap: .35rem;
    border-radius: 20px;
  }
  .hero { grid-template-columns: 1fr; gap: .55rem; padding: .4rem 0 .8rem; }
  .hero-copy, .panel { padding: .75rem .8rem; }
  .glass { backdrop-filter: none; background: rgba(255,255,255,.94); border-radius: 20px; }
  .brand-logo, .child-bar .brand-logo { height: 52px; }
  .hero-logo { height: 112px; }
  .nav-link, .button, .text-button { min-height: 40px; padding: .4rem .7rem; }
  .chips { gap: .35rem; margin-bottom: .4rem; }
  .chips span { padding: .28rem .6rem; font-size: .85rem; }
  .topbar form label span, .admin-bar form label span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .module-card, .student-card, .stat { min-height: 0; padding: .85rem; }
  main { padding-bottom: 1rem; }
  .float-cloud, .float-sun, .float-leaf { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}
body[data-reduced="1"] * { animation: none !important; transition: none !important; }
