:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --accent-soft: #dbeafe;
  --calib: #f59e0b;
  --danger: #dc2626;
  --work-bg: #cbd5e1;
  --shadow: 0 8px 30px rgba(15, 23, 42, .12), 0 2px 6px rgba(15, 23, 42, .08);
  --radius: 14px;
  --topbar-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111a2e;
    --surface-2: #1a2540;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #24314f;
    --accent: #3b82f6;
    --accent-soft: #1e3a8a;
    --work-bg: #1e293b;
    --shadow: 0 8px 30px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
/* No double-tap / pinch page zoom; the plan canvas handles its own zoom */
html { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* No text selection or long-press callouts on touch devices, or anywhere in the workspace */
@media (hover: none) and (pointer: coarse) {
  body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}
body.working { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, select, textarea { -webkit-user-select: text; user-select: text; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
}
body.working { overflow: hidden; overscroll-behavior: none; position: fixed; inset: 0; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.error { color: var(--danger); margin: .5rem 0 0; }

/* Top bar */
.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-size: 1.15rem; letter-spacing: -.01em; }
.brand b { color: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 4px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-2);
  min-height: 40px;
}
.btn.small { padding: 5px 12px; min-height: 34px; font-size: .875rem; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.danger { color: var(--danger); }
.btn:focus-visible, .tool:focus-visible, .icon-btn:focus-visible, .dropzone:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Screens */
.screen { flex: 1 1 auto; min-height: 0; }

/* Upload */
.hero { max-width: 620px; margin: 0 auto; padding: 40px 16px 48px; }
.hero h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 12px; }
.free-badge {
  display: inline-flex; align-items: center; margin: 0 0 14px; padding: 4px 12px;
  border-radius: 999px; background: #dcfce7; color: #15803d;
  font-size: .85rem; font-weight: 700; letter-spacing: .01em;
}
@media (prefers-color-scheme: dark) { .free-badge { background: #14532d; color: #86efac; } }
.br-wide { display: inline; }
.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 28px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 220px; padding: 24px;
  border: 2px dashed var(--border); border-radius: 20px;
  background: var(--surface);
  cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s, transform .15s;
  color: var(--accent);
}
.dropzone strong { color: var(--text); font-size: 1.15rem; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:active { transform: scale(.99); }
@media (hover: none) { .only-pointer { display: none; } }

.saved { margin-top: 32px; }
.saved h2 { margin: 0; font-size: 1.15rem; }
.saved > p { margin: 2px 0 12px; }
.saved-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.plan-card {
  position: relative; display: flex; flex-direction: column; text-align: left;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  overflow: hidden; cursor: pointer; padding: 0;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.plan-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.plan-card:active { transform: scale(.98); }
.plan-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.plan-card .thumb { aspect-ratio: 4 / 3; width: 100%; object-fit: contain; background: #fff; border-bottom: 1px solid var(--border); display: block; }
.plan-card .info { padding: 8px 10px 10px; min-width: 0; }
.plan-card .name { font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 22px; }
.plan-card .when { font-size: .78rem; color: var(--muted); }
.plan-card .del {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: rgba(15, 23, 42, .65); color: #fff; cursor: pointer; font-size: .9rem;
  display: grid; place-items: center;
}
.plan-card .del:hover { background: var(--danger); }

.steps { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; }
.steps li > span {
  flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .9rem;
}
.privacy { margin-top: 28px; }

.faq { margin-top: 40px; border-top: 1px solid var(--border); padding-top: 24px; }
.faq h2 { margin: 0 0 8px; font-size: 1.15rem; }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary {
  cursor: pointer; padding: 14px 28px 14px 0; font-weight: 600; list-style: none; position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+'; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 1.3rem; font-weight: 400;
}
.faq details[open] summary::after { content: '−'; }
.faq details p { margin: 0 0 14px; color: var(--muted); }

/* PDF pages */
#screen-pages { overflow-y: auto; padding: 24px 16px calc(32px + var(--safe-b)); }
.pages-head { max-width: 1000px; margin: 0 auto 16px; }
.pages-head h2 { margin: 0; }
.pages-grid {
  max-width: 1000px; margin: 0 auto;
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.page-card {
  border: 2px solid var(--border); border-radius: 12px; background: var(--surface);
  padding: 8px; cursor: pointer; text-align: center; display: flex; flex-direction: column; gap: 6px;
  transition: border-color .15s, transform .15s;
}
.page-card:hover { border-color: var(--accent); }
.page-card:active { transform: scale(.98); }
.page-card canvas { width: 100%; height: auto; background: #fff; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.page-card .ph { aspect-ratio: 1 / 1.414; background: var(--surface-2); border-radius: 6px; }
.page-card span { font-size: .875rem; color: var(--muted); font-weight: 600; }

/* Workspace */
.work { position: relative; overflow: hidden; background: var(--work-bg); }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; cursor: crosshair; }
#canvas.grabbing { cursor: grabbing; }
#canvas.over-handle { cursor: move; }

.hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px);
  background: rgba(15, 23, 42, .88); color: #f8fafc;
  padding: 9px 16px; border-radius: 999px; font-size: .9rem; text-align: center;
  pointer-events: none; box-shadow: var(--shadow);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.hint.calib { background: rgba(180, 83, 9, .93); }
.hint:empty { display: none; }

.zoom-ctl { position: absolute; right: 12px; top: 64px; display: flex; flex-direction: column; gap: 8px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer;
  display: grid; place-items: center; font-size: 1.4rem; line-height: 1; font-weight: 500;
}
@media (hover: none) and (pointer: coarse) { .zoom-ctl { display: none; } }

.loupe {
  position: absolute; width: 140px; height: 140px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: var(--shadow), 0 0 0 1px rgba(0,0,0,.2);
  pointer-events: none; z-index: 5; background: #fff;
}

/* Toolbar */
.toolbar {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + var(--safe-b));
  display: flex; gap: 2px; padding: 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
  z-index: 10; max-width: calc(100% - 16px);
}
.tool {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 56px; height: 54px; padding: 0 6px;
  border: 0; border-radius: 13px; background: none; cursor: pointer;
  font-size: .72rem; font-weight: 600; color: var(--muted);
}
.tool svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.tool.on { background: var(--accent-soft); color: var(--accent); }
.tool.primary { background: var(--accent); color: var(--accent-ink); }
.tool.primary:hover:not(:disabled) { background: var(--accent); color: var(--accent-ink); filter: brightness(1.08); }
.tool:disabled { opacity: .35; cursor: default; }
.tool.calib-on { background: #fef3c7; color: #b45309; }
.badge {
  position: absolute; top: 4px; right: 8px; font-style: normal;
  background: var(--accent); color: #fff; border-radius: 999px; font-size: .65rem; padding: 0 5px; min-width: 16px; line-height: 16px;
}
.tool span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) {
  .toolbar { width: calc(100% - 16px); }
  .tool { flex: 1 1 0; min-width: 0; padding: 0 2px; font-size: .68rem; }
}

/* Readout card */
.readout {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(86px + var(--safe-b));
  width: min(440px, calc(100% - 24px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 14px; z-index: 9;
  pointer-events: none; /* let taps reach the plan; buttons opt back in */
}
.readout.expanded, .readout button { pointer-events: auto; }
@media (min-width: 1000px) {
  .readout { left: 12px; transform: none; bottom: 12px; width: 340px; }
}
.readout .r-main { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; }
.readout .r-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.readout .r-alt { color: var(--muted); font-variant-numeric: tabular-nums; }
.readout .r-label { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.readout .r-label .dot { width: 10px; height: 10px; border-radius: 50%; }
.readout .r-toggle { border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 4px 0; font-size: .85rem; }
.readout .r-details { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; max-height: 34vh; overflow-y: auto; }
.readout table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.readout td { padding: 3px 0; }
.readout td:last-child { text-align: right; font-weight: 600; }
.readout h4 { margin: 10px 0 4px; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.readout .r-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

/* List sheet */
.sheet {
  position: absolute; right: 12px; top: 12px;
  bottom: calc(86px + var(--safe-b));
  width: min(360px, calc(100% - 24px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; z-index: 11;
}
.sheet-head, .sheet-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; gap: 8px; }
.sheet-head { border-bottom: 1px solid var(--border); }
.sheet-foot { border-top: 1px solid var(--border); }
.list { flex: 1; overflow-y: auto; padding: 6px; }
.list .empty { padding: 24px 12px; text-align: center; color: var(--muted); font-size: .9rem; }
.item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: none; padding: 10px; border-radius: 10px; cursor: pointer;
}
.item:hover { background: var(--surface-2); }
.item.sel { background: var(--accent-soft); }
.item .dot { flex: 0 0 12px; height: 12px; border-radius: 50%; }
.item .meta { flex: 1; min-width: 0; }
.item .t { font-weight: 700; font-variant-numeric: tabular-nums; }
.item .s { font-size: .8rem; color: var(--muted); }
.item .del { border: 0; background: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.item .del:hover { color: var(--danger); background: var(--surface); }

@media (max-width: 640px) {
  .sheet { left: 12px; right: 12px; width: auto; top: auto; max-height: 60%; }
}

/* Dialog */
.dialog {
  border: 0; border-radius: 18px; padding: 22px; width: min(400px, calc(100% - 32px));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.dialog h3 { margin: 0 0 4px; font-size: 1.25rem; }
.dialog p { margin: 0 0 14px; }
.calib-row { display: flex; gap: 8px; }
.calib-row input, .calib-row select {
  min-width: 0; height: 48px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px;
  background: var(--surface-2); font-size: 1.1rem;
}
.calib-row input { flex: 1 1 auto; }
.calib-row select { flex: 0 0 auto; }
.calib-row input:focus, .calib-row select:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* Toast */
.toast {
  position: fixed; left: 50%; top: calc(var(--topbar-h) + 60px); transform: translateX(-50%);
  background: #0f172a; color: #f8fafc; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow);
  z-index: 50; font-size: .9rem; max-width: calc(100% - 32px);
}

/* Drag & drop overlay */
.drop-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(37, 99, 235, .18);
  display: grid; place-items: center; pointer-events: none;
  border: 4px dashed var(--accent);
}
.drop-overlay div { background: var(--surface); padding: 16px 24px; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow); }

/* Language switcher: a native <select> laid invisibly over a globe button */
.lang-switch {
  position: relative; display: inline-flex; align-items: center; gap: 4px;
  height: 34px; padding: 0 10px; border-radius: 999px; background: var(--surface-2);
  color: var(--muted); font-size: .8rem; font-weight: 700; cursor: pointer;
}
.lang-switch:hover { color: var(--text); }
.lang-switch:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.lang-switch select {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
  font-size: 16px; /* avoids iOS zoom on focus */
}
@media (max-width: 420px) {
  .lang-code { display: none; }
  .lang-switch { padding: 0 8px; }
  .topbar-actions { gap: 6px; }
  .seg button { padding: 4px 11px; }
  #btn-new { padding: 7px 10px; }
}

.lang-links { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.lang-links a { color: var(--accent); text-decoration: none; font-size: .875rem; }
.lang-links a:hover { text-decoration: underline; }

/* Right-to-left (Arabic) */
[dir="rtl"] .faq summary { padding: 14px 0 14px 28px; }
[dir="rtl"] .faq summary::after { right: auto; left: 4px; }
[dir="rtl"] .zoom-ctl { right: auto; left: 12px; }
[dir="rtl"] .plan-card { text-align: right; }
[dir="rtl"] .plan-card .del { right: auto; left: 6px; }
[dir="rtl"] .plan-card .name { padding-right: 0; padding-left: 22px; }
[dir="rtl"] .item { text-align: right; }
[dir="rtl"] .readout td:last-child { text-align: left; }
@media (min-width: 641px) { [dir="rtl"] .sheet { right: auto; left: 12px; } }
@media (min-width: 1000px) { [dir="rtl"] .readout { left: auto; right: 12px; } }

/* Estimated floor area */
.readout .r-total {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
  font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
.readout .r-total b { color: var(--text); font-weight: 700; }
.list-total {
  margin: 4px 4px 8px; padding: 12px 14px; border-radius: 12px;
  background: var(--accent-soft); font-variant-numeric: tabular-nums;
}
.list-total .lt-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.list-total .lt-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
.list-total .lt-alt { font-size: .85rem; color: var(--muted); }

/* Landing background: faint floor plan line art, faded out behind the text */
:root { --art-line: #94a3b8; --art-opacity: .5; }
@media (prefers-color-scheme: dark) { :root { --art-line: #64748b; --art-opacity: .5; } }
/* Grows to its content (flex-shrink 0) so the page scrolls; overflow only clips the art at the sides */
#screen-upload { position: relative; overflow: hidden; flex-shrink: 0; }
#screen-upload .hero { position: relative; z-index: 1; }
.plan-art {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  opacity: var(--art-opacity); color: var(--art-line);
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 35%, transparent 35%, #000 85%);
  mask-image: radial-gradient(ellipse 60% 70% at 50% 35%, transparent 35%, #000 85%);
}
.plan-art svg { position: absolute; top: 0; height: 1100px; width: auto; }
.plan-art .art-left { left: -260px; }
.plan-art .art-right { right: -300px; top: 360px; }
@media (max-width: 760px) {
  .plan-art { -webkit-mask-image: linear-gradient(#000, rgba(0,0,0,.35) 40%, rgba(0,0,0,.35) 70%, #000); mask-image: linear-gradient(#000, rgba(0,0,0,.35) 40%, rgba(0,0,0,.35) 70%, #000); --art-opacity: .22; }
  .plan-art .art-left { left: -420px; }
  .plan-art .art-right { right: -520px; top: 700px; }
}
.plan-art .art-accent { color: var(--accent); stroke: currentColor; fill: none; }
.plan-art .art-accent text { fill: currentColor; }
.plan-art .art-accent .art-fill { fill: color-mix(in srgb, var(--accent) 12%, transparent); }

/* Rotating heading words */
.rotator {
  display: inline-block; color: var(--accent);
  transition: opacity .26s ease, transform .26s ease;
}
.rotator.out { opacity: 0; transform: translateY(-.3em); }
.rotator.in { opacity: 0; transform: translateY(.3em); transition: none; }

/* Landing: "Measure on a map" option */
.or-divider { display: flex; align-items: center; gap: 12px; margin: 14px 0; color: var(--muted); font-size: .85rem; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.map-card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 16px 18px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface);
  color: var(--accent); cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
}
.map-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.map-card:active { transform: scale(.99); }
.map-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.map-card-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.map-card-text strong { color: var(--text); font-size: 1.05rem; }
.map-card .chev { color: var(--muted); flex: 0 0 auto; }
[dir="rtl"] .map-card { text-align: right; }
[dir="rtl"] .map-card .chev { transform: scaleX(-1); }

/* Map screen */
.map-screen { position: relative; overflow: hidden; background: var(--work-bg); }
#map { position: absolute; inset: 0; }
.map-search {
  position: absolute; top: 12px; left: 12px; right: 12px; z-index: 5;
  display: flex; gap: 8px; align-items: center; max-width: 560px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 5px; box-shadow: var(--shadow);
}
.map-search input {
  flex: 1; min-width: 0; height: 42px; border: 0; background: transparent; padding: 0 6px;
  font-size: 16px; outline: none;
}
.map-search .icon-btn { box-shadow: none; border: 0; background: var(--surface-2); width: 42px; height: 42px; }
.map-bottom {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); z-index: 5;
  width: min(560px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 8px; align-items: stretch;
}
.map-hint {
  margin: 0; align-self: center; text-align: center; font-size: .85rem; color: #f8fafc;
  background: rgba(15, 23, 42, .82); padding: 7px 14px; border-radius: 999px; backdrop-filter: blur(6px);
}
.map-actions {
  display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 6px; box-shadow: var(--shadow);
}
.map-actions .seg { flex: 0 0 auto; }
.map-actions .icon-btn { box-shadow: none; border: 0; background: var(--surface-2); flex: 0 0 auto; }
.map-actions .btn.primary { flex: 1; min-height: 44px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-screen .maplibregl-ctrl-top-right { top: 70px; }
.map-screen .maplibregl-ctrl-bottom-left, .map-screen .maplibregl-ctrl-bottom-right { bottom: calc(118px + var(--safe-b)); }
@media (hover: none) and (pointer: coarse) { .map-screen .maplibregl-ctrl-top-right { display: none; } }

/* Credit for map imagery in the workspace */
.attribution {
  position: absolute; right: 8px; bottom: calc(76px + var(--safe-b)); z-index: 4; pointer-events: none;
  font-size: .65rem; color: #334155; background: rgba(255, 255, 255, .78); padding: 2px 6px; border-radius: 4px;
  max-width: calc(100% - 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#btn-new { white-space: nowrap; }
@media (max-width: 420px) { body.working .brand span { display: none; } }
