/* The look of the TutrOwl apps: warm paper, hairline warm borders, soft shadows (no hard offsets), Plus Jakarta Sans at weight 800 with
   tight tracking, blue for the main action, yellow for attention. Around the call it is the light paper shell; the video stage is dark. */
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
:root {
  --ink: #141414;
  --paper: #fffefa;
  --canvas: #f4f2ed;
  --muted: #6b6b6b;
  --body: #3d3d3d;
  --blue: #3d5cf2;
  --blue-light: #dfe6ff;
  --yellow: #ffd95a;
  --lilac: #d9c9ff;
  --red: #e5484d;
  --dashed: #c9c5b8;
  --disabled-bg: #e4e1d8;
  --disabled-fg: #8d8a80;
  --shadow: 0 3px 10px rgba(20, 20, 20, 0.07);
  --gutter: max(16px, env(safe-area-inset-left));
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--canvas); color: var(--ink); -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

/* ---- the light shell: lobby, waiting, ended, unsupported ---- */
.brand { position: fixed; top: max(14px, env(safe-area-inset-top)); left: var(--gutter); font-weight: 800; font-size: 18px; letter-spacing: -0.03em; }
body.in-call .brand { display: none; }
.screen { min-height: 100dvh; display: grid; place-items: center; padding: 64px var(--gutter) 24px; }
.card { width: min(440px, 100%); display: grid; gap: 16px; padding: 24px; background: var(--paper); border: 1.5px solid var(--dashed); border-radius: 18px; box-shadow: var(--shadow); }
.card.center { text-align: center; justify-items: center; }
h1 { margin: 0; font-size: 28px; line-height: 1.1; font-weight: 800; letter-spacing: -0.04em; word-spacing: 0.08em; text-wrap: balance; }
.note { margin: 0; color: var(--muted); font-size: 15px; font-weight: 500; line-height: 1.5; max-width: 60ch; }

.preview { aspect-ratio: 4 / 3; background: var(--blue-light); border-radius: 18px; overflow: hidden; border: 1.5px solid var(--dashed); }
.preview video, #self { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }

/* Buttons: the app's own: 54 tall, 14 radius, 15px / 800. "Light" is the default, blue is the main action. */
button, .button {
  font: inherit; font-size: 15px; font-weight: 800; min-height: 54px; padding: 0 20px; border-radius: 14px; border: 1.5px solid var(--dashed);
  background: var(--paper); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 9px; text-decoration: none;
}
button:active:not(:disabled), .button:active { opacity: 0.85; }
button:focus-visible, .button:focus-visible, select:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
button:disabled { background: var(--disabled-bg); color: var(--disabled-fg); border-color: var(--disabled-bg); cursor: not-allowed; }
button.primary, .button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.danger, .button.danger { background: var(--red); border-color: var(--red); color: #fff; }
.card button, .card .button { width: 100%; }

.avatar { position: relative; width: 96px; height: 96px; border-radius: 50%; background: var(--lilac); border: 1.5px solid var(--dashed); display: grid; place-items: center;
  font-size: 40px; font-weight: 800; letter-spacing: -0.03em; }
.avatar::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--blue); animation: ring 1.8s cubic-bezier(0.22, 1, 0.36, 1) infinite; }
@keyframes ring { 0% { transform: scale(0.92); opacity: 0.9; } 100% { transform: scale(1.35); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .avatar::after { animation: none; opacity: 0.5; } }

/* Lobby: pickers and the microphone level */
.devices { display: grid; gap: 12px; }
.devices label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
select { font: inherit; font-size: 15px; font-weight: 600; min-height: 48px; padding: 0 40px 0 14px; border-radius: 14px; border: 1.5px solid var(--dashed); width: 100%;
  appearance: none; background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23141414' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 20px; color: var(--ink); }
.meter-row { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.meter { height: 8px; border-radius: 999px; background: var(--disabled-bg); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--blue); border-radius: 999px; transition: width 80ms linear; }
@media (prefers-reduced-motion: reduce) { .meter span { transition: none; } }

/* ---- the call: a dark stage, rounded tiles, a bar of round controls (the way a meeting app lays it out) ---- */
#call { --head: calc(max(8px, env(safe-area-inset-top)) + 44px); --stage-r: 0px; position: fixed; inset: 0; display: block; padding: 0; background: #111; color: var(--paper); overflow: hidden; }
.head { position: absolute; z-index: 3; top: max(8px, env(safe-area-inset-top)); left: 0; right: 0; height: 44px; padding: 0 calc(var(--gutter) + 4px); display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--paper); }
.head i { width: 1.5px; height: 18px; background: rgba(255, 254, 250, 0.4); }
.tile { position: absolute; inset: var(--head) 12px var(--bar-h, 84px) 12px; border-radius: 20px; overflow: hidden; background: #1c1c1c; }
#remote { width: 100%; height: 100%; object-fit: contain; display: block; }
#screen { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; z-index: 1; }
.name { position: absolute; left: 12px; bottom: 12px; top: auto; margin: 0; padding: 5px 12px; border-radius: 999px; z-index: 3; background: rgba(17, 17, 17, 0.62); color: var(--paper); font-size: 14px; font-weight: 700; }
#self { position: absolute; top: calc(var(--head) + 12px); right: 24px; z-index: 3; width: clamp(88px, 24vw, 180px); aspect-ratio: 3 / 4; height: auto; border-radius: 16px;
  border: 1.5px solid rgba(255, 254, 250, 0.5); background: #2a2a2a; box-shadow: var(--shadow); }
#self.rear { transform: none; }
.debug { position: absolute; z-index: 3; left: calc(var(--gutter) + 4px); top: calc(var(--head) + 4px); max-width: calc(100% - 150px); overflow-wrap: anywhere;
  margin: 0; font: 12px ui-monospace, monospace; color: #cfcbbf; }

/* A shared screen or the whiteboard is the stage. On a phone held upright the two faces sit in a strip above it, on a wide screen in a
   column beside it, so nothing of the shared content is hidden behind them or the controls. */
#call.has-screen.faces-first #screen { display: none; }
#call.has-screen:not(.faces-first) .head, #call.board-open .head { display: none; }
#call:is(.board-open, .has-screen:not(.faces-first)) { --face-w: 132px; --strip: calc(max(8px, env(safe-area-inset-top)) + 99px + 8px); }
#call:is(.board-open, .has-screen:not(.faces-first)) .tile { inset: auto; top: max(8px, env(safe-area-inset-top)); left: var(--gutter); z-index: 3; width: var(--face-w); aspect-ratio: 4 / 3; border-radius: 14px;
  border: 1.5px solid rgba(255, 254, 250, 0.5); background: #2a2a2a; box-shadow: var(--shadow); }
#call:is(.board-open, .has-screen:not(.faces-first)) #remote { object-fit: cover; }
#call:is(.board-open, .has-screen:not(.faces-first)) .name { left: 6px; bottom: 6px; padding: 2px 8px; font-size: 12px; }
#call:is(.board-open, .has-screen:not(.faces-first)) #self, #call:is(.board-open, .has-screen:not(.faces-first)) #self-off { top: max(8px, env(safe-area-inset-top)); left: calc(var(--gutter) + var(--face-w) + 8px); right: auto; width: var(--face-w); aspect-ratio: 4 / 3; }
/* A replaced element given only insets keeps its own size, so the shared screen is sized outright (else a phone screen is cropped to its top-left corner). */
#call.has-screen:not(.faces-first) #screen { top: var(--strip, 0px); left: 0; width: calc(100% - var(--stage-r)); height: calc(100% - var(--strip, 0px) - var(--bar-h, 84px)); }

/* A camera that is off: a round badge with the person's initials, not a black picture. */
.off { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; container-type: size; background: #2a2a2a; color: var(--ink); }
.off span { display: grid; place-items: center; width: min(52cqw, 52cqh, 160px); aspect-ratio: 1; border-radius: 50%; background: var(--lilac); font-weight: 800;
  font-size: min(20cqw, 20cqh, 56px); letter-spacing: -0.03em; }
#self-off { inset: auto; top: calc(var(--head) + 12px); right: 24px; z-index: 3; width: clamp(88px, 24vw, 180px); aspect-ratio: 3 / 4;
  border-radius: 16px; border: 1.5px solid rgba(255, 254, 250, 0.5); box-shadow: var(--shadow); }
#self-off span { font-size: min(16cqw, 16cqh, 40px); }

/* The bar: round controls, a compact red Leave. Wide screens get the controls on a rounded dark plate. */
.bar { --tool: 52px; position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; display: grid; gap: 10px; justify-items: center; padding: 8px var(--gutter) max(14px, env(safe-area-inset-bottom)); }
.tools { display: flex; justify-content: center; align-items: center; gap: 10px; max-width: 100%; }
@media (min-width: 720px) { .tools { padding: 8px 10px; border-radius: 40px; background: #262626; } }
.banner { margin: 0; width: fit-content; max-width: 100%; padding: 8px 14px; border-radius: 16px; background: var(--yellow); color: var(--ink);
  font-size: 13px; font-weight: 800; text-align: center; text-wrap: balance; box-shadow: var(--shadow); }
/* The words are the tooltip and what a screen reader hears. */
.tool { position: relative; flex: none; width: var(--tool); height: var(--tool); min-height: 0; padding: 0; border-radius: 50%; background: #2f2f2f; border-color: transparent; color: var(--paper); }
.tool span:not(.hd) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tool .i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tool .i-off { display: none; }
.tool[aria-pressed="true"] { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
#share[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.tool[aria-pressed="true"] .i-on { display: none; }
.tool[aria-pressed="true"] .i-off { display: block; }
#share[aria-pressed="true"] .i-on { display: block; }
.tool:disabled { background: #222; border-color: transparent; color: #7d7a72; }
.tool.danger { width: calc(var(--tool) * 1.45); border-radius: calc(var(--tool) / 2); background: var(--red); border-color: var(--red); color: #fff; }
.tool.danger .i { transform: rotate(135deg); }
.tool:focus-visible, .item:focus-visible { outline-color: var(--paper); }
#more[aria-expanded="true"] { background: var(--paper); color: var(--ink); }

/* "More": a sheet above the bar, with words, like a meeting app's overflow menu. */
.sheet { position: absolute; z-index: 5; bottom: 100%; margin-bottom: 6px; right: var(--gutter); width: min(300px, calc(100vw - 2 * var(--gutter))); display: grid; gap: 2px; padding: 8px;
  border-radius: 20px; background: var(--paper); color: var(--ink); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35); }
.item { font: inherit; font-size: 15px; font-weight: 700; min-height: 52px; padding: 0 14px; border: 0; border-radius: 14px; background: transparent; color: var(--ink); justify-content: flex-start; gap: 14px; width: 100%; }
.item:active:not(:disabled) { background: var(--blue-light); opacity: 1; }
.item[aria-pressed="true"] { background: var(--blue-light); color: var(--blue); }
.item .i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.item .hd { width: 22px; text-align: center; font-weight: 800; font-size: 14px; }
.item small { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); }

/* ---- the whiteboard ---- */
.board-wrap { position: absolute; z-index: 2; left: 0; right: 0; top: var(--strip, 0px); bottom: var(--bar-h, 84px); display: flex; flex-direction: column; gap: 8px;
  padding: 8px var(--gutter) 4px; background: var(--ink); }
.board-box { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
#board-canvas { display: block; background: var(--paper); border-radius: 14px; touch-action: none; box-shadow: var(--shadow); -webkit-user-select: none; user-select: none; }
.board-note { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); margin: 0; width: max-content; max-width: calc(100% - 16px); padding: 6px 12px; border-radius: 999px;
  background: var(--yellow); color: var(--ink); font-size: 13px; font-weight: 800; text-align: center; box-shadow: var(--shadow); }
.board-tools { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; }
.tool.sm { width: 40px; height: 40px; min-height: 40px; }
.tool.sm .i { width: 20px; height: 20px; }
.swatch[data-c="0"] { --c: #141414; }
.swatch[data-c="1"] { --c: #3d5cf2; }
.swatch[data-c="2"] { --c: #e5484d; }
.swatch { width: 32px; height: 32px; min-height: 0; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid var(--paper); }
.swatch[aria-pressed="true"] { outline: 3px solid var(--yellow); outline-offset: 2px; }
.swatch:disabled, .tool.sm:disabled { opacity: 0.45; }

/* Wide (a laptop, a tablet, a phone on its side): the stage on the left, the two faces in a column on the right. */
@media (min-width: 520px) and (orientation: landscape) {
  #call:is(.board-open, .has-screen:not(.faces-first)) { --face-w: 104px; --strip: 0px; --stage-r: calc(var(--face-w) + 16px); }
  #call.board-open .board-wrap { right: var(--stage-r); }
  #call:is(.board-open, .has-screen:not(.faces-first)) .tile { top: 8px; left: auto; right: 8px; }
  #call:is(.board-open, .has-screen:not(.faces-first)) #self, #call:is(.board-open, .has-screen:not(.faces-first)) #self-off { top: calc(8px + var(--face-w) * 0.75 + 8px); left: auto; right: 8px; }
}
@media (min-width: 860px) and (min-height: 520px) and (orientation: landscape) {
  #call:is(.board-open, .has-screen:not(.faces-first)) { --face-w: 272px; }
}
