/* Standalone playground page (docs/src/playground/index.html). The palette
 * follows the docs site: mdBook's light theme, and its navy theme for dark
 * (which the inline head script also picks when the book is set to a dark
 * theme). */

:root {
  --bg: #ffffff;
  --fg: #333333;
  --surface: #fafafa;
  --border: #d8dbe2;
  --muted: #6b7280;
  --accent: #4183c4;
}

html.dark {
  --bg: #161923;
  --fg: #bcbdd0;
  --surface: #1f2331;
  --border: #3a3f58;
  --muted: #8b8ea3;
  --accent: #2b79a2;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family:
    "Open Sans",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  font-size: 16px;
  color: var(--fg);
  background-color: var(--bg);
}

#playground-app {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  padding: 0.75rem 1rem 1rem;
}

/* Header */

.pg-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.pg-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--fg);
  text-decoration: none;
  font-size: 1.15rem;
}

.pg-logo {
  height: 2rem;
}

html.dark .pg-logo-light,
html:not(.dark) .pg-logo-dark {
  display: none;
}

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

.pg-header-spacer {
  flex: 1;
}

.pg-doc-link {
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
}

.pg-doc-link:hover {
  text-decoration: underline;
}

html.dark .pg-theme-light,
html:not(.dark) .pg-theme-dark {
  display: none;
}

/* Controls */

.pg-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
}

.pg-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--fg);
}

.pg-controls select,
.pg-controls input {
  font: inherit;
  font-size: 0.9rem;
  color: var(--fg);
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.4rem;
}

.pg-controls input[type="number"] {
  width: 4.5rem;
}

.pg-controls select:disabled,
.pg-controls input:disabled {
  opacity: 0.5;
}

.pg-controls-spacer {
  flex: 1;
}

button {
  font: inherit;
  font-size: 0.85rem;
  color: var(--fg);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

/* Panes */

.pg-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
}

.pg-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.pg-pane-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
}

#pg-input,
#pg-output {
  flex: 1;
  min-height: 0;
}

.cm-editor {
  height: 100%;
  font-size: 0.85rem;
  background-color: var(--bg);
}

.cm-editor.cm-focused {
  outline: none;
}

/* Status + errors */

#pg-status {
  min-height: 1.25rem;
  font-size: 0.85rem;
}

.pg-errors {
  margin: 0;
  padding-left: 1.5rem;
  font-size: 0.85rem;
  font-family: ui-monospace, "JetBrains Mono", "Fira Code", monospace;
}

.pg-errors:empty {
  display: none;
}

@media (max-width: 900px) {
  #playground-app {
    height: auto;
    min-height: 100%;
  }

  .pg-panes {
    grid-template-columns: 1fr;
  }

  #pg-input,
  #pg-output {
    min-height: 20rem;
  }

  .cm-editor {
    height: 24rem;
  }
}
