:root {
  --sidebar-width: min(13rem, 19vw);
  color-scheme: light;
  accent-color: var(--action);
  --canvas: #f5f5f5;
  --paper: #fff;
  --ink: #1d1d1d;
  --secondary: #515151;
  --line: #d2d2d2;
  --edge: #777777;
  --action-label: #fff;
  --action: #333333;
  --hover: #454545;
  --link: #454545;
  --tint: #eeeeee;
  --toolbar: rgb(250 250 250 / 88%);
  --shadow: 0 12px 36px -16px rgb(35 35 35 / 24%), 0 2px 6px rgb(35 35 35 / 5%);
  --error: #aa3029;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-optical-sizing: auto;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
button, textarea, a, input { font: inherit; }
button { border: 0; cursor: pointer; background: transparent; color: inherit; }
button:disabled { cursor: default; }
a { color: var(--link); }
:where(a, button, [tabindex="0"]):focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
.topbar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 3.5rem; padding: .25rem max(1rem, env(safe-area-inset-right)) .25rem max(1rem, env(safe-area-inset-left)); background: var(--paper); border-bottom: 1px solid var(--line); z-index: 1; }
.wordmark { margin-inline-end:auto; font-size:1.05rem; font-weight:700; letter-spacing:-.035em; line-height:1.25; }
.topbar .sign-out { padding-inline-end:0; }
.sign-out, .copy-button, #retry-session { min-height: 44px; min-width: 44px; padding: .5rem .8rem; color: var(--link); border-radius: 12px; font-size: .88rem; white-space: nowrap; }
:is(.sign-out,.copy-button,#retry-session):hover { background: var(--tint); }
.sign-out:disabled { color: var(--secondary); }
main { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: auto; background: var(--canvas); }
#entry { width: min(calc(100% - 2rem), 56rem); margin: auto; padding: clamp(1.75rem, 6vh, 4.5rem) 0; text-align: center; }
h1 { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif; margin: 0 auto clamp(1.5rem,4vh,2.25rem); max-width: 18ch; color: var(--ink); font-size: clamp(2.65rem,5.4vw,4.75rem); font-weight: 640; letter-spacing: -.05em; line-height: 1.02; text-wrap: balance; }
.primary, .pdf-download { background: var(--action); color: var(--action-label); border-radius: 999px; }
.primary:hover:not(:disabled), .pdf-download:hover { background: var(--hover); }
.primary:active:not(:disabled), .pdf-download:active { transform: scale(.98); }
.login-button, .pdf-download { display: inline-flex; min-height: 44px; padding: .62rem 1.28rem; align-items: center; justify-content: center; text-decoration: none; font-weight: 540; }
/* The hidden label preserves the button’s original width as text scales. */
.login-button { display: inline-grid; }
#login:active { transform: none; background: var(--hover); }
.login-button > span { grid-area: 1 / 1; }
.login-footprint { visibility: hidden; }
#login-dialog { width: min(24rem, calc(100% - 32px)); max-width: 100%; max-height: calc(100dvh - 32px); padding: clamp(16px, 5vw, 1.25rem); border: 1px solid var(--line); border-radius: 1.25rem; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); text-align: start; }
#login-dialog::backdrop { background: rgb(0 0 0 / 42%); }
#login-dialog header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
#login-title { min-width: 0; margin: 0; font-size: 1.3rem; line-height: 1.2; letter-spacing: -.025em; overflow-wrap: anywhere; }
#close-login { display: grid; place-items: center; padding: 0; }
.login-option { display: flex; flex-wrap: wrap; width: 100%; min-height: 48px; align-items: center; justify-content: space-between; gap: .25rem .75rem; padding: .7rem 1rem; border-radius: .75rem; text-align: start; text-decoration: none; font-weight: 600; }
.login-option:disabled { margin-top: .5rem; color: var(--secondary); background: var(--tint); }
.login-option span { font-size: .875rem; font-weight: 400; }
@media (forced-colors: active) {
  .login-button, .login-option { outline: 1px solid ButtonText; }
  .login-option:disabled { outline-color: GrayText; }
  :is(.login-button,.login-option):focus-visible { outline: 2px solid Highlight; }
}
#composer, .report-composer { width: min(100%,38.5rem); display: flex; align-items: flex-end; gap: .5rem; margin: 0 auto; padding: .5rem .5rem .5rem 1.35rem; border: 1px solid var(--line); border-radius: 2rem; background: var(--paper); box-shadow: var(--shadow); }
#composer:focus-within, .report-composer:focus-within { border-color: var(--edge); }
textarea { flex: 1; min-width: 0; max-height: min(10rem,30dvh); padding: .65rem 0; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); line-height: 1.5; }
textarea::placeholder { color: var(--secondary); opacity: 1; }
#send, #bi-create-button { width: 44px; height: 44px; flex: none; display: grid; place-items: center; font: 500 1.65rem/1 system-ui,sans-serif; }
#send:disabled, #bi-create-button:disabled { color: var(--secondary); background: var(--canvas); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); }
#status { margin: .65rem auto 0; color: var(--secondary); font-size: .88rem; }
#status:empty { display: none; }
main.active { background: var(--paper); overflow: hidden; }
.active #greeting { display: none; }
.conversation-log { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: clamp(1.25rem,3vh,2rem) max(1rem,calc((100% - 48rem)/2)) 1rem; scroll-padding-block: 1rem; }
.message { min-width: 0; overflow-wrap: anywhere; margin: 0 0 1.65rem; }
.message-role { margin: 0; font-size: .8rem; font-weight: 620; color: var(--secondary); }
.message.user { width: fit-content; max-width: min(88%,42rem); margin-left: auto; padding: .8rem 1.05rem; border-radius: 1.25rem 1.25rem .45rem 1.25rem; background: var(--tint); }
.message.user .message-role { margin-bottom: .18rem; }
.message-text { margin: 0; white-space: pre-wrap; line-height: 1.58; }
.message.assistant { max-width: 100%; }
.message-meta { display: flex; align-items: center; gap: .5rem; margin-bottom: .25rem; }
.message-meta .message-role { color: var(--ink); }
.message-error { margin: .55rem 0 0; color: var(--error); font-size: .9rem; }
.answer-markdown { white-space: normal; line-height: 1.6; }
.answer-markdown :is(p,ul,ol) { max-width: 68ch; margin: .65em 0; }
.answer-markdown :is(h2,h3,h4,h5,h6) { margin: 1.35em 0 .45em; line-height: 1.2; letter-spacing: -.028em; }
.answer-markdown > :first-child { margin-top: 0; }
.answer-markdown :is(ul,ol) { padding-inline-start: 1.45em; }
.answer-markdown pre { max-width: 100%; overflow-x: auto; padding: .85rem; background: var(--canvas); border-radius: .6rem; }
.answer-markdown blockquote { margin: .75rem 0; padding-left: 1rem; border-left: 3px solid var(--line); }
.answer-table-region { max-width: 100%; overflow-x: auto; margin-block: 1rem; }
.answer-markdown table { border-collapse: collapse; font-size: .93rem; width: 100%; }
.answer-markdown :is(th,td) { text-align: start; border-bottom: 1px solid var(--line); padding: .55rem .75rem; }
.answer-markdown th { background: var(--canvas); }
.answer-markdown .numeric { text-align: end; font-variant-numeric: tabular-nums; }
.active #entry { width: 100%; margin: 0; flex: none; padding: .7rem max(1rem,env(safe-area-inset-left)) max(.45rem,env(safe-area-inset-bottom)); background: var(--canvas); border-top: 1px solid var(--line); }
.active #composer { box-shadow: 0 2px 10px rgb(0 0 0 / 5%); }
.pdf-report { margin: .5rem 0; border: 1px solid var(--line); border-radius: 1.2rem; overflow: hidden; background: var(--canvas); }
.pdf-report-header { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .65rem .85rem; background: var(--paper); border-bottom: 1px solid var(--line); }
.pdf-report-header h3 { margin: 0 auto 0 0; font-size: 1rem; font-weight: 620; }
.pdf-download { font-size: .85rem; padding-inline: 1rem; }
.pdf-page-count,.pdf-preview-status,.pdf-page-label { font-size: .82rem; color: var(--secondary); }
.pdf-preview-status,.pdf-page-label { margin: 0; padding: .45rem .75rem; }
.pdf-pages { display: grid; gap: .9rem; padding: .85rem; }
.pdf-page { width: fit-content; max-width: 100%; margin-inline: auto; min-width: 0; background: white; color: #1d1d1d; box-shadow: 0 2px 6px rgb(0 0 0 / 10%); }
.pdf-page-label { color: #515151; }
.pdf-pages:has(> :only-child) .pdf-page-label { display: none; }
.pdf-page canvas { width: 100%; max-width: 100%; height: auto; display: block; }
@supports (backdrop-filter: blur(16px)) {
  .topbar { background: var(--toolbar); backdrop-filter: saturate(130%) blur(16px); }
}
@media (max-width: 600px) {
  #entry { width: calc(100% - 2.25rem); }
  .conversation-log { padding-top: 1.2rem; }
  .active #entry { padding-top: .5rem; }
  .pdf-pages { padding: .5rem; }
}
@media (max-height: 530px) {
  #entry { padding-block: .75rem; }

}
@media (prefers-reduced-transparency: reduce) { .topbar { backdrop-filter: none; background: var(--paper); } }
@media (prefers-reduced-motion: no-preference) { .message { animation: arrive .16s ease-out; } @keyframes arrive { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } } }
@media (forced-colors: active) { #composer,.primary,.pdf-download { border: 1px solid ButtonText; } #composer:focus-within, .report-composer:focus-within { outline: 2px solid Highlight; } }
@media print {
  :root { color-scheme: light; --paper:white; --canvas:white; --ink:black; --secondary:#333; --line:#aaa; --edge:#666; --link:#333; --action:#333; --hover:#222; --tint:#eee; --error:#333; }
  .pdf-page-label { color:var(--secondary); }
  body,main,main.active,.conversation-log { display:block; height:auto; overflow:visible; background:white; }
  .conversation-log { padding:0; }
  .topbar { padding:0; background:white; backdrop-filter:none; }
  .active #entry,.sign-out,.copy-button,.pdf-download { display:none; }
  .message,.pdf-page { animation:none; box-shadow:none; }
  .pdf-page { break-inside:avoid; }
  .answer-table-region { overflow:visible; }
  .pdf-pages { display:block; }
  .pdf-page { margin:0 0 1rem; }
}

.answer-chart-controls { display: flex; align-items: center; justify-content: flex-end; margin-top: .75rem; }
.answer-chart-toggle { min-height: 44px; padding: .4rem .85rem; border: 1px solid var(--line); border-radius: 100px; color: var(--link); font-size: .85rem; font-weight: 570; }
.answer-chart-toggle:hover { background: var(--tint); }
.answer-chart { margin: .6rem 0 1rem; padding: 1rem; background: var(--canvas); border-radius: 1rem; }
.answer-chart-plot text { font: 12px system-ui, sans-serif; }
.answer-chart-plot { overflow-x: auto; }
.answer-chart svg { min-width: 24rem; display: block; width: 100%; height: auto; }
@media print { .answer-chart-controls { display:none; } }
.report-reading { background: var(--paper); border-bottom: 1px solid var(--line); }
.report-reading summary { padding: .7rem 1rem; min-height: 44px; color: var(--link); cursor: pointer; font-size: .88rem; font-weight: 570; }
.report-reading summary:focus-visible { outline: 2px solid var(--link); outline-offset: -3px; }
.report-reading > .answer-markdown { padding: .65rem 1rem 1rem; }
.answer-chart-summary { margin-top: .65rem; font-size: .9rem; color: var(--secondary); }
.answer-chart-toggle[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
@media (forced-colors: active) {
  .answer-chart-toggle[aria-pressed="true"] { outline: 2px solid Highlight; }
}
.report-edit-button, .report-editor button { min-height: 44px; padding: .4rem .8rem; border-radius: .8rem; color: var(--link); font-weight: 570; }
.report-editor { padding: 1rem; background: var(--paper); }
.report-editor label { display: block; font-weight: 570; }
.report-editor textarea { display: block; width: 100%; min-height: 15rem; resize: vertical; margin: .6rem 0; padding: .85rem; border: 1px solid var(--edge); border-radius: .75rem; background: var(--canvas); color: var(--ink); font: inherit; line-height: 1.5; }
.report-editor button[type="submit"] { background: var(--action); color: var(--action-label); }
.report-editor p { font-size: .9rem; }
@media print { .report-editor, .report-edit-button { display: none; } }
@page { margin: 12mm; }
.workspace { display:flex; flex:1; min-height:0; position:relative; }
.workspace main { min-width:0; }
#workspace-nav { flex:0 0 var(--sidebar-width); padding:1.25rem .65rem; background:var(--paper); border-inline-end:1px solid var(--line); }
#workspace-nav a { display:flex; align-items:center; min-height:44px; padding:.5rem .85rem; margin-bottom:.2rem; border-radius:.65rem; color:var(--secondary); text-decoration:none; font-weight:550; }
#workspace-nav a:hover { background:var(--canvas); }
#workspace-nav a[aria-current] { background:var(--tint); color:var(--link); font-weight:650; }
#reports { width:min(100%,72rem); margin:0 auto; padding:clamp(1rem,4vw,3rem); }
#reports #reports-title { margin:0 0 1.5rem; max-width:none; text-align:center; }
#reports h2 { margin:.5rem 0; font-size:1.25rem; letter-spacing:-.025em; }
#bi-library, #weekly-preview { max-width:58rem; margin-inline:auto; }
.bi-card { padding:clamp(1rem,3vw,1.5rem); border:1px solid var(--line); border-radius:1.1rem; background:var(--paper); }
#bi-clarify label { display:block; margin-block-end:.4rem; font-weight:600; }
#bi-clarify select { display:block; width:100%; background:var(--canvas); color:var(--ink); border:1px solid var(--edge); border-radius:.65rem; padding:.7rem; font:inherit; margin:.5rem 0 .8rem; }
#bi-create { margin:1.5rem auto; max-width:38.5rem; }
#bi-clarify { margin-top:.75rem; }
#bi-clarify select:focus-visible { outline:2px solid var(--edge); outline-offset:2px; }
.bi-action { padding:.6rem 1rem; min-height:44px; font-size:.94rem; font-weight:550; }
.bi-action:disabled { background:var(--canvas); color:var(--secondary); }
#bi-saved { margin-block:1.5rem; }
#bi-list { margin:0; padding:0; list-style:none; }
#bi-list button { width:100%; padding:.7rem .2rem; min-height:44px; text-align:start; color:var(--link); border-bottom:1px solid var(--line); }
#bi-list button:hover { text-decoration:underline; }
.bi-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:.4rem .7rem; margin-bottom:.75rem; }
#bi-heading { flex:1; overflow-wrap:anywhere; }
#bi-canvas { height:clamp(31rem,72dvh,60rem); width:100%; overflow:hidden; border:1px solid var(--line); background:var(--paper); border-radius:.8rem; }
#bi-canvas iframe { border:0; width:100%; height:100%; }
#report-tabs { display:flex; justify-content:center; flex-wrap:wrap; gap:.3rem; margin:0 auto 1.25rem; max-width:58rem; }
#report-tabs button { padding:.65rem 1rem; min-height:44px; border-radius:2rem; border:1px solid var(--line); background:var(--paper); color:inherit; font:inherit; cursor:pointer; }
#report-tabs button[aria-selected=true] { background:#1d1d1d; color:white; }
#distance-example { max-width:58rem; margin:1rem auto; }
#distance-example summary { cursor:pointer; }
#bi-status { max-width:58rem; margin:.65rem auto; text-align:center; }
#bi-retry:not([hidden]) { display:block; margin-inline:auto; }
#bi-status:empty { display:none; }
@media(max-width:600px) {
  #bi-heading { flex-basis:calc(100% - 8rem); }
  #bi-canvas { height:max(26rem,65dvh); }
}
#reports h1 { font-size:clamp(2rem,5vw,3.25rem); margin-bottom:1rem; }
#reports p { color:var(--secondary); }
#nav-toggle { display:none; }
@media(max-width:680px) {
  #nav-toggle { display:block; min-height:44px; color:var(--link); }
  #workspace-nav { display:none; }
  #workspace-nav.open { display:block; position:absolute; inset:0 auto 0 0; width:min(16rem,85%); z-index:2; box-shadow:var(--shadow); }
}
@media print { #workspace-nav,#nav-toggle { display:none!important; } .workspace { display:block; } }

[data-running]::after {
  content: ""; display: inline-block; width: .85rem; height: .85rem; flex: none;
  margin-inline-start: .5rem; border: 2px solid transparent; border-top-color: currentColor; border-right-color: currentColor;
  border-radius: 50%; vertical-align: middle; animation: query-spin .9s linear infinite;
}
#workspace-nav [data-running]::after { margin-inline-start: auto; }
@keyframes query-spin { from { transform: rotate(0turn); } to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) {
  #status[data-running]::after { content:none; animation:none; }
  :is(#workspace-nav a, #nav-toggle)[data-running]::after {
    animation-duration: 2s;
  }
}

#older-history { align-self: center; }

#history-notice { color: var(--secondary); font-size: .85rem; margin: .6rem 0 0; }
@media print { #older-history, #history-notice { display: none; } }

#bi-editor:fullscreen, #migration-library:fullscreen { display:flex; flex-direction:column; overflow:auto; padding:1rem; border:0; border-radius:0; background:var(--paper); }
#bi-editor:fullscreen #bi-canvas, #migration-library:fullscreen iframe { flex:1; min-height:0; height:auto; }
#migration-library iframe { width:100%; height:70vh; border:0; }
#migration-library select { max-width:100%; font:inherit; }
#migration-library label { max-width:100%; }
.distance-scroll { overflow-x:auto; } .distance-scroll th, .distance-scroll td { padding:.35rem .6rem; text-align:end; font-variant-numeric:tabular-nums; }

@media screen {
  :root[data-appearance="light"] {
    --canvas: #f9f9f9;
    --ink: #262626;
    --secondary: #5b5b5b;
    --line: #dddddd;
    --edge: #797979;
    --action: #343434;
    --hover: #484848;
    --link: #575757;
    --tint: #eeeeee;
    --shadow: 0 1px 3px rgb(40 40 40 / 6%), 0 8px 24px -12px rgb(40 40 40 / 16%);
  }
  [data-appearance="light"] .topbar { background: var(--paper); }
  [data-appearance="light"] #workspace-nav { background: #f1f1f1; }
  [data-appearance="light"] #workspace-nav a[aria-current] {
    background: var(--paper);
    color: var(--ink);
    box-shadow: inset 3px 0 #777777, inset 0 0 0 1px var(--line);
  }
  [data-appearance="light"] .bi-card { box-shadow: var(--shadow); }
  :root[data-appearance="dark"] {
    color-scheme: dark;
    --canvas: #191919;
    --paper: #212121;
    --ink: #f2f2f2;
    --secondary: #b2b2b2;
    --line: #3a3a3a;
    --edge: #828282;
    --action-label: #181818;
    --action: #ededed;
    --hover: #d6d6d6;
    --link: #c5c5c5;
    --tint: #2c2c2c;
    --toolbar: rgb(25 25 25 / 94%);
    --shadow: 0 5px 18px rgb(0 0 0 / 20%);
    --error: #ffaaa2;
  }
  [data-appearance="dark"] .topbar { background:#111111; }
  [data-appearance="dark"] #workspace-nav { background:#151515; }
  [data-appearance="dark"] #workspace-nav a[aria-current] {
    color: var(--ink);
    box-shadow: inset 3px 0 #b9b9b9;
  }
  [data-appearance="dark"] main.active { background:var(--canvas); }
  [data-appearance="dark"] #report-tabs button[aria-selected=true] { background:var(--action); color:var(--action-label); }
}
#workspace-nav { flex-direction:column; overflow-y:auto; }
@media(min-width:681px) { #workspace-nav { display:flex; } }
@media(max-width:680px) { #workspace-nav.open { display:flex; } }
#appearance-toggle { display:flex; align-items:center; justify-content:space-between; gap:.75rem; margin-top:auto; min-height:44px; padding:.5rem .85rem; color:var(--secondary); font-size:.9rem; border-top:1px solid var(--line); }
.appearance-track { display:inline-flex; align-items:center; width:2rem; height:1.15rem; border:1px solid var(--edge); border-radius:1rem; padding:2px; }
.appearance-track::after { content:""; width:.75rem; height:.75rem; border-radius:100%; background:currentColor; }
:is(#appearance-toggle,#preview-appearance)[aria-checked=true] .appearance-track { justify-content:flex-end; background:var(--ink); color:var(--canvas); }

@media screen and (min-width:681px) {
  body:has(#workspace-nav:not([hidden])) .topbar { padding-inline:var(--sidebar-width); }
}

::selection { color: var(--action-label); background: var(--action); }

/* Keep regular chat focused on the answer and put its actions underneath. */
#log .message-role { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
#log .message.assistant { display:flex; flex-direction:column; gap:.4rem; }
#log .message-meta { order:1; margin:0; }
#log .message.user { border-radius:1.4rem; }
main.active:has(#log:not([hidden])) #entry { border-top:0; background:var(--paper); }


#bi-attendance { width: min(100%, 42rem); margin: 1.5rem auto; }
#bi-attendance table { width:100%; border-collapse:collapse; }
#bi-attendance th,#bi-attendance td { padding:.65rem; text-align:end; border-bottom:1px solid var(--line); font-variant-numeric:tabular-nums; }
#bi-attendance tr > :first-child { text-align:start; }
#bi-thread { max-width:44rem; margin-inline:auto; text-align:start; white-space:pre-wrap; }
#bi-thread:not(:empty) { padding-block:1rem; }

#bi-request-summary { max-width:44rem; margin:1rem auto; text-align:center; font-weight:600; }

.chart-period { margin: .75rem 0 0; border: 1px solid var(--line); border-radius: .75rem; display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.chart-period label { display: inline-flex; gap: .5rem; align-items: center; }
.chart-period select { font: inherit; min-height: 44px; color: var(--ink); background: var(--paper); }

#bi-new { display:inline-flex; align-items:center; justify-content:center; gap:.25rem; flex:none; min-height:44px; min-width:44px; padding:0 .75rem; border-radius:2rem; background:var(--canvas); color:var(--secondary); font-size:.875rem; white-space:nowrap; }
#bi-new:hover:enabled { background:var(--tint); color:var(--ink); }
#bi-instructions { min-width:0; }
@media (max-width: 540px) { #bi-new .report-new-label { display:none; } }

#bi-thread article { white-space:normal; margin-block:1.25rem; }
.report-kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,9rem),1fr)); gap:.75rem; margin:1rem 0; }
.report-kpis > div { padding:1rem; border:1px solid var(--line); border-radius:1rem; background:var(--paper); }
.report-kpis dt { color:var(--secondary); font-size:.875rem; }
.report-kpis dd { margin:.4rem 0 0; font-size:1.5rem; font-weight:650; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }

#entry:has(#login:not([hidden])) {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0;
}
.scruffy-walkway {
  display: contents;
  --scruffy-size: min(37vw, clamp(8rem, 24vh, 15rem));
  --scruffy-display-scale: .512;
  --labrador-puppy-scale: .55;
}
/* The hidden greeting and original button row set the dogs' starting positions. */
#entry:has(#composer[hidden]) #greeting { visibility: hidden; }
.scruffy-walkway:has(#login:not([hidden])) {
  display: grid;
  flex: 1 0 auto;
  position: relative;
  isolation: isolate;
  width: 100%;
  --signin-top-min: max(0px, calc(min(var(--scruffy-size), 16dvh) - var(--signin-header-offset, 0px)));
  --signin-bottom-pad: max(0px, calc(min(var(--signin-header-height, 3.5rem), 12dvh) + var(--signin-header-offset, 0px)));
  grid-template: minmax(var(--signin-top-min),1fr) auto var(--signin-button-height, max(44px, calc(1lh + 1.24rem))) minmax(0,1fr) var(--signin-bottom-pad) / minmax(0,1fr);
  cursor: pointer;
}
.scruffy-walkway:has(#login:not([hidden])) #greeting {
  grid-area: 2 / 1;
  padding-inline: .65rem;
  margin-block-end: clamp(1rem, 2.7vh, 1.65rem);
}
.scruffy-walkway #login {
  position: fixed;
  left: var(--signin-center-x, 50%);
  top: var(--signin-center-y, 50dvh);
  translate: -50% -50%;
  width: max-content;
  max-width: 100%;
  place-items: center;
  z-index: 1;
}
#scruffy-yard {
  position: fixed;
  inset: calc(var(--signin-header-height, 3.5rem) + var(--signin-header-offset, 0px)) 0 0;
  z-index: 0;
  display: none;
  place-items: center;
  width: 100%;
  height: auto;
  padding: 0;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}
.scruffy-walkway:has(#login:not([hidden])) #scruffy-yard { display: grid; }
@media (forced-colors: none) {
  [data-appearance="dark"] #scruffy-yard {
    background: #000;
  }
  [data-appearance="dark"] #scruffy-yard::before {
    content: "";
    position: absolute;
    inset: auto -80% 0;
    height: 280%;
    pointer-events: none;
    --floor-tile: clamp(7rem, 19vmin, 11rem);
    background:
      linear-gradient(to right, white 1px, transparent 1px),
      linear-gradient(to top, white 1px, transparent 1px);
    background-size: var(--floor-tile) var(--floor-tile);
    background-position: center bottom;
    transform-origin: center bottom;
    transform: perspective(160vh) rotateX(47deg);
    mask-image: linear-gradient(to bottom, transparent 4%, black 80%);
    opacity: .11;
  }
}
#scruffy-yard:focus-visible { outline-offset: -3px; }
#scruffy-yard:disabled { pointer-events: none; }
.labrador-pack-stage, .scruffy-robot-stage, .scruffy-lab-stage {
  grid-area: 1 / 1;
  place-self: end center;
  height: min(var(--scruffy-size), max(0px, calc(100% + var(--signin-header-offset, 0px))));
  aspect-ratio: 1;
  transform-origin: center bottom;
  display: none;
  pointer-events: none;
}
.scruffy-robot-stage {
  transform: scale(var(--scruffy-display-scale));
}
.scruffy-walkway[data-dogs="scruffy"]:has(#login:not([hidden])) .scruffy-robot-stage { display: block; }
.scruffy-walkway[data-dogs="scruffy"]:has(#login:not([hidden])) .scruffy-lab-stage {
  display: grid;
  place-items: end center;
  transform: translateX(var(--puppy-offset, -65%)) scale(var(--scruffy-display-scale));
}
.scruffy-lab-stage[data-guest="labTwo"] { --puppy-offset: 65%; }
.scruffy-portrait {
  position: absolute;
  pointer-events: none;
  background: url("/labradors/charcoal-cool.webp") center / 100% 100% no-repeat;
}
.scruffy-portrait[data-portrait="labTwo"] { transform: scaleX(-1); }
.scruffy-portrait[data-portrait="robot"] { background-image: url("/scruffy-body/light.webp"); }
[data-appearance="dark"] .scruffy-portrait { background-image: url("/labradors/golden-tricolor.webp"); }
[data-appearance="dark"] .scruffy-portrait[data-portrait="robot"] { background-image: url("/scruffy-body/dark.webp"); }
#scruffy-yard[data-robot="walking"] [data-portrait="robot"],
#scruffy-yard[data-lab="walking"] [data-portrait="lab"],
#scruffy-yard[data-lab-two="walking"] [data-portrait="labTwo"],
#scruffy-yard[data-view="walking"] ~ .labrador-pack-stage { visibility: hidden; }
.scruffy-world, .scruffy-fence { display: block; width: 100%; height: 100%; }
.scruffy-world, .scruffy-fence { position: absolute; inset: 0; pointer-events: none; }
.scruffy-fence { z-index: 1; }
.scruffy-controls { display: flex; align-items: center; gap: 2px; }
#dog-pack {
  max-width: 11rem;
  min-height: 44px;
  padding-inline: .45rem;
  font: inherit;
  color: var(--ink);
  background: var(--canvas);
  border: 0;
  border-radius: .45rem;
  cursor: pointer;
}
.scruffy-walkway[data-dogs="labradors"]:has(#login:not([hidden])) .labrador-pack-stage {
  display: block;
  transform: scale(var(--scruffy-display-scale));
}
.labrador-pack-stage::after {
  content: "";
  position: absolute;
  inset: 0 -85%;
  transform: scale(var(--labrador-puppy-scale));
  transform-origin: center bottom;
  background: url("/labradors/standing.webp") center bottom / contain no-repeat;
}
[data-appearance="dark"] .labrador-pack-stage::after {
  background-image: url("/labradors/standing-dark.webp");
}
.scruffy-controls button {
  display: grid; place-items: center; width: 44px; height: 44px;
  padding: 0; border-radius: .65rem; color: var(--secondary);
}
.scruffy-controls button:hover { color: var(--ink); background: var(--tint); }
.scruffy-controls svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.roam-pause, .roam-retry { display: none; }
#scruffy-roam[data-icon="pause"] .roam-start, #scruffy-roam[data-icon="retry"] .roam-start { display: none; }
#scruffy-roam[data-icon="pause"] .roam-pause, #scruffy-roam[data-icon="retry"] .roam-retry { display: inline; }
.roam-pause { stroke-width: 3; }
/* Reserve the walking controls while the models load so an in-progress tap stays on Login. */
body:has(#login:not([hidden])) .scruffy-controls[hidden] { display: flex !important; visibility: hidden; }
body:has(#login:not([hidden])) #scruffy-jump[hidden] { display: grid !important; visibility: hidden; }
body:has(#login:not([hidden])) .topbar { flex-wrap: wrap; }
@media (max-width: 540px) {
  body:has(#login:not([hidden])) .topbar { gap: .25rem; }
  #preview-appearance .appearance-label { display: none; }
  #preview-appearance { padding-inline: .25rem; }
}
@media (max-width: 420px) {
  body:has(#login:not([hidden])) .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
  }
  body:has(#login:not([hidden])) .topbar #preview-appearance { grid-area: 1 / 2; }
  body:has(#login:not([hidden])) .topbar.measure-signin-wrap { display: flex; }
  body:has(#login:not([hidden])) .topbar .scruffy-controls { grid-area: 2 / 1 / 3 / 3; }
}
@media (max-height: 500px) {
  .scruffy-walkway { --scruffy-size: min(8rem, 24vh); }
}
