/* Vibe Design shared tokens + primitives (landing, studio, share). Dark UI, brand purple, green = success. */
:root {
  --bg: #0b0d12;
  --bg-2: #11141b;
  --panel: #161a22;
  --panel-2: #1c212b;
  --panel-3: #232937;
  --line: #2a3140;
  --line-2: #363f52;
  --text: #f3f5f9;
  --text-2: #b4bccb;
  --text-3: #8a93a6;
  --brand: #8b3dff;
  --brand-strong: #781ff3;
  --brand-soft: rgba(139, 61, 255, 0.16);
  --brand-line: rgba(139, 61, 255, 0.45);
  --select: #0d99ff;
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, 0.14);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

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

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.mono {
  font-family: var(--mono);
}

/* --- buttons ---------------------------------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 150ms var(--ease), border-color 150ms var(--ease), opacity 150ms var(--ease);
}
.btn:hover {
  background: var(--panel-3);
  border-color: #4a5468;
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}
.btn-primary {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand);
  border-color: var(--brand);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-ghost:hover {
  background: var(--panel-2);
  color: var(--text);
  border-color: transparent;
}
.btn-danger {
  color: #fca5a5;
}
.btn-danger:hover {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.5);
}
.btn-lg {
  height: 46px;
  padding: 0 20px;
  font-size: 15px;
  border-radius: var(--radius);
}
.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
}
.btn-icon.btn-sm {
  width: 28px;
}

.count {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}
.btn-primary .count {
  background: rgba(255, 255, 255, 0.22);
}

/* --- fields ----------------------------------------------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > label,
.label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}
.input,
.textarea,
.select {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  color: var(--text);
  font-size: 13px;
  transition: border-color 150ms var(--ease);
}
.input:hover,
.textarea:hover,
.select:hover {
  border-color: #4a5468;
}
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.45;
}
.hint {
  font-size: 12px;
  color: var(--text-3);
}
.error-text {
  font-size: 12px;
  color: #fca5a5;
}

/* --- pills ------------------------------------------------------------------------------------------------------ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--line-2);
  color: var(--text-2);
  background: var(--panel-2);
}
.pill-brand {
  color: #d7c2ff;
  border-color: var(--brand-line);
  background: var(--brand-soft);
}
.pill-ok {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.4);
  background: var(--ok-soft);
}
.pill-warn {
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.4);
  background: var(--warn-soft);
}
.pill-danger {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
  background: var(--danger-soft);
}

/* --- modal (scrim 80%, x only, no Cancel) ------------------------------------------------------------------------ */
.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.8);
  animation: fade-in 150ms var(--ease);
}
.modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: pop-in 180ms var(--ease);
}
.modal-wide {
  width: min(1280px, 100%);
  height: min(860px, calc(100vh - 48px));
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 0 12px 0 20px;
  border-bottom: 1px solid var(--line);
}
.modal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
}
.modal-body {
  padding: 20px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

/* --- toast ------------------------------------------------------------------------------------------------------ */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #202634;
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: pop-in 180ms var(--ease);
}
.toast svg {
  width: 16px;
  height: 16px;
  flex: none;
}
.toast-ok svg {
  color: var(--ok);
}
.toast-error {
  border-color: rgba(239, 68, 68, 0.5);
}
.toast-error svg {
  color: var(--danger);
}
.toast a,
.toast button {
  color: #d7c2ff;
  background: none;
  border: 0;
  cursor: pointer;
  font-weight: 600;
  padding: 0;
}

/* --- lang switch ------------------------------------------------------------------------------------------------ */
.lang-switch {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
}
.lang-switch button {
  height: 26px;
  min-width: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.lang-switch button[aria-pressed="true"] {
  background: var(--panel-3);
  color: var(--text);
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  flex: none;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
}
.logo-mark {
  width: 26px;
  height: 26px;
  flex: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

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