@font-face { font-family: 'Unbounded'; src: url('/static/fonts/unbounded.ttf') format('truetype'); font-weight: 200 900; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('/static/fonts/manrope.ttf') format('truetype'); font-weight: 200 800; font-display: swap; }

:root {
  color-scheme: light;
  --mustard: #e2a02b;
  --mustard-deep: #c98a1c;
  --cream: #f6f0e4;
  --paper: #fdf9f1;
  --peach: #efd6b4;
  --peach-soft: #f5e6cf;
  --burgundy: #5c1e20;
  --burgundy-hover: #772b2d;
  --rose: #a8807a;
  --rose-soft: #d8c2bb;
  --ink: #4e1b1c;
  --muted: #8a6760;
  --line: #e7d8c3;
  --display: 'Unbounded', 'Manrope', sans-serif;
  --body: 'Manrope', system-ui, sans-serif;
  --radius-card: 32px;
  --radius-panel: 20px;
  --radius-field: 12px;
  --overhang: 22px;
}

* { box-sizing: border-box; }
html { background: var(--mustard); }
body { margin: 0; min-height: 100dvh; background: var(--mustard); color: var(--ink); font: 500 15px/1.5 var(--body); }
a { color: var(--burgundy); text-underline-offset: 3px; }
p { margin: 0 0 12px; }
strong, b { font-weight: 800; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--burgundy); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 7px 18px; border: 0; border-radius: 999px;
  background: var(--peach); color: var(--burgundy); font-weight: 700; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, color .15s;
}
button:hover, .button:hover { background: #e8c79d; }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: var(--burgundy); color: var(--cream); }
.primary:hover { background: var(--burgundy-hover); }
.ghost { background: transparent; color: var(--peach); border: 1.5px solid rgba(239, 214, 180, .45); }
.ghost:hover { background: rgba(239, 214, 180, .14); color: var(--cream); }
.danger { background: transparent; color: #8f2a2c; padding-inline: 0; text-decoration: underline; text-underline-offset: 3px; }
.danger:hover { background: transparent; color: #b5302f; }

.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 30px; min-height: 100dvh; padding: 22px 26px 22px 22px; }
.sidebar {
  position: sticky; top: 22px; align-self: start; display: flex; flex-direction: column;
  min-height: calc(100dvh - 44px); max-height: calc(100dvh - 44px); overflow-y: auto; overscroll-behavior: contain;
  padding: 26px 18px 20px; border-radius: var(--radius-card);
  background: var(--burgundy); color: var(--cream); scrollbar-width: thin; scrollbar-color: var(--burgundy-hover) transparent;
}
.brand { display: block; color: var(--cream); text-decoration: none; font: 700 16px/1.25 var(--display); }
.brand-note { margin: 10px 0 24px; color: var(--rose-soft); font-size: 13px; line-height: 1.4; }
nav { display: flex; flex-direction: column; gap: 3px; }
nav a { padding: 8px 14px; border-radius: 999px; color: var(--cream); text-decoration: none; font-weight: 600; font-size: 14px; }
nav a:hover { background: rgba(239, 214, 180, .14); }
nav a[aria-current] { background: var(--peach); color: var(--burgundy); font-weight: 800; }
.nav-label { margin: 20px 14px 4px; color: var(--rose); font-size: 13px; font-weight: 600; }
.logout { margin-top: auto; padding-top: 22px; }
.logout button { width: 100%; }

.card { position: relative; min-width: 0; background: var(--cream); border-radius: var(--radius-card); padding: 30px 40px 36px; }
.page-heading { display: flex; align-items: center; gap: 16px; justify-content: space-between; margin: 0 0 26px; }
.page-heading h1 {
  margin: 0 0 0 calc(-40px - var(--overhang)); padding: 14px 34px 14px calc(40px + var(--overhang));
  flex: 1; min-width: 0; border-radius: 999px; background: var(--peach); color: var(--burgundy);
  font: 700 26px/1.2 var(--display); letter-spacing: -.005em;
}
.page-actions { display: flex; align-items: center; gap: 14px; flex: none; }
.page-actions:empty { display: none; }
h2 { margin: 0 0 14px; color: var(--burgundy); font: 600 17px/1.3 var(--display); }
h2.pill { display: inline-block; padding: 8px 18px; border-radius: 999px; background: var(--peach-soft); font-size: 15px; }
.muted, small, .meta, .hint, .record-count, .list-limit { color: var(--muted); font-size: 13px; font-weight: 500; }
.hint { max-width: 72ch; margin-top: 14px; }
.notice, .error { position: relative; margin: 0 0 20px; padding: 10px 16px 10px 22px; border-radius: 14px; background: var(--paper); }
.notice::before, .error::before { content: ''; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 5px; border-radius: 3px; background: var(--peach); }
.error { color: #8f2a2c; }
.error::before { background: #b5302f; }
.empty { padding: 18px 0; color: var(--muted); }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }

.stamps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; margin-bottom: 34px; }
.stamp {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 170px; padding: 16px 16px 14px;
  border: 7px dotted var(--cream); background: var(--stamp, var(--paper)); background-clip: border-box;
  box-shadow: inset 0 0 0 8px var(--stamp, var(--paper)), inset 0 0 0 9.5px var(--rose-soft);
}
.stamp-places { --stamp: #f4e3c8; }
.stamp-legends { --stamp: #f1ddd3; }
.stamp-riddles { --stamp: #f6ead6; }
.stamp-routes { --stamp: #ecdcc4; }
.stamp-face { display: flex; flex-direction: column; align-items: flex-start; padding: 12px 12px 4px; color: var(--burgundy); text-decoration: none; }
.stamp-face .picto { position: absolute; top: 22px; right: 22px; width: 40px; height: auto; aspect-ratio: 1; opacity: .3; stroke-width: 1.6; pointer-events: none; }
.stamp-face strong, .stamp-face span, .stamp-add { position: relative; z-index: 1; }
.stamp-face strong { font: 700 44px/1 var(--display); font-variant-numeric: tabular-nums; }
.stamp-face span { font-weight: 700; }
.stamp-face:hover span { text-decoration: underline; text-underline-offset: 3px; }
.stamp-add { align-self: flex-start; margin: 0 12px 6px; font-size: 13px; font-weight: 700; }
.picto { fill: none; stroke: var(--burgundy); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px; }
.panel { min-width: 0; }
.inbox-links a { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 52px; padding: 0 6px; border-bottom: 1.5px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 700; }
.inbox-links a:hover { color: var(--burgundy); background: var(--peach-soft); }
.inbox-links b { color: var(--burgundy); font: 700 22px/1 var(--display); font-variant-numeric: tabular-nums; }
.index-action { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }

.records { border-radius: var(--radius-panel); background: var(--paper); padding: 6px 8px; }
.record-head, .record { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: baseline; gap: 28px; padding: 12px 16px; }
.record-head { color: var(--muted); font-size: 13px; font-weight: 600; border-bottom: 1.5px solid var(--line); }
.record { border-radius: 14px; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.record + .record { margin-top: 2px; }
.record strong { font-weight: 700; }
.record span { color: var(--muted); font-size: 14px; }
.record:hover { background: var(--peach-soft); }
.record:hover strong { color: var(--burgundy); }
.record-count { white-space: nowrap; }

label, legend { display: block; margin-bottom: 6px; color: var(--burgundy); font-weight: 800; font-size: 14px; }
input:not([type=hidden]):not([type=checkbox]), textarea, select {
  display: block; width: 100%; min-width: 0; padding: 9px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-field);
  background: var(--paper); color: var(--ink); line-height: 1.45;
}
input:not([type=hidden]):not([type=checkbox]), select { min-height: 42px; }
input:focus, textarea:focus, select:focus { border-color: var(--rose); outline: none; box-shadow: 0 0 0 3px rgba(168, 128, 122, .25); }
textarea { resize: vertical; min-height: 64px; }
input::placeholder, textarea::placeholder { color: #ad9088; opacity: 1; }
small { display: block; margin-top: 6px; line-height: 1.35; }
small:empty { display: none; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset > p { font-size: 13px; margin-bottom: 10px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--burgundy); }

.editor { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px 24px; }
.field { min-width: 0; display: flex; flex-direction: column; grid-column: span 3; }
.field textarea { flex: 1; }
.editor > .actions { grid-column: 1 / -1; position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; gap: 18px; margin-bottom: -18px; padding: 14px 0 18px; border-top: 1.5px solid var(--line); background: var(--cream); }
.editor > .actions .danger { margin-left: auto; }
.editor-places { grid-template-areas: 'name name name aliases aliases aliases' 'location location location location location location' 'description description description description tags tags' 'description description description description closed closed' 'sources sources sources sources slug slug' 'actions actions actions actions actions actions'; }
.editor-places [data-field=name] { grid-area: name; }
.editor-places [data-field=aliases] { grid-area: aliases; }
.editor-places [data-field=location] { grid-area: location; }
.editor-places [data-field=description] { grid-area: description; }
.editor-places [data-field=description] textarea { min-height: 180px; }
.editor-places [data-field=tags] { grid-area: tags; }
.editor-places [data-field=closed] { grid-area: closed; align-self: start; }
.editor-places [data-field=sources] { grid-area: sources; }
.editor-places [data-field=slug] { grid-area: slug; }
.editor-places > .actions { grid-area: actions; }
.editor-legends { grid-template-areas: 'title title title title status status' 'text text text text place place' 'text text text text slug slug' 'sources sources sources sources sources sources' 'actions actions actions actions actions actions'; }
.editor-legends [data-field=title] { grid-area: title; }
.editor-legends [data-field=text] { grid-area: text; }
.editor-legends [data-field=text] textarea { min-height: 200px; }
.editor-legends [data-field=status] { grid-area: status; }
.editor-legends [data-field=place_id] { grid-area: place; }
.editor-legends [data-field=slug] { grid-area: slug; }
.editor-legends [data-field=sources] { grid-area: sources; }
.editor-legends > .actions { grid-area: actions; }
.editor-riddles [data-field=question], .editor-riddles [data-field=explanation] { grid-column: span 4; }
.editor-riddles [data-field=answers], .editor-riddles [data-field=hints] { grid-column: span 2; }
.editor-routes { grid-template-areas: 'title title title title transport duration' 'description description description description tags tags' 'stops stops stops stops slug slug' 'sources sources sources sources sources sources' 'actions actions actions actions actions actions'; }
.editor-routes [data-field=title] { grid-area: title; }
.editor-routes [data-field=description] { grid-area: description; }
.editor-routes [data-field=transport] { grid-area: transport; }
.editor-routes [data-field=duration_min] { grid-area: duration; }
.editor-routes [data-field=tags] { grid-area: tags; }
.editor-routes [data-field=stops] { grid-area: stops; }
.editor-routes [data-field=slug] { grid-area: slug; }
.editor-routes [data-field=sources] { grid-area: sources; }
.editor-routes > .actions { grid-area: actions; }
.stop { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.stop select { min-width: 0; }
.stop button { min-height: 38px; padding: 6px 12px; }

.location { display: grid; gap: 12px; padding: 18px; border-radius: var(--radius-panel); background: var(--paper); }
.location-search { display: flex; gap: 10px; }
.location-search input { flex: 1; }
.geo-results { display: flex; flex-wrap: wrap; gap: 8px; }
.geo-results[hidden], .geo-status[hidden] { display: none; }
.geo-results button { white-space: normal; text-align: left; font-weight: 600; font-size: 13px; }
.geo-status { margin: 0; color: var(--muted); font-size: 13px; }
.geo-status button { margin-left: 8px; min-height: 30px; padding: 4px 12px; font-size: 13px; }
.map { height: 360px; border-radius: var(--radius-field); overflow: hidden; background: var(--peach-soft); border: 1.5px solid var(--line); z-index: 0; }
.map-small { height: 300px; }
.coords { display: grid; grid-template-columns: 170px 170px minmax(0, 1fr); align-items: end; gap: 12px; }
.coords label { font-size: 12px; color: var(--muted); }
.coords input:not([type=hidden]) { min-height: 36px; padding-block: 6px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.coords small { margin: 0 0 6px; }
.pin { background: none; border: 0; }
.pin span { position: absolute; left: 3px; top: 0; width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--burgundy); border: 3px solid var(--peach); box-shadow: 0 3px 8px rgba(60, 20, 20, .35); }
.leaflet-container { font-family: var(--body); background: var(--peach-soft); }
.leaflet-tile-pane { filter: sepia(.32) saturate(.9) contrast(.96); }
.leaflet-control-attribution { font-size: 10px; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: -6px 0 18px; }
.tabs a { padding: 7px 16px; border-radius: 999px; background: var(--paper); color: var(--muted); text-decoration: none; font-weight: 700; font-size: 14px; }
.tabs a:hover { color: var(--burgundy); }
.tabs a[aria-current] { background: var(--burgundy); color: var(--cream); }
.inbox-item { padding: 18px 20px; margin-bottom: 12px; border-radius: var(--radius-panel); background: var(--paper); }
.inbox-item .prewrap { max-width: 95ch; }
.meta { margin-bottom: 8px; }
.actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.actions form, .buttons { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inbox-item .actions { margin-top: 12px; }
summary { cursor: pointer; color: var(--burgundy); font-weight: 800; }

.page-sandbox { display: flex; flex-direction: column; }
.dialogue { display: flex; flex-direction: column; height: max(420px, calc(100dvh - 250px)); border-radius: var(--radius-panel); background: var(--paper); padding: 6px 6px 14px; }
.chat { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 6px; scrollbar-color: var(--rose-soft) transparent; }
.bubble { max-width: min(78ch, 86%); margin-bottom: 14px; padding: 12px 16px 14px; border-radius: 22px; }
.bubble > strong { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 800; }
.bubble p { margin: 0; }
.bubble.grandma { background: var(--peach-soft); border-bottom-left-radius: 6px; }
.bubble.grandma > strong { color: var(--rose); }
.bubble.user { margin-left: auto; background: var(--burgundy); color: var(--cream); border-bottom-right-radius: 6px; }
.bubble.user > strong { color: var(--peach); }
.bubble > form { margin-top: 10px; }
.bubble:not(:last-child) > form { display: none; }
.buttons button, .buttons .button { min-height: 32px; padding: 5px 14px; font-size: 13px; background: var(--cream); }
.buttons button:hover, .buttons .button:hover { background: var(--peach); }
.chat-empty { display: grid; place-items: center; align-content: center; gap: 6px; height: 100%; color: var(--muted); text-align: center; }
.composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; padding: 10px 10px 0; }
.composer textarea { min-height: 52px; max-height: 180px; background: var(--cream); }
.composer .busy { grid-column: 1 / -1; }
.location-picker { flex: none; padding: 8px 10px 0; }
.location-picker > summary { display: inline-flex; padding: 5px 14px; border-radius: 999px; background: var(--cream); font-size: 13px; list-style: none; }
.location-picker > summary:hover { background: var(--peach); }
.location-picker > summary::-webkit-details-marker { display: none; }
.location-picker[open] > summary { margin-bottom: 8px; background: var(--peach); }
.location-picker .location { padding: 12px; background: var(--cream); }
.location-picker .map-small { height: 220px; }
.location-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.location-actions small { margin: 0; }
.busy { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

.studio { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 28px; height: max(520px, calc(100dvh - 195px)); }
.studio-chat { display: flex; flex-direction: column; min-height: 0; border-radius: var(--radius-panel); background: var(--paper); padding: 6px 6px 14px; }
.bubble.failed { background: #f3dcd6; border-bottom-left-radius: 6px; }
.bubble.failed > strong { color: #8f2a2c; }
.outputs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px !important; }
.outputs a { padding: 4px 12px; border-radius: 999px; background: var(--cream); font-size: 13px; font-weight: 700; text-decoration: none; }
.outputs a:hover { background: var(--peach); }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-tabs { flex-wrap: nowrap; overflow-x: auto; margin: -6px 0 12px; padding-bottom: 4px; scrollbar-width: thin; }
.chat-tabs a { display: inline-flex; align-items: center; gap: 6px; flex: none; max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-chats { height: max(460px, calc(100dvh - 250px)); }
.studio-single { grid-template-columns: minmax(0, 1fr); }
.draft { margin-top: 10px; padding: 12px 14px; border-radius: var(--radius-field); background: var(--cream); }
.draft h3 { margin: 0 0 6px; font-size: 16px; }
.draft .meta { margin: 0 0 6px; }
.draft .prewrap { margin-bottom: 8px; }
.draft .meta:last-child, .draft-state { margin-bottom: 0; }
.draft-state { font-weight: 700; }
.draft-actions { margin-top: 8px; }
.storyboards { display: grid; gap: 8px; margin-top: 10px; }
.storyboard { display: block; border-radius: var(--radius-field); overflow: hidden; background: #2b0d0e; }
.storyboard img { display: block; width: 100%; height: auto; }
.storyboard:hover img { opacity: .9; }
.steps-log { margin-top: 10px; }
.steps-log > summary { font-size: 13px; }
.steps { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.step { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: baseline; column-gap: 8px; font-size: 14px; font-weight: 600; }
.step-mark { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--rose); align-self: center; display: grid; place-items: center; font-size: 10px; line-height: 1; font-weight: 800; }
.step[data-state=done] .step-mark { background: var(--burgundy); border-color: var(--burgundy); color: var(--cream); }
.step[data-state=done] .step-mark::after { content: '✓'; }
.step[data-state=failed] .step-mark { background: #b5302f; border-color: #b5302f; color: var(--cream); }
.step[data-state=failed] .step-mark::after { content: '×'; font-size: 12px; }
.step[data-state=failed] .step-text { color: #8f2a2c; }
.step[data-state=running] .step-mark { border-color: var(--mustard-deep); border-right-color: transparent; animation: spin 1s linear infinite; }
.step-file { color: var(--muted); font-weight: 500; overflow-wrap: anywhere; }
.step progress { grid-column: 2; width: 100%; height: 8px; margin-top: 6px; appearance: none; border: 0; border-radius: 999px; background: var(--cream); overflow: hidden; }
.step progress::-webkit-progress-bar { background: var(--cream); border-radius: 999px; }
.step progress::-webkit-progress-value { background: var(--mustard); border-radius: 999px; transition: width .4s; }
.step progress::-moz-progress-bar { background: var(--mustard); border-radius: 999px; }
.live { max-width: min(78ch, 86%); margin: 4px 0 14px; padding: 14px 18px 12px; border: 5px dotted var(--paper); background: var(--peach-soft); box-shadow: inset 0 0 0 6px var(--peach-soft), inset 0 0 0 7.5px var(--rose-soft); }
.live-head { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; color: var(--burgundy); font-weight: 800; }
.live-head time { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--mustard); animation: pulse 1.6s ease-in-out infinite; }
.live-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .step[data-state=running] .step-mark, .live-dot { animation: none; }
}
.studio-media { display: flex; flex-direction: column; gap: 18px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 6px; scrollbar-width: thin; scrollbar-color: var(--rose-soft) transparent; }
.media-group h2 { margin: 0 0 8px; font-size: 15px; }
.player { flex: none; margin: 0; padding: 10px; border-radius: var(--radius-panel); background: var(--burgundy); }
.player[hidden] { display: none; }
.player video, .player img { display: block; width: 100%; max-height: 56dvh; border-radius: var(--radius-field); background: #2b0d0e; object-fit: contain; }
.player audio { width: 100%; }
.player figcaption { display: flex; justify-content: space-between; gap: 12px; padding: 10px 4px 2px; color: var(--peach); font-size: 13px; overflow-wrap: anywhere; }
.player figcaption a { color: var(--cream); font-weight: 700; white-space: nowrap; }
.files { margin: 0; padding: 0; list-style: none; }
.files li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1.5px solid var(--line); }
.files a { font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.files a:hover, .files a[aria-current] { text-decoration: underline; }
.files small { margin: 0; white-space: nowrap; }
.upload { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; margin-bottom: 6px; padding: 10px 10px 10px 12px; border-radius: var(--radius-panel); background: var(--paper); }
.upload input[type=file] { padding: 4px; border: 0; background: transparent; font-size: 13px; color: var(--muted); }
.upload input[type=file]::file-selector-button { margin-right: 12px; padding: 6px 14px; border: 0; border-radius: 999px; background: var(--peach-soft); color: var(--burgundy); font: 700 13px var(--body); cursor: pointer; }
.upload input[type=file]::file-selector-button:hover { background: var(--peach); }
.upload small, .upload .busy { grid-column: 1 / -1; margin: 0; }
.setup { max-width: 64ch; }
.setup pre { padding: 14px 18px; border-radius: var(--radius-field); background: var(--paper); overflow-x: auto; }
code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .92em; }

.auth-card { width: min(440px, calc(100% - 32px)); margin: 12dvh auto 0; padding: 34px 40px 38px; }
.auth-card .brand { margin-bottom: 26px; color: var(--burgundy); }
.login { display: grid; gap: 4px; }
.login button { margin-top: 16px; justify-self: start; }

@media (max-width: 1180px) {
  .stamps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .studio { grid-template-columns: 1fr; height: auto; }
  .studio-chat { height: max(480px, calc(100dvh - 220px)); }
  .studio-media { overflow: visible; padding-right: 0; }
  .editor { gap: 18px; }
  .editor-places, .editor-legends, .editor-routes { grid-template-areas: none; }
  .editor .field, .editor > .actions { grid-area: auto; grid-column: span 3; }
  .editor [data-field=description], .editor [data-field=text], .editor [data-field=question], .editor [data-field=explanation], .editor [data-field=sources], .editor [data-field=stops], .editor [data-field=location], .editor > .actions { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  :root { --radius-card: 26px; --overhang: 14px; }
  .shell { display: block; padding: 12px; }
  .sidebar { position: static; min-height: 0; max-height: none; overflow: visible; padding: 16px 0 12px; margin-bottom: 14px; }
  .sidebar .brand { padding: 0 16px; }
  .brand-note, .nav-label { display: none; }
  .studio-chat { height: max(380px, calc(100dvh - 290px)); }
  nav { flex-direction: row; flex-wrap: nowrap; gap: 4px; margin-top: 12px; padding: 0 16px 4px; overflow-x: auto; scrollbar-width: none; scroll-padding-inline: 16px; }
  nav::-webkit-scrollbar { display: none; }
  nav a { flex: none; padding: 6px 12px; font-size: 13px; }
  .logout { position: absolute; top: 24px; right: 24px; margin: 0; padding: 0; }
  .logout button { width: auto; min-height: 32px; padding: 4px 14px; }
  .card { padding: 22px 18px 26px; }
  .page-heading { flex-wrap: wrap; margin-bottom: 20px; }
  .page-heading h1 { margin-left: calc(-18px - var(--overhang)); padding: 12px 22px 12px calc(18px + var(--overhang)); font-size: 21px; flex-basis: 100%; }
  .overview-grid { grid-template-columns: 1fr; gap: 24px; }
  .record-head { display: none; }
  .record { grid-template-columns: 1fr; gap: 2px; }
  .editor { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .editor .field, .editor > .actions { grid-column: 1 / -1; }
  .editor [data-field=status], .editor [data-field=place_id], .editor [data-field=transport], .editor [data-field=duration_min] { grid-column: span 1; }
  .location { padding: 12px; }
  .location-search { flex-wrap: wrap; }
  .location-search input { flex-basis: 100%; }
  .coords { grid-template-columns: 1fr 1fr; }
  .coords small { grid-column: 1 / -1; }
  .map { height: 300px; }
  input:not([type=hidden]):not([type=checkbox]), textarea, select { font-size: 16px; }
  .dialogue { height: max(380px, calc(100dvh - 290px)); }
  .editor > .actions { margin-inline: -18px; padding-inline: 18px; }
  .live { max-width: 94%; }
  .bubble { max-width: 94%; }
}
@media (max-width: 520px) {
  .stamps { grid-template-columns: 1fr; gap: 14px; }
  .auth-card { padding: 26px 22px 30px; }
}
