:root {
  --page: #f6f7f9;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #e3e7ed;
  --line-strong: #d4dae3;
  --blue: #0f6fff;
  --blue-dark: #075dd7;
  --green: #12a15a;
  --shadow: 0 18px 50px rgba(31, 42, 61, .08);
}

* { box-sizing: border-box; }
html { background: var(--page); }
body.padpage {
  display: block;
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(15, 111, 255, .24);
  outline-offset: 2px;
}

#appframe {
  width: min(1540px, calc(100% - 24px));
  min-height: calc(100vh - 24px);
  margin: 12px auto;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: rgba(255, 255, 255, .72);
  box-shadow: var(--shadow);
}

/* ---------- top rail ---------- */
#topbar {
  min-height: 80px;
  padding: 14px 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .9);
}
#brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  letter-spacing: -.02em;
}
#brand strong { font-weight: 720; }
#brand strong span { color: var(--muted); font-weight: 560; }
#brandicon {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: linear-gradient(145deg, #fff, #eef1f5);
  box-shadow: 0 3px 7px rgba(31, 42, 61, .12);
  color: #475467;
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
#viewcontrols {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f3f4f6;
}
#viewcontrols button {
  min-width: 84px;
  padding: 10px 16px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #344054;
  cursor: pointer;
}
#viewcontrols button:hover { color: var(--ink); }
#viewcontrols button.active {
  background: var(--panel);
  box-shadow: 0 2px 8px rgba(31, 42, 61, .08);
  color: var(--ink);
}
#topactions { justify-self: end; display: flex; align-items: center; gap: 10px; }
#topactions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel);
  color: #344054;
  cursor: pointer;
}
#topactions button:hover:not(:disabled) { background: #f8fafc; border-color: #c7ced8; }
#topactions .rushbutton svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
#topactions #go {
  min-width: 92px;
  border-color: var(--blue);
  background: var(--blue);
  color: white;
  box-shadow: 0 5px 14px rgba(15, 111, 255, .22);
}
#topactions #go:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); }
#topactions button:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }

/* ---------- workspace ---------- */
#workspace {
  display: grid;
  grid-template-columns: minmax(0, .94fr) minmax(0, 1.06fr);
  gap: 18px;
  min-height: min(710px, calc(100vh - 210px));
  padding: 24px 26px 18px;
}
#pad, #stagewrap {
  min-width: 0;
  min-height: 560px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--panel);
}
#pad { max-width: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
#stagewrap { display: flex; flex-direction: column; }
#workspace[data-view="code"] { grid-template-columns: minmax(0, 1fr); }
#workspace[data-view="code"] #stagewrap { display: none; }
#workspace[data-view="preview"] { grid-template-columns: minmax(0, 1fr); }
#workspace[data-view="preview"] #pad { display: none; }
#workspace[data-view="devices"] { grid-template-columns: minmax(0, 1fr); }
#workspace[data-view="devices"] #pad { display: none; }

/* ---------- editor ---------- */
#padhead, #bar {
  min-height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 251, 252, .88);
}
#filetab {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 6px;
  border-bottom: 2px solid #344054;
  color: #344054;
  font-size: 13px;
}
#filetab > span { width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: #ff6b35; }
#filetab strong { font-weight: 620; }
#filetab small { color: var(--muted); font-size: inherit; }
#badge {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
}
#badge[data-kind="empty"] { opacity: .75; }
#badge:not([data-kind="empty"]):not([data-kind="unknown"]) { color: var(--blue); }
#boxwrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #fff;
}
#boxwrap:focus-within { border: 0; box-shadow: inset 0 0 0 2px rgba(15, 111, 255, .12); }
#linenumbers {
  flex: 0 0 46px;
  padding: 20px 10px 20px 0;
  overflow: hidden;
  border-right: 1px solid #f0f2f5;
  color: #98a2b3;
  text-align: right;
  white-space: pre;
  user-select: none;
  font: 12px/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
#box {
  flex: 1;
  width: 100%;
  min-height: 100%;
  resize: none;
  padding: 20px 22px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #243147;
  caret-color: var(--blue);
  font: 13px/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  tab-size: 2;
}
#box::placeholder { color: #667085; }
#box::selection { background: rgba(15, 111, 255, .18); }
#editorstatus {
  min-height: 45px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.readydot { width: 8px; height: 8px; border-radius: 50%; background: #98a2b3; }
#editorstatus.ready .readydot, #privacystrip .readydot { background: var(--green); }

/* ---------- preview ---------- */
#bar { justify-content: space-between; }
#who { display: flex; flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
#title { color: #344054; font-size: 13px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#kind {
  padding: 3px 7px;
  border: 1px solid #cfe0ff;
  border-radius: 999px;
  background: #f1f6ff;
  color: var(--blue);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}
#tools { display: flex; gap: 5px; }
#tools button {
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
#tools button:hover { border-color: var(--line); background: #fff; color: var(--ink); }
#tools button[aria-pressed="true"] { border-color: var(--line-strong); background: #fff; color: var(--ink); }
#warn { margin: 0; padding: 9px 14px; border-bottom: 1px solid #f5d6aa; background: #fff8eb; color: #854d0e; font-size: 12px; }
#stage { position: relative; flex: 1 1 auto; min-height: 0; background: white; }
#previewgrid, #previewprimary, #previewprimary .deviceviewport { width: 100%; height: 100%; min-height: 0; }
#previewgrid { position: relative; z-index: 1; }
#workspace:not(.has-run) #previewgrid { visibility: hidden; }
.devicepreview { min-width: 0; }
.devicelabel { display: none; }
.deviceviewport { overflow: hidden; background: #fff; }
#frame { width: 100%; height: 100%; border: 0; display: block; background: #fff; opacity: 0; }
#workspace.has-run #frame { opacity: 1; }
#deviceviews { display: none; }
#workspace[data-view="devices"] #stage { padding: 16px; background: #f4f6f9; }
#workspace[data-view="devices"] #previewgrid { display: grid; grid-template-columns: minmax(0, 1fr) 244px; gap: 16px; }
#workspace[data-view="devices"] .devicelabel { height: 28px; margin: 0; display: flex; align-items: baseline; justify-content: space-between; color: var(--muted); font-size: 10px; }
#workspace[data-view="devices"] .devicelabel strong { color: #344054; font-size: 11px; }
#workspace[data-view="devices"] #previewprimary { height: 100%; display: flex; flex-direction: column; }
#workspace[data-view="devices"] #previewprimary .deviceviewport { flex: 1; height: auto; border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 8px 20px rgba(31,42,61,.06); }
#workspace[data-view="devices"] #deviceviews { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow: auto; }
#workspace[data-view="devices"] #deviceviews .deviceviewport { position: relative; margin: 0 auto; border: 1px solid #cbd2dc; border-radius: 12px; box-shadow: 0 7px 18px rgba(31,42,61,.08); }
#workspace[data-view="devices"] .phone .deviceviewport { width: 119px; height: 258px; }
#workspace[data-view="devices"] .phone iframe { width: 390px; height: 844px; transform: scale(.305); transform-origin: top left; border: 0; }
#workspace[data-view="devices"] .tablet .deviceviewport { width: 213px; height: 307px; }
#workspace[data-view="devices"] .tablet iframe { width: 820px; height: 1180px; transform: scale(.26); transform-origin: top left; border: 0; }
#emptypreview {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 9px;
  color: var(--muted);
  text-align: center;
}
#emptypreview > span { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: #edf4ff; color: var(--blue); }
#emptypreview strong { color: #344054; font-size: 15px; }
#emptypreview small { font-size: 12px; }
#workspace.has-run #emptypreview { display: none; }
#console {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 45%;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line-strong);
  background: #fff;
  box-shadow: 0 -10px 26px rgba(31, 42, 61, .08);
}
#console[hidden] { display: none; }
#consolehead { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
#consolehead button { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--muted); cursor: pointer; }
#consoletxt { margin: 0; padding: 10px 12px; overflow: auto; white-space: pre-wrap; color: #344054; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
#consoletxt .line { display: block; }
#consoletxt .line.error, #consoletxt .line.warn { color: #c2413b; }
#consoletxt .lvl { margin-right: 6px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
#consoletoggle .n { display: inline-block; min-width: 15px; margin-left: 5px; padding: 1px 4px; border-radius: 999px; background: #eef2f6; text-align: center; font-size: 9px; }
#consoletoggle .n:empty { display: none; }

/* ---------- command bar and local history ---------- */
#commandbar {
  width: max-content;
  max-width: calc(100% - 52px);
  min-height: 50px;
  margin: 0 auto 20px;
  padding: 7px 8px 7px 14px;
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 5px 15px rgba(31, 42, 61, .06);
}
#hint { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
#hint .sep { margin: 0 5px; color: var(--faint); }
kbd { padding: 3px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: #fafbfc; color: #475467; font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
#privacystrip { display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 10px; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--muted); font-size: 11.5px; }
#privacystrip p { margin: 0; }
#privacystrip .more { margin-left: 2px; color: var(--blue); text-decoration: none; }
#privacystrip .more:hover { text-decoration: underline; }

/* ---------- AI iteration dock ---------- */
#chatdock {
  width: min(900px, calc(100% - 52px));
  margin: 0 auto 30px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 22px rgba(31, 42, 61, .07);
}
#chathead { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
#chathead > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.aistar { color: var(--blue); font-size: 17px; }
#chathead strong { color: #344054; font-size: 12px; }
#chathead small { padding-left: 8px; border-left: 1px solid var(--line); color: var(--muted); font-size: 10.5px; }
#keysettings { margin-left: auto; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 10.5px; cursor: pointer; }
#keysettings:hover { border-color: #c7d8f5; color: var(--blue); }
#chatcomposer { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: 8px; }
#chatprovider { min-height: 44px; padding: 0 32px 0 11px; border: 1px solid var(--line-strong); border-radius: 10px; background: #f8fafc; color: #344054; font-size: 12px; cursor: pointer; }
#chatprompt { width: 100%; min-height: 44px; max-height: 130px; resize: vertical; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; color: var(--ink); line-height: 1.5; }
#chatprompt::placeholder { color: #667085; }
#sendchat { width: 44px; height: 44px; border: 1px solid var(--blue); border-radius: 10px; background: var(--blue); color: #fff; cursor: pointer; font-size: 19px; }
#sendchat:hover:not(:disabled) { background: var(--blue-dark); }
#sendchat:disabled { opacity: .55; cursor: wait; }
#chatprivacy { margin: 9px 2px 0; color: var(--muted); font-size: 10.5px; line-height: 1.45; }
#chatreply { margin-top: 9px; padding: 9px 11px; border-radius: 8px; background: #edf8f2; color: #176b3a; font-size: 11px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
#history { margin: 6px 26px 30px; }
#histhead { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
#history h2 { margin: 0; color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
#clearhist { margin-left: auto; padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 10px; cursor: pointer; }
#clearhist:hover { color: #c2413b; }
#histlist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#histlist li { min-width: 0; padding: 10px 12px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.82); cursor: pointer; }
#histlist li:hover { border-color: #c7d8f5; background: #fff; }
#histlist .hk { padding: 3px 6px; border-radius: 5px; background: #edf4ff; color: var(--blue); font-size: 9px; font-weight: 720; text-transform: uppercase; }
#histlist .ht { min-width: 0; flex: 1; overflow: hidden; color: #344054; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
#histlist .hd { color: var(--faint); font-size: 10px; }

/* ---------- privacy promises ---------- */
#sitefoot { margin: 0; padding: 64px max(26px, 7vw) 50px; border-top: 1px solid var(--line); background: #111827; color: #d0d5dd; }
.promisehead { display: flex; align-items: end; gap: 30px; margin-bottom: 32px; }
.promise-kicker { margin: 0 0 8px; color: #84adff; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
#sitefoot h2 { margin: 0; max-width: 620px; color: #fff; font-size: clamp(28px, 4vw, 48px); font-weight: 650; letter-spacing: -.03em; line-height: 1.05; }
.promisehead > a { margin-left: auto; color: #d0d5dd; text-underline-offset: 4px; }
.promisehead > a:hover { color: #fff; }
#promises { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-top: 1px solid #344054; }
#promises > div { padding: 24px 24px 24px 0; }
#promises > div + div { padding-left: 24px; border-left: 1px solid #344054; }
#promises dt { margin-bottom: 8px; color: #fff; font-size: 14px; font-weight: 650; }
#promises dd { margin: 0; color: #98a2b3; font-size: 13px; line-height: 1.6; }
#rushpromise { max-width: 900px; margin: 30px 0 0; padding-top: 24px; border-top: 1px solid #344054; color: #98a2b3; font-size: 13px; line-height: 1.65; }
#rushpromise strong { color: #e4e7ec; }
#rushpromise code { padding: 2px 5px; border-radius: 4px; background: #344054; color: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- Rush dialog ---------- */
#rushdialog { width: min(560px, calc(100vw - 28px)); max-height: min(820px, calc(100vh - 28px)); overflow: auto; padding: 30px; border: 1px solid var(--line-strong); border-radius: 18px; background: #fff; color: var(--ink); box-shadow: 0 28px 90px rgba(16, 24, 40, .22); }
#rushdialog::backdrop { background: rgba(16, 24, 40, .42); backdrop-filter: blur(3px); }
#rushcloseform { position: absolute; top: 14px; right: 14px; }
#rushclose { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--muted); cursor: pointer; font-size: 20px; }
.rushhead { display: flex; align-items: center; gap: 12px; margin: 0 40px 18px 0; }
.rushhead p { margin: 0 0 2px; color: var(--blue); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.rushhead h2 { margin: 0; font-size: 25px; letter-spacing: -.025em; }
.rushmark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #edf4ff; color: var(--blue); }
.rushexplainer { margin: 0 0 22px; max-width: 55ch; color: var(--muted); font-size: 13px; line-height: 1.6; }
#rushmodes { margin: 0 0 18px; padding: 0; border: 0; }
#rushmodes legend { margin-bottom: 8px; color: #344054; font-size: 12px; font-weight: 650; }
#rushmodes label { display: flex; align-items: flex-start; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
#rushmodes input { margin-top: 3px; accent-color: var(--blue); }
#rushmodes span { display: flex; flex-direction: column; gap: 3px; }
#rushmodes strong { color: #344054; font-size: 13px; }
#rushmodes small { color: var(--muted); font-size: 12px; line-height: 1.45; }
#rushpasswordwrap, #unlockpasswordwrap { display: flex; flex-direction: column; gap: 7px; margin: 16px 0; color: #344054; font-size: 12px; font-weight: 650; }
#rushpassword, #unlockpassword, #rushlink { width: 100%; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: var(--ink); }
#makerush, #unlockrush, #copyrush { padding: 11px 15px; border: 1px solid var(--blue); border-radius: 9px; background: var(--blue); color: #fff; font-weight: 650; cursor: pointer; }
#makerush:hover, #unlockrush:hover, #copyrush:hover { background: var(--blue-dark); }
#makerush:disabled, #unlockrush:disabled { opacity: .6; cursor: wait; }
.rusherror { margin: 12px 0; padding: 10px 12px; border-radius: 8px; background: #fff1f0; color: #b42318; font-size: 12px; }
#rushresult { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
#rushresult p { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }
#rushresult p strong { color: #344054; }
.rushcopy { display: flex; gap: 8px; }
.rushcopy #rushlink { min-width: 0; font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.rushcopy #copyrush { flex: 0 0 auto; }

#keydialog {
  width: min(720px, calc(100vw - 28px));
  max-height: min(860px, calc(100vh - 28px));
  overflow: auto;
  padding: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(16, 24, 40, .22);
}
#keydialog::backdrop { background: rgba(16, 24, 40, .42); backdrop-filter: blur(3px); }
.dialogclose { position: absolute; top: 14px; right: 14px; }
.dialogclose button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--muted); cursor: pointer; font-size: 20px; }
.settingshead { display: flex; align-items: center; gap: 11px; margin-right: 42px; }
.settingshead p { margin: 0 0 2px; color: var(--blue); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.settingshead h2 { margin: 0; font-size: 25px; letter-spacing: -.025em; }
.settingslead { margin: 16px 0 22px; max-width: 68ch; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
#keyfields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#keyfields fieldset { margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 11px; }
#keyfields legend { padding: 0 5px; color: #344054; font-size: 12px; font-weight: 700; }
#keyfields label { display: flex; flex-direction: column; gap: 5px; margin-top: 9px; color: var(--muted); font-size: 10.5px; }
#keyfields input { width: 100%; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); font-size: 12px; }
#rememberkeys { display: flex; align-items: center; gap: 8px; margin-top: 16px; color: #344054; font-size: 12px; }
#rememberkeys input { accent-color: var(--blue); }
#keyactions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
#keyactions button { padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: var(--muted); cursor: pointer; }
#keyactions #savekeys { border-color: var(--blue); background: var(--blue); color: #fff; font-weight: 650; }
#keyactions #savekeys:hover { background: var(--blue-dark); }
#forgetkeys:hover { color: #b42318; }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  #appframe { width: 100%; min-height: 100vh; margin: 0; border: 0; border-radius: 0; }
  #topbar { grid-template-columns: 1fr auto; gap: 12px; padding: 12px 16px; }
  #viewcontrols { grid-row: 2; grid-column: 1 / -1; justify-self: stretch; }
  #viewcontrols button { flex: 1; min-width: 0; }
  #workspace { grid-template-columns: 1fr; min-height: 0; padding: 16px; }
  #workspace[data-view="split"] #pad, #workspace[data-view="split"] #stagewrap { min-height: 520px; }
  #workspace[data-view="devices"] #previewgrid { grid-template-columns: minmax(0, 1fr) 220px; }
  #histlist { grid-template-columns: 1fr 1fr; }
  #promises { grid-template-columns: 1fr 1fr; }
  #promises > div:nth-child(3) { padding-left: 0; border-left: 0; border-top: 1px solid #344054; }
  #promises > div:nth-child(4) { border-top: 1px solid #344054; }
}
@media (max-width: 620px) {
  #topbar { min-height: 0; }
  #brand { font-size: 16px; }
  #brandicon { width: 35px; height: 35px; }
  #topactions button { min-height: 39px; padding: 0 13px; }
  #topactions .rushbutton svg { display: none; }
  #workspace { padding: 10px; gap: 10px; }
  #pad, #stagewrap, #workspace[data-view="split"] #pad, #workspace[data-view="split"] #stagewrap { min-height: 470px; border-radius: 12px; }
  #workspace[data-view="devices"] #stage { padding: 10px; }
  #workspace[data-view="devices"] #previewgrid { grid-template-columns: 1fr; }
  #workspace[data-view="devices"] #deviceviews { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
  #tools #rerun, #tools #edit { display: none; }
  #commandbar { width: calc(100% - 20px); max-width: none; margin-bottom: 10px; justify-content: center; }
  #hint { display: none; }
  #privacystrip { border-left: 0; }
  #history { margin: 10px 10px 24px; }
  #chatdock { width: calc(100% - 20px); margin-bottom: 20px; }
  #chathead small { display: none; }
  #chatcomposer { grid-template-columns: 1fr auto; }
  #chatcomposer label { grid-column: 1 / -1; }
  #chatprovider { width: 100%; }
  #histlist { grid-template-columns: 1fr; }
  #sitefoot { padding: 48px 22px 38px; }
  .promisehead { display: block; }
  .promisehead > a { display: inline-block; margin-top: 18px; }
  #promises { grid-template-columns: 1fr; }
  #promises > div, #promises > div + div { padding: 18px 0; border-left: 0; border-top: 1px solid #344054; }
  #promises > div:first-child { border-top: 0; }
  #rushdialog { padding: 24px 20px; }
  #keydialog { padding: 24px 20px; }
  #keyfields { grid-template-columns: 1fr; }
  .rushcopy { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; }
}
