/* Netflix-style profile picker on Reading Road blue (#1859C4), big colourful tiles.
   The brand blue is the design in both OS themes. */
:root {
  --bg: #1859c4;          /* Reading Road blue */
  --surface: #0f3f92;     /* deeper navy for panels and dialogs */
  --surface-2: #154aa6;
  --input: #0b3476;
  --text: #eaf1ff;
  --text-strong: #ffffff;
  --muted: #c2d4f5;
  --border: #3a6fd0;
  --accent: #ffffff;      /* primary buttons: white with blue text */
  --accent-text: #1859c4;
  --allow: #8ef0bd;
  --allow-bg: #0f4a3a;
  --deny: #ffb3ab;
  --deny-bg: #5a1f2a;
  --warn: #ffe08a;
  --warn-bg: #4a3a10;
  --focus: #ffffffcc;
  --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h2 { font-size: 1rem; margin: 0 0 .5rem; color: var(--text-strong); }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .85em; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hint { color: var(--muted); font-size: .85rem; margin: 0 0 .75rem; }
.hidden { display: none !important; }
.error { color: var(--deny); font-size: .85rem; min-height: 1.2em; margin: .25rem 0 0; }

/* ------------------------------------------------------------ header */
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 18px 4vw;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text-strong); font-size: 1.15rem; letter-spacing: .01em; }
.logo-img { display: block; height: clamp(56px, 7.5vw, 86px); width: auto; } /* ~3x the old badge lettering */
.logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: var(--accent-text); font-size: .8rem; font-weight: 800; }
.env { font-size: .75rem; color: var(--warn); background: var(--warn-bg); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }

/* ------------------------------------------------------------ home: who's learning */
.stage { padding: 0 4vw 80px; }
.home { min-height: calc(100vh - 200px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.home-title { color: var(--text-strong); font-size: clamp(2rem, 4.2vw, 3.4rem); font-weight: 500; margin: 0 0 .3em; letter-spacing: -.01em; }
.home-title.left, .home-sub.left { text-align: left; }
.home-sub { color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.2rem); margin: 0 0 2.2rem; max-width: 36em; }
.profiles { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(16px, 2.4vw, 32px); }
.profile {
  all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 12px;
  width: clamp(110px, 11vw, 170px); color: var(--muted); transition: color .15s;
}
.profile .tile {
  width: 100%; aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center;
  font-size: clamp(3.4rem, 6vw, 5.4rem); line-height: 1;
  outline: 3px solid transparent; outline-offset: 0; transition: outline-color .15s, transform .15s;
}
.profile .name { font-size: clamp(.95rem, 1.2vw, 1.25rem); }
.profile .sub { font-size: .75rem; color: var(--muted); margin-top: -8px; }
.profile:hover .tile, .profile:focus-visible .tile { outline-color: var(--text-strong); transform: scale(1.04); }
.profile:hover, .profile:focus-visible { color: var(--text-strong); }
.profile[aria-disabled="true"] { cursor: default; }
.profile[aria-disabled="true"]:hover .tile { transform: none; outline-color: #ffffff44; }
.empty-tile .tile { background: #ffffff1f; border: 2px dashed #ffffff66; color: var(--text-strong); font-size: 3rem; }
.profile .tile { box-shadow: 0 6px 18px rgba(4, 22, 60, .35); }

.add-tile .tile { background: #ffffff14; border: 2px solid #ffffff55; color: var(--text-strong); font-size: 4rem; font-weight: 300; box-shadow: none; }

/* sign-up / add learner */
.switch-line { margin: 14px 0 0; font-size: .85rem; color: var(--muted); }
.linklike { all: unset; cursor: pointer; color: var(--text-strong); text-decoration: underline; font-weight: 600; }
.linklike:focus-visible { outline: 2px solid var(--focus); }
.notice { background: var(--allow-bg); border-radius: 10px; padding: 14px 16px; }
.notice p { margin: 0 0 8px; }
.notice p:last-child { margin-bottom: 0; }
#verify-form .notice { margin-bottom: 14px; }
.code-input { font-size: 1.6rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.field-label { font-size: .8rem; color: var(--muted); margin: 6px 0 8px; }
.avatar-pick { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.avatar-pick button { width: 58px; height: 58px; border-radius: 10px; font-size: 2rem; padding: 0; border: 3px solid transparent; }
.avatar-pick button[aria-checked="true"] { border-color: var(--text-strong); box-shadow: 0 0 0 2px #0008; }

/* tile colours (by avatar) */
.c-fox { background: linear-gradient(135deg, #f08a24, #c4561a); }
.c-owl { background: linear-gradient(135deg, #8e5ad8, #5a2fa3); } /* purple: a blue tile would vanish on the blue page */
.c-bear { background: linear-gradient(135deg, #2fa37f, #1b6e55); }
.c-frog { background: linear-gradient(135deg, #8bc34a, #4f8a1f); }
.c-panda { background: linear-gradient(135deg, #b0b0b0, #6d6d6d); }
.c-default { background: linear-gradient(135deg, #b5489c, #7a2a6b); }

/* ------------------------------------------------------------ learner home */
.learner-home { min-height: calc(100vh - 200px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; }
.hello { display: flex; align-items: center; gap: 22px; }
.hello-avatar { width: 120px; height: 120px; border-radius: 12px; display: grid; place-items: center; font-size: 4.4rem; }
.lh-cards { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.lh-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px 28px; min-width: 220px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lh-big { font-size: 3rem; font-weight: 700; color: var(--text-strong); line-height: 1.1; }
.lh-label { color: var(--muted); }
.lh-card button { margin-top: 10px; }
.big-btn { font-size: 1rem; padding: 12px 22px; }
.launch {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  background: #ffffff; color: #1859c4; border-radius: 16px; padding: 18px 28px; font-size: 1.15rem; min-width: min(420px, 100%);
  box-shadow: 0 10px 30px rgba(4, 22, 60, .35);
}
.launch strong { font-size: 1.4rem; }
.launch-to { font-size: .8rem; opacity: .8; word-break: break-all; }
.launch .row { margin-top: 8px; }
.center-row { justify-content: center; }
.launch button { background: #1859c4; color: #fff; }
.launch button.secondary { background: transparent; color: #1859c4; border-color: #1859c499; }

/* ------------------------------------------------------------ controls */
label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 10px; }
input {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit; color: var(--text-strong);
  background: var(--input); border: 1px solid var(--border); border-radius: 6px;
}
input::placeholder { color: #9fb8e6; }
input:focus, button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
button {
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
  padding: 9px 16px; border-radius: 6px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-text);
}
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary { background: var(--surface-2); color: var(--text-strong); border-color: var(--border); }
button.ghost { background: transparent; color: var(--muted); border-color: var(--border); }
button.ghost:hover { color: var(--text-strong); border-color: #9fb8e6; }
button.small { padding: 4px 10px; font-size: .8rem; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.row.end { justify-content: flex-end; }

/* corner logon */
.corner-btn {
  position: fixed; right: 20px; bottom: 20px; z-index: 20;
  background: #0b3476cc; color: var(--text-strong); border: 1px solid #ffffff66; border-radius: 999px;
  padding: 9px 16px; font-weight: 500; backdrop-filter: blur(6px);
}
.corner-btn:hover { border-color: #ffffff; }
.corner-btn.signed-in { border-color: #ffffff; box-shadow: 0 0 0 2px #ffffff33; }

/* ------------------------------------------------------------ dialogs */
dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
dialog::backdrop { background: rgba(4, 22, 60, .65); }
.logon { padding: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: .6rem; }
.card-head h2 { margin: 0; }
.identity { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.identity + .identity { margin-top: 8px; }
.identity.learner { background: var(--allow-bg); }
.identity .big { font-size: 1.8rem; line-height: 1; }
.identity .name { font-weight: 600; color: var(--text-strong); word-break: break-all; }
.identity .meta { font-size: .78rem; color: var(--muted); word-break: break-all; }
.chip { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); margin-right: 4px; }

.pic { padding: 22px; }
.pic-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.pic-head h2 { margin: 0; }
.pic-head .hint { margin: 2px 0 0; }
.pic-avatar { width: 64px; height: 64px; border-radius: 10px; display: grid; place-items: center; font-size: 2.4rem; line-height: 1; }
.dots { display: flex; gap: 10px; justify-content: center; margin: 6px 0 16px; min-height: 46px; }
.dot { width: 46px; height: 46px; border-radius: 50%; border: 2px dashed #6f95dc; display: grid; place-items: center; font-size: 1.5rem; }
.dot.filled { border-style: solid; border-color: var(--text-strong); }
.pic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pic-grid button {
  font-size: 2.8rem; padding: 14px 0; border-radius: 12px; background: var(--surface-2);
  border: 2px solid var(--border); color: var(--text); line-height: 1; font-weight: 400;
}
.pic-grid button:hover:not(:disabled) { border-color: var(--text-strong); }
.pic-grid button .label { display: block; font-size: .7rem; color: var(--muted); margin-top: 6px; }

/* ------------------------------------------------------------ grown-up tools */
.tools { max-width: 1280px; margin: 0 auto; }
.tools-head { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 24px; margin-bottom: 14px; }
.tools-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; }
.tools-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; min-width: 0; }
.mentor-bar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 8px; }
.mentor-bar label { margin: 0; min-width: 200px; }
.mentor-bar .hint { margin: 0 0 10px; }
.table-wrap { overflow-x: auto; }
.matrix { width: 100%; border-collapse: collapse; font-size: .85rem; }
.matrix th, .matrix td { padding: 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.matrix th { font-size: .75rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.matrix td.who { min-width: 170px; color: var(--text-strong); }
.matrix .who .avatar { font-size: 1.3rem; margin-right: 6px; vertical-align: middle; }
.matrix .who .sub { display: block; font-size: .72rem; color: var(--muted); white-space: nowrap; }
.cell { min-width: 92px; }
.res { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; border: 0; cursor: pointer; background: var(--surface-2); color: var(--muted); }
.res.allow { background: var(--allow-bg); color: var(--allow); }
.res.deny { background: var(--deny-bg); color: var(--deny); }
.res.warn { background: var(--warn-bg); color: var(--warn); }
.res.pending { opacity: .6; }
.cell-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.probe { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.probe .hint { margin: 0 0 6px; }
.probe-row { display: flex; gap: 8px; flex-wrap: wrap; }
.probe-row input { flex: 1 1 200px; margin: 0; }
.code { margin: 0; max-height: 320px; overflow: auto; padding: 12px; border-radius: 8px; background: #082a63; font: 12px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; white-space: pre-wrap; word-break: break-all; }
.log { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; font-size: .8rem; }
.log li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.log time { color: var(--muted); font-variant-numeric: tabular-nums; }
.log .what { word-break: break-all; }

@media (max-width: 900px) {
  .tools-grid { grid-template-columns: 1fr; }
  .stage { padding: 0 16px 110px; }
  .top { padding: 14px 16px; }
  .hello { flex-direction: column; text-align: center; }
  .home-title.left, .home-sub.left { text-align: center; }
}
