@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-Variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #070707;
  --bg-soft: #0a0a0a;
  --surface: #101010;
  --surface-raised: #151515;
  --surface-hover: #1b1b1b;
  --line: #242424;
  --line-strong: #343434;
  --text: #f4f4f4;
  --text-soft: #c8c8c8;
  --muted: #808080;
  --subtle: #555555;
  --inverse: #090909;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.44);
  --nav-height: 60px;
  --iphone-width: 428px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Geist", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
label,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 1px solid #d8d8d8;
  outline-offset: 3px;
}

svg {
  display: block;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

::selection {
  background: #e8e8e8;
  color: #080808;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #353535;
  background-clip: padding-box;
}

.floating-nav {
  position: fixed;
  z-index: 80;
  top: 16px;
  left: 50%;
  display: grid;
  grid-template-columns: 44px auto;
  align-items: center;
  gap: 6px;
  width: max-content;
  min-height: var(--nav-height);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(15, 15, 15, 0.88);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.36);
  padding: 7px;
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.nav-brand,
.nav-action,
.icon-button,
.tool-button {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.nav-brand {
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: #0b0b0b;
}

.nav-brand img {
  width: 27px;
  height: 27px;
  object-fit: contain;
}

.nav-action,
.icon-button {
  border-radius: 50%;
}

.nav-action {
  position: absolute;
  top: 50%;
  right: -58px;
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--text-soft);
  transform: translateY(-50%);
}

.nav-action:hover {
  transform: translateY(-50%);
}

.nav-action:active {
  transform: translateY(-50%) scale(0.94);
}

.nav-action.is-active {
  border-color: #646464;
  background: var(--text);
  color: var(--inverse);
}

.nav-action:hover,
.icon-button:hover:not(:disabled),
.tool-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.icon-button:active:not(:disabled),
.tool-button:active:not(:disabled) {
  transform: scale(0.94);
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0 22px;
  font-size: 15px;
  font-weight: 430;
  white-space: nowrap;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.nav-tab svg {
  width: 16px;
  height: 16px;
}

.nav-tab:hover {
  color: var(--text-soft);
}

.nav-tab.is-active {
  border-color: var(--line);
  background: var(--surface-hover);
  color: var(--text);
}

.app-main {
  width: min(100%, 1920px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 116px 24px 48px;
}

.is-preview-view .app-main {
  width: 100%;
  max-width: none;
  height: 100dvh;
  overflow: hidden;
  padding-top: 84px;
  padding-bottom: 5px;
  padding-right: 5px;
  padding-left: 5px;
}

.is-preview-view {
  overflow: hidden;
}

#previewView.is-active {
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.app-view {
  display: none;
}

.app-view.is-active {
  display: block;
  animation: view-in 220ms ease both;
}

.view-heading,
.preview-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.view-heading {
  min-height: 104px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
}

.view-heading h1,
.preview-heading h1 {
  margin: 0;
  font-weight: 430;
  letter-spacing: 0;
}

.view-heading h1 {
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
}

.view-heading p:not(.eyebrow) {
  max-width: 500px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.library-stats {
  display: grid;
  min-width: 86px;
  padding-bottom: 2px;
  text-align: right;
}

.library-stats strong {
  font-family: "Geist Mono", monospace;
  font-size: 28px;
  font-weight: 350;
  line-height: 1;
}

.library-stats span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.capture-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) 1px minmax(380px, 0.85fr);
  gap: 22px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 24px 0;
}

.url-capture-form {
  display: grid;
  grid-template-columns: 40px minmax(220px, 1fr) minmax(120px, 0.45fr) auto 38px;
  gap: 10px;
  align-items: end;
}

.capture-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.capture-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.capture-field > span {
  color: var(--muted);
  font-size: 10px;
}

.capture-field input,
.file-capture-form > input {
  width: 100%;
  height: 40px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-soft);
  padding: 0 11px;
  outline: none;
  transition: border-color 140ms ease, background 140ms ease;
}

.capture-field input:hover,
.capture-field input:focus,
.file-capture-form > input:hover,
.file-capture-form > input:focus,
.chat-composer:focus-within {
  border-color: var(--line-strong);
  background: #0d0d0d;
}

input::placeholder,
textarea::placeholder {
  color: var(--subtle);
}

.permission {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.permission input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #efefef;
}

.capture-submit {
  width: 40px;
  height: 40px;
  border-color: var(--text);
  border-radius: 8px;
  background: var(--text);
  color: var(--inverse);
}

.capture-submit:hover:not(:disabled) {
  border-color: #d7d7d7;
  background: #d7d7d7;
  color: var(--inverse);
}

.capture-divider {
  width: 1px;
  height: 48px;
  background: var(--line);
}

.file-capture-form {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(110px, 0.7fr) auto;
  gap: 10px;
  align-items: center;
}

.file-picker {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  min-height: 48px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  padding: 7px 10px;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.file-picker:hover {
  border-color: #575757;
  background: var(--surface);
}

.file-picker > svg {
  grid-row: 1 / 3;
  color: var(--muted);
}

.file-picker span,
.file-picker small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-picker span {
  font-size: 11px;
}

.file-picker small {
  color: var(--muted);
  font-size: 9px;
}

.file-picker input,
.attach-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.file-capture-form > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-raised);
  padding: 0 13px;
  font-size: 11px;
}

.file-capture-form > button:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.file-capture-form > button svg {
  width: 14px;
  height: 14px;
}

.sites-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  color: var(--muted);
  font-size: 13px;
}

.icon-button.subtle {
  color: var(--muted);
}

.site-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.site-cover-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color 160ms ease, transform 160ms ease;
}

.site-cover-card:hover {
  border-color: #454545;
  transform: translateY(-2px);
}

.site-cover-card.is-current {
  border-color: #686868;
}

.site-cover-media {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 16 / 9;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #050505;
}

.site-cover-media::before {
  content: "Aperçu indisponible";
  position: absolute;
  color: var(--subtle);
  font-family: "Geist Mono", monospace;
  font-size: 10px;
}

.site-cover-media img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  background: #050505;
  object-fit: cover;
  object-position: center;
}

.site-cover-media img.is-missing {
  display: none;
}

.site-cover-media > span {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: rgba(8, 8, 8, 0.82);
  color: #d6d6d6;
  padding: 5px 8px;
  font-family: "Geist Mono", monospace;
  font-size: 9px;
  backdrop-filter: blur(8px);
}

.site-cover-caption {
  min-width: 0;
  padding: 15px 15px 13px;
}

.site-cover-caption strong,
.site-cover-caption small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-cover-caption strong {
  font-size: 15px;
  font-weight: 480;
}

.site-cover-caption small {
  margin-top: 6px;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
  font-size: 10px;
}

.site-cover-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
}

.site-cover-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  height: 48px;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  transition: background 150ms ease, color 150ms ease;
}

.site-cover-actions button + button {
  border-left: 1px solid var(--line);
}

.site-cover-actions button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.site-cover-actions svg {
  width: 16px;
  height: 16px;
}

.load-more-sites {
  grid-column: 1 / -1;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.load-more-sites:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.site-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 14, 14, 0.86);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.site-card:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  transform: translateY(-2px);
}

.site-card.is-current {
  border-color: #505050;
}

.site-open {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  min-height: 104px;
  align-items: center;
  background: transparent;
  color: inherit;
  padding: 18px;
  text-align: left;
}

.site-monogram {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #1a1a1a;
  color: var(--text-soft);
  font-family: "Geist Mono", monospace;
  font-size: 13px;
}

.site-card-copy {
  min-width: 0;
}

.site-card-copy strong,
.site-card-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-card-copy strong {
  font-size: 14px;
  font-weight: 470;
}

.site-card-copy small {
  margin-top: 6px;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
  font-size: 10px;
}

.site-card-meta {
  display: grid;
  grid-template-columns: auto auto auto minmax(56px, 1fr) 30px;
  align-items: center;
  gap: 10px;
  min-height: 45px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 7px 10px 7px 16px;
  font-family: "Geist Mono", monospace;
  font-size: 10px;
}

.site-card-meta .site-score {
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-card-meta .icon-button {
  width: 30px;
  height: 30px;
  min-width: 30px;
}

.empty-state {
  display: grid;
  grid-column: 1 / -1;
  place-items: center;
  min-height: 260px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 20px;
  height: 20px;
  margin-bottom: 14px;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state strong {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 450;
}

.empty-state span {
  margin-top: 6px;
  font-size: 11px;
}

.capture-view.is-active {
  display: grid;
  min-height: calc(100dvh - 164px);
  place-items: center;
}

.capture-stage {
  width: min(820px, 100%);
  padding: 48px 0;
}

.capture-stage-heading {
  display: grid;
  justify-items: center;
  margin-bottom: 34px;
  text-align: center;
}

.capture-stage-heading .eyebrow {
  margin-bottom: 12px;
}

.capture-stage-heading h1 {
  margin: 0;
  font-size: 42px;
  font-weight: 420;
  line-height: 1;
}

.capture-stage-heading > p:not(.eyebrow) {
  max-width: 520px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.capture-stage .url-capture-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
}

.capture-stage .capture-field {
  gap: 9px;
}

.capture-stage .capture-field > span {
  padding-left: 3px;
  font-size: 11px;
}

.capture-input-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 10px;
  height: 64px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #0d0d0d;
  padding: 8px 8px 8px 17px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.capture-input-row:focus-within {
  border-color: #686868;
  background: #101010;
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.4);
}

.capture-input-row > svg {
  color: var(--muted);
}

.capture-stage .capture-input-row input {
  width: 100%;
  height: 46px;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--text);
  font-size: 17px;
  outline: 0;
}

.capture-stage .capture-input-row input:hover,
.capture-stage .capture-input-row input:focus {
  border: 0;
  background: transparent;
}

.capture-stage .capture-submit {
  width: 46px;
  height: 46px;
  border-radius: 8px;
}

.capture-stage .permission {
  justify-self: center;
  height: 28px;
  font-size: 11px;
}

.capture-stage .capture-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: auto;
  margin: 30px 0;
  background: transparent;
  color: var(--subtle);
  font-family: "Geist Mono", monospace;
  font-size: 9px;
  text-transform: uppercase;
}

.capture-stage .capture-divider::before,
.capture-stage .capture-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.capture-stage .file-capture-form {
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 0.55fr) auto;
}

.capture-stage .file-picker {
  min-height: 58px;
}

.preview-heading {
  min-height: 64px;
  padding-bottom: 10px;
  padding-right: 14px;
  padding-left: 14px;
}

.preview-title,
.preview-title > div,
.title-row {
  min-width: 0;
}

.preview-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.preview-heading h1 {
  overflow: hidden;
  max-width: min(54vw, 760px);
  font-size: 21px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 3px 7px;
  font-family: "Geist Mono", monospace;
  font-size: 8px;
  text-transform: uppercase;
  white-space: nowrap;
}

.preview-url {
  display: block;
  overflow: hidden;
  max-width: min(62vw, 900px);
  margin-top: 5px;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

.save-state > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #606060;
}

.save-state.is-modified > span {
  background: #e6e6e6;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.save-state p {
  margin: 0;
}

.preview-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 0.2fr) minmax(0, 0.8fr);
  gap: 8px;
  align-items: stretch;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.canvas-column {
  position: relative;
  display: grid;
  grid-column: 2;
  grid-row: 1;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.canvas-shell {
  position: relative;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0b0b;
  box-shadow: var(--shadow);
  padding: 70px 8px 8px;
}

.floating-toolbar {
  position: absolute;
  z-index: 4;
  top: 12px;
  right: 14px;
  left: 14px;
  display: grid;
  grid-template-columns: minmax(165px, 2fr) 1px repeat(3, minmax(48px, 1fr)) 1px repeat(2, minmax(48px, 1fr));
  align-items: center;
  gap: 5px;
  width: auto;
  max-width: none;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(24, 24, 24, 0.92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  padding: 4px;
  backdrop-filter: blur(16px);
}

.tool-button {
  width: 100%;
  height: 38px;
  min-width: 38px;
  border-radius: 6px;
}

.tool-button svg {
  width: 16px;
  height: 16px;
}

.tool-button.is-active {
  background: var(--text);
  color: var(--inverse);
}

.tool-button.is-active:hover {
  background: #dcdcdc;
  color: var(--inverse);
}

.export-button:not(:disabled) {
  border-color: #f0f0f0;
  background: #f0f0f0;
  color: #090909;
  box-shadow: 0 5px 16px rgba(255, 255, 255, 0.12);
}

.export-button:hover:not(:disabled) {
  border-color: #fff;
  background: #fff;
  color: #090909;
}

.tool-separator {
  width: 1px;
  height: 17px;
  margin: 0 3px;
  background: var(--line-strong);
}

.page-picker {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111;
  color: var(--text-soft);
  padding: 0 11px;
  cursor: pointer;
}

.page-picker svg {
  width: 15px;
  height: 15px;
}

.page-picker select {
  width: 100%;
  min-width: 0;
  border: 0;
  appearance: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  outline: 0;
  font-size: 12px;
  font-weight: 480;
}

.page-picker-chevron {
  color: var(--muted);
}

.page-picker option {
  background: var(--surface-raised);
}

.preview-canvas {
  position: relative;
  display: grid;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 5px;
  background: #050505;
}

.desktop-preview,
.mobile-preview {
  min-width: 0;
}

.desktop-preview {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  border: 1px solid #2d2d2d;
  border-radius: 5px;
  background: #050505;
}

.desktop-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 1440px;
  height: 810px;
  background: #fff;
  transform-origin: top left;
}

iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.mobile-preview {
  display: grid;
  place-items: center;
}

.phone-shell {
  position: relative;
  width: min(100%, var(--iphone-width));
  aspect-ratio: 428 / 926;
  overflow: hidden;
  border: 7px solid #262626;
  border-radius: 33px;
  background: #fff;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.48);
}

.phone-shell iframe {
  border-radius: 25px;
}

.phone-speaker {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 50%;
  width: 55px;
  height: 5px;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.7);
  transform: translateX(-50%);
  pointer-events: none;
}

.preview-loading {
  position: absolute;
  z-index: 6;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 13px;
  border-radius: 5px;
  background: rgba(8, 8, 8, 0.96);
  color: var(--muted);
  opacity: 0;
  transition: opacity 220ms ease;
  backdrop-filter: blur(10px);
}

.preview-loading[hidden] {
  display: none;
}

.preview-loading.is-visible {
  opacity: 1;
}

.preview-loading span {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
}

.preview-loading-spinner {
  width: 28px;
  height: 28px;
  border: 1px solid #353535;
  border-top-color: #ededed;
  border-radius: 50%;
  animation: preview-spin 760ms linear infinite;
}

.view-desktop {
  grid-template-columns: minmax(0, 1fr);
}

.view-desktop .mobile-preview {
  display: none;
}

.view-mobile {
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 8px;
}

.view-mobile .desktop-preview {
  display: none;
}

.view-mobile .mobile-preview {
  width: 100%;
  height: 100%;
}

.view-mobile .phone-shell {
  width: auto;
  max-width: 100%;
  height: 100%;
}

.qa-strip {
  position: static;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(14, 14, 14, 0.9);
  padding: 9px 13px;
  backdrop-filter: blur(12px);
}

.qa-status {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.qa-dot,
.ai-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #555;
}

.qa-status strong,
.qa-status p {
  display: block;
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qa-status strong {
  font-size: 12px;
  font-weight: 480;
}

.qa-status p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.similarity-score {
  min-width: 64px;
  text-align: right;
  font-family: "Geist Mono", monospace;
  font-size: 18px;
  font-weight: 350;
}

.qa-strip.is-passed .qa-dot,
.ai-dot.is-online {
  background: #f0f0f0;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.qa-strip.is-running .qa-dot {
  background: #bcbcbc;
  animation: pulse 1s ease-in-out infinite;
}

.qa-strip.is-warning .qa-dot,
.qa-strip.is-failed .qa-dot,
.qa-strip.is-stale .qa-dot {
  background: #8a8a8a;
}

.chat-panel {
  position: relative;
  display: grid;
  grid-column: 1;
  grid-row: 1;
  grid-template-rows: 60px minmax(220px, 1fr) auto auto;
  height: auto;
  align-self: stretch;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 14, 14, 0.94);
  box-shadow: var(--shadow);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px 8px 14px;
}

.chat-header > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header strong,
.chat-header small {
  display: block;
}

.chat-header strong {
  font-size: 15px;
  font-weight: 500;
}

.chat-header small {
  overflow: hidden;
  max-width: 230px;
  margin-top: 2px;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-messages {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 14px;
  scroll-behavior: smooth;
}

.chat-empty {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 100%;
  color: var(--muted);
  padding: 26px 20px;
  text-align: center;
}

.assistant-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--text-soft);
}

.assistant-mark svg {
  width: 15px;
  height: 15px;
}

.chat-empty strong {
  margin-top: 14px;
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 480;
}

.chat-empty p {
  max-width: 260px;
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.55;
}

.chat-message {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
}

.chat-message.is-user {
  justify-items: end;
}

.message-role {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
  font-size: 8px;
  text-transform: uppercase;
}

.message-role svg {
  width: 12px;
  height: 12px;
}

.chat-message p {
  max-width: 94%;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-soft);
  padding: 0;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-message.is-user p {
  border-color: var(--line);
  background: var(--surface-hover);
  color: var(--text);
  padding: 9px 11px;
}

.message-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 5px;
  width: min(100%, 270px);
}

.chat-message.is-user .message-images {
  width: min(76%, 190px);
  justify-self: end;
}

.chat-message.is-assistant .message-images {
  justify-self: start;
}

.message-images img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
}

.chat-message.is-error > p {
  border-left: 2px solid #7b4545;
  color: #d8b0b0;
  padding-left: 10px;
}

.retry-message {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  width: max-content;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 0 9px;
  font-size: 10px;
}

.chat-message.is-user .retry-message {
  justify-self: end;
}

.retry-message:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.retry-message svg {
  width: 12px;
  height: 12px;
}

.ai-progress {
  display: grid;
  gap: 7px;
  margin: 4px 0 18px;
  color: var(--text-soft);
}

.ai-progress-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-progress-heading strong {
  font-size: 13px;
  font-weight: 480;
}

.ai-progress > p {
  margin: 0 0 0 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.ai-progress-spinner {
  width: 10px;
  height: 10px;
  border: 1px solid #5a5a5a;
  border-top-color: #f0f0f0;
  border-radius: 50%;
  animation: ai-progress-spin 760ms linear infinite;
}

.ai-progress-track {
  width: calc(100% - 18px);
  height: 1px;
  overflow: hidden;
  margin-left: 18px;
  background: #292929;
}

.ai-progress-track span {
  display: block;
  width: 34%;
  height: 100%;
  background: #d8d8d8;
  animation: ai-progress-scan 1.4s ease-in-out infinite;
}

.message-changes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 100%;
}

.change-chip {
  overflow: hidden;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #111;
  color: var(--muted);
  padding: 3px 5px;
  font-family: "Geist Mono", monospace;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-attachments {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  padding: 9px 12px;
}

.chat-attachments[hidden] {
  display: none;
}

.attachment-thumb {
  position: relative;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
}

.attachment-thumb img {
  width: 100%;
  height: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  object-fit: cover;
}

.attachment-thumb button {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #1d1d1d;
  color: var(--text-soft);
  padding: 0;
}

.attachment-thumb button svg {
  width: 10px;
  height: 10px;
}

.chat-composer {
  margin: 0 10px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101010;
  transition: border-color 140ms ease, background 140ms ease;
}

.chat-composer textarea {
  display: block;
  width: 100%;
  min-height: 52px;
  max-height: 150px;
  resize: none;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 12px 12px 4px;
  font-size: 14px;
  line-height: 1.45;
  outline: 0;
}

.composer-actions {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 3px 5px 5px;
}

.attach-button {
  position: relative;
}

.composer-actions > span {
  color: var(--subtle);
  font-size: 8px;
}

.send-button {
  background: var(--text);
  color: var(--inverse);
}

.send-button:hover:not(:disabled) {
  border-color: #d8d8d8;
  background: #d8d8d8;
  color: var(--inverse);
}

.chat-composer.is-sending .send-button svg {
  animation: send-pulse 900ms ease-in-out infinite alternate;
}

.profile-view {
  max-width: 1220px;
  margin: 0 auto;
}

.profile-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 48px;
  padding-top: 36px;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 13px;
  height: max-content;
}

.profile-avatar {
  display: grid;
  overflow: hidden;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #0b0b0b;
}

.profile-avatar img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.profile-identity strong,
.profile-identity span {
  display: block;
}

.profile-identity strong {
  font-size: 17px;
  font-weight: 480;
}

.profile-identity span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.profile-content {
  min-width: 0;
}

.api-key-panel {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 22px;
}

.api-key-heading {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
}

.api-key-heading strong,
.api-key-heading p,
.api-key-feedback {
  margin: 0;
}

.api-key-heading strong {
  display: block;
  font-size: 16px;
  font-weight: 480;
}

.api-key-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.api-key-form {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  padding-left: 55px;
}

.api-key-form > label {
  color: var(--text-soft);
  font-family: "Geist Mono", monospace;
  font-size: 10px;
}

.secret-input {
  position: relative;
}

.secret-input input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0b0b0b;
  padding: 0 48px 0 13px;
  color: var(--text);
  font-family: "Geist Mono", monospace;
  font-size: 12px;
}

.secret-input input:focus {
  border-color: #565656;
}

.secret-input button {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}

.secret-input button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.api-key-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-key-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text-soft);
  padding: 0 12px;
  font-size: 12px;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.api-key-actions button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.api-key-actions .primary-api-action {
  border-color: #e8e8e8;
  background: #e8e8e8;
  color: #090909;
}

.api-key-actions .primary-api-action:hover:not(:disabled) {
  border-color: #ffffff;
  background: #ffffff;
  color: #090909;
}

.api-key-actions .danger-api-action {
  width: 38px;
  margin-left: auto;
  padding: 0;
  color: #a7a7a7;
}

.api-key-actions .danger-api-action:hover:not(:disabled) {
  border-color: #744343;
  background: #211313;
  color: #f0b2b2;
}

.api-key-feedback {
  min-height: 17px;
  color: var(--muted);
  font-size: 11px;
}

.api-key-feedback.is-success {
  color: #b8d8c1;
}

.api-key-feedback.is-error {
  color: #efb0b0;
}

.settings-list {
  margin-top: 24px;
  border-top: 1px solid var(--line);
}

.setting-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(180px, auto);
  gap: 13px;
  align-items: center;
  min-height: 116px;
  border-bottom: 1px solid var(--line);
}

.setting-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
}

.setting-row strong,
.setting-row p {
  margin: 0;
}

.setting-row strong {
  font-size: 16px;
  font-weight: 480;
}

.setting-row p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.setting-value {
  display: grid;
  justify-items: end;
  gap: 5px;
  color: var(--text-soft);
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  text-align: right;
}

.setting-value small {
  max-width: 260px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill.is-online {
  border-color: #494949;
  color: var(--text-soft);
}

.busy-overlay {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 5, 5, 0.78);
  backdrop-filter: blur(8px);
}

.busy-overlay[hidden] {
  display: none;
}

.busy-dialog {
  width: min(340px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #121212;
  box-shadow: var(--shadow);
  padding: 18px;
}

.busy-loader {
  height: 2px;
  overflow: hidden;
  margin-bottom: 18px;
  background: #292929;
}

.busy-loader span {
  display: block;
  width: 38%;
  height: 100%;
  background: #ededed;
  animation: loading-scan 1.05s ease-in-out infinite alternate;
}

.busy-dialog strong {
  display: block;
  font-size: 13px;
  font-weight: 480;
}

.busy-dialog p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.toast {
  position: fixed;
  z-index: 130;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #171717;
  color: var(--text-soft);
  box-shadow: var(--shadow);
  padding: 11px 13px;
  font-size: 11px;
}

.toast[hidden] {
  display: none;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loading-scan {
  from {
    transform: translateX(-105%);
  }

  to {
    transform: translateX(270%);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

@keyframes send-pulse {
  to {
    transform: translateY(-3px);
  }
}

@keyframes ai-progress-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes ai-progress-scan {
  from {
    transform: translateX(-110%);
  }

  to {
    transform: translateX(300%);
  }
}

@keyframes preview-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1300px) {
  .app-main {
    padding-right: 22px;
    padding-left: 22px;
  }

  .is-preview-view .app-main {
    padding-right: 5px;
    padding-left: 5px;
  }

  .capture-panel {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .capture-divider {
    width: 100%;
    height: 1px;
  }

  .preview-workspace {
    grid-template-columns: minmax(260px, 0.22fr) minmax(0, 0.78fr);
  }

}

@media (max-width: 980px) {
  .is-preview-view {
    overflow: auto;
  }

  .is-preview-view .app-main {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  #previewView.is-active {
    grid-template-rows: auto auto;
    height: auto;
  }

  .site-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preview-workspace {
    grid-template-columns: 1fr;
    height: auto;
  }

  .chat-panel {
    position: static;
    grid-column: 1;
    grid-row: 2;
    height: 620px;
  }

  .canvas-column {
    grid-column: 1;
    grid-row: 1;
    grid-template-rows: auto auto;
    gap: 10px;
    height: auto;
  }

  .qa-strip {
    position: static;
  }

  .canvas-shell,
  .preview-canvas {
    height: auto;
  }

}

@media (max-width: 720px) {
  .floating-nav {
    top: 10px;
    max-width: calc(100vw - 20px);
    min-height: 48px;
    padding: 4px;
  }

  .nav-tab {
    gap: 0;
    min-width: 38px;
    height: 38px;
    padding: 0 11px;
  }

  .nav-tab span {
    display: none;
  }

  .app-main {
    padding: 94px 12px 32px;
  }

  .view-heading {
    min-height: 90px;
    padding-bottom: 18px;
  }

  .view-heading h1 {
    font-size: 30px;
  }

  .capture-view.is-active {
    min-height: calc(100dvh - 126px);
  }

  .capture-stage {
    padding: 32px 0;
  }

  .capture-stage-heading h1 {
    font-size: 34px;
  }

  .capture-stage .file-capture-form {
    grid-template-columns: 1fr auto;
  }

  .capture-stage .file-capture-form > input {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .site-grid {
    grid-template-columns: 1fr;
  }

  .preview-heading {
    align-items: center;
  }

  .preview-heading h1 {
    max-width: 50vw;
  }

  .preview-url,
  .save-state p {
    display: none;
  }

  .canvas-shell {
    padding: 68px 7px 7px;
  }

  .floating-toolbar {
    top: 10px;
    grid-template-columns: minmax(92px, 1.7fr) repeat(5, minmax(34px, 1fr));
    max-width: calc(100% - 12px);
  }

  .tool-separator {
    display: none;
  }

  .page-picker {
    grid-template-columns: 13px minmax(0, 1fr) 11px;
    padding: 0 5px;
  }

  .tool-separator {
    margin: 0 1px;
  }

  .qa-strip {
    gap: 8px;
    padding: 8px 10px;
  }

  .qa-status p {
    white-space: normal;
  }

  .profile-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .api-key-heading {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .api-key-heading .status-pill {
    grid-column: 2;
  }

  .api-key-form {
    padding-left: 0;
  }

  .setting-row {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 14px 0;
  }

  .setting-value {
    grid-column: 2;
    justify-items: start;
    text-align: left;
  }
}

@media (max-width: 430px) {
  .nav-brand,
  .nav-action {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }

  .nav-tab {
    min-width: 34px;
    height: 34px;
    padding: 0 9px;
  }

  .view-heading {
    gap: 16px;
  }

  .file-capture-form {
    grid-template-columns: 1fr 40px;
  }

  .file-capture-form > button {
    width: 40px;
    padding: 0;
  }

  .file-capture-form > button span {
    display: none;
  }

  .site-card-meta {
    grid-template-columns: auto auto minmax(54px, 1fr) 30px;
  }

  .site-card-meta > span:nth-child(3) {
    display: none;
  }

  .platform-badge {
    display: none;
  }

  .preview-heading h1 {
    max-width: 58vw;
  }

  .floating-toolbar {
    gap: 0;
  }

  .page-picker {
    grid-template-columns: 13px minmax(0, 1fr);
  }

  .page-picker-chevron {
    display: none;
  }

  .tool-button {
    width: 100%;
    height: 29px;
    min-width: 29px;
  }

  .tool-separator {
    display: none;
  }

  .chat-panel {
    min-height: 530px;
    height: 72dvh;
  }

  .api-key-panel {
    padding: 16px;
  }

  .api-key-actions button span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
