:root {
  color-scheme: dark;
  --paper: #151817;
  --surface: #1c201e;
  --input: #171a19;
  --ink: #e6ebe7;
  --muted: #a5b0a9;
  --line: #353d38;
  --highlight: #2a332e;
  --primary: #a6c3ad;
  --primary-hover: #bad1be;
  --on-primary: #121b15;
  --danger: #e9a29a;
  font: 16px/1.5 "Segoe UI", "Arial", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: progress; opacity: .65; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1, h2 { font-weight: 700; line-height: 1.16; letter-spacing: -.025em; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.75rem, 3.5vw, 2.45rem); }
h2 { font-size: 1.25rem; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner {
  max-width: 90rem;
  min-height: 4.25rem;
  margin: auto;
  padding: .6rem clamp(1rem, 4vw, 3.25rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: .65rem; font-size: 1.35rem; font-weight: 750; text-decoration: none; }
.brand-mark { display: inline-flex; width: 1.7rem; height: 1.3rem; color: var(--primary); }
.brand-mark::before, .brand-mark::after {
  content: "";
  width: 50%;
  border: 2px solid currentColor;
}
.brand-mark::before { border-radius: .26rem .14rem .18rem .25rem; transform: skewY(10deg); }
.brand-mark::after { border-radius: .14rem .26rem .25rem .18rem; transform: skewY(-10deg); margin-left: -1px; }
.account { display: flex; gap: 1rem; align-items: center; font-weight: 600; overflow-wrap: anywhere; }
.surface { border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); }
.muted, .field-help, .page-status { color: var(--muted); }
.field-help { font-size: .875rem; }
.page-status { width: min(100% - 2rem, 34rem); margin: 4rem auto; }
.error { color: var(--danger); font-size: .9375rem; overflow-wrap: anywhere; }

.button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  font-weight: 600;
  min-height: 2.75rem;
  text-align: center;
}
.button {
  padding: .55rem 1rem;
  border-radius: .4rem;
  border: 1px solid transparent;
  transition: background-color .15s, border-color .15s;
}
.primary { background: var(--primary); color: var(--on-primary); }
.primary:hover:enabled { background: var(--primary-hover); }
.secondary { color: var(--ink); background: transparent; }
.secondary:hover:enabled, .secondary.is-off, .text-button:hover:enabled { background: var(--highlight); }
.danger { color: var(--danger); background: transparent; }
.danger:hover:enabled { background: #392825; }
.small { min-height: 2.35rem; padding: .3rem .75rem; font-size: .875rem; white-space: nowrap; }
.text-button {
  padding: .3rem .5rem;
  background: none;
  border: 0;
  border-radius: .4rem;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: .2em;
}
.icon-btn svg { flex: 0 0 auto; width: 1.125rem; height: 1.125rem; }
.media-toggle { min-width: 2.75rem; padding: .5rem; }
.media-toggle .button-caption {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

@media (hover: hover) {
  [data-tooltip] { position: relative; }
  [data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    z-index: 3;
    bottom: calc(100% + .4rem);
    left: 50%;
    width: max-content;
    max-width: min(14rem, 75vw);
    padding: .28rem .55rem;
    border: 1px solid var(--line);
    border-radius: .35rem;
    color: var(--ink);
    background: var(--input);
    font-size: .8125rem;
    font-weight: 400;
    line-height: 1.4;
    text-align: center;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%);
    transition: opacity .12s;
  }
  [data-tooltip]:hover:enabled::after, [data-tooltip]:focus-visible::after { opacity: 1; }
  .topbar [data-tooltip]::after { bottom: auto; top: calc(100% + .4rem); right: 0; left: auto; transform: none; }
}

label { display: grid; gap: .375rem; font-size: .9375rem; font-weight: 650; }
input {
  min-width: 0;
  width: 100%;
  min-height: 2.9rem;
  padding: .55rem .75rem;
  border: 1px solid var(--line);
  border-radius: .4rem;
  background: var(--input);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 400;
}
input::placeholder { color: #929e96; }
input[readonly] { background: var(--paper); }
form { display: grid; gap: 1rem; }

.auth {
  width: min(100% - 2rem, 30rem);
  margin: clamp(1.5rem, 8vh, 5rem) auto 2rem;
  padding: clamp(1.25rem, 4vw, 2.5rem);
}
.auth h1 { margin-bottom: 1.5rem; }
.auth > .muted { margin: -.9rem 0 1.35rem; }
.auth .field-help { margin-top: -.5rem; }
.auth .text-button { margin-top: .75rem; }

.dashboard, .room {
  width: min(100% - clamp(2rem, 8vw, 6.5rem), 83.5rem);
  margin: clamp(1.5rem, 5vh, 3rem) auto 2rem;
}
.page-heading { margin-bottom: 1.25rem; }
.dashboard-columns, .room-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem);
  gap: 1rem;
  align-items: start;
}
.lesson-list { min-height: 8rem; overflow: hidden; }
.lesson-list > p { padding: 1.5rem; color: var(--muted); }
.lesson-list ul { margin: 0; padding: 0; list-style: none; }
.lesson-list li + li { border-top: 1px solid var(--line); }
.lesson-list a { display: grid; gap: .25rem; padding: 1rem 1.35rem; text-decoration: none; }
.lesson-list a:hover { background: var(--highlight); }
.lesson-list a:focus-visible { outline-offset: -4px; }
.lesson-title { font-weight: 650; overflow-wrap: anywhere; }
.lesson-meta { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.create-room, .invitation-panel { padding: 1.2rem; }
.create-room h2, .invitation-panel h2 { margin: 0 0 .15rem; }

.back { display: inline-block; margin-bottom: .65rem; color: var(--primary); font-weight: 600; text-underline-offset: .22em; }
.room-heading { display: grid; gap: .4rem; }
.call-status { min-height: 1.5em; }
.call { padding: .75rem; }
.participants {
  position: relative;
  background: #101311;
  border-radius: .75rem;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  min-height: 14rem;
}
.video-tile { position: relative; margin: 0; background: #101311; overflow: hidden; }
.video-tile video { display: block; width: 100%; height: 100%; object-fit: cover; }
.video-tile figcaption {
  position: absolute;
  bottom: .45rem;
  left: .45rem;
  right: max(.45rem, 15%);
  width: fit-content;
  max-width: calc(100% - .9rem);
  color: var(--ink);
  background: #141816ed;
  border-radius: .35rem;
  padding: .15rem .5rem;
  font-size: .875rem;
  overflow-wrap: anywhere;
}
.remote { height: 100%; }
.local {
  position: absolute;
  bottom: .65rem;
  right: .65rem;
  width: clamp(5rem, 26%, 13rem);
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--highlight);
}
.local video { transform: scaleX(-1); }
.video-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem 18% 2.25rem;
  color: var(--muted);
  text-align: center;
  background: #101311;
}
.call-controls { display: flex; justify-content: center; flex-wrap: wrap; gap: .55rem; margin-top: .75rem; }
.call-error { margin: .75rem .25rem 0; }
.invitation-panel { display: grid; gap: .85rem; }
.invitation-panel .button { width: 100%; }
.invitation-panel label { margin-bottom: .65rem; }
.student-room { max-width: 62rem; }
.student-room .room-columns { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 54rem) {
  .dashboard-columns, .room-columns { grid-template-columns: minmax(0, 1fr); }
  .create-room { grid-row: 1; }
}

@media (max-width: 34rem) {
  .call-controls > .button { flex: 1 1 8rem; }
  .call-controls > .media-toggle { flex: 0 1 2.75rem; }
  .participants { min-height: 12.5rem; }
  .video-empty { padding-bottom: 3rem; }
}

@media (hover: none) {
  .call-controls > .media-toggle { flex: 1 1 auto; padding: .5rem .65rem; }
  .media-toggle .button-caption {
    position: static;
    width: auto;
    height: auto;
    clip-path: none;
    overflow: visible;
  }
}
