/* Tokens, reset, boot screen and the hidden SEO text. */

:root {
  color-scheme: dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", "Helvetica Neue", "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* ReWord "Night" palette (scripts/make-app-icon.swift). */
  --navy: #1C2340;
  --deep: #0B0E1A;
  --wand: #3A4266;
  --star: #8C96C9;
  --cream: #F4F1E8;
  --gold: #FFC94A;
  --gold-pale: #FFE7A3;
  --lilac: #6C74D8;

  /* macOS dark. */
  --accent: #0A84FF;
  --accent-soft: rgba(10, 132, 255, 0.22);
  --text: rgba(255, 255, 255, 0.92);
  --text-2: rgba(255, 255, 255, 0.62);
  --text-3: rgba(255, 255, 255, 0.4);
  --sep: rgba(255, 255, 255, 0.1);
  --win-bg: #1e1e20;
  --win-bg-2: #262628;
  --win-sidebar: rgba(44, 44, 48, 0.82);
  --glass: rgba(34, 34, 38, 0.62);
  --glass-strong: rgba(30, 30, 34, 0.82);
  --glass-border: rgba(255, 255, 255, 0.14);
  --blur: blur(32px) saturate(1.8);
  --red: #FF453A;
  --green: #32D74B;
  --yellow: #FFD60A;

  --menubar-h: 26px;
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--deep);
  color: var(--text);
  font: 13px/1.35 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: default; }
a { color: inherit; }
img { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.sf { display: inline-block; vertical-align: -0.12em; flex: none; fill: currentColor; overflow: visible; }
.sf .sf-s { fill: var(--sf-s, currentColor); }
.sf .sf-p { fill: var(--sf-p, currentColor); }

.screen {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overflow: clip; /* hidden still lets focus() scroll it sideways */
  user-select: none;
  -webkit-user-select: none;
}

/* Boot screen: the Apple-ish progress bar with ReWord's icon. */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 34px;
  background: #000;
  transition: opacity 0.5s ease;
}
.boot img { width: 88px; height: 88px; }
.boot-bar { width: 180px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.2); overflow: hidden; }
.boot-bar::after { content: ""; display: block; height: 100%; width: var(--p, 5%); background: #fff; border-radius: inherit; transition: width 0.3s ease; }
.boot.is-done { opacity: 0; pointer-events: none; }
.boot-error { display: none; color: var(--text-2); max-width: 300px; text-align: center; }
.boot.is-failed .boot-error { display: block; }
.boot.is-failed .boot-bar { display: none; }

/* SEO and no-JS text: visually hidden, read by search engines and screen readers. */
.seo {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
noscript .noscript {
  position: fixed; inset: 0; z-index: 200; overflow: auto;
  padding: 40px max(20px, calc(50% - 340px));
  background: var(--deep); color: var(--text); font-size: 15px; line-height: 1.6;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 14px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.16); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn-primary:hover { background: #2a93ff; }
.btn-ghost { background: transparent; }
.link { color: #4ea1ff; text-decoration: none; cursor: pointer; }
.link:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.92em; }
code.block {
  display: block; margin-top: 6px; padding: 8px 10px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--sep);
  user-select: all; -webkit-user-select: all; white-space: pre-wrap;
}

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