/* Enjoy's look for this app: the colors, type and controls of Enjoy's own interface, in light
   and dark. Light is bone paper and ink; dark is near-black and bone; the accent is international
   orange with ink on it, for the one main action. Lines, not shadows; small square corners.
   Pages follow the computer's appearance; data-theme="light" or "dark" on <html> picks one, as
   Enjoy does for apps that open files. Archivo and JetBrains Mono are used when the computer
   has them, with system fonts otherwise. Change anything here: the app is yours. */
:root {
  color-scheme: light;
  --paper: #ece8df;
  --ink: #0e0e0e;
  --canvas: #fbfaf7;
  --panel: #f6f4ef;
  --raised: #ffffff;
  --field-bg: #ffffff;
  --line: #d9d4c9;
  --surface-border: var(--line);
  --strong: var(--ink);
  --muted: #5d5950;
  --faint: #8e897e;
  --select: #0e0e0e0d;
  --accent: #ff4f00;
  --on-accent: #0e0e0e;
  --warn-ink: #b4430c;
  --good: #0a7f45;
  --error: #b3261e;
  /* Older names, kept so pages made with them keep working: fills take the accent. */
  --logo-blue: var(--accent);
  --logo-orange: var(--accent);
  --logo-pink: var(--accent);
  --connected: var(--good);
  --button-bg: var(--accent);
  --button-fg: var(--on-accent);
  --radius-control: 3px;
  --radius-container: 4px;
  --label-track: 0.06em;
  --font: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-rounded: var(--font);
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --paper: #0c0c0b;
    --ink: #ece8df;
    --canvas: #121211;
    --panel: #0f0f0e;
    --raised: #1c1b19;
    --field-bg: #151513;
    --line: #2a2926;
    --muted: #9d988d;
    --faint: #6b675f;
    --select: #ece8df10;
    --warn-ink: color-mix(in srgb, #ff4f00 70%, #ece8df);
    --good: #4ad08a;
    --error: #ff8f80;
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: #0c0c0b;
  --ink: #ece8df;
  --canvas: #121211;
  --panel: #0f0f0e;
  --raised: #1c1b19;
  --field-bg: #151513;
  --line: #2a2926;
  --muted: #9d988d;
  --faint: #6b675f;
  --select: #ece8df10;
  --warn-ink: color-mix(in srgb, #ff4f00 70%, #ece8df);
  --good: #4ad08a;
  --error: #ff8f80;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  color: var(--strong);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
}

/* Hidden stays hidden, whatever display the rules below give the element. */
[hidden] {
  display: none !important;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font);
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
  font-weight: 600;
}

p {
  margin: 0;
}

a {
  color: var(--strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* A panel: a calm surface with a 1px line. */
.card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-container);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* Buttons are flat: the main one in the accent with ink on it; pressed, it darkens. */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  justify-self: start;
  min-height: 32px;
  padding: 6px 13px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--button-bg);
  color: var(--button-fg);
  font: 600 13px/1.2 var(--font);
  cursor: pointer;
  transition: background 120ms ease;
}

button:not(:disabled):hover {
  background: color-mix(in srgb, var(--button-bg) 92%, black);
}

button:not(:disabled):active {
  background: color-mix(in srgb, var(--button-bg) 84%, black);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

/* A quieter action beside the main one: a 1px line and ink. */
button.secondary {
  background: transparent;
  color: var(--strong);
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--line);
}

button.secondary:not(:disabled):hover {
  background: var(--select);
}

button.secondary:not(:disabled):active {
  background: color-mix(in srgb, var(--strong) 10%, transparent);
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--field-bg);
  color: var(--strong);
  font: inherit;
  box-shadow: inset 0 0 0 1px var(--line);
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

input[type='checkbox'],
input[type='radio'] {
  width: auto;
  accent-color: var(--accent);
  box-shadow: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

code,
kbd,
pre {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

code {
  padding: 1px 5px;
  border-radius: var(--radius-control);
  background: var(--select);
}

pre {
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  border-radius: var(--radius-container);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  white-space: pre-wrap;
}

pre code {
  padding: 0;
  background: none;
}

:focus-visible {
  outline: 2px solid var(--strong);
  outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline-offset: -1px;
}

[role='alert'] {
  color: var(--error);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
