:root {
  /* University of Waterloo brand colours (Black & Gold), muted gold + white worked in */
  --gold: #c99a2e;
  --gold-bright: #e0b23f;
  --bg: #0c0c0c;
  --surface: #161616;
  --border: rgba(255, 255, 255, 0.16);
  --text: #ffffff;
  --text-dim: #b8b8b8;
  --link: #ffffff;
  --accent: #e0b23f;
  --accent-dim: #2a2313;
  --on-gold: #0c0c0c;
  --error: #ff6b6b;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
}

.goose {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.goose-shadow { fill: #ffffff; opacity: 0.08; }
.goose-body, .goose-head { fill: #ffffff; }
.goose-neck { fill: none; stroke: #ffffff; stroke-width: 11; stroke-linecap: round; }
.goose-wing { fill: #0c0c0c; opacity: 0.14; }
.goose-leg { stroke: var(--gold); stroke-width: 3; stroke-linecap: round; }
.goose-beak { fill: var(--gold); }
.goose-eye { fill: #0c0c0c; }

h1 {
  font-size: 1.5rem;
  margin: 0;
  display: inline-block;
  border-bottom: 4px solid var(--gold);
  padding-bottom: 0.15rem;
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin: 0 0 1.75rem;
}

a {
  color: var(--link);
  text-decoration-color: var(--border);
}

a:hover {
  text-decoration-color: var(--gold);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--gold-bright);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

progress {
  width: 100%;
  height: 6px;
  accent-color: var(--gold-bright);
  margin-top: 0.5rem;
}

.qform {
  display: flex;
  gap: 0.5rem;
}

input[type="text"], input[type="password"], select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
}

input[type="text"]:focus, input[type="password"]:focus, select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

button {
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--gold);
  color: var(--on-gold);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
}

button:hover:not(:disabled) {
  background: var(--gold-bright);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--text);
  font-weight: 400;
}

.chunk {
  border-top: 1px solid var(--border);
  padding: 0.75rem 0;
  font-size: 0.9rem;
}

.chunk:first-child { border-top: none; padding-top: 0; }

.chunk-source {
  font-size: 0.78rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.chunk-source:hover {
  border-bottom-color: var(--gold);
}

.chunk-text {
  color: var(--text-dim);
  margin-top: 0.2rem;
}

details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.turn-question {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.turn-chunks {
  margin: 0 0 0.75rem;
}

.turn-chunks summary {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.field {
  margin-bottom: 0.75rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}

.hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.4rem;
}

.answer {
  white-space: pre-wrap;
  font-size: 0.95rem;
  margin-top: 0.75rem;
}

.error {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 2rem;
}

footer a { color: var(--text-dim); }

code {
  font-family: var(--mono);
  background: var(--accent-dim);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-size: 0.85em;
}

[hidden] { display: none !important; }
