/*
    Video chat styles. One dark theme: video looks best on a dark stage, and the drawing board is white paper on it.
    Layout: top bar / main / control bar, all inside the viewport, nothing scrolls but the chat log and the thumbnails.
*/

:root {
    --bg: #0d0f14;
    --bg-elev: #141720;
    --panel: #161a23;
    --surface: #1f242f;
    --surface-2: #2a3040;
    --line: #262c38;
    --text: #e9ecf2;
    --muted: #8e97ab;
    --accent: #6ea8ff;
    --accent-strong: #3b82f6;
    --danger: #ef4444;
    --ok: #34d399;
    --warn: #fbbf24;
    --paper: #ffffff;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 12px 40px rgba(0, 0, 0, .45);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --tab: 4;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    font: 15px/1.5 var(--font);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

button,
input,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: 0;
    background: none;
    padding: 0;
}

button:disabled {
    cursor: default;
    opacity: .5;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

.icon {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

.icon-lg {
    width: 2.75rem;
    height: 2.75rem;
    stroke-width: 1.4;
}

.icon-fill {
    fill: currentColor;
    stroke: none;
}

/* Your own camera is flipped like a mirror, the way a preview feels natural; nobody else sees it flipped. */
.mirror {
    transform: scaleX(-1);
}

/* ---------- Frame ---------- */

.app {
    height: 100dvh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .55rem 1rem;
    padding-top: max(.55rem, env(safe-area-inset-top));
    border-bottom: 1px solid var(--line);
    background: var(--bg-elev);
}

.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 600;
    letter-spacing: .01em;
}

.status-dot {
    width: .6rem;
    height: .6rem;
    border-radius: 50%;
    background: var(--muted);
    box-shadow: 0 0 0 3px rgba(142, 151, 171, .18);
    transition: background .2s, box-shadow .2s;
}

.app[data-state="init"] .status-dot,
.app[data-state="calling"] .status-dot {
    background: var(--warn);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, .22);
    animation: pulse 1.2s ease-in-out infinite;
}

.app[data-state="incall"] .status-dot {
    background: var(--ok);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, .22);
}

@keyframes pulse {
    50% {
        opacity: .45;
    }
}

.status {
    margin: 0;
    flex: 1;
    min-width: 0;
    color: var(--muted);
    font-size: .875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    gap: .25rem;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    color: var(--muted);
    transition: background .15s, color .15s;
}

.icon-btn:hover {
    background: var(--surface);
    color: var(--text);
}

a.icon-btn {
    text-decoration: none;
}

.main {
    min-height: 0;
    position: relative;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 2.5rem;
    padding: .45rem .95rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    transition: background .15s, transform .08s;
}

.btn:hover {
    background: var(--surface-2);
}

.btn:active {
    transform: translateY(1px);
}

.btn.primary {
    background: var(--accent-strong);
    color: #fff;
}

.btn.primary:hover {
    background: #4f8ef7;
}

/* ---------- Lobby ---------- */

.lobby {
    height: 100%;
    overflow: auto;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 1rem;
    padding: 1rem;
}

.lobby-note {
    width: min(100%, 30rem);
    margin: 0;
    text-align: center;
    font-size: .8125rem;
    line-height: 1.5;
    color: var(--muted);
}

.lobby-note a {
    color: var(--accent);
    text-decoration: none;
}

.lobby-note a:hover {
    text-decoration: underline;
}

.lobby-card {
    width: min(100%, 30rem);
    display: grid;
    gap: 1.1rem;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) + 4px);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.preview {
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}

.preview video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.preview-off {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: .5rem;
    color: var(--muted);
    background: linear-gradient(160deg, #1a1f2b, #0f1218);
}

.field {
    display: grid;
    gap: .35rem;
    font-size: .8125rem;
    color: var(--muted);
}

.field input,
.share-row input {
    width: 100%;
    min-width: 0;
    min-height: 2.5rem;
    padding: .45rem .75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: .9375rem;
}

.field input:focus,
.share-row input:focus,
.composer textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.share {
    display: grid;
    gap: .45rem;
}

.share-title {
    font-size: .8125rem;
    color: var(--muted);
}

.share-row {
    display: flex;
    gap: .5rem;
}

.share-row input {
    flex: 1;
    font-family: var(--mono);
    font-size: .8125rem;
    text-overflow: ellipsis;
}

.lobby-status {
    margin: 0;
    min-height: 1.5em;
    text-align: center;
    color: var(--muted);
}

.lobby-status.alert {
    color: var(--warn);
}

/* A small ring turns in front of the line while something is in progress: signing in, entering, connecting. */
.lobby-status.busy::before {
    content: "";
    display: inline-block;
    width: .8em;
    height: .8em;
    margin-right: .5em;
    vertical-align: -.08em;
    border: 2px solid var(--surface-2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.lobby-actions {
    display: flex;
    justify-content: center;
    gap: .5rem;
}

.lobby-actions:empty,
.lobby-actions:not(:has(:not([hidden]))) {
    display: none;
}

/* ---------- Call ---------- */

.call {
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 0;
    transition: grid-template-columns .2s ease;
}

.call.chat-open {
    grid-template-columns: minmax(0, 1fr) var(--chat-width, 23rem); /* --chat-width is set by the resize handle */
}

.viewer {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: .75rem;
    padding: .75rem;
}

.stage {
    position: relative;
    min-height: 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    display: grid;
    grid-template: minmax(0, 1fr) / minmax(0, 1fr); /* one cell, exactly the stage's size, whatever the video's own size */
    place-items: center;
}

/* The video and the board share that one cell, so each sits centred on its own. */
.stage > video,
.stage > .board-wrap {
    grid-area: 1 / 1;
    min-width: 0;
    min-height: 0;
}

/* Every video is shown whole and centred, never cropped: a camera, a shared screen, and the board alike. */
.stage video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

/* The placeholder (no video yet, or a camera turned off) lies over the whole stage, centred in it. */
.stage-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: .5rem;
    text-align: center;
    color: var(--muted);
}

.stage-caption {
    position: absolute;
    left: .75rem;
    bottom: .75rem;
    padding: .25rem .65rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(6px);
    font-size: .8125rem;
    pointer-events: none;
}

.stage-caption:empty {
    display: none;
}

.sound-pill {
    position: absolute;
    top: .75rem;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .5rem .9rem;
    border-radius: 999px;
    background: var(--accent-strong);
    color: #fff;
    font-weight: 500;
    box-shadow: var(--shadow);
}

/* The board: white paper that keeps its 16:10 shape inside the stage. */

.board-wrap {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    padding: .75rem;
    container-type: size;
}

/* As wide as the stage allows, or as wide as its height allows: 16:10 either way, never stretched. */
.board-wrap canvas {
    width: min(100%, calc(100cqh * 1.6));
    height: auto;
    aspect-ratio: 16 / 10;
    background: var(--paper);
    border-radius: 8px;
    touch-action: none;
    cursor: crosshair;
    display: block;
}

.board-tools {
    position: absolute;
    top: .75rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: .5rem;
    max-width: calc(100% - 1.5rem);
    padding: .4rem .5rem;
    border-radius: 999px;
    background: rgba(13, 15, 20, .82);
    backdrop-filter: blur(8px);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.swatches,
.sizes {
    display: flex;
    gap: .3rem;
    padding: 0 .25rem;
}

.sizes {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
}

.swatch {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--c);
    border: 2px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}

.swatch[aria-pressed="true"] {
    border-color: #fff;
}

.size {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
}

.size i {
    width: var(--s);
    height: var(--s);
    border-radius: 50%;
    background: var(--muted);
}

.size[aria-pressed="true"] {
    background: var(--surface-2);
}

.size[aria-pressed="true"] i {
    background: #fff;
}

.tool {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    height: 1.9rem;
    padding: 0 .6rem;
    border-radius: 999px;
    color: var(--muted);
    font-size: .8125rem;
    white-space: nowrap;
}

.tool:hover,
.tool[aria-pressed="true"] {
    background: var(--surface-2);
    color: var(--text);
}

/* Thumbnails */

.strip {
    display: flex;
    justify-content: center;
    gap: .6rem;
    overflow-x: auto;
    padding: 2px 2px 4px;
    scrollbar-width: thin;
}

.strip:not(:has(.tile:not([hidden]))) {
    display: none;
}

.tile {
    position: relative;
    flex: 0 0 auto;
    width: 11rem;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
    outline: 2px solid transparent;
    outline-offset: 0;
    transition: outline-color .15s;
}

.tile:hover {
    outline-color: var(--surface-2);
}

.tile[aria-pressed="true"] {
    outline-color: var(--accent);
}

.tile video,
.tile canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.tile-board canvas {
    background: var(--paper);
}

.tile-name {
    position: absolute;
    left: .4rem;
    bottom: .4rem;
    max-width: calc(100% - .8rem);
    padding: .1rem .5rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, .55);
    font-size: .75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tile-badge {
    position: absolute;
    right: .4rem;
    top: .4rem;
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
}

.tile-badge .icon {
    width: .9rem;
    height: .9rem;
}

/* A camera that is turned off: the video is black, so a placeholder sits on top of it. */

.tile-off {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    color: var(--muted);
    background: linear-gradient(160deg, #1a1f2b, #0f1218);
}

.tile[data-camera="off"] .tile-off {
    display: grid;
}

.stage[data-camera="off"] video {
    visibility: hidden;
}

/* ---------- Chat ---------- */

.chat {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    min-width: 0;
    overflow: hidden;
    border-left: 1px solid var(--line);
    background: var(--panel);
}

/* The resize handle: a thin strip over the panel's left edge, lit while it is used. */
.chat-resizer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 8px;
    cursor: col-resize;
    z-index: 2;
    touch-action: none;
}

.chat-resizer::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    background: var(--accent);
    opacity: 0;
    transition: opacity .15s;
}

.chat-resizer:hover::after,
.chat-resizer:focus-visible::after,
body.resizing .chat-resizer::after {
    opacity: 1;
}

.chat-resizer:focus-visible {
    outline: none;
}

body.resizing {
    cursor: col-resize;
    user-select: none;
}

.call:not(.chat-open) .chat {
    visibility: hidden;
}

.chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .6rem .75rem .6rem 1rem;
    border-bottom: 1px solid var(--line);
}

.chat-head h2 {
    margin: 0;
    font-size: .9375rem;
    font-weight: 600;
}

.log {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: .9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .8rem;
    scrollbar-width: thin;
}

.log:empty::before {
    content: "No messages yet.";
    color: var(--muted);
    font-size: .875rem;
    text-align: center;
    margin: auto;
}

.msg {
    display: grid;
    gap: .2rem;
    min-width: 0;
}

.msg-meta {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    font-size: .75rem;
    color: var(--muted);
}

.msg-who {
    font-weight: 600;
    color: var(--text);
}

.msg.me .msg-who {
    color: var(--accent);
}

.msg-body {
    min-width: 0;
    padding: .55rem .8rem;
    border-radius: 12px;
    background: var(--surface);
    overflow-wrap: anywhere;
}

.msg.system {
    justify-items: center;
    text-align: center;
    font-size: .8125rem;
    color: var(--muted);
}

.msg-file {
    display: grid;
    gap: .35rem;
}

.msg-file progress {
    width: 100%;
    height: .4rem;
    accent-color: var(--accent);
}

.msg-file a {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--accent);
    text-decoration: none;
}

.msg-file a:hover {
    text-decoration: underline;
}

.msg-file img {
    max-width: 100%;
    max-height: 16rem;
    border-radius: 8px;
    display: block;
}

.file-size {
    color: var(--muted);
    font-size: .8125rem;
}

/* Rendered markdown. Code keeps its indentation, never wraps and scrolls sideways inside the message. */

.md > :first-child {
    margin-top: 0;
}

.md > :last-child {
    margin-bottom: 0;
}

.md p {
    margin: 0;
}

.md p + p,
.md p + pre,
.md pre + p,
.md ul,
.md ol,
.md blockquote,
.md h1,
.md h2,
.md h3,
.md h4,
.md h5,
.md h6,
.md hr,
.md table {
    margin: .5rem 0;
}

.md h1,
.md h2,
.md h3,
.md h4,
.md h5,
.md h6 {
    line-height: 1.3;
    font-weight: 650;
}

.md h1 {
    font-size: 1.3em;
}

.md h2 {
    font-size: 1.18em;
}

.md h3 {
    font-size: 1.08em;
}

.md h4,
.md h5,
.md h6 {
    font-size: 1em;
}

.md a {
    color: var(--accent);
}

.md ul,
.md ol {
    padding-left: 1.4rem;
}

.md li + li {
    margin-top: .15rem;
}

.md blockquote {
    padding: .1rem .8rem;
    border-left: 3px solid var(--surface-2);
    color: var(--muted);
}

.md hr {
    border: 0;
    border-top: 1px solid var(--line);
}

.md img {
    max-width: 100%;
    border-radius: 8px;
}

.md code {
    font-family: var(--mono);
    font-size: .875em;
    padding: .1em .35em;
    border-radius: 5px;
    background: rgba(255, 255, 255, .09);
}

.md pre {
    position: relative;
    margin: .5rem 0;
    padding: .65rem .8rem;
    border-radius: 8px;
    background: #0a0c11;
    border: 1px solid var(--line);
    overflow-x: auto;
    white-space: pre;
    tab-size: var(--tab);
    font: .8125rem/1.55 var(--mono);
    scrollbar-width: thin;
}

.md pre code,
.md pre code.hljs {
    display: block;
    min-height: 1.55em; /* an empty block still shows as one line */
    padding: 0;
    background: none;
    font-size: inherit;
    white-space: inherit;
    overflow: visible;
}

.md pre[data-lang]::before {
    content: attr(data-lang);
    position: absolute;
    top: .3rem;
    right: .5rem;
    font-size: .6875rem;
    color: var(--muted);
    text-transform: lowercase;
}

.md pre .copy-code {
    position: absolute;
    top: .3rem;
    right: .5rem;
    padding: .1rem .45rem;
    border-radius: 5px;
    background: var(--surface);
    color: var(--muted);
    font: .6875rem var(--font);
    opacity: 0;
    transition: opacity .15s;
}

.md pre:hover .copy-code,
.md pre .copy-code:focus-visible {
    opacity: 1;
}

.md table {
    border-collapse: collapse;
    font-size: .9em;
}

.md th,
.md td {
    padding: .25rem .6rem;
    border: 1px solid var(--line);
}

/* The composer: a textarea that grows with the text. */

.composer {
    display: flex;
    align-items: flex-end;
    gap: .35rem;
    padding: .6rem .6rem .35rem .75rem;
    border-top: 1px solid var(--line);
}

.composer textarea {
    flex: 1;
    min-width: 0;
    max-height: 12rem;
    resize: none;
    padding: .5rem .75rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
    line-height: 1.45;
    tab-size: var(--tab);
    overflow-y: hidden; /* app.js sizes the box to its text and lets it scroll only past max-height */
    scrollbar-width: thin;
}

.composer .send {
    color: var(--accent);
}

.composer-hint {
    margin: 0;
    padding: 0 .9rem .6rem;
    font-size: .6875rem;
    color: var(--muted);
}

.composer-hint code {
    font-family: var(--mono);
}

/* ---------- Control bar ---------- */

.bar {
    display: flex;
    justify-content: center;
    gap: .5rem;
    padding: .6rem 1rem;
    padding-bottom: max(.6rem, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--bg-elev);
}

.ctl {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    min-width: 4.6rem;
    padding: .5rem .55rem;
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    transition: background .15s, transform .08s;
}

.ctl:hover {
    background: var(--surface-2);
}

.ctl:active {
    transform: translateY(1px);
}

.ctl .icon {
    width: 1.35rem;
    height: 1.35rem;
}

.ctl-label {
    font-size: .6875rem;
    color: var(--muted);
    white-space: nowrap;
}

.ctl .off {
    display: none;
}

/* A pressed toggle: the microphone muted, the camera off, the screen or the board shared. */

.ctl[aria-pressed="true"] {
    background: var(--text);
    color: var(--bg);
}

.ctl[aria-pressed="true"] .ctl-label {
    color: var(--bg);
}

#btnMic[aria-pressed="true"] .on,
#btnCamera[aria-pressed="true"] .on {
    display: none;
}

#btnMic[aria-pressed="true"] .off,
#btnCamera[aria-pressed="true"] .off {
    display: block;
}

.ctl.danger {
    background: var(--danger);
    color: #fff;
}

.ctl.danger .ctl-label {
    color: rgba(255, 255, 255, .85);
}

.ctl.danger:hover {
    background: #dc2626;
}

.hangup {
    transform: rotate(135deg);
}

.unread {
    position: absolute;
    top: .3rem;
    right: .45rem;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 .3rem;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: .6875rem;
    line-height: 1.1rem;
    text-align: center;
}

/* ---------- Toasts ---------- */

.toasts {
    position: fixed;
    left: 50%;
    bottom: calc(5.5rem + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: grid;
    gap: .5rem;
    width: min(92vw, 28rem);
    z-index: 50;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .7rem .9rem;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text);
    box-shadow: var(--shadow);
    font-size: .875rem;
    pointer-events: auto;
    animation: rise .18s ease-out;
}

.toast.error {
    background: #3b1f24;
    border: 1px solid #7f1d1d;
}

.toast p {
    margin: 0;
    flex: 1;
}

.toast p + p {
    margin-top: .25rem;
    color: var(--muted);
}

.toast .icon-btn {
    width: 1.75rem;
    height: 1.75rem;
    margin: -.2rem -.3rem -.2rem 0;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
}

/* ---------- Waiting room controls, settings dialog ---------- */

.preview-ctls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: .75rem;
    display: flex;
    justify-content: center;
    gap: .6rem;
}

.pctl {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: rgba(13, 15, 20, .62);
    backdrop-filter: blur(6px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .18);
    transition: background .15s;
}

.pctl:hover {
    background: rgba(13, 15, 20, .85);
}

.pctl .off {
    display: none;
}

.pctl[aria-pressed="true"] {
    background: var(--danger);
    border-color: transparent;
}

.pctl[aria-pressed="true"] .on {
    display: none;
}

.pctl[aria-pressed="true"] .off {
    display: block;
}

.btn.big {
    min-height: 2.9rem;
    padding: .5rem 1.6rem;
    font-size: 1rem;
}

.app:not([data-state="incall"]) #btnSettings {
    display: none;
}

.dialog {
    width: min(92vw, 24rem);
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--shadow);
}

.dialog::backdrop {
    background: rgba(0, 0, 0, .55);
}

.dialog h2 {
    margin: 0 0 1rem;
    font-size: 1.05rem;
}

.dialog-hint {
    margin: .5rem 0 0;
    font-size: .8125rem;
    color: var(--muted);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: 1.25rem;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 56rem) {
    .ctl {
        min-width: 3.5rem;
    }

    .call,
    .call.chat-open {
        grid-template-columns: minmax(0, 1fr);
    }

    .viewer {
        padding: .5rem;
        gap: .5rem;
    }

    .tile {
        width: 7.5rem;
    }

    .strip {
        justify-content: flex-start;
    }

    .chat-resizer {
        display: none;
    }

    /* The chat covers the call on a phone. */
    .chat {
        position: fixed;
        inset: 0;
        z-index: 30;
        border-left: 0;
        grid-template-rows: auto minmax(0, 1fr) auto;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .composer-hint {
        display: none;
    }

    .board-tools .tool span {
        display: none;
    }

    .board-tools {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: .35rem;
        border-radius: 16px;
    }


    .board-wrap {
        padding: .4rem;
    }
}

@media (max-width: 30rem) {
    .ctl-label {
        display: none;
    }

    .ctl {
        min-width: 3.25rem;
        padding: .65rem .5rem;
    }

    .brand-name {
        display: none;
    }

    .topbar {
        gap: .6rem;
    }

    .lobby-card {
        padding: 1rem;
    }

    .share-row .btn span {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}
