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

body {
  background: #fff;
  color: #111;
  font-family: system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  max-width: 640px;
  margin: 0 auto;
  padding: max(1.25rem, env(safe-area-inset-top)) 1rem 3rem;
}

h1 {
  font-size: 1rem;
  font-weight: normal;
  color: #767676;
  margin-bottom: 1.25rem;
}

h1 strong { color: #111; }

hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 1rem 0;
}

p { margin-bottom: 0.5rem; }

a {
  color: #00e;
  cursor: pointer;
}

a:hover { color: #00a; }

/* Link-styled button: keeps the inline "pick one manually" affordance keyboard
   operable, unlike a bare <label>. */
.linkbtn {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #00e;
  cursor: pointer;
}

.linkbtn:hover { background: none; color: #00a; }

img {
  display: block;
  width: 100%;
  background: #f5f5f5;
}

button {
  appearance: none;
  background: #f0f0f0;
  border: 1px solid #ccc;
  color: #111;
  cursor: pointer;
  font: inherit;
  padding: 0.3rem 0.9rem;
}

button:hover { background: #e5e5e5; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: #5b4fff; border-color: #5b4fff; color: #fff; }
button.primary:hover:not(:disabled) { background: #4a3ecc; }

.field label {
  color: #666;
  font-size: 0.8rem;
  display: block;
  margin-bottom: 0.25rem;
}

input[type=text], input[type=password], select, textarea {
  appearance: none;
  background: #fff;
  border: 1px solid #ccc;
  color: #111;
  font: inherit;
  font-size: 0.875rem;
  padding: 0.4rem 0.6rem;
  width: 100%;
  display: block;
}

input:focus, select:focus, textarea:focus {
  outline: 1px solid #5b4fff;
  border-color: #5b4fff;
}

textarea { resize: vertical; }

.field { margin-bottom: 0.9rem; }
.hint { color: #767676; font-size: 0.75rem; margin-top: 0.2rem; }
.label-note { color: #767676; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 0.75rem; }
.footer-note { margin-top: 1.5rem; }

details > summary {
  cursor: pointer;
  color: #767676;
  font-size: 0.875rem;
  list-style: none;
  user-select: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '▶  '; font-size: 0.65rem; }
details[open] > summary::before { content: '▼  '; }
details > summary:hover { color: #111; }
details > .body { padding-top: 1rem; }

pre {
  font: inherit;
  white-space: pre-wrap;
  word-break: break-word;
}

pre.error { color: #c00; }
#result.thinking { color: #767676; }

code {
  font-family: monospace;
  font-size: 0.85em;
  background: #f0f0f0;
  padding: 0 3px;
}

#model-used {
  font-size: 0.75rem;
  color: #767676;
  margin-top: 0.5rem;
}

#raw-wrap { margin-top: 0.75rem; }

#raw {
  font-family: monospace;
  font-size: 0.75rem;
  color: #555;
  background: #f5f5f5;
  padding: 0.5rem;
  margin: 0.5rem 0;
  max-height: 50vh;
  overflow: auto;
}
