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

::selection {
  background: var(--selection-bg);
  color: var(--selection-ink);
}

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

  /* A frozen spinner reads as a hung page, so it keeps turning, just slower. */
  .gc-spinner {
    animation-duration: 1.4s !important;
    animation-iteration-count: infinite !important;
  }
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  font-family: system-ui, sans-serif;
  background: linear-gradient(to bottom right, var(--gradient-start), var(--gradient-mid), var(--gradient-end));
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: hidden;
}

#app {
  width: 100%;
  min-height: 100dvh;
}

@keyframes gc-spin {
  to { transform: rotate(360deg); }
}

#gc-loader {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#gc-pct {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  color: var(--loader-ink);
  letter-spacing: 0.05em;
}

.gc-spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 4px solid var(--loader-track);
  border-top-color: var(--accent);
  animation: gc-spin 1s linear infinite;
}

#app:has(> :not(#gc-loader)) #gc-loader {
  opacity: 0;
}

/* Markdown message styles */
.markdown-body {
  line-height: 1.4;
  white-space: normal;
}

.markdown-body :where(p, h1, h2, h3, h4, h5, h6, ul, ol, blockquote, pre, hr, table) {
  margin: 0;
}

.markdown-body :where(p, h1, h2, h3, h4, h5, h6, td, th, li) {
  white-space: pre-wrap;
}

.markdown-body li:has(ul),
.markdown-body li:has(ol) {
  white-space: normal;
}

.markdown-body > * {
  margin-block: 0.5em;
}

.markdown-body > *:first-child {
  margin-block-start: 0;
}

.markdown-body > *:last-child {
  margin-block-end: 0;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.5em !important;
}

.markdown-body ul {
  list-style-type: disc;
}

.markdown-body ol {
  list-style-type: decimal;
}

.markdown-body li {
  margin: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  font-weight: 600;
}

.markdown-body h1 { font-size: 1.5em; }
.markdown-body h2 { font-size: 1.3em; }
.markdown-body h3 { font-size: 1.15em; }
.markdown-body h4 { font-size: 1.05em; }

.markdown-body a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.16em;
}

.markdown-body a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 0.14em;
}

.markdown-body code {
  background: var(--markdown-fill);
  padding: 0.125em 0.375em;
  border-radius: 0.25em;
  font-size: 0.9em;
}

.markdown-body pre {
  background: var(--markdown-fill);
  padding: 0.75em;
  border-radius: 0.5em;
  overflow-x: auto;
}

.markdown-body pre code {
  background: none;
  padding: 0;
}

.markdown-body blockquote {
  border-left: 3px solid var(--markdown-line);
  padding-left: 0.75em;
  opacity: 0.85;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--markdown-line);
}

.markdown-body table {
  border-collapse: collapse;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--markdown-line);
  padding: 0.375em 0.75em;
}

.markdown-body th {
  background: var(--markdown-fill);
  font-weight: 600;
}

.markdown-body strong {
  font-weight: 600;
}

.markdown-body em {
  font-style: italic;
}

.markdown-body img {
  max-width: 100%;
  border-radius: 0.5em;
}

