/* FancyBox2D playground — self-contained page styles (site palette). */

:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #5f6b82;
  --surface: #ffffff;
  --surface-muted: #f5f7fc;
  --line: #dfe5f0;
  --brand: #1a237e;
  --brand-light: #3949ab;
  --accent: #006600;
  --accent-hover: #008800;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

body {
  background: var(--surface);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  margin: 0;
}

img { max-width: 100%; }
a { color: var(--brand-light); }

/* ---- site header (mirrors hexape.com/fancybox2d) ---- */

.site-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1180px;
  min-height: 72px;
  padding: 0 28px;
}

.site-header-brand { align-items: center; display: flex; gap: 14px; }

.home-link {
  display: block;
  height: 34px;
  overflow: hidden;
  transition: opacity 0.2s, transform 0.2s;
  width: 34px;
}

.home-link img { display: block; height: 100%; object-fit: cover; width: 100%; }

.home-link:hover { opacity: 0.85; transform: translateY(-1px); }

.site-brand {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  font-size: 1.12rem;
  font-weight: 700;
  gap: 10px;
  text-decoration: none;
}

.site-brand img { height: 34px; width: 34px; }

.site-nav { display: flex; gap: 22px; }

.site-nav a { color: var(--muted); font-size: 0.95rem; text-decoration: none; }

.site-nav a:hover { color: var(--brand); }

.site-nav a.active { color: var(--brand); font-weight: 600; }

/* ---- intro ---- */

.play-main { margin: 0 auto; max-width: 1180px; padding: 0 28px 64px; }

.intro { padding: 40px 0 6px; }

.eyebrow {
  color: var(--brand-light);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin: 0 0 6px;
}

.intro h1 { font-size: 1.9rem; margin: 0 0 10px; }

.intro p { color: var(--muted); margin: 0; max-width: 760px; }

/* ---- toolbar ---- */

.toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin: 22px 0 4px;
}

.toolbar-group { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }

.btn {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.86rem;
  padding: 7px 14px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.btn:hover:not(:disabled) { border-color: var(--brand-light); color: var(--brand); }

.btn:disabled { cursor: default; opacity: 0.45; }

.btn-small { font-size: 0.8rem; padding: 4px 10px; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }

.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.demo-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.status { color: var(--muted); font-size: 0.85rem; }

.status.err { color: #b00020; }

.demo-desc { color: var(--muted); font-size: 0.9rem; margin: 8px 0 16px; min-height: 1.4em; }

/* ---- split panes ---- */

.split {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.pane { min-width: 0; }

.screen-frame {
  background: #101828;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(23, 32, 51, 0.12);
  overflow: hidden;
}

.screen-titlebar {
  align-items: center;
  background: #1b2430;
  color: #c7d0e0;
  display: flex;
  font-size: 0.78rem;
  gap: 6px;
  padding: 8px 12px;
}

.dot { border-radius: 50%; display: inline-block; height: 10px; width: 10px; }

.dot-r { background: #ff5f57; }
.dot-y { background: #febc2e; }
.dot-g { background: #28c840; }

.screen-title {
  margin-left: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-body { background: #000; min-height: 200px; position: relative; }

#screen { display: block; height: auto; max-width: 100%; }

.screen-overlay {
  align-items: center;
  background: rgba(9, 14, 24, 0.88);
  color: #9fb0c8;
  display: flex;
  font-size: 0.92rem;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: absolute;
  text-align: center;
  white-space: pre-line;
}

.screen-overlay.hidden { display: none; }

.screen-toast {
  background: rgba(16, 24, 40, 0.92);
  border: 1px solid rgba(199, 208, 224, 0.28);
  border-radius: 8px;
  color: #e8eef8;
  font-size: 0.86rem;
  left: 50%;
  max-width: 82%;
  opacity: 0;
  padding: 8px 16px;
  pointer-events: none;
  position: absolute;
  top: 14px;
  transform: translateX(-50%);
  transition: opacity 0.2s;
  white-space: pre-line;
}

.screen-toast.show { opacity: 1; }

.pane-hint { color: var(--muted); font-size: 0.8rem; line-height: 1.7; margin: 10px 2px 0; }

.pane-hint strong { color: var(--ink); }

.code-frame {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.code-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: 0.78rem;
  justify-content: space-between;
  padding: 9px 14px;
}

.code-head-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

#editor {
  background: var(--surface);
  border: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.84rem;
  height: 560px;
  line-height: 1.55;
  outline: none;
  padding: 14px;
  resize: vertical;
  tab-size: 4;
  white-space: pre;
  width: 100%;
}

/* ---- panels: console & virtual filesystem ---- */

.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 20px;
  overflow: hidden;
}

.panel-head {
  align-items: center;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
}

.panel-head h2 { font-size: 0.95rem; margin: 0; }

.console {
  background: #0f172a;
  color: #d7e1f2;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  max-height: 300px;
  min-height: 120px;
  overflow: auto;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-all;
}

.console .log-err { color: #ff8a80; }
.console .log-sys { color: #8ab4f8; }

.fs-cwd { color: var(--muted); font-size: 0.85rem; margin: 12px 14px 6px; }

.fs-cwd code { background: var(--surface-muted); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); padding: 2px 8px; }

.fs-list { max-height: 280px; overflow: auto; }

.fs-row {
  align-items: center;
  border-bottom: 1px solid var(--surface-muted);
  display: flex;
  font-size: 0.85rem;
  gap: 10px;
  padding: 7px 14px;
}

.fs-row:last-child { border-bottom: 0; }

.fs-empty { color: var(--muted); font-size: 0.85rem; padding: 10px 14px; }

.fs-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fs-name.dir { color: var(--brand); font-weight: 600; }

.fs-size { color: var(--muted); font-size: 0.76rem; }

.fs-hint { color: var(--muted); font-size: 0.8rem; margin: 10px 14px 14px; }

/* ---- boundaries ---- */

.boundaries {
  background: #fffaf0;
  border: 1px solid #f0dfb2;
  border-radius: 12px;
  margin-top: 26px;
  padding: 18px 22px;
}

.boundaries h2 { color: #7a5a00; font-size: 1.02rem; margin: 0 0 10px; }

.boundaries ul { color: #57492a; font-size: 0.88rem; line-height: 1.85; margin: 0; padding-left: 1.2em; }

.boundaries strong { color: #7a5a00; }

.boundaries code { background: rgba(122, 90, 0, 0.1); border-radius: 4px; padding: 1px 5px; }

.changelog-note { color: var(--muted); font-size: 0.88rem; margin-top: 22px; }

/* ---- footer (mirrors site) ---- */

.site-footer {
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: 0.88rem;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px;
}

.site-footer p { margin: 0; }

.site-footer a { color: var(--accent); text-decoration: none; }

/* ---- responsive ---- */

@media (max-width: 980px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  #editor { height: 420px; }
}

@media (max-width: 800px) {
  .site-header { min-height: 64px; padding: 0 20px; }
  .site-nav { gap: 14px; }
  .site-nav a { font-size: 0.88rem; }
  .play-main { padding: 0 20px 48px; }
  .intro h1 { font-size: 1.5rem; }
}

@media (max-width: 440px) {
  .site-brand { font-size: 1rem; }
  .site-brand img { height: 28px; width: 28px; }
  .home-link { height: 28px; width: 28px; }
  .site-nav { gap: 10px; }
  .site-nav a { font-size: 0.8rem; }
  .site-footer { align-items: flex-start; flex-direction: column; gap: 8px; }
  .toolbar { align-items: flex-start; flex-direction: column; }
}
