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

@view-transition { navigation: auto; }

/* iOS Safari auto-zooms the page when you focus a text field whose font-size is
   under 16px. Hold every editable field at >=16px on phones to suppress that;
   desktop keeps each field's own design size. The floor is !important so a more
   specific component rule (e.g. .gif-search-row input) that loads later can't
   silently drop a field back under 16px and re-introduce the zoom. */
@media (max-width: 768px) {
  input[type="text"], input[type="search"], input[type="email"], input[type="url"],
  input[type="password"], input[type="number"], input[type="tel"], input:not([type]),
  textarea, select {
    font-size: 16px !important;
  }
}

/* Light mode — default */
:root {
  color-scheme: light; /* match the site's own light theme, not the OS, and opt out of browser auto-dark */
  --bg: #ffffff;
  --surface: #f5f5f5;
  --surface2: #ebebeb;
  --border: #e0e0e0;
  --text: #111111;
  --muted: #888888;
  --accent: #2563eb;
  --accent-dim: #2563eb15;
  --chatkin: #2563eb; /* Chatkin's own colour — never overridden by room branding */
  --chatkin-dim: #2563eb15;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);

  --c-researcher: #16a34a;
  --c-vc: #ea580c;
  --c-psychologist: #7c3aed;
  --c-designer: #db2777;
  --c-builder: #2563eb;
  --c-domain_expert: #d97706;
  --c-devils_advocate: #dc2626;
  --c-customer: #059669;
}

/* Dark mode */
html.dark {
  color-scheme: dark;
  --bg: #141414;
  --surface: #212121;
  --surface2: #2c2c2c;
  --border: #555555;
  --text: #ebebeb;
  --muted: #909090;
  --accent: #60a5fa;
  --accent-dim: #60a5fa20;
  --chatkin: #60a5fa;
  --chatkin-dim: #60a5fa20;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);

  --c-researcher: #4ade80;
  --c-vc: #f97316;
  --c-psychologist: #a78bfa;
  --c-designer: #f472b6;
  --c-builder: #60a5fa;
  --c-domain_expert: #fbbf24;
  --c-devils_advocate: #ef4444;
  --c-customer: #34d399;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  height: 100%;
  overflow: hidden;
  transition: background 0.2s, color 0.2s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  transition: opacity 0.15s;
}
button:hover { opacity: 0.85; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-text, #fff);
  font-weight: 500;
}

input, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
input:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); }

input[type="checkbox"], input[type="radio"] {
  all: revert;
  cursor: pointer;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  /* Modals are Chatkin chrome — keep Chatkin's colour, ignore room branding */
  --accent: var(--chatkin);
  --accent-dim: var(--chatkin-dim);
  --accent-text: #fff;
}

.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 32px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.modal h2 { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.modal p { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.modal .field { margin-bottom: 16px; }
.modal label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

/* Theme toggle */
.theme-toggle,
.sidebar-icon-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 16px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
}
.theme-toggle:hover,
.sidebar-icon-btn:hover { opacity: 0.75; }
.sidebar-icon-btn:hover { text-decoration: none; }

/* A spinning loader, shared by upload indicators. Pair with a circular icon
   (ph-circle-notch / ph-spinner-gap) so the rotation reads as motion. */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; animation: spin 0.8s linear infinite; }

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 8px;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  animation: toast-in 0.2s ease;
  white-space: nowrap;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
