/* Phasing's neutral surfaces, rounded controls and typography. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface-1: #f4f4f5;
  --surface-2: #e7e7ea;
  --surface-raised: #ffffff;
  --surface-bubble: #ffffff;
  --surface-hover: #e9e9ee;
  --border: #e4e4e7;
  --border-light: #e4e4e7;
  --border-subtle: #a1a1aa;
  --text: #18181b;
  --text-muted: #52525b;
  --text-subtle: #71717a;
  --text-faint: #a1a1aa;
  --green: #15803d;
  --green-bg: rgba(22, 163, 74, 0.09);
  --red: #b91c1c;
  --red-bg: rgba(220, 38, 38, 0.09);
  --blue: #52525b;
  --font: 'Hanken Grotesk', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  --font-display: 'IBM Plex Serif', Georgia, serif;
  --font-logo: 'Noto Serif JP', Georgia, 'Times New Roman', serif;
}
html.dark {
  color-scheme: dark;
  --bg: #121214;
  --surface-1: #1c1c20;
  --surface-2: #27272b;
  --surface-raised: #2a2a2f;
  --surface-bubble: #26262c;
  --surface-hover: #33333b;
  --border: #3f3f46;
  --border-light: #3f3f46;
  --border-subtle: #71717a;
  --text: #f4f4f5;
  --text-muted: #d4d4d8;
  --text-subtle: #a1a1aa;
  --text-faint: #71717a;
  --green: #4ade80;
  --green-bg: rgba(74, 222, 128, 0.1);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.1);
  --blue: #d4d4d8;
}
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-weight: 450; line-height: 1.5; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button, a, input, select, td {
  transition: color 150ms, background-color 150ms, box-shadow 150ms, opacity 150ms;
}
button { border: 0; }
button:focus-visible, a:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--border-subtle); }
button:disabled { cursor: default; opacity: 0.4; }
::selection { background: var(--text-muted); color: var(--bg); }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 3px; }


/* Phasing's full-page sign-in layout and pill-shaped fields. */
.auth-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: 100dvh; }
.auth-column { display: flex; flex-direction: column; min-height: 100dvh; }
.auth-header { display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 12px 32px; }
.auth-main { display: flex; flex: 1; align-items: center; justify-content: center; padding: 56px 32px; }
.auth-form { width: 100%; max-width: 384px; display: flex; flex-direction: column; gap: 16px; }
.auth-form h1 { font: 600 36px/1.2 var(--font-display); letter-spacing: -1px; margin-bottom: 12px; }
.auth-field { position: relative; height: 56px; border-radius: 999px; background: var(--surface-1); }
.auth-field:focus-within { background: var(--surface-2); }
.auth-field-icon { position: absolute; left: 18px; top: 19px; color: var(--text-subtle); pointer-events: none; }
.auth-field input { width: 100%; height: 100%; border: 0; outline: none; border-radius: inherit; background: transparent; color: var(--text); padding: 0 20px 0 48px; font-size: 14px; }
.auth-field label { position: absolute; left: 48px; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--text-subtle); pointer-events: none; transition: opacity 150ms; }
.auth-field input:focus + label, .auth-field input:not(:placeholder-shown) + label { opacity: 0; }
.auth-form .auth-submit { display: flex; align-items: center; justify-content: center; gap: 8px; height: 56px; margin-top: 8px; font-size: 14px; }
.auth-form .form-error { margin: 0; }
.auth-decoration { padding: 20px 20px 20px 16px; }
.auth-art-window { position: relative; height: 100%; overflow: hidden; border-radius: 40px; }
.auth-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
html.dark .auth-art { filter: brightness(0.75); }
.auth-footer { text-align: center; font-size: 13px; color: var(--text-subtle); }
.auth-footer a { color: var(--text); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }
/* Fonts, illustration and navigation are served with the application. */
@font-face { font-family: 'Hanken Grotesk'; src: url('/fonts/hanken-grotesk.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/jetbrains-mono.woff2') format('woff2'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'IBM Plex Serif'; src: url('/fonts/ibm-plex-serif.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Noto Serif JP'; src: url('/fonts/noto-serif-logo.woff2') format('woff2'); font-weight: 300 900; font-display: swap; }
.logo { display: inline-flex; align-items: baseline; font: 900 30px var(--font-logo); letter-spacing: -0.05em; color: var(--text); text-decoration: none; }
.logo:hover { opacity: .8; }
.logo-tag { margin-left: 8px; font: 400 14px var(--font); letter-spacing: 0; color: var(--text-faint); }
.header-actions { display: flex; align-items: center; gap: 6px; }
.theme-toggle { width: 36px; height: 36px; border-radius: 50%; color: var(--text-muted); background: transparent; display: grid; place-items: center; flex-shrink: 0; padding: 0; }
.theme-toggle:hover { background: var(--surface-1); color: var(--text); }
.icon-dark, html.dark .icon-light { display: none; }
html.dark .icon-dark { display: block; }
button { padding: 10px 18px; min-height: 40px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .3px; color: var(--text-muted); background: var(--surface-2); white-space: nowrap; }
button:hover { background: var(--surface-hover); color: var(--text); }
button.primary { background: var(--text); color: var(--bg); }
button.primary:hover { opacity: .85; }
button.owned { box-shadow: inset 0 0 0 1px var(--border-subtle); background: var(--surface-1); color: var(--text); }
button.quiet { background: transparent; color: var(--text-subtle); }
button.quiet:hover { background: var(--surface-2); color: var(--text); }
button:disabled:hover { opacity: .4; }
input, select { min-width: 0; border: 1px solid transparent; outline: none; border-radius: 999px; background: var(--surface-1); color: var(--text); padding: 10px 16px; }
input:focus, select:focus { border-color: var(--border-subtle); }
input::placeholder { color: var(--text-faint); }
input:-webkit-autofill { -webkit-text-fill-color: var(--text); box-shadow: 0 0 0 100px var(--surface-1) inset; }
.auth-intro { font-size: 14px; color: var(--text-subtle); margin-top: -12px; margin-bottom: 8px; }
.auth-form .auth-footer { margin-top: 8px; }
.form-error { color: var(--red); font-size: 13px; padding: 0 6px; }
.navbar { position: sticky; top: 0; z-index: 50; background: var(--bg); }
#siteNav { padding: 6px 0; --web-island-paper: var(--bg); --web-island-ink: var(--text); --web-island-font: var(--font); --web-island-brand-font: var(--font-logo); }
.shell { width: 100%; padding: 0 16px; margin: 0 auto; }
.eyebrow { font-size: 11px; color: var(--text-subtle); letter-spacing: 1.5px; margin-bottom: 12px; }
h1 { font: 600 32px/1.25 var(--font-display); letter-spacing: -.8px; overflow-wrap: anywhere; }
.muted { color: var(--text-subtle); line-height: 1.7; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 10px; color: var(--text-subtle); background: var(--surface-1); white-space: nowrap; }
.pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--text-faint); }
.pill.active { color: var(--green); background: var(--green-bg); }
.pill.active::before { background: var(--green); }
#browserPage { padding-top: 20px; }
.browser-panel { background: var(--surface-1); border-radius: 20px; padding: 8px; }
.toolbar { display: flex; align-items: center; gap: 12px; padding: 4px 6px 12px; }
.history { display: flex; gap: 2px; flex-shrink: 0; }
.icon-button { padding: 0; width: 36px; height: 36px; min-height: 36px; display: grid; place-items: center; background: transparent; }
.icon-button svg, .empty-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#navigate { display: flex; align-items: center; flex: 1; gap: 6px; padding: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; min-width: 0; }
#url { background: transparent; flex: 1; width: 0; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-family: var(--font-mono); }
#navigate button { min-height: 30px; padding: 5px 14px; font-size: 11px; }
#stage { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; outline: none; background: var(--bg); }
#stage:focus-visible { box-shadow: 0 0 0 2px var(--border-subtle); }
#screen { display: block; width: 100%; height: 100%; object-fit: contain; touch-action: none; }
.view-only #screen { cursor: default; }
#empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; background: var(--bg); text-align: center; }
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--surface-1); color: var(--text-subtle); margin-bottom: 6px; }
.empty-icon svg { width: 26px; height: 26px; }
#empty h2 { font: 600 20px/1.4 var(--font-display); }
#empty p { font-size: 12px; color: var(--text-subtle); }
.ask { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .32); }
.ask-card { width: min(440px, 100%); padding: 22px; border-radius: 16px; background: var(--surface-raised); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, .24); }
.ask-card h2 { font: 600 17px/1.4 var(--font-display); margin-bottom: 8px; }
#newtab-url { font: 12px/1.6 var(--font-mono); color: var(--text-muted); overflow-wrap: anywhere; max-height: 5.2em; overflow: auto; margin-bottom: 16px; }
.ask-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ask-message { font-size: 13px; line-height: 1.6; color: var(--text-muted); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 40vh; overflow: auto; margin-bottom: 16px; }
.ask-input { width: 100%; margin-bottom: 16px; font-size: 13px; }
.ask-note { margin-top: 12px; font-size: 11px; color: var(--text-subtle); }
.popwin { position: absolute; top: 12px; right: 12px; z-index: 4; display: flex; flex-direction: column; width: min(460px, calc(100% - 24px)); max-height: calc(100% - 24px); border-radius: 14px; overflow: hidden; background: var(--surface-raised); box-shadow: 0 0 0 1px var(--border), 0 12px 40px rgba(0, 0, 0, .24); }
.popwin-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 0 14px; font-size: 12px; font-weight: 600; }
#popwin-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popwin-url { padding: 0 14px 8px; font: 11px/1.5 var(--font-mono); color: var(--text-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#popwin-screen { display: block; width: 100%; min-height: 0; flex: 1; object-fit: contain; background: var(--surface-1); cursor: default; outline: none; touch-action: none; }
#popwin-screen:focus-visible { box-shadow: inset 0 0 0 2px var(--border-subtle); }
.popwin-text { display: flex; gap: 6px; padding: 8px; }
#popwin-input { flex: 1; width: 0; font-size: 12px; }
.popwin-text button { min-height: 32px; padding: 6px 12px; font-size: 11px; }
.browser-footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 10px 4px; font-size: 10px; color: var(--text-subtle); }
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 32px; padding: 4px 4px 4px 12px; background: transparent; font-size: 11px; color: var(--text-muted); }
.switch:hover { background: var(--surface-2); }
.switch-track { position: relative; width: 40px; height: 24px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); transition: background .18s ease; flex-shrink: 0; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--bg); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s ease; }
.switch[aria-checked="true"] { color: var(--text); }
.switch[aria-checked="true"] .switch-track { background: var(--text); box-shadow: none; }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(16px); }
.switch:disabled { opacity: .5; }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-thumb { transition: none; } }
.footer-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.power[aria-pressed="true"] { color: var(--green); }
.footer-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
#text-form { display: flex; align-items: center; flex: 1; gap: 6px; min-width: 0; max-width: 520px; }
#text { flex: 1; width: 0; font-size: 12px; min-height: 32px; background: var(--surface-raised); border-color: var(--border); }
#text:focus { border-color: var(--border-subtle); }
#text::placeholder { color: var(--text-subtle); }
#text-form button { min-height: 32px; padding: 6px 12px; font-size: 11px; }
.settings-page { max-width: 760px; margin: 0 auto; padding: 28px 0 24px; }
.settings-intro { margin: 12px 0 24px; }
.settings-card { padding: 24px; border-radius: 16px; background: var(--surface-1); margin-bottom: 16px; min-width: 0; }
.settings-card h2 { font-size: 17px; font-weight: 600; margin-bottom: 14px; }
.settings-card p { font-size: 13px; }
.mcp-config { padding: 20px; margin: 18px 0 16px; border-radius: 12px; background: var(--surface-bubble); font: 11px/1.7 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
code { font-family: var(--font-mono); font-size: .9em; }
.settings-card h3 { font-size: 13px; font-weight: 600; }
.settings-card > p + button { margin-top: 14px; }
.settings-form { display: grid; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); justify-items: start; }
.settings-form .field { display: grid; gap: 6px; width: 100%; font-size: 12px; color: var(--text-muted); }
.settings-form .field input { width: 100%; border-radius: 12px; background: var(--surface-bubble); }
.field-hint { font-size: 12px !important; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.settings-row h3 { margin-bottom: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 1023px) { .auth-layout { grid-template-columns: minmax(0, 1fr); } .auth-decoration { display: none; } }
@media (max-width: 767px) {
  .has-site-nav { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
  .shell { padding: 0 16px; }
  #browserPage { padding-top: 12px; }
  .eyebrow { font-size: 9px; letter-spacing: 1px; }
  h1 { font-size: 24px; }
  .toolbar { flex-wrap: wrap; gap: 6px; padding: 2px 0 8px; }
  .history { gap: 0; }
  .icon-button { width: 30px; height: 34px; min-height: 34px; }
  #navigate { order: 3; flex-basis: 100%; }
  #stop { margin-left: auto; }
  #stage { aspect-ratio: auto; height: auto; min-height: 240px; }
  .browser-footer { gap: 6px; padding: 10px 6px 4px; }
  #empty h2 { font-size: 18px; }
  .settings-page { padding-top: 18px; }
  .settings-card { padding: 18px; }
  .mcp-config { padding: 14px; font-size: 10px; }
}
@media (max-width: 600px) { .auth-header { padding: 12px 16px; } .auth-main { padding: 40px 24px; } .auth-form h1 { font-size: 30px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
.api-key-row { display: flex; gap: 8px; align-items: center; margin-top: 18px; }
.api-key-row input { flex: 1; width: 0; background: var(--surface-bubble); font-family: var(--font-mono); font-size: 11px; }
#mirror { display: none; position: absolute; inset: 0; overflow: hidden; background: white; }
.dom-view #mirror { display: block; }
.dom-view #empty { z-index: 3; }
#mirror iframe { display: block; border: 0; transform-origin: top left; }

.surface-wait { margin: 0; padding: 32px; color: #71717a; font-size: 14px; }

.facts { display: grid; gap: 10px; margin-bottom: 4px; }
.facts > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; font-size: 13px; }
.facts dt { color: var(--text-subtle); }
.facts dd { font: 12px var(--font-mono); overflow-wrap: anywhere; text-align: right; }
.proxy-meta { font-size: 12px; color: var(--text-subtle); }
.proxy-link-label { font-size: 11px; color: var(--text-subtle); letter-spacing: .5px; margin: 14px 0 -8px; }
.admin-page { max-width: 880px; }
.admin-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.admin-heading h2 { margin-bottom: 0 !important; }
.admin-account { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--border); }
.admin-account:first-child { margin-top: 18px; }
.admin-account-name { flex: 1; min-width: 180px; overflow-wrap: anywhere; }
.admin-account-name strong { font-size: 14px; }
.admin-account.inactive .admin-account-name strong { color: var(--text-subtle); text-decoration: line-through; }
.admin-tags { display: inline-flex; gap: 6px; margin-left: 8px; vertical-align: 1px; }
.admin-tag { font-size: 10px; line-height: 1.6; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.admin-tag.strong { background: var(--text); color: var(--bg); }
.admin-tag.warn { background: var(--red-bg); color: var(--red); }
.admin-switches { display: flex; gap: 2px; }
.admin-menu { position: relative; }
.admin-menu summary { list-style: none; cursor: pointer; border-radius: 999px; }
.admin-menu summary::-webkit-details-marker { display: none; }
.admin-menu summary:hover, .admin-menu[open] summary { background: var(--surface-2); }
.admin-menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; display: grid; min-width: 220px; padding: 6px; border-radius: 14px; background: var(--surface-raised); box-shadow: 0 8px 28px rgba(0,0,0,.16), 0 0 0 1px var(--border); }
.admin-menu-list button { justify-content: flex-start; text-align: left; min-height: 36px; padding: 8px 12px; border-radius: 10px; background: transparent; font-weight: 500; }
.admin-menu-list button:hover { background: var(--surface-2); }
.admin-menu-list button.danger { color: var(--red); }
.admin-checks { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); }
.admin-checks label { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 600px) { .admin-switches { width: 100%; } .admin-switches .switch { padding-left: 0; } }
.auth-switch { margin-top: 14px; font-size: 13px; color: var(--text-subtle); }
.auth-switch button { min-height: 0; padding: 0; background: transparent; color: var(--text); font-weight: 600; text-decoration: underline; }
