/* cropmark, web version. Colours are the ones of the author's website (its
   assets/theme-light.scss and assets/theme-dark.scss); see docs/ARCHITECTURE.md. */

:root {
  --bg: #FBF5E6;
  --panel: #FFFDF7;
  --text: #1E2430;
  --muted: #4A5160;
  --border: #E3D8BA;
  --accent: #2B4FB8;
  --accent-text: #FFFFFF;
  --danger: #B93A2B;

  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 6px;
  color-scheme: light;
}
/* Dark: the system setting, unless the toggle has chosen light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171C; --panel: #1E2128; --text: #F2EDE0; --muted: #B3B8C5; --border: #343947;
    --accent: #9DB3F7; --accent-text: #15171C; --danger: #F08D7C;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171C; --panel: #1E2128; --text: #F2EDE0; --muted: #B3B8C5; --border: #343947;
  --accent: #9DB3F7; --accent-text: #15171C; --danger: #F08D7C;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 var(--ui);
  overflow: hidden;
}
[hidden] { display: none !important; }
body.busy, body.busy button { cursor: progress; }
.grow { flex: 1 1 auto; }

/* ---- toolbar (44px) and status bar (28px) ---- */
.toolbar {
  flex: none;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow-x: auto;
}
.brand { font-weight: 600; margin-right: 4px; }
.privacy { color: var(--muted); margin-left: 6px; }
.field { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
button, select {
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  flex: none;
}
button { cursor: pointer; }
select { background: var(--panel); }
button:hover, select:hover { border-color: var(--accent); }
button:focus-visible, select:focus-visible, a:focus-visible, canvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button[aria-expanded="true"] { border-color: var(--accent); }

.status {
  flex: none;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
}
.status a { color: var(--muted); }
.status a:hover { color: var(--accent); }

.message {
  flex: none;
  margin: 0;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--danger);
  color: var(--danger);
}
.message.plain { color: var(--muted); border-bottom-color: var(--border); }

/* ---- the middle: the start text, or the editor, with the shortcut list beside it ---- */
main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}
.start {
  flex: 1 1 auto;
  margin: 24px;
  padding: 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  overflow: auto;
}
.start h1 { margin: 0 0 8px; font-size: 22px; color: var(--text); }
.start p { margin: 4px 0; max-width: 44rem; }
.start .lead { color: var(--text); font-size: 16px; }
body.dragging .start, body.dragging .stage { outline: 2px solid var(--accent); outline-offset: -6px; }

.stage { flex: 1 1 auto; min-width: 0; min-height: 0; }
#canvas { display: block; width: 100%; height: 100%; outline-offset: -2px; }

.keys {
  flex: none;
  width: 20rem;
  max-width: 60vw;
  overflow: auto;
  padding: 12px 16px;
  background: var(--panel);
  border-left: 1px solid var(--border);
}
.keys h2 { margin: 0 0 6px; font-size: 15px; }
.keys p { margin: 0 0 10px; color: var(--muted); }
.keys dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
.keys dt { font-weight: 600; white-space: nowrap; }
.keys dd { margin: 0; color: var(--muted); }

/* ---- the right-click menu on the picture; app.js places it at the pointer ---- */
.menu {
  position: fixed;
  z-index: 10;
  min-width: 12rem;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.menu button {
  display: flex;
  width: 100%;
  gap: 24px;
  justify-content: space-between;
  border-color: transparent;
  text-align: left;
}
.menu button:hover, .menu button:focus-visible { background: var(--accent); color: var(--accent-text); border-color: var(--accent); outline: none; }
.menu kbd { font: inherit; color: inherit; opacity: 0.75; }

@media (max-width: 700px) {
  .privacy { display: none; }
}
