/* Portal shell: login, space setup, library, My clips, students. Tokens and components come from the designer's
   css/tokens.css and css/app.css; nothing here defines a colour. */
.portal { position: relative; min-height: 100%; display: flex; flex-direction: column; background: var(--bg); }
.portal > .ma-head { position: relative; z-index: 3; }
.portal .ob-bg { z-index: 0; }
.portal[data-view="library"] .ob-bg, .portal[data-view="clips"] .ob-bg { display: none; }
.portal[data-view="login"]::before, .portal[data-view="setup"]::before, .portal[data-view="boot"]::before { content: ""; position: absolute; inset: 0; z-index: 1;
  background: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(3,3,4,.55), rgba(3,3,4,.15) 70%, rgba(3,3,4,.6)); }
.pscreen { position: relative; z-index: 2; flex: 1; }
.pscreen.center { display: grid; place-items: center; padding: 40px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); }
.pcard { width: min(460px, 100%); padding: 28px 32px 32px; }
.pcard.wide { width: min(640px, 100%); }
.pcard h1 { font-size: clamp(24px, 3.6vw, 34px); margin: 6px 0 22px; }
.pform { display: flex; flex-direction: column; gap: 14px; }
.pnote { margin: 0; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-dim); line-height: 1.5; }
.perr { margin: 0; font-family: var(--font-mono); font-size: 11px; color: var(--red); border: 1px solid var(--red-dim); background: var(--red-wash); border-radius: var(--r-sm); padding: 6px 9px; }
.psent { margin: 0; font-size: 14px; line-height: 1.6; }
#screen-boot { display: grid; place-items: center; }
.who { font-size: 10.5px; color: var(--text-dim); max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pnav { display: flex; gap: 4px; align-items: center; position: relative; top: calc(var(--lockup-h, 40px) * -0.1307); }
.pnav a { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); text-decoration: none; padding: 5px 10px; border-radius: var(--r-sm); border: 1px solid transparent; }
.pnav a:hover { color: var(--blue); }
.pnav a[aria-current="page"] { color: var(--blue); border-color: var(--blue-dim); background: var(--blue-wash); }
.field textarea { background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 8px 10px; font-family: var(--font-mono); font-size: 12px; resize: vertical; }
.field textarea:focus { border-color: var(--blue); outline: none; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline input[type=text] { flex: 1 1 140px; min-width: 0; background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 7px 10px; font-size: 12.5px; }
.inline input[type=text]:focus { border-color: var(--blue); outline: none; }

/* setup */
.kindseg { align-self: flex-start; }
.terms { max-height: 180px; overflow: auto; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--panel-2); font-size: 12px; line-height: 1.55; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.terms p { margin: 0 0 8px; }
.terms ul { margin: 0; padding-left: 18px; color: var(--text-dim); }
.join-row { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.join-row .inline input { max-width: 180px; text-transform: uppercase; }

/* library */
.pwrap { width: min(980px, 100%); margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 16px; }
.dropzone { display: flex; align-items: center; gap: 18px; padding: 18px 20px; border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--panel); transition: border-color .2s, box-shadow .2s; }
.dropzone.drag { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue), inset 0 0 60px rgba(0,229,255,.08); }
.dropzone .drop-plus { margin: 0; flex: none; width: 56px; height: 56px; }
.dropzone .drop-plus .icon { width: 28px; height: 28px; }
.dropzone strong { font-size: 15px; font-weight: 600; }
.dropzone p { margin: 2px 0 0; font-size: 12px; color: var(--text-dim); }
.uploads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.uploads:empty { display: none; }
.up { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--panel); }
.up .name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up .meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-dim); }
.up .bar { grid-column: 1 / -1; margin-top: 2px; }
.up.failed .meta { color: var(--red); }
.lib-head { display: flex; align-items: baseline; gap: 12px; }
.lib-head h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.dim { color: var(--text-dim); font-size: 10.5px; }
.rounds-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--panel); overflow: hidden; }
.rounds-list:empty { display: none; }
.rrow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 16px; align-items: center; padding: 11px 14px; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; width: 100%; }
.rrow:first-child { border-top: 0; }
.rrow:hover:not(:disabled) { background: var(--panel-2); }
.rrow:disabled { cursor: default; }
.rrow .title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .sub { grid-column: 1; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-dim); }
.rrow .len { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.status { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--border-strong); color: var(--text-dim); white-space: nowrap; }
.status.ready { color: var(--blue); border-color: var(--blue-dim); background: var(--blue-wash); }
.status.failed { color: var(--red); border-color: var(--red-dim); background: var(--red-wash); }
.status.analysing, .status.queued, .status.uploading { color: var(--text); }

/* My clips */
.cgroup { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.cgroup h3 { margin: 0; font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; color: var(--blue); text-transform: uppercase; }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.ccard { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--panel); }
.ccard video { width: 100%; aspect-ratio: 16 / 9; background: var(--bg); border-radius: var(--r-sm); }
.ccard .t { font-size: 12.5px; font-weight: 500; }
.ccard .m { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-dim); }

.subhead { margin: 18px 0 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; color: var(--text-dim); text-transform: uppercase; font-weight: 500; }
.moments { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--panel); }
.moments li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 12.5px; }
.moments li:first-child { border-top: 0; }
.moments .m { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-dim); }

/* students dialog */
#students-dlg { width: min(560px, calc(100% - 32px)); }
.students-list { max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--panel-2); scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.students-list:empty::before { content: "No students yet. Add one below, or import a list."; display: block; padding: 12px; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-dim); }
.srow { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; border-top: 1px solid var(--border); font-size: 12.5px; }
.srow:first-child { border-top: 0; }
.srow .m { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-dim); white-space: nowrap; }
.csv-report { font-family: var(--font-mono); font-size: 11px; line-height: 1.5; padding: 10px; border: 1px solid var(--blue-dim); border-radius: var(--r-sm); background: var(--blue-wash); }
.csv-report ul { margin: 4px 0 0; padding-left: 18px; color: var(--text-dim); }

@media (max-width: 700px) {
  .pnav { order: 3; }
  .rrow { grid-template-columns: minmax(0, 1fr) auto; }
  .rrow .len { display: none; }
  .dropzone { flex-direction: column; text-align: center; }
  .pcard { padding: 22px 18px 26px; }
  .portal .ma-head { flex-wrap: wrap; row-gap: 6px; }
  .who { display: none; }
}
