:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --paper: #1f2430;
  --muted: #667085;
  --line: #d9dde4;
  --hover: #eceff3;
  --sidebar: #eceff3;
  --accent: #2f5fd0;
  --accent-strong: #234aa8;
  --accent-soft: #e2e9fa;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #9a5b00;
  --warn-soft: #fdf3dc;
  --shadow: 0 6px 20px rgb(16 24 40 / .12);
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Newsreader', Georgia, serif;
  --mono: 'DM Mono', ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--paper); font: 15px/1.5 var(--sans); }
button, input, textarea { font: inherit; color: inherit; }
button { min-height: 36px; padding: 6px 14px; border: 1px solid transparent; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
button:hover { background: var(--accent-strong); }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
kbd { border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; margin-left: 6px; font: 11px var(--mono); }
.artifact-icon { font-size: 15px; line-height: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Page chrome */
header { height: 56px; padding: 0 24px; display: flex; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.mark { color: var(--paper); font-weight: 700; font-size: 18px; text-decoration: none; flex-shrink: 0; }
.mark span { display: none; }
.head-label, .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--muted); }
.head-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-link { margin-left: auto; flex-shrink: 0; color: var(--paper); font-size: 14px; text-decoration: none; padding: 8px 10px; border-radius: 6px; }
.library-link:hover { background: var(--hover); }
h1 { font-weight: 600; overflow-wrap: anywhere; }
.lede, .login p:not(.eyebrow) { color: var(--muted); }

/* Library */
.library { max-width: 1080px; margin: 0 auto; padding: 40px 24px; }
.library h1 { font-size: 32px; margin: 8px 0; }
.grid { margin-top: 28px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.card { min-width: 0; min-height: 140px; display: flex; flex-direction: column; position: relative; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--paper); text-decoration: none; }
.card:hover { border-color: var(--accent); }
.card-tag { align-self: flex-start; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.card strong { font-size: 18px; margin: 14px 0 10px; overflow-wrap: anywhere; }
.card small { margin-top: auto; font: 11px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arrow { position: absolute; top: 16px; right: 16px; color: var(--muted); }

/* Login */
.login { max-width: 420px; margin: 0 auto; padding: 14vh 24px 40px; }
.login h1 { font-size: 30px; margin: 8px 0 12px; }
.login form { display: flex; flex-direction: column; gap: 14px; margin-top: 24px; }
.login label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
.login input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-family: var(--mono); }
.login button { display: flex; justify-content: space-between; align-items: center; }

/* Presentation and phone remote */
.present { max-width: 1600px; margin: auto; padding: 20px 24px 28px; }
.present-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.present-head > div { min-width: 0; }
.present h1 { font-size: 26px; margin: 4px 0 16px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; flex-shrink: 0; }
.controls button { color: var(--paper); background: var(--surface); border-color: var(--line); }
.controls button:hover { background: var(--hover); }
iframe#deck { display: block; width: 100%; height: min(73dvh, 850px); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
footer { display: flex; justify-content: space-between; gap: 20px; padding-top: 12px; font-size: 13px; color: var(--muted); }
footer span { min-width: 0; }
footer a { overflow-wrap: anywhere; }
.remote { min-height: 100svh; padding: 48px 24px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.remote h1 { font-size: clamp(26px, 6vw, 44px); max-width: 760px; }
#slide-number { color: var(--muted); font-size: 18px; }
.remote-buttons { display: flex; gap: 16px; margin: 32px 0; }
.remote button { font-size: 32px; width: 110px; height: 88px; border-radius: 12px; }
.remote p:last-child { max-width: 280px; font-size: 14px; color: var(--muted); }

/* Comments under a deck */
section#artifact-comments { padding-top: 16px; }
section#artifact-comments form { display: grid; gap: 12px; }
section#artifact-comments textarea { display: block; width: 100%; margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); resize: vertical; }
section#artifact-comments article { margin-bottom: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow-wrap: anywhere; }
#comment-error, #artifact-action-error { color: var(--danger); }
#comment-error:empty, #artifact-action-error:empty { display: none; }

/* Artifact viewer */
.artifact-viewer { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 44px minmax(0, 1fr); background: var(--surface); }
.artifact-toolbar { height: 44px; padding: 0 10px; gap: 8px; border-bottom: 1px solid var(--line); background: var(--surface); }
.artifact-toolbar > a { display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 6px; color: var(--paper); text-decoration: none; }
.artifact-toolbar > a:hover { background: var(--hover); }
.artifact-title { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
#artifact-title { cursor: text; }
.title-input { width: 100%; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.artifact-toolbar button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 28px; height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--paper); font-size: 13px; }
.artifact-toolbar button:hover { background: var(--hover); }
.annotation-tools { display: flex; flex-shrink: 0; }
.annotation-tools #annotation-mode { border-radius: 6px 0 0 6px; }
.annotation-tools #comment-options { border-left: 0; border-radius: 0 6px 6px 0; color: var(--muted); }
#changes-toggle[aria-pressed="true"] { color: #8a6400; background: #f5d76e55; border-color: #e0b020; }
#annotation-mode[aria-pressed="true"] { color: var(--accent-strong); background: var(--accent-soft); border-color: var(--accent); }
#comment-options[aria-expanded="true"], #comment-filter[aria-expanded="true"] { background: var(--hover); }
.comment-count { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--paper); }
.artifact-toolbar #artifact-expand { border: 0; font-size: 16px; }
.artifact-toolbar #artifact-share { background: var(--accent); border-color: var(--accent); color: #fff; }
.artifact-toolbar #artifact-share:hover { background: var(--accent-strong); }
.artifact-canvas { position: relative; min-width: 0; min-height: 0; }
.artifact-canvas iframe:is(#deck, #deck-pending) { width: 100%; height: 100%; border: 0; border-radius: 0; }
#deck-pending { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
#artifact-status { position: fixed; z-index: 30; bottom: 16px; left: 50%; transform: translateX(-50%); margin: 0; max-width: calc(100vw - 32px); padding: 8px 14px; border-radius: 6px; background: var(--paper); color: #fff; font-size: 14px; }

/* Popovers shared by the viewer */
#artifact-sharing, #comment-menu, #comment-filters, #comments-panel, #selection-comment, .pin-preview {
  position: fixed; inset: auto; margin: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--paper); box-shadow: var(--shadow); font-size: 14px; outline: none;
}
#artifact-sharing { width: 360px; max-width: calc(100vw - 24px); padding: 14px 16px; }
.sharing-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sharing-heading h2 { flex: 1; margin: 0; font-size: 15px; }
#sharing-close { width: 28px; min-height: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 18px; }
#sharing-close:hover { background: var(--hover); }
.sharing-toggle { display: flex; align-items: center; gap: 8px; font-weight: 500; }
#sharing-link-description { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.sharing-footer { display: flex; justify-content: flex-end; margin-top: 12px; }
#comment-menu, #comment-filters { width: max-content; max-width: min(320px, calc(100vw - 16px)); padding: 4px; }
#comment-menu button, #comment-filters button { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 30px; padding: 4px 10px; border: 0; border-radius: 4px; background: transparent; color: inherit; text-align: left; }
#comment-menu button:hover, #comment-filters button:not([aria-disabled="true"]):hover, #comment-filters button:focus { background: var(--hover); }
#comment-filters button[aria-disabled="true"] { opacity: .45; cursor: default; }
#comment-filters hr { margin: 4px 6px; border: 0; border-top: 1px solid var(--line); }
.filter-check { margin-left: auto; color: var(--accent); font-weight: 700; }
#show-resolved .filter-check { order: -1; margin-left: 0; width: 14px; }
[aria-checked="false"] > .filter-check { visibility: hidden; }
#comments-panel { inset: 52px 12px auto auto; width: 300px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 64px); padding: 0; overflow-y: auto; font-size: 13px; }
.comments-heading { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); }
.comments-heading h2 { flex: 1; margin: 0; font-size: 14px; }
.comments-heading button { width: 28px; min-height: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--paper); }
.comments-heading button:hover { background: var(--hover); }
#comments-panel #comment-threads { padding: 0 10px 8px; }
#comments-panel article { border-bottom: 1px solid var(--line); }
#comments-panel article:last-child { border-bottom: 0; }
.comments-empty { padding: 18px 8px; text-align: center; color: var(--muted); }
.comments-empty p { margin: 0 0 4px; color: var(--paper); font-weight: 500; }
.comments-empty small { display: block; }
.comments-filtered-empty button { min-height: 0; padding: 0; border: 0; background: transparent; color: var(--accent); text-decoration: underline; }
.thread-summary { display: block; padding: 10px 0; cursor: pointer; }
.thread-summary:hover { background: var(--bg); }
.thread-summary small { display: block; font-size: 12px; color: var(--muted); }
.thread-reply-count { display: block; margin-top: 4px; color: var(--accent); font-size: 12px; }

/* Comment card next to a selection */
#selection-comment { display: none; flex-direction: column; gap: 10px; width: 300px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 52px); overflow: auto; padding: 12px; font-size: 14px; }
#selection-comment:popover-open { display: flex; }
.annotation-heading { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.annotation-heading small { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
#selection-quote { flex-shrink: 0; margin: 0; padding-left: 8px; border-left: 3px solid var(--line); color: var(--muted); max-height: 96px; overflow-y: auto; overflow-wrap: anywhere; white-space: pre-wrap; }
#selection-comment form { display: flex; flex-direction: column; gap: 8px; }
#selection-comment form[hidden] { display: none; }
/* The border sits on the wrapper: the script sizes the textarea to its scrollHeight, which excludes borders. */
.annotation-input { padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.annotation-input:focus-within { border-color: var(--accent); }
.annotation-input textarea { display: block; width: 100%; min-height: 20px; max-height: 40vh; padding: 0; border: 0; background: transparent; resize: none; outline: none; }
.annotation-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.annotation-actions label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.annotation-actions button { width: 32px; min-height: 32px; height: 32px; padding: 0; }
#selection-comment #comment-error { margin: 0; font-size: 13px; }
#inline-thread { max-height: 260px; overflow-y: auto; }
.thread-message { padding: 8px 0; overflow-wrap: anywhere; }
.thread-message-heading { display: flex; align-items: center; gap: 6px; min-height: 26px; }
.thread-message strong { font-size: 13px; font-weight: 600; }
.thread-message time { flex: 1; color: var(--muted); font-size: 12px; white-space: nowrap; }
.thread-message p { white-space: pre-wrap; margin: 4px 0 0; }
.thread-action { display: grid; place-items: center; flex-shrink: 0; width: 26px; min-height: 26px; height: 26px; padding: 0; border: 0; background: transparent; color: var(--paper); }
.thread-action:hover { background: var(--hover); }
.thread-resolved { padding-top: 6px; color: var(--muted); font-size: 13px; }
#selection-comment.saved-thread { gap: 6px; }

/* Pins on the artifact */
#comment-shield { position: absolute; inset: 0; }
#comment-markers { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.comment-pin { position: absolute; pointer-events: auto; width: 16px; min-height: 16px; height: 16px; margin: -8px 0 0 -8px; padding: 0; border: 2px solid var(--surface); border-radius: 50%; background: var(--accent); box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.comment-pin:hover { background: var(--accent-strong); }
.pin-preview { width: 280px; max-width: calc(100vw - 16px); padding: 10px 12px; font-size: 13px; cursor: pointer; }
.pin-preview .thread-message { padding: 0; }

/* Attachments in the Remote Control composer and messages */
#composer-files { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
#send[data-multiline] #composer-files { margin-bottom: 8px; }
.composer-file { position: relative; flex: 0 0 110px; width: 110px; height: 110px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--paper); font-size: 13px; line-height: 1.3; }
.composer-file > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.composer-file:has(img) > .composer-file-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.composer-file-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.composer-file-name-long { display: flex; min-width: 0; flex-direction: column; }
.composer-file-name-long > span { display: flex; min-width: 0; }
.composer-file-name-long bdi { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-file-name-long > span > span { flex-shrink: 0; }
.composer-file-badge { position: absolute; bottom: 8px; left: 8px; max-width: calc(100% - 16px); overflow: hidden; padding: 0 4px; border: 1px solid var(--line); border-radius: 4px; font-size: 11px; }
.composer-file[data-state="failed"] > :not(.composer-file-remove) { opacity: .5; }
.composer-file[data-state="pending"] { opacity: .6; }
.composer-file-open, #send .composer-file-open { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; border-radius: inherit; background: transparent; }
.composer-file-open:hover { background: transparent; }
#send .composer-file-remove { position: absolute; top: -8px; right: -8px; z-index: 1; display: grid; place-items: center; width: 20px; height: 20px; min-height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 12px; }
.message-files { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.message-file-open { display: block; min-height: 0; text-align: left; }
.message-file-open:hover { background: var(--hover); }
.message-image-open { display: block; max-width: 100%; min-height: 0; padding: 0; border: 0; background: transparent; }
.message-image-open:hover { background: transparent; }
.message-image-open > img { display: block; max-width: 100%; }
.message-image-open.composer-file > img { width: 100%; height: 100%; object-fit: contain; }

/* Attachment previews */
.attachment-file-preview { width: 520px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); margin: auto; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--paper); font-size: 14px; }
.attachment-file-preview::backdrop, .attachment-image-preview::backdrop { background: rgb(0 0 0 / .45); }
.attachment-file-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: start; margin-bottom: 12px; }
.attachment-file-header h2 { grid-column: 1; margin: 0; overflow-wrap: anywhere; font-size: 18px; }
.attachment-file-meta { grid-column: 1; color: var(--muted); font-size: 13px; }
.attachment-file-preview button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); background: var(--surface); color: var(--paper); }
.attachment-file-preview button:hover { background: var(--hover); }
.attachment-file-preview .attachment-file-close { grid-column: 2; grid-row: 1 / 3; width: 32px; padding: 0; border: 0; }
.attachment-file-download-error { margin: 0; color: var(--danger); text-align: center; }
.attachment-file-body { display: flex; flex-direction: column; height: min(384px, 60vh); overflow-y: auto; }
.attachment-file-preview:has(.attachment-file-frame) { width: 1100px; }
.attachment-file-preview:has(.attachment-file-frame) .attachment-file-body { height: calc(100dvh - 140px); overflow: hidden; }
.attachment-file-frame { flex: 1; width: 100%; border: 0; border-radius: 4px; background: #fff; }
.attachment-file-text { flex: 1; min-height: 0; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 6px; overflow: auto; white-space: pre-wrap; overflow-wrap: break-word; background: var(--bg); font: 13px/1.5 var(--mono); }
.attachment-file-fallback, .attachment-file-audio { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 0 16px; text-align: center; }
.attachment-file-fallback p { margin: 0; max-width: 100%; overflow-wrap: break-word; color: var(--muted); }
.attachment-file-audio audio { width: 100%; max-width: 448px; }
.attachment-file-truncated { display: flex; flex-shrink: 0; flex-direction: column; align-items: center; gap: 8px; margin-top: 8px; }
.attachment-file-truncated p { margin: 0; color: var(--muted); text-align: center; font-size: 13px; }
.attachment-file-loading { display: grid; flex: 1; place-items: center; color: var(--muted); }
.attachment-file-loading::after { content: 'Loading…'; }
.attachment-file-csv { display: flex; width: 100%; margin: auto; flex-direction: column; align-items: center; }
.attachment-file-columns { width: 240px; max-width: 100%; height: 200px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.attachment-file-columns > :first-child { display: flex; align-items: center; height: 36px; padding: 0 12px; border-bottom: 1px solid var(--line); font-weight: 500; }
.attachment-file-columns svg { flex-shrink: 0; margin-right: 8px; }
.attachment-file-columns > :last-child { height: 162px; overflow-y: auto; padding: 10px 12px 4px; color: var(--muted); }
.attachment-file-columns > :last-child > div { margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-file-count { margin-bottom: 8px; }
.attachment-image-preview { position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 40px; border: 0; background: rgb(0 0 0 / .6); color: #fff; outline: none; }
.attachment-image-preview[open] { display: grid; place-items: center; }
.attachment-image-content { width: 100%; max-width: 640px; }
.attachment-image-picture { position: relative; width: fit-content; margin: 0 auto; }
.attachment-image-frame { width: fit-content; max-width: 100%; border-radius: 6px; overflow: hidden; }
.attachment-image-frame > img { display: block; max-width: 100%; max-height: calc(100vh - 64px); width: auto; height: auto; }
.attachment-image-caption { padding-top: 6px; text-align: center; overflow-wrap: break-word; }
.attachment-image-close { position: absolute; left: 100%; top: 0; margin-left: 6px; display: grid; place-items: center; width: 32px; min-height: 32px; height: 32px; padding: 0; border: 0; background: rgb(0 0 0 / .5); color: #fff; }
.attachment-image-close:hover { background: rgb(0 0 0 / .7); }
@media (max-width: 639px) {
  .attachment-image-preview { padding: 16px; }
  .attachment-image-close { left: auto; right: 6px; top: 6px; margin: 0; }
}

@media (max-width: 700px) {
  header { height: 52px; padding: 0 14px; gap: 12px; }
  .head-label { display: none; }
  .library { padding: 28px 16px; }
  .present { padding: 16px; }
  .present-head { display: block; }
  .controls button { flex: 1; }
  iframe#deck { height: 65dvh; }
  footer { flex-direction: column; gap: 6px; }
  .artifact-toolbar { padding: 0 6px; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* Phones and touch screens */
@media (pointer: coarse) {
  /* iOS zooms the page when a field under 16px takes focus. */
  input:not([type="checkbox"], [type="radio"]), textarea, #send textarea, .annotation-input textarea { font-size: 16px; }
  .artifact-viewer { grid-template-rows: 52px minmax(0, 1fr); }
  .artifact-toolbar { height: 52px; }
  .artifact-toolbar > a, .artifact-toolbar button { min-width: 40px; min-height: 40px; height: 40px; }
  .comment-pin::before { content: ''; position: absolute; inset: -14px; }
  #sharing-close, .comments-heading button, .thread-action, #comment-menu button, #comment-filters button { min-width: 40px; min-height: 40px; height: 40px; }
  .annotation-actions button { width: 40px; min-height: 40px; height: 40px; }
  .sharing-toggle input { width: 20px; height: 20px; }
  .remote button { touch-action: manipulation; }
}
@media (max-width: 700px) {
  .artifact-toolbar { padding: 0 max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left)); }
  .artifact-viewer { padding-top: env(safe-area-inset-top); }
  /* Panels open as bottom sheets instead of cards floating over the page. */
  #comments-panel { inset: auto 0 0 0; width: 100%; max-width: none; max-height: 70dvh; border-radius: 12px 12px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  /* !important: artifact.js places this popover with inline left/top for desktop. */
  #artifact-sharing { inset: auto 0 0 0 !important; width: 100%; max-width: none; border-radius: 12px 12px 0 0; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  /* Decks: a frame with the slides' own shape, so the slide fills its width. */
  .present iframe#deck { height: auto; aspect-ratio: 960 / 700; }
}
/* A phone held sideways: the deck gets the whole screen. */
@media (max-height: 500px) and (orientation: landscape) {
  body:has(.present) > header, .present-head, .present footer { display: none; }
  .present { padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  .present iframe#deck { height: 100dvh; aspect-ratio: auto; border: 0; border-radius: 0; }
  .remote { min-height: 100dvh; padding-top: 16px; justify-content: center; }
  .remote h1 { margin: 0; }
  .remote-buttons { margin: 16px 0; }
}
/* Fullscreen for browsers that only allow it on video (iPhone Safari). */
body.deck-fullscreen { overflow: hidden; }
body.deck-fullscreen iframe#deck { position: fixed; z-index: 40; inset: 0; width: 100vw; height: 100dvh; aspect-ratio: auto; border: 0; border-radius: 0; }
#deck-exit { display: none; }
body.deck-fullscreen #deck-exit { display: grid; place-items: center; position: fixed; z-index: 41; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); width: 40px; height: 40px; padding: 0; border-radius: 50%; background: rgb(0 0 0 / .5); color: #fff; font-size: 18px; }
