:root {
  --canvas: #f6f7f9;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --ink: #172033;
  --text: #475569;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #15803d;
  --warning: #b45309;
  --danger: #b91c1c;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 12px 32px rgb(15 23 42 / 12%);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #e8ebef;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: #e8ebef; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgb(37 99 235 / 22%); outline-offset: 2px; }
button { border: 0; background: none; cursor: pointer; }
svg { display: block; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.is-hidden { display: none !important; }
.muted { color: var(--muted); }
.kicker { margin: 0 0 5px; color: var(--primary); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.prototype-toolbar { min-height: 70px; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.prototype-title, .prototype-actions, .segmented { display: flex; align-items: center; }
.prototype-title { gap: 10px; }
.prototype-title > span { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.prototype-title strong { font-size: 15px; }
.prototype-title small { color: var(--muted); font-size: 12px; }
.prototype-actions { gap: 8px; }
.segmented { padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--canvas); }
.segmented button { padding: 7px 13px; border-radius: 6px; color: var(--muted); font-size: 12px; }
.segmented button.is-active { color: var(--ink); background: var(--surface); box-shadow: 0 1px 3px rgb(15 23 42 / 10%); }
.toolbar-button { padding: 8px 13px; color: var(--text); border: 1px solid var(--border); border-radius: 8px; background: var(--surface); text-decoration: none; font-size: 12px; }
.toolbar-primary { color: #fff; border-color: var(--ink); background: var(--ink); }

.prototype-stage { min-height: calc(100vh - 70px); padding: 28px; display: grid; place-items: center; }
.device { position: relative; overflow: hidden; width: 390px; height: 844px; max-height: calc(100vh - 126px); border: 8px solid #111827; border-radius: 36px; background: var(--canvas); box-shadow: 0 24px 70px rgb(15 23 42 / 24%); transition: width .25s ease, height .25s ease, border-radius .25s ease; }
.device-camera { position: absolute; z-index: 80; top: 8px; left: 50%; width: 92px; height: 22px; transform: translateX(-50%); border-radius: 12px; background: #111827; pointer-events: none; }
.device-pad { width: min(1180px, calc(100vw - 64px)); height: min(820px, calc(100vh - 126px)); border-radius: 25px; }
.device-pad .device-camera { width: 7px; height: 7px; top: 8px; }
.app { position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--canvas); }

.primary-button, .secondary-button { min-height: 42px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 9px; font-weight: 700; }
.primary-button { color: #fff; background: var(--primary); }
.primary-button:hover { background: var(--primary-hover); }
.secondary-button { color: var(--ink); border: 1px solid var(--border-strong); background: var(--surface); }
.small-button { min-height: 36px; padding: 0 12px; font-size: 12px; }
.icon-button, .primary-icon { width: 38px; height: 38px; flex: 0 0 auto; display: inline-grid; place-items: center; border-radius: 9px; }
.icon-button { border: 1px solid var(--border); background: var(--surface); }
.primary-icon { color: #fff; background: var(--primary); }
.text-button { padding: 4px; color: var(--primary); font-size: 12px; font-weight: 700; }
.avatar { position: relative; width: 34px; height: 34px; flex: 0 0 auto; display: inline-grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 50%; color: var(--ink); background: var(--surface); font-size: 12px; font-weight: 700; }
.avatar > .icon { width: 18px; height: 18px; }
.unread-dot { position: absolute; top: -1px; right: -1px; width: 8px; height: 8px; border: 2px solid white; border-radius: 50%; background: var(--danger); }

.field { display: grid; gap: 7px; margin: 14px 0; color: var(--text); font-size: 12px; font-weight: 600; }
.field input, .field select { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; color: var(--ink); background: var(--surface); }
.search-field { height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.search-field .icon { width: 17px; color: var(--muted); }
.search-field input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--border-strong); }
.status-success { background: var(--success); }
.status-warning { background: var(--warning); }
.status-spinner { width: 15px; height: 15px; flex: 0 0 auto; border: 2px solid #bfdbfe; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-screen { width: 100%; height: 100%; padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom)); display: grid; place-items: center; overflow: auto; background: var(--canvas); }
.auth-layout { width: min(860px, 100%); display: grid; }
.auth-intro { display: none; }
.auth-card { width: min(390px, 100%); margin: auto; padding: 26px 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 10px 28px rgb(15 23 42 / 8%); }
.auth-brand { min-height: 28px; display: flex; align-items: center; }
.auth-brand img { width: auto; height: 24px; display: block; }
.auth-card h1 { margin: 28px 0 8px; font-size: 24px; letter-spacing: -.02em; }
.auth-description { min-height: 20px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.auth-tabs { margin: 24px 0 18px; display: grid; grid-template-columns: repeat(2, 1fr); border-bottom: 1px solid var(--border); }
.auth-tabs button { position: relative; min-height: 42px; color: var(--muted); font-size: 13px; font-weight: 700; }
.auth-tabs button::after { position: absolute; right: 18px; bottom: -1px; left: 18px; height: 2px; border-radius: 2px; background: transparent; content: ""; }
.auth-tabs button.is-active { color: var(--ink); }
.auth-tabs button.is-active::after { background: var(--primary); }
.auth-card [role="tabpanel"] .field:first-child { margin-top: 0; }
.auth-card > .primary-button { width: 100%; margin-top: 8px; }
.auth-card > .primary-button:disabled { cursor: wait; opacity: .7; }
.auth-password { position: relative; display: block; }
.auth-password input { padding-right: 54px; }
.auth-password button { position: absolute; top: 0; right: 0; height: 44px; padding: 0 12px; color: var(--primary); font-size: 11px; font-weight: 700; }
.auth-input-group { height: 44px; display: flex; align-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.auth-input-group:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(37 99 235 / 12%); }
.field .auth-input-group input { min-width: 0; height: 42px; border: 0; border-radius: 0; outline: 0; }
.auth-country-code { padding: 0 0 0 12px; color: var(--text); font-size: 12px; font-weight: 600; }
.auth-country-code::after { margin: 0 10px; color: var(--border-strong); content: "|"; }
.auth-code-input button { height: 28px; padding: 0 12px; flex: 0 0 auto; border-left: 1px solid var(--border); color: var(--primary); font-size: 11px; font-weight: 700; }
.auth-code-input button:disabled { color: var(--muted); cursor: not-allowed; }
.auth-error { min-height: 17px; margin: -2px 0 8px; color: var(--danger); font-size: 11px; }
.auth-help { display: block; margin-top: 16px; color: var(--muted); font-size: 10px; line-height: 1.6; text-align: center; }

@media (min-width: 768px) {
  .device-pad .auth-layout { grid-template-columns: minmax(0, 1fr) 390px; overflow: hidden; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
  .device-pad .auth-intro { padding: 52px 44px; display: block; color: var(--ink); background: #f1f5f9; }
  .device-pad .auth-intro > img { width: auto; height: 28px; display: block; }
  .device-pad .auth-intro h1 { margin: 46px 0 12px; font-size: 34px; line-height: 1.25; letter-spacing: -.04em; }
  .device-pad .auth-intro > p:last-of-type { color: var(--text); font-size: 13px; line-height: 1.7; }
  .device-pad .auth-intro ul { margin: 28px 0 0; padding: 0; display: grid; gap: 12px; color: var(--text); font-size: 11px; list-style: none; }
  .device-pad .auth-intro li::before { margin-right: 8px; color: var(--success); content: "✓"; }
  .device-pad .auth-card { align-self: center; border: 0; box-shadow: none; }
}

.toast-region { position: absolute; z-index: 100; right: 16px; bottom: 18px; left: 16px; display: grid; gap: 8px; pointer-events: none; }
.toast { padding: 12px 14px; border: 1px solid #334155; border-radius: 9px; color: #fff; background: #172033; box-shadow: var(--shadow); animation: toast-in .18s ease-out; }
.toast strong, .toast small { display: block; }
.toast strong { font-size: 13px; }
.toast small { margin-top: 2px; color: #cbd5e1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

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