:root {
  --bg: #eef1f6; --ink: #1d2433; --muted: #5b6475; --line: #d5dbe6; --card: #fff;
  --accent: #3b5bdb; --accent-ink: #fff; --chrome: #dee3ec; --chrome-2: #f3f5f9; --tab: #fff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151c; --ink: #e6e9f0; --muted: #9aa3b5; --line: #2b3242; --card: #1a1f2b;
    --accent: #7b93ff; --accent-ink: #0b1020; --chrome: #232a38; --chrome-2: #1b2130; --tab: #2c3445;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#demo { display: flex; flex-direction: column; min-height: 100%; padding: 12px 16px 16px; gap: 12px; }
.top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; font-weight: 700; font-size: 17px; }
.brand img { width: 26px; height: 26px; border-radius: 6px; }
.pill { background: #e3f6e8; color: #17692f; border: 1px solid #bfe6c9; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.grow { flex: 1; }
.btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 7px 12px; font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.body { display: grid; grid-template-columns: 260px 1fr; gap: 14px; flex: 1; min-height: 0; }
.guide { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; align-self: start; }
.guide h2 { margin: 0 0 6px; font-size: 15px; }
.guide ol { margin: 0; padding-left: 20px; }
.guide li { margin: 6px 0; }
.guide .note { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
.window { display: flex; flex-direction: column; background: var(--chrome); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; min-height: 640px; box-shadow: 0 8px 30px rgba(20, 30, 60, .12); }
.titlebar { display: flex; align-items: flex-end; gap: 10px; padding: 8px 10px 0; }
.dots { display: flex; gap: 6px; padding-bottom: 10px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; display: block; }
.dots i:nth-child(2) { background: #febc2e; } .dots i:nth-child(3) { background: #28c840; }
.tabs { display: flex; gap: 2px; overflow-x: auto; min-width: 0; scrollbar-width: none; }
.tab { display: flex; align-items: center; gap: 6px; max-width: 220px; min-width: 120px; padding: 7px 10px; border-radius: 9px 9px 0 0; background: transparent; cursor: pointer; color: var(--ink); font-size: 12.5px; white-space: nowrap; }
.tab.on { background: var(--chrome-2); }
.tab:not(.on):hover { background: rgba(255,255,255,.35); }
.tfav { width: 14px; height: 14px; border-radius: 3px; }
.tlabel { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.tclose { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--chrome-2); border-bottom: 1px solid var(--line); }
.nb { border: 0; background: none; font-size: 16px; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.nb:hover { background: var(--chrome); }
.addr { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--muted); }
.addr .url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.pages { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 5px 6px; font: inherit; font-size: 12.5px; max-width: 170px; }
.extbtn { position: relative; border: 1px solid transparent; background: none; border-radius: 8px; padding: 4px; cursor: pointer; animation: pulse 2.4s ease-in-out 3; }
.extbtn img { width: 22px; height: 22px; display: block; border-radius: 5px; }
.extbtn.on, .extbtn:hover { background: var(--chrome); border-color: var(--line); }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(59, 91, 219, .3); } }
.badge { position: absolute; right: -4px; bottom: -3px; min-width: 16px; padding: 0 4px; border-radius: 8px; background: #d93025; color: #fff; font-size: 10px; line-height: 15px; text-align: center; font-weight: 700; }
.stage { position: relative; flex: 1; min-height: 0; display: flex; }
.viewport { position: relative; flex: 1; background: #fff; }
.tabframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: none; background: #fff; }
.tabframe.on { display: block; }
.scrim { position: absolute; inset: 0; background: transparent; }
.popup { position: absolute; top: 4px; right: 10px; background: #fff; border-radius: 10px; box-shadow: 0 10px 34px rgba(0,0,0,.28); overflow: hidden; border: 1px solid var(--line); z-index: 5; }
.popup iframe { display: block; border: 0; width: 360px; height: 480px; }
.bgframe { position: absolute; width: 1px; height: 1px; left: -9999px; border: 0; }
.toasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 20; width: min(560px, calc(100% - 32px)); }
.toast { background: #1f2533; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: 13.5px; }
.toast a { color: #a9bcff; word-break: break-all; }
@media (max-width: 900px) {
  .body { grid-template-columns: 1fr; }
  .guide { order: 2; }
  .guide ol { columns: 1; }
}
@media (max-width: 600px) {
  #demo { padding: 10px 12px 14px; }
  .window { min-height: 560px; border-radius: 10px; }
  .dots { display: none; }
  .tab { min-width: 92px; max-width: 150px; }
  .pages { max-width: 110px; }
  .addr { font-size: 12px; padding: 5px 10px; }
  .popup { left: 6px; right: 6px; top: 4px; }
  .popup iframe { width: 100% !important; }
}
