:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #14213d;
  background: #f4f7fc;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button, .icon-button { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
button:focus-visible, a:focus-visible, .preview-stage:focus-visible { outline: 3px solid #157dfa; outline-offset: 3px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.toolbar {
  flex: none;
  position: relative;
  z-index: 1;
  padding: max(14px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 14px max(24px, env(safe-area-inset-left));
  border-bottom: 1px solid #dfe6f1;
  background: #fff;
}
.toolbar-heading { display: flex; align-items: center; gap: 20px; margin-bottom: 14px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: #0e2f50; font-size: 23px; font-weight: 750; letter-spacing: -.8px; flex-shrink: 0; }
.brand img { object-fit: contain; }
.brand-accent { color: #157dfa; }
.toolbar-title { color: #66758c; font-size: 13px; }
.view-switch { display: flex; gap: 3px; margin-left: auto; padding: 4px; background: #f0f3f8; border: 1px solid #e5eaf1; border-radius: 12px; }
.view-switch button { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 6px 14px; background: transparent; color: #66758c; border: 0; border-radius: 8px; font-size: 13px; font-weight: 600; }
.view-switch button[aria-pressed="true"] { background: #fff; color: #1268df; box-shadow: 0 2px 6px #14213d14; }
.view-switch button:hover { color: #1268df; }
.address-form { display: flex; align-items: center; gap: 8px; }
.address-field { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; height: 44px; padding: 0 13px; border: 1px solid #dce3ee; border-radius: 10px; background: #f8fafd; color: #8390a4; }
.address-field:focus-within { border-color: #157dfa; box-shadow: 0 0 0 3px #157dfa14; }
.address-field:has(input[aria-invalid="true"]) { border-color: #c64040; }
.address-field input { width: 100%; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: #14213d; font-size: 16px; }
.address-field input::placeholder { color: #8390a4; }
.submit-button { min-height: 44px; padding: 0 19px; border: 1px solid #157dfa; border-radius: 10px; color: white; background: #157dfa; font-weight: 600; font-size: 14px; }
.submit-button:hover { background: #1168db; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; border: 1px solid #dce3ee; border-radius: 10px; background: #fff; color: #66758c; text-decoration: none; }
.icon-button:hover:not(:disabled) { color: #157dfa; background: #f4f8ff; }
.url-error { margin: 9px 0 0; color: #b32f38; font-size: 13px; }
.controls-toggle { position: fixed; z-index: 3; top: max(10px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid #d6e2f5; border-radius: 14px; background: #fff; color: #1268df; box-shadow: 0 4px 16px #14213d24; }
.controls-toggle .expand-icon { display: none; }
.toolbar-heading { padding-right: 52px; }
body[data-controls-collapsed="true"] .preview-info,
body[data-controls-collapsed="true"] .scroll-hint { display: none; }
body[data-controls-collapsed="true"] .controls-toggle .expand-icon { display: block; }
body[data-controls-collapsed="true"] .controls-toggle .collapse-icon { display: none; }

.workspace { display: flex; flex: 1; min-height: 0; flex-direction: column; }
.preview-info { display: flex; align-items: center; gap: 10px; min-height: 43px; padding: 8px max(24px, env(safe-area-inset-left)); font-size: 12px; flex: none; }
.device-label { font-weight: 650; }
.dimensions { color: #66758c; font-variant-numeric: tabular-nums; }
.load-status { margin-left: auto; color: #66758c; }
.preview-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: radial-gradient(ellipse at 40% 30%, #e3edff 0, transparent 65%), #f0f4fa;
  padding: 22px 24px;
  scrollbar-gutter: stable;
}
.preview-footprint { position: relative; margin-inline: auto; }
.device-shell { position: absolute; top: 0; left: 0; transform-origin: top left; background: #fff; }
body[data-host="desktop"][data-view="mobile"] .device-shell { border: 10px solid #182435; border-radius: 49px; overflow: hidden; box-shadow: 0 0 0 1px #728099, 0 20px 60px #1b36552b, inset 0 0 0 1px #647188; }
body[data-view="desktop"] .device-shell { box-shadow: 0 8px 30px #1b365514; outline: 1px solid #dce3ee; }
iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.frame-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: #fff; color: #66758c; font-size: 16px; }
.loading-spinner { width: 36px; height: 36px; border: 3px solid #e3edff; border-top-color: #157dfa; border-radius: 50%; animation: loading-spin .8s linear infinite; }
@keyframes loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .loading-spinner { animation: none; }
}
.empty-state { max-width: 430px; margin: 70px auto 30px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 22px; border: 1px solid #fff; border-radius: 20px; background: #ffffffbd; box-shadow: 0 8px 24px #356df312; color: #157dfa; }
.empty-icon svg { width: 29px; height: 29px; }
.empty-state h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.6px; font-weight: 650; margin: 0 0 14px; }
.empty-state p { color: #66758c; font-size: 14px; line-height: 1.7; margin: 0 0 24px; }
.example-button { min-height: 44px; padding: 10px 17px; border: 1px solid #d6e2f5; border-radius: 10px; background: #fff; color: #1268df; font-size: 14px; font-weight: 600; }
.example-button span { margin-left: 14px; }
.example-button:hover { background: #f7faff; }
.scroll-hint, .load-help { flex: none; margin: 0; padding: 8px max(16px, env(safe-area-inset-left)); color: #66758c; background: #fff; font-size: 12px; line-height: 1.5; }
.scroll-hint { border-bottom: 1px solid #dfe6f1; }
.load-help { border-top: 1px solid #dfe6f1; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.load-help a { color: #1268df; text-underline-offset: 3px; white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.noscript-message { position: fixed; inset: auto 16px 16px; z-index: 2; padding: 16px; border-radius: 12px; background: #fff; box-shadow: 0 2px 20px #14213d26; }

body[data-host="mobile"][data-view="mobile"] .preview-stage { padding: 0; background: #fff; scrollbar-gutter: auto; }
body[data-host="mobile"][data-view="mobile"] .preview-footprint { margin: 0; }
body[data-host="mobile"][data-view="mobile"] .device-shell { border-radius: 0; }
body[data-host="mobile"][data-view="desktop"] .preview-stage { padding: 12px; scrollbar-gutter: auto; }

@media (max-width: 640px) {
  .toolbar { padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left)); }
  .toolbar-heading { gap: 8px; margin-bottom: 10px; }
  .brand { font-size: 21px; gap: 5px; }
  .brand img { width: 24px; height: 24px; }
  .toolbar-title { display: none; }
  .view-switch button { min-height: 36px; padding: 6px 9px; gap: 5px; font-size: 12px; }
  .view-switch svg { width: 17px; height: 17px; }
  .address-form { gap: 6px; }
  .address-field { flex-basis: 0; padding-inline: 10px; }
  .submit-button { padding: 0 12px; }
  .address-form .icon-button { width: 36px; height: 36px; }
  .preview-info { padding: 8px max(12px, env(safe-area-inset-left)); gap: 7px; font-size: 11px; flex-wrap: wrap; }
  .preview-stage { padding: 16px; }
  .empty-state { margin-top: 40px; padding: 0 20px; }
  .empty-state h1 { font-size: 22px; }
}

@media (max-width: 359px) {
  .brand > span { display: none; }
}
