/* Bauamt · style.css (shell from nights 052–061) */
:root {
  --bg: #05070f; --ui-text: #e8e3d6; --muted: #8d97ab; --amber: #e8a84a; --violet: #a98bff;
  --panel-bg: rgba(8, 12, 22, 0.78); --panel-border: rgba(255, 255, 255, 0.1); --field: rgba(10, 14, 27, 0.92);
  --mono: ui-monospace, Menlo, "SF Mono", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); overscroll-behavior: none; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ui-text); -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
#cv:focus-visible { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#cv { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; height: 100dvh; display: block;
  touch-action: none; cursor: crosshair; background: var(--bg); }
#cv.panning { cursor: grab; }
#cv.grabbing { cursor: grabbing; }

a.home { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); left: calc(14px + env(safe-area-inset-left, 0px)); z-index: 8;
  font-size: 12px; color: #8d9ab0; text-decoration: none; padding: 4px 7px; border-radius: 5px;
  background: rgba(6, 10, 22, 0.84); border: 1px solid var(--panel-border); }
a.home:hover, a.home:focus-visible { color: var(--amber); }

.stats { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); z-index: 8;
  font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--muted); padding: 4px 8px; border-radius: 6px;
  background: rgba(6, 10, 22, 0.84); border: 1px solid var(--panel-border); font-variant-numeric: tabular-nums; pointer-events: none;
  max-width: min(330px, calc(100vw - 160px)); text-align: right; }
.stats b { color: var(--ui-text); font-weight: 500; }

.title-overlay { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 9;
  text-align: center; pointer-events: none; opacity: 1; transition: opacity 1s ease; width: max-content;
  max-width: min(520px, calc(100vw - 720px)); padding: 6px 18px; border-radius: 12px;
  background: rgba(8, 10, 18, 0.82); border: 1px solid var(--panel-border); }
.title-overlay.faded { opacity: 0; }
.title-overlay h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: 0.06em; color: #f0e2c4; text-shadow: 0 1px 12px rgba(0,0,0,0.95); }
.title-overlay p { margin: 1px 0 0; font-size: 11.5px; color: #b3bccb; text-shadow: 0 1px 10px rgba(0,0,0,0.95); }
@media (max-width: 64rem) {
  .title-overlay { top: calc(64px + env(safe-area-inset-top, 0px)); max-width: calc(100vw - 28px); }
}

/* ---------- toolbar ---------- */
.bar { position: fixed; z-index: 8; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; align-items: stretch; gap: 5px; padding: 6px; border-radius: 11px;
  background: var(--panel-bg); border: 1px solid var(--panel-border); width: max-content; max-width: calc(100vw - 28px); }
.row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 5px; }
.btn { flex: 0 0 auto; min-height: 40px; min-width: 40px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--panel-border); background: rgba(18, 24, 38, 0.7); border-radius: 8px; font-size: 13px; color: var(--ui-text); cursor: pointer; white-space: nowrap;
  touch-action: manipulation; }
.btn:hover { border-color: rgba(255,255,255,0.24); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.go { color: #10131c; background: var(--amber); border-color: var(--amber); font-weight: 600; }
.btn.go:hover { background: #f0b862; }
.btn.tog[aria-pressed="true"] { color: var(--violet); border-color: rgba(169,139,255,0.6); background: rgba(30,24,48,0.75); }
.btn[aria-expanded="true"]:not(.go) { color: var(--amber); border-color: rgba(232,168,74,0.6); }
.btn.flash { color: var(--amber); border-color: rgba(232,168,74,0.7); }
.btn.go.flash { color: #10131c; }

.kinds { padding-top: 5px; border-top: 1px solid var(--panel-border); }
.chip { min-height: 34px; padding: 0 9px; font-size: 12px; }
.chip .sw { width: 10px; height: 10px; border-radius: 2px; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18); }
.chip .short { display: none; }
.chip[aria-pressed="true"] { color: #f0e2c4; border-color: rgba(232,168,74,0.75); background: rgba(40, 30, 18, 0.75); }
.chip.size { min-width: 36px; font-family: var(--mono); font-size: 12px; }
.chip.size:first-of-type, .kinds .gap { margin-left: 8px; }

#urlBox { width: 100%; font-family: var(--mono); font-size: 11px; padding: 6px; border-radius: 6px; border: 1px solid var(--panel-border);
  background: var(--field); -webkit-user-select: text; user-select: text; }

/* ---------- help ---------- */
.help { position: fixed; z-index: 20; top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px));
  max-height: calc(100vh - 160px); max-height: calc(100dvh - 160px);
  width: min(440px, calc(100vw - 28px)); display: flex; flex-direction: column; border-radius: 12px; background: rgba(8, 12, 22, 0.95);
  border: 1px solid rgba(255,255,255,0.14); box-shadow: 0 10px 40px rgba(0,0,0,0.6); }
.help-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--panel-border); }
.help-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0.04em; color: #f0e2c4; }
.help-body { overflow: auto; padding: 6px 14px 14px; font-size: 12.5px; line-height: 1.45; -webkit-user-select: text; user-select: text; }
.help-body h3 { margin: 12px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--amber); font-weight: 600; }
.help-body p { margin: 6px 0; color: #b3bccb; }
.help-body dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; }
.help-body dt { font-family: var(--mono); font-size: 12px; color: var(--ui-text); }
.help-body dd { margin: 0; color: var(--muted); }
.help-body code { font-family: var(--mono); font-size: 12px; color: var(--ui-text); }

.msg { position: fixed; z-index: 10; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: calc(100vw - 40px);
  font-family: var(--mono); font-size: 13px; line-height: 1.5; color: var(--ui-text); text-align: center; padding: 12px 16px; border-radius: 8px;
  background: rgba(6, 10, 22, 0.9); border: 1px solid var(--panel-border); }

@media (prefers-reduced-motion: reduce) { .title-overlay { transition: none; } }

/* ---------- narrower desktops: kind chips lose their long names ---------- */
@media (max-width: 70rem) {
  .chip .long { display: none; }
  .chip .short { display: inline; }
}

/* ---------- phone ---------- */
@media (max-width: 34rem) {
  a.home { top: calc(10px + env(safe-area-inset-top, 0px)); left: calc(10px + env(safe-area-inset-left, 0px)); }
  .stats { top: calc(10px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px));
    max-width: calc(100vw - 122px); font-size: 10px; line-height: 1.4; padding: 3px 6px; }
  .title-overlay { top: calc(54px + env(safe-area-inset-top, 0px)); left: 10px; right: 10px; transform: none; width: auto; max-width: none;
    padding: 5px 12px; border-radius: 9px; background: rgba(8,10,18,0.8); transition: opacity 0.5s ease; }
  .title-overlay h1 { font-size: 15px; }
  .title-overlay p { font-size: 10.5px; margin-top: 1px; }
  .bar { left: calc(8px + env(safe-area-inset-left, 0px)); right: calc(8px + env(safe-area-inset-right, 0px)); transform: none; width: auto;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px)); max-width: none; gap: 4px; padding: 5px; }
  .row { gap: 4px; justify-content: space-between; }
  .tools .btn { flex: 1 1 calc(14.28% - 4px); min-width: 0; min-height: 38px; padding: 0 1px; font-size: 11px; }
  /* one horizontally scrolling strip: eight kinds, a gap, four sizes */
  .kinds { padding-top: 4px; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scrollbar-width: none; touch-action: pan-x; }
  .kinds::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; min-width: 52px; min-height: 36px; padding: 0 8px; font-size: 11px; gap: 4px; }
  .chip .sw { width: 8px; height: 8px; }
  .chip.size { min-width: 44px; }
  .chip.size:first-of-type { margin-left: 0; }
  .kinds .gap { flex: 0 0 6px; margin-left: 0; align-self: stretch; border-left: 1px solid var(--panel-border); }
  .help { top: auto; bottom: calc(var(--bar-h, 180px) + 14px + env(safe-area-inset-bottom, 0px)); right: 8px; left: 8px; width: auto;
    max-height: 50vh; max-height: 50dvh; }
  .help-head { padding: 4px 8px 4px 12px; }
  .help-head .btn { padding: 0 12px; min-height: 34px; }
  .help-body { padding: 4px 10px 10px; }
}
@media (max-width: 34rem) and (prefers-reduced-motion: reduce) { .title-overlay { transition: none; } }
