/* Demo frame (top bar, fake browser, guide) + the shared UI kit every fake app uses.
   Requires site.css for tokens and buttons. */
body.demo { min-height: 100vh; }

.demo-top {
  display: flex; align-items: center; gap: 18px; padding: 12px 20px;
  background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.demo-title { display: flex; flex-direction: column; line-height: 1.15; padding-left: 18px; border-left: 1px solid var(--line); }
.demo-title span { font-size: 12px; color: var(--muted); }
.demo-title strong { font: 700 17px/1.2 var(--display); }
.fake-pill { background: var(--pencil-soft); color: var(--pencil-ink); font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 99px; }
.demo-top-actions { margin-left: auto; display: flex; gap: 8px; }

.demo-stage {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px;
  padding: 20px; max-width: 1500px; margin: 0 auto; align-items: start;
}
.browser {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow); min-width: 0;
}
.browser-bar { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: #EEF1F5; border-bottom: 1px solid var(--line); }
.dots { display: flex; gap: 6px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #CDD3DD; }
.url {
  flex: 1; display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line);
  border-radius: 99px; padding: 6px 14px; font-size: 13px; color: var(--slate); min-width: 0;
}
.url span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lock { width: 9px; height: 10px; border: 2px solid var(--go); border-radius: 2px; position: relative; flex: none; margin-top: 3px; }
.lock::before { content: ""; position: absolute; left: 0; top: -7px; width: 5px; height: 6px; border: 2px solid var(--go); border-bottom: 0; border-radius: 4px 4px 0 0; }
.browser-view { position: relative; height: calc(100vh - 150px); min-height: 560px; }
.app { height: 100%; overflow: auto; background: var(--paper); font-size: 15px; }

/* Guide panel */
.guide {
  position: sticky; top: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; max-height: calc(100vh - 40px); overflow: auto;
}
.guide-kicker { margin: 0; color: var(--muted); font-size: 13px; }
.guide h2 { font-size: 24px; margin: 2px 0 8px; }
.guide h3 { font-size: 15px; margin: 22px 0 8px; }
.guide-intro { color: var(--slate); font-size: 15px; margin: 0; }
.tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.tips li { display: flex; gap: 10px; align-items: flex-start; }
.tick { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); margin-top: 1px; position: relative; }
.tips li.done { color: var(--muted); }
.tips li.done .tick { background: var(--go); border-color: var(--go); }
.tips li.done .tick::after { content: ""; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.explain { margin-top: 20px; border-left: 4px solid var(--pencil); padding: 4px 0 4px 14px; border-radius: 2px; font-size: 14px; }
.explain h3 { margin-top: 0; }
.explain p, .explain ul { margin: 0 0 .6em; }
.explain ul { padding-left: 18px; }
.page-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.page-list a { font-size: 13px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: 4px 11px; }
.page-list a.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Pulsing ring around the next thing to try */
.spot { position: relative; box-shadow: 0 0 0 3px var(--pencil); animation: spot 1.6s ease-in-out infinite; }
@keyframes spot { 50% { box-shadow: 0 0 0 6px rgba(245, 184, 0, .35); } }

/* Toast + modal live inside the fake browser */
.toast {
  position: absolute; left: 50%; bottom: 16px; transform: translate(-50%, 140%); transition: transform .25s ease, opacity .25s ease; opacity: 0; visibility: hidden;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 99px; font-size: 14px; font-weight: 600;
  display: flex; gap: 10px; align-items: center; z-index: 30; max-width: 90%; box-shadow: var(--shadow);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--go); flex: none; }
.toast-dot.warn { background: var(--pencil); }
.toast-dot.err { background: var(--stop); }
.modal { position: absolute; inset: 0; background: rgba(23, 32, 51, .45); display: grid; place-items: center; padding: 20px; z-index: 20; }
.modal[hidden] { display: none; }
.m-card { background: #fff; border-radius: var(--r-m); width: min(560px, 100%); max-height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.m-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.m-head h3 { margin: 0; font-size: 18px; }
.m-x { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); }
.m-body { padding: 18px 20px; overflow: auto; }
.m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-2); }

/* ---------- Shared fake-app UI kit (inside .app) ---------- */
.a-top { display: flex; align-items: center; gap: 16px; padding: 12px 22px; background: var(--ink); color: #fff; flex-wrap: wrap; }
.a-logo { display: flex; align-items: center; gap: 10px; font: 700 17px/1 var(--display); }
.a-logo i { width: 26px; height: 26px; border-radius: 7px; background: var(--pencil); display: grid; place-items: center; color: var(--pencil-ink); font-style: normal; font-size: 13px; }
.a-school { font-size: 13px; color: #B9C2D3; }
.a-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.a-nav a { color: #D5DBE6; text-decoration: none; padding: 7px 12px; border-radius: 6px; font-size: 14px; font-weight: 600; }
.a-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.a-nav a.on { background: rgba(255, 255, 255, .14); color: #fff; }
.a-user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #D5DBE6; }

.a-shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); height: 100%; }
.a-scroll { overflow: auto; min-width: 0; }
.a-side { background: var(--ink); color: #fff; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.a-side .a-logo { padding: 0 8px 18px; }
.a-side a { color: #C9D1DE; text-decoration: none; padding: 9px 12px; border-radius: 7px; font-size: 14px; font-weight: 600; display: flex; gap: 10px; align-items: center; }
.a-side a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.a-side a.on { background: var(--pencil); color: var(--pencil-ink); }
.a-side .a-foot { margin-top: auto; font-size: 12px; color: #8D9AB3; padding: 12px 8px 0; }

.a-main { padding: 24px; min-width: 0; }
.a-main.narrow { max-width: 760px; margin: 0 auto; }
.a-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.a-h h1 { font-size: 26px; margin: 0; }
.a-h p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.a-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px; margin-bottom: 18px; }
.panel h2 { font-size: 17px; margin-bottom: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m); padding: 16px; text-decoration: none; color: inherit; display: block; }
a.stat:hover { border-color: var(--ink); }
.stat b { display: block; font: 700 30px/1.1 var(--display); }
.stat span { color: var(--muted); font-size: 13px; }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-m); background: #fff; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 700; color: var(--slate); font-size: 13px; background: #F3F5F8; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.flash td { animation: flash 1.6s ease; }
@keyframes flash { from { background: var(--pencil-soft); } to { background: transparent; } }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl a { color: var(--ink); font-weight: 600; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--line-2); color: var(--slate); white-space: nowrap; }
.badge.go { background: var(--go-soft); color: #0F5A45; }
.badge.stop { background: var(--stop-soft); color: #8A2A1B; }
.badge.wait { background: var(--wait-soft); color: #7A4D00; }
.badge.info { background: var(--info-soft); color: #23488A; }
.badge.ink { background: var(--ink); color: #fff; }

.field { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--slate); }
.field input, .field select, .field textarea, .input {
  font: 15px/1.4 var(--body); color: var(--ink); padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-s); background: #fff; width: 100%;
}
.field textarea { min-height: 90px; resize: vertical; }
.field small { font-weight: 500; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }

.seg { display: inline-flex; background: #E7EBF1; border-radius: 8px; padding: 3px; }
.seg button { border: 0; background: none; font: 600 14px/1 var(--body); padding: 8px 14px; border-radius: 6px; cursor: pointer; color: var(--slate); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--pencil); }

.avatar { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none; display: inline-block; vertical-align: middle; }
.avatar svg { width: 100%; height: 100%; display: block; }
.person { display: flex; align-items: center; gap: 10px; }

.progress { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--go); border-radius: 99px; transition: width .3s ease; }
.console {
  background: #0F1726; color: #D5DEEE; font: 13px/1.6 var(--mono); padding: 14px 16px; border-radius: var(--r-m);
  white-space: pre-wrap; overflow-x: auto; max-height: 320px;
}
.console .ok { color: #7FD8B6; }
.console .warn { color: #FFD666; }
.console .dim { color: #7D8AA5; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.note { background: var(--info-soft); color: #23488A; border-radius: var(--r-s); padding: 10px 14px; font-size: 14px; }
.note.warn { background: var(--wait-soft); color: #6A4300; }
.note.stop { background: var(--stop-soft); color: #7A2416; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 4px 11px; font-size: 13px; background: #fff; cursor: pointer; font-weight: 600; color: var(--slate); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

@media (max-width: 1100px) {
  .demo-stage { grid-template-columns: 1fr; }
  .guide { position: static; max-height: none; }
  .browser-view { height: 72vh; min-height: 520px; }
}
@media (max-width: 760px) {
  .demo-stage { padding: 12px 0; gap: 12px; }
  .browser, .guide { border-radius: 0; border-left: 0; border-right: 0; }
  .demo-top { padding: 10px 16px; gap: 10px; }
  .demo-title { border-left: 0; padding-left: 0; }
  .demo-top-actions { margin-left: 0; width: 100%; }
  .a-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .a-side { flex-direction: row; overflow-x: auto; padding: 8px; gap: 2px; }
  .a-side .a-logo, .a-side .a-foot { display: none; }
  .a-side a { white-space: nowrap; }
  .a-main { padding: 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .a-nav { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
}
.guide .btn.block + .btn.block { margin-top: 8px; }
